query
stringlengths
7
33.1k
document
stringlengths
7
335k
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
TODO Autogenerated method stub
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_activity_main); mDrawerView=(LinearLayout)findViewById(R.id.linearLayout); profilePic=(ImageView)findViewById(R.id.myBloodGroup); name=(TextView)findViewById(R.id.donorMenuName); name.setText("Hunain"); profilePic.setImageResource(returnImageSource("B+")); mTitle = mDrawerTitle = getTitle(); // load slide menu items navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items); // nav drawer icons from resources navMenuIcons = getResources() .obtainTypedArray(R.array.nav_drawer_icons); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.list_slidermenu); navDrawerItems = new ArrayList<NavDrawerItem>(); navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1))); // Find People navDrawerItems.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons.getResourceId(1, -1))); // Photos navDrawerItems.add(new NavDrawerItem(navMenuTitles[2], navMenuIcons.getResourceId(2, -1))); // Communities, Will add a counter here navDrawerItems.add(new NavDrawerItem(navMenuTitles[3], navMenuIcons.getResourceId(3, -1))); navMenuIcons.recycle(); mDrawerList.setOnItemClickListener(new SlideMenuClickListener()); adapter = new NavDrawerListAdapter(getApplicationContext(), navDrawerItems); mDrawerList.setAdapter(adapter); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, //nav menu toggle icon R.string.app_name, // nav drawer open - description for accessibility R.string.app_name // nav drawer close - description for accessibility ) { public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); // calling onPrepareOptionsMenu() to show action bar icons invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(mDrawerTitle); // calling onPrepareOptionsMenu() to hide action bar icons invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); mDrawerLayout.closeDrawer(mDrawerView); if (savedInstanceState == null) { // on first time display view for first nav item displayView(1); } }
{ "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}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "private stendhal() {\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\r\n\tpublic void dispase() {\n\r\n\t}", "@Override\n\tprotected void initialize() {\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 }", "@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.66708666", "0.65675074", "0.65229905", "0.6481001", "0.64770633", "0.64584893", "0.6413091", "0.63764185", "0.6275735", "0.62541914", "0.6236919", "0.6223816", "0.62017626", "0.61944294", "0.61944294", "0.61920846", "0.61867654", "0.6173323", "0.61328775", "0.61276996", "0.6080555", "0.6076938", "0.6041293", "0.6024541", "0.6019185", "0.5998426", "0.5967487", "0.5967487", "0.5964935", "0.59489644", "0.59404725", "0.5922823", "0.5908894", "0.5903041", "0.5893847", "0.5885641", "0.5883141", "0.586924", "0.5856793", "0.58503157", "0.58464456", "0.5823378", "0.5809384", "0.58089525", "0.58065355", "0.58065355", "0.5800514", "0.57912874", "0.57912874", "0.57912874", "0.57912874", "0.57912874", "0.57912874", "0.57896614", "0.5789486", "0.5786597", "0.5783299", "0.5783299", "0.5773351", "0.5773351", "0.5773351", "0.5773351", "0.5773351", "0.5760369", "0.5758614", "0.5758614", "0.574912", "0.574912", "0.574912", "0.57482654", "0.5732775", "0.5732775", "0.5732775", "0.57207066", "0.57149917", "0.5714821", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57115865", "0.57045746", "0.5699", "0.5696016", "0.5687285", "0.5677473", "0.5673346", "0.56716853", "0.56688815", "0.5661065", "0.5657898", "0.5654782", "0.5654782", "0.5654782", "0.5654563", "0.56536144", "0.5652585", "0.5649566" ]
0.0
-1
display view for selected nav drawer item
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { displayView(position); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void selectDrawerItem(MenuItem menuItem) {\n Fragment fragment = null;\n Class fragmentClass;\n switch(menuItem.getItemId()) {\n case R.id.nav_home:\n fragmentClass = MainFragment.class;\n startFragment(fragmentClass);\n break;\n case R.id.nav_fav:\n fragmentClass = FavoriteFragment.class;\n startFragment(fragmentClass);\n break;\n case R.id.nav_upd:\n openLink(\"https://play.google.com/store/apps/details?id=com.satyajit.gamex\");\n\n break;\n case R.id.nav_settings:\n fragmentClass = SettingsFragment.class;\n startFragment(fragmentClass);\n break;\n case R.id.nav_rate:\n openLink(\"https://play.google.com/store/apps/details?id=com.satyajit.gamex\");\n break;\n case R.id.nav_share:\n shareApp();\n break;\n }\n\n\n if (menuItem.getItemId()!= R.id.nav_share && menuItem.getItemId()!= R.id.nav_rate && menuItem.getItemId()!= R.id.nav_upd ) {\n // Highlight the selected item has been done by NavigationView\n menuItem.setChecked(true);\n // Set action bar title\n setTitle(menuItem.getTitle());\n\n }\n\n else {\n\n\n }\n // Close the navigation drawer\n mDrawer.closeDrawers();\n }", "void displayDrawer() {\n //toolbar = (Toolbar) findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n actionbar = getSupportActionBar();\n actionbar.setDisplayHomeAsUpEnabled(true);\n\n actionbar.setHomeAsUpIndicator(R.drawable.ic_menu);\n\n navigationView.setNavigationItemSelectedListener(\n new NavigationView.OnNavigationItemSelectedListener() {\n @Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n // set item as selected to persist highlight\n menuItem.setChecked(true);\n // close drawer when item is tapped\n mdrawer.closeDrawers();\n\n String choice = menuItem.getTitle().toString();\n\n switch (choice) {\n case \"Register\":\n Intent i = new Intent(getBaseContext(), SignIn.class);\n startActivity(i);\n break;\n case \"Log In\":\n Intent p = new Intent(getBaseContext(), LoginActivity.class);\n startActivity(p);\n break;\n\n case \"Profile Picture\":\n Intent pic = new Intent(getBaseContext(), ImageUpload.class);\n startActivity(pic);\n break;\n\n case \"Users\":\n Intent users = new Intent(getBaseContext(), Userlist.class);\n startActivity(users);\n break;\n\n case \"Chats\":\n Intent chats = new Intent(getBaseContext(), ChatList.class);\n startActivity(chats);\n break;\n }\n\n // Add code here to update the UI based on the item selected\n // For example, swap UI fragments here\n\n return true;\n }\n });\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n displaySelected(id);\n// if (id == R.id.nav_camera) {\n// // Handle the camera action\n// } else if (id == R.id.nav_gallery) {\n//\n// } else if (id == R.id.nav_slideshow) {\n//\n// } else if (id == R.id.nav_manage) {\n//\n// } else if (id == R.id.nav_share) {\n//\n// } else if (id == R.id.nav_send) {\n//\n// }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n displaySelectedScreen(id);\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "private void selectDrawerItem(MenuItem menuItem) {\n Fragment fragment = null;\n Class fragmentClass;\n boolean flag = false;\n switch (menuItem.getItemId()) {\n case R.id.nav_organization_fragment:\n fragmentClass = OrganizationFragment.class;\n flag = true;\n break;\n case R.id.nav_home_fragment:\n fragmentClass = HomeFragment.class;\n flag = true;\n break;\n case R.id.nav_template_fragment:\n fragmentClass = TemplateFragment.class;\n flag = true;\n break;\n case R.id.nav_checklist_fragment:\n fragmentClass = ChecklistFragment.class;\n flag = true;\n break;\n case R.id.nav_activity_fragment:\n fragmentClass = ActivityFragment.class;\n flag = true;\n break;\n case R.id.nav_settings_fragment:\n fragmentClass = SettingFragment.class;\n flag = true;\n break;\n case R.id.nav_logout:\n fragmentClass = HomeFragment.class;\n revokeAccess();\n break;\n default:\n fragmentClass = HomeFragment.class;\n }\n\n try {\n Bundle args = new Bundle();\n args.putInt(\"status_checklist\", 0);\n fragment = (Fragment) fragmentClass.newInstance();\n fragment.setArguments(args);\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n if (flag) {\n FragmentManager fragmentManager = getSupportFragmentManager();\n fragmentManager\n .beginTransaction()\n .add(R.id.flContent, fragment)\n .commit();\n }\n\n\n\n menuItem.setChecked(true); // Highlight the selected item has been done by NavigationView\n setTitle(menuItem.getTitle());\n mDrawerLayout.closeDrawers();\n }", "public void selectDrawerItem(MenuItem menuItem) {\n Fragment fragment = null;\n Class fragmentClass;\n switch (menuItem.getItemId()) {\n case R.id.nav_home:\n// if (!isTotalLayoutVisible()) {\n// Database mydb = new Database(this);\n// List<FoodItemCart> foodItemCartList = mydb.getAllFoodItemCart();\n// if (foodItemCartList.size() > 0)\n// setLinlaHeaderProgressVisible();\n// }\n fragmentClass = HomeFragment.class;\n break;\n case R.id.nav_orders:\n lastPosition=-1;\n setTotalLayoutGone();\n fragmentClass = MyOrdersFragment.class;\n break;\n// case R.id.nav_notification:\n// fragmentClass = HomeFragment.class;\n// break;\n case R.id.nav_setting:\n lastPosition=-1;\n setTotalLayoutGone();\n fragmentClass = SettingsFragment.class;\n break;\n case R.id.nav_help:\n lastPosition=-1;\n setTotalLayoutGone();\n fragmentClass = HelpFragment.class;\n break;\n default:\n fragmentClass = HomeFragment.class;\n }\n\n try {\n fragment = (Fragment) fragmentClass.newInstance();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n // Insert the fragment by replacing any existing fragment\n FragmentManager fragmentManager = getSupportFragmentManager();\n fragmentManager.beginTransaction().replace(R.id.flContent, fragment).commit();\n\n // Highlight the selected item has been done by NavigationView\n menuItem.setChecked(true);\n // Set action bar title\n setTitle(menuItem.getTitle());\n // Close the navigation drawer\n mDrawer.closeDrawers();\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case R.id.nav_camera:\n Toast.makeText(MainActivity.this, \"nav_camera\", Toast.LENGTH_SHORT).show();\n break;\n case R.id.nav_gallery:\n Toast.makeText(MainActivity.this, \"nav_gallery\", Toast.LENGTH_SHORT).show();\n break;\n case R.id.nav_slideshow:\n Toast.makeText(MainActivity.this, \"nav_slideshow\", Toast.LENGTH_SHORT).show();\n break;\n }\n closeDrawer();\n return true;\n }", "public void selectDrawerItem(MenuItem menuItem) {\n Fragment fragment = null;\n Class fragmentClass;\n switch(menuItem.getItemId()) {\n case R.id.builder:\n fragmentClass = UserFragment.class;\n Toast.makeText(getApplicationContext(), \"Builder \", Toast.LENGTH_LONG).show();\n break;\n case R.id.nav_component:\n Intent usericon=new Intent(this,UserActivity.class);\n startActivity(usericon);\n finish();\n case R.id.user_menu:\n Toast.makeText(getApplicationContext(), \"User List \", Toast.LENGTH_LONG).show();\n fragmentClass = UserFragment.class;\n break;\n default:\n fragmentClass = UserFragment.class;\n }\n\n try {\n fragment = (Fragment) fragmentClass.newInstance();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n // Insert the fragment by replacing any existing fragment\n FragmentManager fragmentManager = getSupportFragmentManager();\n fragmentManager.beginTransaction().replace(R.id.flContent, fragment).commit();\n\n // Highlight the selected item has been done by NavigationView\n menuItem.setChecked(true);\n // Set action bar title\n setTitle(menuItem.getTitle());\n // Close the navigation drawer\n mDrawer.closeDrawers();\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\r\n @Override\r\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n displaySelectedScreen(id);\r\n\r\n return true;\r\n }", "private void setupDrawerContent() {\n previousMenuItem = navigationView.getMenu().findItem(R.id.nav_category);\n previousMenuItem.setChecked(true);\n previousMenuItem.setCheckable(true);\n\n navigationView.setNavigationItemSelectedListener(\n new NavigationView.OnNavigationItemSelectedListener() {\n @Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n\n drawerLayout.closeDrawer(Gravity.LEFT);\n\n if (previousMenuItem.getItemId() == menuItem.getItemId())\n return true;\n\n menuItem.setCheckable(true);\n menuItem.setChecked(true);\n previousMenuItem.setChecked(false);\n previousMenuItem = menuItem;\n\n switch (menuItem.getItemId()) {\n case R.id.nav_category:\n displayView(CATEGORIES_FRAG, null);\n break;\n case R.id.nav_favorites:\n displayView(FAVORITE_FRAG, null);\n break;\n case R.id.nav_reminder:\n displayView(REMINDER_FRAG, null);\n break;\n case R.id.nav_about:\n displayView(ABOUT_FRAG, null);\n break;\n case R.id.nav_feedback:\n IntentHelper.sendEmail(BaseDrawerActivity.this);\n break;\n case R.id.nav_rate_us:\n IntentHelper.voteForAppInBazaar(BaseDrawerActivity.this);\n break;\n case R.id.nav_settings:\n displayView(SETTINGS_FRAG, null);\n break;\n\n }\n\n\n return true;\n }\n }\n\n );\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n /* if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else */\n\n if (id == R.id.nav_share) {\n favortiesMethed();\n } else if (id == R.id.nav_send) {\n https://play.google.com/store/apps/details?navId=com.adeebhat.rabbitsvilla/\n try {\n Intent viewIntent =\n new Intent(\"android.intent.action.VIEW\",\n Uri.parse(\"https://play.google.com/store/apps/details?id=com.eclix.unit.converter.calculator\"));\n startActivity(viewIntent);\n\n } catch(Exception e) {\n Toast.makeText(getApplicationContext(),\"Unable to Connect Try Again...\",\n Toast.LENGTH_LONG).show();\n e.printStackTrace();\n }\n }else if(id == R.id.nav_fav){\n\n setFavortiesLayout();\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "void onNavigationDrawerItemSelected(int resourceId);", "@Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n menuItem.setChecked(true);\n // close drawer when item is tapped\n switch (menuItem.getItemId()) {\n case R.id.weather:\n Intent net = new Intent (MainActivity.this, WeatherActivity.class);\n startActivity(net);\n break;\n case R.id.settings:\n Intent conf = new Intent(MainActivity.this, PreferencesActivity.class);\n startActivity(conf);\n break;\n default:\n break;\n }\n mDrawerLayout.closeDrawers();\n\n // Add code here to update the UI based on the item selected\n // For example, swap UI fragments here\n\n return true;\n }", "private void selectItem(int position) \n {\n \tFragment fragment = null;\n Bundle args = new Bundle();\n switch(position){\n \n case 0:\n \tDrawerTest.this.getActionBar().hide();\n \tfragment = new StaticViewer();\n args.putInt(\"static_viewer\", position);\n break;\n case 1:\n \tDrawerTest.this.getActionBar().hide();\n \tfragment = new DoctorPanel();\n args.putInt(\"doctor_panel\", position);\n break;\n case 2:\n \tDrawerTest.this.getActionBar().hide();\n \tfragment = new Panel();\n \targs.putInt(\"panel\", position);\n \tbreak;\n case 3:\n \tfragment = new Help();\n \targs.putInt(\"help\", position);\n case 4:\n \tfragment = new About();\n \targs.putInt(\"about\", position);\n default:\n \tDrawerTest.this.getActionBar().show();\n \tbreak;\n }\n //args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position);\n fragment.setArguments(args);\n\n FragmentManager fragmentManager = getFragmentManager();\n fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();\n\n // update selected item and title, then close the drawer\n mDrawerList.setItemChecked(position, true);\n setTitle(mPlanetTitles[position]);\n mDrawerLayout.closeDrawer(mDrawerList);\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n } else if (id == R.id.nav_collect) {\n Intent intent = new Intent(MainActivity.this, SearchActivity.class);\n intent.setAction(Constants.Action.SHOW_COLLECT);\n startActivity(intent);\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "void onNavigationDrawerItemSelected(int position);", "void onNavigationDrawerItemSelected(int position);", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n\n displaySelectedScreen(item.getItemId());\n\n item.setChecked(true);\n\n drawer.closeDrawers();\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(@NonNull MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.dices) {\n\n Answers.getInstance().logContentView(new ContentViewEvent()\n .putContentName(\"Dados\")\n .putContentType(\"Package access from menu\"));\n\n Intent intent_dices=new Intent(this, MainDicesActivity.class);\n this.startActivity(intent_dices);\n\n } else if (id == R.id.voting) {\n\n Answers.getInstance().logContentView(new ContentViewEvent()\n .putContentName(\"Votaciones\")\n .putContentType(\"Package access from menu\"));\n\n Intent intent_voting=new Intent(this, ConfigVotingActivity.class);\n this.startActivity(intent_voting);\n\n } else if (id == R.id.acts) {\n\n Answers.getInstance().logContentView(new ContentViewEvent()\n .putContentName(\"Actas\")\n .putContentType(\"Package access from menu\"));\n\n Intent intent_acts=new Intent(this, MainActsActivity.class);\n this.startActivity(intent_acts);\n\n } else if (id == R.id.expenses) {\n\n Answers.getInstance().logContentView(new ContentViewEvent()\n .putContentName(\"Gastos\")\n .putContentType(\"Package access from menu\"));\n\n Intent intent_expenses=new Intent(this, MainExpensesActivity.class);\n this.startActivity(intent_expenses);\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n\n }", "public void selectDrawerItem(MenuItem menuItem) {\n Fragment fragment = null;\n Class fragmentClass;\n switch(menuItem.getItemId()) {\n case R.id.nav_home:\n fragmentClass = AccountFragment.class;\n break;\n case R.id.nav_bill:\n fragmentClass = BillFragment.class;\n break;\n case R.id.nav_transfer:\n fragmentClass = MoneyTransferFragment.class;\n break;\n default:\n fragmentClass = AccountFragment.class;\n }\n\n try {\n fragment = (Fragment) fragmentClass.newInstance();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n // Insert the fragment by replacing any existing fragment\n FragmentManager fragmentManager = getSupportFragmentManager();\n fragmentManager.beginTransaction().replace(R.id.detail_fragment_container, fragment).commit();\n\n // Highlight the selected item has been done by NavigationView\n menuItem.setChecked(true);\n // Set action bar title\n setTitle(menuItem.getTitle());\n // Close the navigation drawer\n mDrawer.closeDrawers();\n }", "public void selectDrawerItem(MenuItem menuItem) {\n ListFragment Listfragment = null;\n Fragment fragment = null;\n\n Class fragmentClass;\n switch(menuItem.getItemId()) {\n case R.id.bar_code_search:\n fragmentClass = BarCodeSearchFragment.class;\n break;\n case R.id.magazzino_search:\n fragmentClass = MagazzinoSearchFragment.class;\n break;\n case R.id.aggiungi_nuovo:\n fragmentClass = InserisciNuovoFragment.class;\n break;\n case R.id.settings:\n fragmentClass = SettingsFragment.class;\n break;\n default:\n fragmentClass = MagazzinoSearchFragment.class;\n }\n\n FragmentManager fragmentManager = getSupportFragmentManager();\n\n if (Listfragment!=null){\n try {\n Listfragment = (ListFragment) fragmentClass.newInstance();\n fragmentManager.beginTransaction().replace(R.id.flContent, Listfragment).commit();\n } catch (Exception e) {\n e.printStackTrace();\n }\n } else {\n try {\n fragment = (Fragment) fragmentClass.newInstance();\n fragmentManager.beginTransaction().replace(R.id.flContent, fragment).commit();\n } catch (InstantiationException e) {\n e.printStackTrace();\n } catch (IllegalAccessException e) {\n e.printStackTrace();\n }\n }\n\n menuItem.setChecked(true);\n setTitle(menuItem.getTitle());\n mDrawer.closeDrawers();\n }", "@Override\n public boolean onNavigationItemSelected(@NonNull MenuItem item) {\n\n if (item.getItemId() == R.id.nav_movies_main) {\n mSearchMenu.setGroupVisible(R.id.search_options, true);\n mSearchMenuItem.setVisible(true);\n mSearchMenuItem.collapseActionView();\n setFragment(new MainFilmsFragment());\n drawerActions(item);\n } else if (item.getItemId() == R.id.nav_movies_year) {\n mSearchMenu.setGroupVisible(R.id.search_options, true);\n mSearchMenuItem.setVisible(true);\n mSearchMenuItem.collapseActionView();\n setFragment(new DetailedFilmsFragment());\n drawerActions(item);\n } else if (item.getItemId() == R.id.nav_help) {\n mSearchMenu.setGroupVisible(R.id.search_options, false);\n mSearchMenuItem.setVisible(false);\n mSearchMenuItem.collapseActionView();\n setFragment(new HelpFragment());\n drawerActions(item);\n } else if (item.getItemId() == R.id.nav_about) {\n startActivity(new Intent(MainActivity.this, AboutActivity.class));\n }\n\n if (item.getItemId() != R.id.nav_about) mCurrentItemId = item.getItemId();\n\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n if(getSupportActionBar() != null) getSupportActionBar().setTitle(item.getTitle());\n switch (id){\n case R.id.contacts:\n mFragmentManager.beginTransaction().replace(R.id.fragmentContainer, contactListFragment, FRAGMENT_TAG).commit();\n case R.id.whitelist_scheduler:\n mFragmentManager.beginTransaction().replace(R.id.fragmentContainer, alarmScheduleFragment, FRAGMENT_TAG).commit();\n break;\n case R.id.nav_about2:\n break;\n }\n\n DrawerLayout drawer = findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n menuItem.setChecked(true);\n // close drawer when item is tapped\n drawer.closeDrawers();\n\n // Add code here to update the UI based on the item selected\n // For example, swap UI fragments here\n\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_present) {\n getSupportFragmentManager().beginTransaction().replace(R.id.fragmentContainer,\n new PresentFragment()).commit();\n getSupportActionBar().setTitle(\"Scanner\");\n } else if (id == R.id.nav_notpresent) {\n getSupportFragmentManager().beginTransaction().replace(R.id.fragmentContainer,\n new NotPresentFragment()).commit();\n getSupportActionBar().setTitle(\"Belum Absen\");\n } else if (id == R.id.nav_alpha) {\n getSupportFragmentManager().beginTransaction().replace(R.id.fragmentContainer,\n new AlphaFragment()).commit();\n getSupportActionBar().setTitle(\"Tidak Hadir\");\n }\n\n DrawerLayout drawer = findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n // Handle navigation view item clicks here.\n int id = item.getItemId();\n if (id == R.id.nav_inicio) {\n selector();\n } else if (id == R.id.nav_carro) {\n flat(true, carro);\n } else if (id == R.id.nav_idioma) {\n //No se aplica de momento.\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "void showSelectedAgentView();", "@Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n menuItem.setChecked(true);\n // close drawer when item is tapped\n\n navDrawer.closeDrawers();\n\n int itemId = menuItem.getItemId();\n switch (itemId) {\n case R.id.nav_sale:\n Intent intent = new Intent(getApplicationContext(), SaleActivity.class);\n startActivity(intent);\n return true;\n }\n // Add code here to update the UI based on the item selected\n // For example, swap UI fragments here\n\n return true;\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n// getActionBar().setTitle(\"Select Destination\");\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n }\n\n\n\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n Intent intent = null;\n switch (id) {\n\n case R.id.home_h:\n intent = new Intent(this, MainActivity.class);\n break;\n\n case R.id.nav_info:\n intent = new Intent(this, Information.class);\n break;\n\n default:\n intent = new Intent(this, ToDo.class);\n }\n\n startActivity(intent);\n finish();\n /* Closing the drawer by getting reference to the drawer layout, and calling its closeDrawer() method. */\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START); // using START as the drawer is attached to the activity's start edge\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n menuItem.setChecked(true);\n // close drawer when item is tapped\n mdrawer.closeDrawers();\n\n String choice = menuItem.getTitle().toString();\n\n switch (choice) {\n case \"Register\":\n Intent i = new Intent(getBaseContext(), SignIn.class);\n startActivity(i);\n break;\n case \"Log In\":\n Intent p = new Intent(getBaseContext(), LoginActivity.class);\n startActivity(p);\n break;\n\n case \"Profile Picture\":\n Intent pic = new Intent(getBaseContext(), ImageUpload.class);\n startActivity(pic);\n break;\n\n case \"Users\":\n Intent users = new Intent(getBaseContext(), Userlist.class);\n startActivity(users);\n break;\n\n case \"Chats\":\n Intent chats = new Intent(getBaseContext(), ChatList.class);\n startActivity(chats);\n break;\n }\n\n // Add code here to update the UI based on the item selected\n // For example, swap UI fragments here\n\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n displaySelectedScreen(item.getItemId());\n return true;\n }", "private void setupDrawerContent(NavigationView navigationView){\n navigationView.setNavigationItemSelectedListener(\n new NavigationView.OnNavigationItemSelectedListener() {\n @Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n //selectDrawerItem(menuItem);\n switch(menuItem.getItemId()) {\n case R.id.review_menu:\n startActivity(new Intent(getApplicationContext(),MainActivity.class));\n break;\n case R.id.settings_menu:\n startActivity(new Intent(getApplicationContext(),SettingsActivity.class));\n break;\n case R.id.share_menu:\n Intent shareIntent = new Intent();\n shareIntent.setAction(Intent.ACTION_SEND);\n shareIntent.putExtra(Intent.EXTRA_TEXT, \"Check out Nearest Places App for your smartphone. Download it today from -----link-----\");\n shareIntent.setType(\"text/plain\");\n startActivity(shareIntent);\n break;\n case R.id.info_menu:\n\n break;\n default:\n //fragmentClass = FirstFragment.class;\n }\n return true;\n }\n });\n }", "public void selectDrawerItem(MenuItem menuItem) {\n Fragment fragment = null;\n Class fragmentClass;\n switch(menuItem.getItemId()) {\n case R.id.my_cards_navigation_drawer:\n setFragmentToFrameLayout(null);\n attachViewPager();\n break;\n case R.id.rooms_navigation_drawer:\n detachViewPager();\n setFragmentToFrameLayout(RoomsFragment.class);\n break;\n case R.id.settings_navigation_drawer:\n detachViewPager();\n setFragmentToFrameLayout(SettingsFragment.class);\n break;\n case R.id.info_navigation_drawer:\n detachViewPager();\n setFragmentToFrameLayout(InfoFragment.class);\n break;\n case R.id.login_navigation_drawer:\n detachViewPager();\n setFragmentToFrameLayout(LoginFragment.class);\n break;\n }\n // Highlight the selected item has been done by NavigationView\n menuItem.setChecked(true);\n // Set action bar title\n setTitle(menuItem.getTitle());\n // Close the navigation drawer\n m_DrawerLayout.closeDrawers();\n }", "private void displayView(int position) {\n\t\tFragment fragment = null;\n\t\tBundle bundle=new Bundle();\n\t\tswitch (position) {\n\t\tcase 0:\n\t\t\tfragment = new Profile();\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tfragment = new SearchProjects();\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tfragment = new MyProjects();\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\n\n\t\tif (fragment != null) {\n\t\t\tFragmentManager fragmentManager = getFragmentManager();\n\t\t\tfragmentManager.beginTransaction()\n\t\t\t.replace(R.id.frame_container, fragment).commit();\n\n\t\t\t// update selected item and title, then close the drawer\n\t\t\tmDrawerList.setItemChecked(position, true);\n\t\t\tmDrawerList.setSelection(position);\n\t\t\tsetTitle(navMenuTitles[position]);\n\t\t\tmDrawerLayout.closeDrawer(mDrawerView);\n\t\t} else {\n\t\t\t// error in creating fragment\n\t\t\tLog.e(\"MainActivity\", \"Error in creating fragment\");\n\t\t}\n\t}", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_home) {\n // Handle the camera action\n handleselection(\"home\");\n } else if (id == R.id.nav_profile) {\n handleselection(\"profile\");\n } else if (id == R.id.nav_favorite_meals) {\n handleselection(\"favorite meals\");\n } else if (id == R.id.nav_diet_plan) {\n handleselection(\"diet plan\");\n } else if (id == R.id.nav_news) {\n handleselection(\"news\");\n } else if (id == R.id.nav_share) {\n handleselection(\"share\");\n } else if (id == R.id.nav_send) {\n handleselection(\"send\");\n } else if (id == R.id.nav_people) {\n handleselection(\"people\");\n }else if (id == R.id.nav_settings) {\n handleselection(\"settings\");\n }else if (id == R.id.nav_support) {\n handleselection(\"support\");\n }else if (id == R.id.nav_about) {\n handleselection(\"about\");\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n Toast.makeText(this, \"gallery is clicked!\", Toast.LENGTH_LONG).show();\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n if(id==R.id.profile)\n {\n Intent intent=new Intent(this, persondoc.class);\n startActivity(intent);\n }\n\n if (id == R.id.nav_slideshow) {\n Intent intent=new Intent(this,loc.class) ;\n startActivity(intent);\n\n } else if (id == R.id.logout){\n open(navHeader);\n }\n /*else if(id==R.id.nav_manage)\n {\n Intent intent=new Intent(this,SettingsActivity.class);\n startActivity(intent);\n } */\n else\n { int i ;\n for(i=0;i<inter.getC;i++)\n {\n if(id==b[i])\n { selectedclinic=inter.a[i];\n selectedclinickey=inter.a[i].ckey;\n Intent intent=new Intent(this,start1.class);\n startActivity(intent);\n break;\n }\n }\n }\n \n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n\n } else if (id == R.id.nav_gallery) {\n Intent intent = new Intent(this, PersonGroupListActivity.class);\n startActivity(intent);\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n Intent intent = new Intent(this, TestActivity.class);\n startActivity(intent);\n }\n// else if (id == R.id.nav_slideshow) {\n//\n// }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.carrera) {\n Intent intentf = new Intent(Navigation.this,CarreraListView.class);\n startActivity(intentf);\n } else if (id == R.id.curso) {\n Intent intentf = new Intent(Navigation.this,CursoListView.class);\n startActivity(intentf);\n } else if (id == R.id.profesor) {\n Intent intentf = new Intent(Navigation.this,ProfesorListView.class);\n startActivity(intentf);\n } else if (id == R.id.alumno) {\n Intent intentf = new Intent(Navigation.this,AlumnoListView.class);\n startActivity(intentf);\n } else if (id == R.id.ciclo) {\n Intent intentf = new Intent(Navigation.this,CicloListView.class);\n startActivity(intentf);\n } else if (id == R.id.grupo) {\n Intent intentf = new Intent(Navigation.this,GrupoListView.class);\n startActivity(intentf);\n } else if (id == R.id.usuario) {\n Intent intentf = new Intent(Navigation.this,UsuarioView.class);\n startActivity(intentf);\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_dash) {\n Toast.makeText(MainActivity.this, \"Dashboard\", Toast.LENGTH_SHORT).show();\n }else if (id == R.id.nav_config){\n Toast.makeText(MainActivity.this, \"Fazer alguma coisa aqui...\", Toast.LENGTH_SHORT).show();\n }\n DrawerLayout drawer = findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n menuItem.setChecked(true);\n // close drawer when item is tapped\n mDrawerLayout.closeDrawers();\n\n // Add code here to update the UI based on the item selected\n // For example, swap UI fragments here\n if (menuItem.getItemId() == R.id.nav_song){\n Intent intent = new Intent(SongList.this,SongList.class);\n startActivity(intent);}\n if (menuItem.getItemId() == R.id.nav_artist){\n Intent intent = new Intent(SongList.this,ArtistList.class);\n startActivity(intent);}\n if (menuItem.getItemId() == R.id.nav_playlist){\n Intent intent = new Intent(SongList.this,PlaylistList.class);\n startActivity(intent);}\n if (menuItem.getItemId() == R.id.nav_album){\n Intent intent = new Intent(SongList.this,AlbumList.class);\n startActivity(intent);}\n if (menuItem.getItemId() == R.id.nav_genre){\n Intent intent = new Intent(SongList.this,GenreList.class);\n startActivity(intent);}\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if(id == R.id.nav_hot){\n\n }else if(id == R.id.nav_special){\n\n }else if(id == R.id.nav_preference){\n\n }else if(id == R.id.nav_findGame){\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n Fragment fragment = null;\n int id = item.getItemId();\n\n if (id == R.id.drawer_area) {\n // Handle the camera action\n fragment = new AreaFragment();\n } else if (id == R.id.drawer_cooking) {\n\n } else if (id == R.id.drawer_currency) {\n\n } else if (id == R.id.drawer_energy) {\n\n } else if (id == R.id.drawer_fuel) {\n\n } else if (id == R.id.drawer_length) {\n\n }\n\n if(fragment != null){\n\n FragmentManager fragmentManager = getSupportFragmentManager();\n FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();\n\n fragmentTransaction.replace(R.id.drawer, fragment);\n fragmentTransaction.commit();\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\r\n @Override\r\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n if (id == R.id.nav_device) {\r\n\r\n } else if (id == R.id.nav_scan) {\r\n Intent intent = new Intent(this, Scan.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n } else if (id == R.id.nav_listapp) {\r\n Intent intent = new Intent(this, Listapp.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n }else if (id == R.id.nav_permission) {\r\n Intent intent = new Intent(this, PermissionList.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n\r\n } else if (id == R.id.nav_network) {\r\n Intent intent = new Intent(this, Network.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n }else if (id == R.id.nav_findingip) {\r\n Intent intent = new Intent(this, FindingIP.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n } else if (id == R.id.nav_folderlock) {\r\n Intent intent = new Intent(this, Encryption.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n }else if (id == R.id.nav_about) {\r\n Intent intent = new Intent(this, About.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n }else if (id == R.id.nav_share) {\r\n Intent intent = new Intent(Intent.ACTION_SEND);\r\n intent.setType(\"text/plain\");\r\n String shareDes = \"WIDefend - App to monitoring your device and protect from trojan. Download github.com/wishihab\";\r\n intent.putExtra(Intent.EXTRA_TEXT,shareDes);\r\n startActivity(Intent.createChooser(intent, \"Share with\"));\r\n }\r\n\r\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\r\n drawer.closeDrawer(GravityCompat.START);\r\n return true;\r\n }", "@Override\n public void onItemClick(AdapterView<?> parent, View view, int position,\n long id) {\n displayView(position);\n }", "@Override\n public void onItemClick(AdapterView<?> parent, View view, int position,\n long id) {\n displayView(position);\n }", "@Override\n public void onItemClick(AdapterView<?> parent, View view, int position,\n long id) {\n displayView(position);\n }", "@Override\n public void onItemClick(AdapterView<?> parent, View view, int position,\n long id) {\n displayView(position);\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n } else if (id == R.id.nav_dark_theme) {\n Log.d(TAG, \"nav dark theme\");\n // todo: selectTheme()\n\n\n } else if (id == R.id.nav_settings) {\n\n Intent intent = new Intent(this, SettingsActivity.class);\n startActivity(intent);\n }\n // config\n\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id==R.id.nav_my_mall){\n getSupportActionBar().setDisplayShowTitleEnabled(false);\n setFragment(new HomeFragment(),HOME_FRAGMENT);\n\n }else if (id == R.id.nav_my_orders) {\n\n } else if (id == R.id.nav_my_rewards) {\n\n } else if (id == R.id.nav_my_cart) {\n myCart();\n\n } else if (id == R.id.nav_my_wishlist) {\n\n } else if (id == R.id.nav_my_account) {\n gotoFragment(\"My Account\",new MyAccountFragment(),ACCOUNT_FRAGMENT);\n\n }else if (id == R.id.nav_sign_out){\n\n }\n\n DrawerLayout drawer = findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.Car_Bingo) {\n // Handle the camera action\n } else if (id == R.id.Four_In_A_Row) {\n\n } else if (id == R.id.Memory) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n Fragment switchTo = null;\n\n switch(item.getItemId()) {\n case R.id.nav_home:\n switchTo = new UsageFragment();\n break;\n case R.id.nav_devices:\n switchTo = new DevicesFragment();\n break;\n case R.id.nav_alerts:\n switchTo = new AlarmsFragment();\n break;\n case R.id.nav_settings:\n switchTo = new SettingsFragment();\n break;\n case R.id.nav_logout:\n onLogout();\n break;\n default:\n break;\n };\n\n if(switchTo != null) {\n FragmentTransaction ft = getSupportFragmentManager().beginTransaction();\n ft.replace(R.id.fragment_container, switchTo, \"Visible Fragment\");\n for (int i = 0; i < getSupportFragmentManager().getBackStackEntryCount(); i++) {\n getSupportFragmentManager().popBackStackImmediate();\n }\n\n ft.commit();\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n System.out.println(\"id = \" + id);\n\n if (id == 16908332) {\n mNavigationDrawerFragment.openDrawer();\n return true;\n }\n\n\n return super.onOptionsItemSelected(item);\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_my_complaints) {\n fragment = new MyComplaintsFragment();\n getFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).addToBackStack(\"tag\").commit();\n // Handle the camera action\n } else if (id == R.id.nav_website) {\n new FinestWebView.Builder(MainDrawerActivity.this)\n .titleDefault(\"KP Traffic Police Official Website\")\n .titleFont(\"Roboto-Medium.ttf\")\n .disableIconForward(true)\n .disableIconBack(true)\n .show(\"http://www.ptpkp.gov.pk/\");\n } else if (id == R.id.nav_logout) {\n editor.clear().commit();\n startActivity(new Intent(MainDrawerActivity.this, MainActivity.class));\n finish();\n } else if (id == R.id.nav_home) {\n startActivity(new Intent(MainDrawerActivity.this, MainDrawerActivity.class));\n finish();\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n Fragment f = getSupportFragmentManager().findFragmentById(ID_FRAGMENT_CONTAINER);\n\n switch (id) {\n case R.id.nav_pdf:\n if(!(f instanceof PDFManagementFragment))\n showPdfManagement();\n break;\n case R.id.nav_video:\n if(!(f instanceof VideoManagementFragment))\n showVideoManagement();\n break;\n case R.id.nav_questionnaire:\n if(!(f instanceof QuestionnaireManagementFragment))\n showQuestionnaireManagement();\n break;\n case R.id.nav_logout:\n sharedPrefManager.setLogin(false);\n finish();\n startActivity(new Intent(getApplicationContext(), LandingPageActivity.class));\n break;\n }\n\n\n DrawerLayout drawer = findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return false;\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n menuItem.setChecked(true);\n int id = menuItem.getItemId();\n if(id == R.id.nav_account){\n Intent intent = new Intent(RunningResultsActivity.this,ProfileActivity.class);\n startActivity(intent);\n }\n else if(id == R.id.nav_challenges){\n Intent intent = new Intent(RunningResultsActivity.this,ChallengesActivity.class);\n startActivity(intent);\n }\n else if(id == R.id.nav_friends){\n Intent intent = new Intent(RunningResultsActivity.this, HistoryActivity.class);\n startActivity(intent);\n }\n else if(id == R.id.history){\n Intent intent = new Intent(RunningResultsActivity.this,HistoryActivity.class);\n startActivity(intent);\n }\n else if(id == R.id.nav_leaderboard){\n Intent intent = new Intent(RunningResultsActivity.this,LeaderBoardActivity.class);\n startActivity(intent);\n }\n // close drawer when item is tapped\n mDrawerLayout.closeDrawers();\n\n // Add code here to update the UI based on the item selected\n // For example, swap UI fragments here\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\r\n @Override\r\n public boolean onNavigationItemSelected(MenuItem item) {\n Fragment fragment = null;\r\n int id = item.getItemId();\r\n\r\n if (id == R.id.nav_Home) {\r\n // Handle action\r\n fragment = new HomeFragment();\r\n } else if (id == R.id.nav_Fuel) {\r\n fragment = new FuelFragment();\r\n } else if (id == R.id.nav_Milage) {\r\n fragment = new MilageFragment();\r\n } else if (id == R.id.nav_Service) {\r\n fragment = new ServiceFragment();\r\n } else if (id == R.id.nav_Condition) {\r\n fragment = new ConditionFragment();\r\n } else if (id == R.id.nav_send) {\r\n fragment = new UsFragment();\r\n }\r\n\r\n if(fragment != null){\r\n FragmentManager fragmentManager = getSupportFragmentManager();\r\n FragmentTransaction ft = fragmentManager.beginTransaction();\r\n ft.replace(R.id.screen_area,fragment);\r\n\r\n ft.commit();\r\n }\r\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\r\n drawer.closeDrawer(GravityCompat.START);\r\n return true;\r\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_contacts) {\n // Handle the camera action\n setContentFragment(id, MainApplication.SL_USER);\n }else if(id == R.id.nav_devices){\n setContentFragment(id, MainApplication.SL_DEVICE);\n }else if(id == R.id.nav_push){\n setContentFragment(id, MainApplication.SL_DEVICE);\n }else if(id == R.id.nav_storage){\n setContentFragment(id, MainApplication.SL_DEVICE);\n }\n// else if (id == R.id.nav_gallery) {\n//\n// } else if (id == R.id.nav_slideshow) {\n//\n// }\n\n// else if (id == R.id.nav_settings) {\n// Intent intent = new Intent(MainActivity.this, ConnTestingActivity.class);\n// startActivity(intent);\n// }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.record_sum) {\n // Jump to the record sum page\n Intent intent = new Intent(AccountKeep.this, AccountSum.class);\n startActivity(intent);\n\n } else if (id == R.id.nav_talk) {\n Intent intent = new Intent(AccountKeep.this, TalkInput.class);\n startActivity(intent);\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(@NonNull MenuItem item) {\n int id = item.getItemId();\n\n switch (id){\n case R.id.nav_aujourdhui :\n this.openAujourdhui();\n break;\n case R.id.nav_medicaments:\n this.openMesMedicaments();\n break;\n case R.id.nav_rappels:\n this.openMesRappels();\n break;\n case R.id.nav_donnees_perso:\n this.openDonneesPersonnelles();\n default:\n break;\n }\n\n this.drawerLayout.closeDrawer(GravityCompat.START);\n\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n Fragment fragment = null;\n Class fragmentClass;\n\n // Handle navigation view item clicks here.\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n fragment = new FirstFragment(displayName);\n // break;\n } else if (id == R.id.nav_gallery) {\n fragment = new SecondFragment();\n // break;\n\n } else if (id == R.id.nav_slideshow) {\n fragment = new ThirdFragment();\n // break;\n } else if (id == R.id.nav_manage) {\n fragment = new FourthFragment();\n // break;\n } else if (id == R.id.nav_share) {\n fragment = new FifthFragment();\n // break;\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n if (fragment != null) {\n FragmentTransaction ft = getSupportFragmentManager().beginTransaction();\n ft.replace(R.id.content_frame, fragment);\n ft.commit();\n }\n\n item.setChecked(true);\n // Set action bar title\n setTitle(item.getTitle());\n\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(@NonNull MenuItem item) {\n // Handle navigation view item clicks here.\n int id = item.getItemId();\n\n // Use a case statement\n if (id == R.id.nav_camera) {\n // Bible Resource 1\n } else if (id == R.id.nav_gallery) {\n // Bible Resource 2\n } else if (id == R.id.nav_slideshow) {\n // Bible Resource 3\n } else if (id == R.id.nav_manage) {\n // Bible Resource 4\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n sendEmail();\n }\n\n DrawerLayout drawer = findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(@NonNull MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n Intent intent = new Intent(StateActivity.this, SetTempActivity.class);\n startActivity(intent);\n finish();\n } else if (id == R.id.nav_gallery) {\n //state\n Intent intent = new Intent(StateActivity.this, StateActivity.class);\n startActivity(intent);\n finish();\n\n } else if (id == R.id.nav_share) {\n Intent intent = new Intent(StateActivity.this, AboutActivity.class);\n startActivity(intent);\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n kondisi(id);\n\n DrawerLayout drawer = findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Latest\n Intent i = new Intent(getApplicationContext(), LastestActivity.class);\n startActivity(i);\n finish();\n } else if (id == R.id.nav_gallery) {\n//Cat\n Intent i = new Intent(getApplicationContext(), CategoriesActivity.class);\n startActivity(i);\n finish();\n } else if (id == R.id.nav_slideshow) {\n//Favor\n\n Intent i = new Intent(getApplicationContext(), FavouriteActivity.class);\n startActivity(i);\n finish();\n } else if (id == R.id.nav_manage) {\n//GIFs\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n Fragment fragment;\n Class fragmentClass;\n\n switch (id) {\n case R.id.about:\n fragment = AboutFragment.newInstance();\n break;\n case R.id.nav_messages:\n fragment = new MessageFragment();\n break;\n case R.id.nav_subscription:\n fragment = new SubscriptionFragment();\n break;\n default:\n fragment = AboutFragment.newInstance();\n break;\n }\n FragmentTransaction ft = getSupportFragmentManager().beginTransaction();\n try {\n ft.replace(R.id.main_fragment, fragment);\n } catch (Exception e) {\n\n }\n ft.addToBackStack(null);\n ft.commit();\n\n setTitle(item.getTitle());\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_chicken_wings) {\n setFragment(fragment = new ChickenWings());\n } else if (id == R.id.nav_turkey_wings) {\n setFragment(fragment = new TurkeyWingsFragment());\n } else if (id == R.id.nav_sides) {\n setFragment(fragment = new SidesFragment());\n } else if (id == R.id.nav_extra) {\n setFragment(fragment = new ExtrasFragment());\n } else if (id == R.id.nav_drink_n_desert) {\n setFragment(fragment = new DesertnDrinksFragment());\n } else if (id == R.id.nav_order_here) {\n setFragment(fragment = new OrderFragment());\n } else if (id == R.id.nav_loyalty_points) {\n\n } else if (id == R.id.nav_contact_us) {\n fab.setVisibility(View.GONE);\n setFragment(fragment = new ContactFragment());\n }\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.notification) {\n Intent intent = new Intent(this, Notification.class);\n startActivity(intent);\n } else if (id == R.id.pastActivity) {\n isPastSevenData = true;\n ((TextView)findViewById(R.id.activityHeading)).setText(\"Past Activities\");\n activitySegment.refresh(isPastSevenData);\n }else if (id == R.id.todaysActivity) {\n isPastSevenData = false;\n ((TextView)findViewById(R.id.activityHeading)).setText(\"Today's Activities\");\n activitySegment.refresh(isPastSevenData);\n } else if (id == R.id.mySchedule) {\n Intent intent = new Intent(this, Scheduler.class);\n startActivity(intent);\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressLint(\"MissingPermission\")\n @SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n startActivity(new Intent(getApplicationContext(), DetailsRegistration.class));\n } else if (id == R.id.nav_slideshow) {\n Toast.makeText(getApplicationContext(), \"U Clicked me1!\", Toast.LENGTH_SHORT).show();\n startActivity(new Intent(getApplicationContext(), Cropimage.class));\n } else if (id == R.id.nav_manage) {\n startActivity(new Intent(getApplicationContext(), Prediction.class));\n } else if (id == R.id.nav_share) {\n String number = \"7010882689\";\n Intent intent = new Intent(Intent.ACTION_CALL);\n intent.setData(Uri.parse(\"tel:\" +number));\n startActivity(intent);\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "private void selectItemFromDrawer(int position) {\n Fragment fragment = new PreferencesFragment();\n\n FragmentManager fragmentManager = getFragmentManager();\n fragmentManager.beginTransaction()\n .replace(R.id.mainContent, fragment)\n .commit();\n\n mDrawerList.setItemChecked(position, true);\n setTitle(mNavItems.get(position).mTitle);\n\n // Close the drawer\n mDrawerLayout.closeDrawer(mDrawerPane);\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == net.iquesoft.android.seedprojectchat.R.id.nav_home){\n replaceFragment(mainFragment);\n }else if (id == net.iquesoft.android.seedprojectchat.R.id.nav_friends) {\n replaceFragment(containerFriendFragment);\n } else if (id == net.iquesoft.android.seedprojectchat.R.id.nav_group_chat) {\n replaceFragment(groupChatContainer);\n } else if (id == net.iquesoft.android.seedprojectchat.R.id.nav_manage) {\n replaceFragment(settingsFragment);\n } else if (id == net.iquesoft.android.seedprojectchat.R.id.nav_terms_and_conditions) {\n replaceFragment(termsAndConditionsFragment);\n } else if (id == net.iquesoft.android.seedprojectchat.R.id.nav_about_us) {\n replaceFragment(aboutUsFragment);\n } else if (id == net.iquesoft.android.seedprojectchat.R.id.nav_share) {\n presenter.share(this);\n } else if (id == net.iquesoft.android.seedprojectchat.R.id.nav_logout) {\n presenter.logOut(this, updateCurentUser);\n }\n DrawerLayout drawer = (DrawerLayout) findViewById(net.iquesoft.android.seedprojectchat.R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {\n TextView textView = (TextView)view;\n switch(textView.getText().toString()){\n case \"NavBar\":\n Intent nav = new Intent(this, NavDrawerActivity.class);\n startActivity(nav);\n break;\n }\n\n //Toast.makeText(MainActivity.this,\"Go to \" + textView.getText().toString() + \" page.\",Toast.LENGTH_LONG).show();\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 }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.main_screen) {\n selectedItem = id;\n getSupportActionBar().setTitle(\"Plan de Vuelo\");\n MapPlannerFragment mapPlannerFragment = new MapPlannerFragment();\n getSupportFragmentManager().beginTransaction().replace(R.id.main_container, mapPlannerFragment).commit();\n } else if (id == R.id.calibrate_wizzard) {\n\n } else if (id == R.id.settings) {\n selectedItem = id;\n getSupportActionBar().setTitle(\"Ajustes\");\n SettingsFragment settingsFragment = new SettingsFragment();\n getSupportFragmentManager().beginTransaction().replace(R.id.main_container, settingsFragment).commit();\n } else if (id == R.id.plan_settings) {\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n /*\n if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n }\n */\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n LuPOFragment settingsFragment = new LuPOFragment();\n this.getFragmentManager().beginTransaction()\n .replace(R.id.fragmentContainer, settingsFragment, \"Hi\")\n .addToBackStack(null)\n .commit();\n } else if (id == R.id.nav_gallery) {\n\n\n } else if (id == R.id.nav_share) {\n SettingsFragment settingsFragment = new SettingsFragment();\n this.getFragmentManager().beginTransaction()\n .replace(R.id.fragmentContainer, settingsFragment, \"Hi\")\n .addToBackStack(null)\n .commit();\n }\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n \n\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\r\n @Override\r\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n if (id == R.id.customer) {\r\n addCustomerFragment();\r\n // Handle the camera action\r\n } else if (id == R.id.offer) {\r\n addOfferFragment();\r\n } else if (id == R.id.nav_share) {\r\n\r\n }\r\n //accessibility\r\n setContentDescription();\r\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\r\n drawer.closeDrawer(GravityCompat.START);\r\n return true;\r\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\r\n @Override\r\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n if (id == R.id.nav_camera) {\r\n // Handle the camera action\r\n } else if (id == R.id.nav_gallery) {\r\n\r\n } else if (id == R.id.nav_slideshow) {\r\n\r\n } else if (id == R.id.nav_manage) {\r\n\r\n } else if (id == R.id.nav_share) {\r\n\r\n } else if (id == R.id.nav_send) {\r\n\r\n }\r\n\r\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\r\n drawer.closeDrawer(GravityCompat.START);\r\n return true;\r\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_newsurvey) {\n // Handle the camera action\n\n CapturePlot fr = new CapturePlot();\n fragment = fr;\n this.setTitle(fr.TAG);\n getSupportFragmentManager().beginTransaction().replace(R.id.fholder, fragment).addToBackStack(fr.TAG).commit();\n\n } else if (id == R.id.nav_pendingshare) {\n\n } else if (id == R.id.nav_nonmemtomem) {\n\n } else if (id == R.id.nav_editplot) {\n\n } else if (id == R.id.nav_daysummary) {\n DaySummary fr = new DaySummary();\n fragment = fr;\n this.setTitle(fr.TAG);\n getSupportFragmentManager().beginTransaction().replace(R.id.fholder, fragment).addToBackStack(fr.TAG).commit();\n\n } else if (id == R.id.nav_dataimport) {\n ImportData fr = new ImportData();\n fragment = fr;\n this.setTitle(fr.TAG);\n getSupportFragmentManager().beginTransaction().replace(R.id.fholder, fragment).addToBackStack(fr.TAG).commit();\n\n } else if (id == R.id.nav_logout) {\n //CommanData.conn.oprator.truncateTable();\n\n this.finish();\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\r\n @Override\r\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n if (id == R.id.nav_home_id) {\r\n // Handle the camera action\r\n\r\n } else if (id == R.id.nav_banks) {\r\n Intent i = new Intent(MainActivity.this, BanksActivity.class);\r\n startActivity(i);\r\n } else if (id == R.id.nav_saccos) {\r\n Toast.makeText(this, \"Use Bank for this demo\", Toast.LENGTH_SHORT).show();\r\n } else if (id == R.id.nav_individuals) {\r\n Toast.makeText(this, \"Use Bank for this demo\", Toast.LENGTH_SHORT).show();\r\n } else if (id == R.id.nav_history) {\r\n Toast.makeText(this, \"All transactions\", Toast.LENGTH_SHORT).show();\r\n } else if (id == R.id.nav_profile_id) {\r\n Intent i = new Intent(MainActivity.this, ProfileActivity.class);\r\n startActivity(i);\r\n }else if (id == R.id.nav_share_id) {\r\n\r\n }\r\n\r\n DrawerLayout drawer = findViewById(R.id.drawer_layout);\r\n drawer.closeDrawer(GravityCompat.START);\r\n return true;\r\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n\t@Override\n\tpublic boolean onNavigationItemSelected(MenuItem item) {\n\t\tint id = item.getItemId();\n\t\tNavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);\n\n\t\t//creating fragment object\n\t\tFragment fragment = null;\n\n\t\tif (id == R.id.nav_appointment) {\n\t\t\tfragment = new AppointmentFragment();\n\t\t\tsetToolbarTitle(item.getTitle().toString());\n\t\t} else if (id == R.id.nav_medicines) {\n\t\t\tfragment = new MedicineFragment();\n\t\t\tsetToolbarTitle(item.getTitle().toString());\n\t\t} else if (id == R.id.nav_personal) {\n\t\t\tfragment = new PersonalFragment();\n\t\t\tsetToolbarTitle(item.getTitle().toString());\n\t\t} else if (id == R.id.nav_emergency) {\n\t\t\tfragment = new EmergencyFragment();\n\t\t\tsetToolbarTitle(item.getTitle().toString());\n\t\t} else if (id == R.id.nav_settings) {\n\t\t\tfragment = new SettingFragment();\n\t\t\tsetToolbarTitle(item.getTitle().toString());\n\t\t} else if (id == R.id.nav_home) {\n\t\t\tfragment = new HomeFragment();\n\t\t\tsetToolbarTitle(item.getTitle().toString());\n\t\t}\n\n\t\t//replacing the fragment\n\t\tif (fragment != null) {\n\t\t\tFragmentTransaction ft = getFragmentManager().beginTransaction();\n\t\t\t//ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out);\n\t\t\tft.replace(R.id.contain_main, fragment);\n\t\t\t//rft.addToBackStack(tag);\n\t\t\tft.commit();\n\t\t}\n\n\t\tDrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n\t\tdrawer.closeDrawer(GravityCompat.START);\n\t\treturn true;\n\t}", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_dongvat) {\n\n } else if (id == R.id.nav_sacmau) {\n\n } else if (id == R.id.nav_tainhieunhat) {\n\n } else if (id == R.id.nav_thiennhien) {\n\n } else if (id == R.id.nav_tinhyeu) {\n\n }\n\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n startActivity(ChangeInfoActivity.class);\n } else if (id == R.id.nav_gallery) {\n startActivity(AddHdActivity.class);\n } else if (id == R.id.nav_slideshow) {\n startActivity(HDongDeleteActivity.class);\n } else if (id == R.id.nav_manage) {\n startActivity(FriendActivity.class);\n } else if (id == R.id.nav_share) {\n KeyValueStorage keyValueStorage = new KeyValueStorage(this);\n keyValueStorage.putString(Config.IS_AUTO_LOGIN,\"1\");\n startActivity(LoginActivity.class);\n finish();\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_cat) {\n setTitle(\"Catergories\");\n categories frag = new categories();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.replace(R.id.frame, frag, \"fragment_cat\");\n fragmentTransaction.commitAllowingStateLoss();\n } else if (id == R.id.nav_prof) {\n setTitle(\"Profile\");\n profile frag = new profile();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.replace(R.id.frame, frag, \"fragment_profile\");\n fragmentTransaction.commitAllowingStateLoss();\n } else if (id == R.id.nav_favs) {\n setTitle(\"Favourites\");\n favourites frag = new favourites();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.replace(R.id.frame, frag, \"fragment_profile\");\n fragmentTransaction.commitAllowingStateLoss();\n } else if (id == R.id.nav_orders) {\n Toast.makeText(getBaseContext(), \"Function currently unavailable\", Toast.LENGTH_SHORT).show();\n } else if (id == R.id.nav_signout) {\n Intent i = new Intent(this, MainActivity.class);\n startActivity(i);\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n displaySelectedScreen(item.getItemId());\n //make this method blank\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n displaySelectedScreen(item.getItemId());\n //make this method blank\n return true;\n }", "private static void viewItem(Item item) {\n try {\n FXMLLoader fxmlLoader = new FXMLLoader(ToF.getResource(\"Item.fxml\"));\n Parent menu = (Parent) fxmlLoader.load();\n ((ItemController)fxmlLoader.getController()).setItem(item);\n Stage stage = new Stage();\n stage.setScene(new Scene(menu));\n stage.show();\n } catch (IOException ex) {\n throw new IllegalStateException(\"Couldn't load the item view.\", ex);\n }\n }", "public void ShowDrawer(View target)\n\t{\n mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);\n mDrawerList = (ListView) findViewById(R.id.left_drawer);\n mDrawerLayout.openDrawer(mDrawerList);\n\t}", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id){\n case R.id.activity_main_bills :\n break;\n case R.id.activity_main_drawer_profile:\n break;\n case R.id.activity_main_drawer_layout:\n break;\n default:\n break;\n }\n\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_home) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n startActivity(new Intent(MainActivity.this, DBTestActivity.class));\n return true;\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_settings) {\n startActivity(new Intent(MainActivity.this,SettingsActivity.class));\n return true;\n } else if (id == R.id.nav_help) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n }\n\n DrawerLayout drawer = findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camara) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(@NonNull MenuItem item) {\n switch (item.getItemId()) {\n case R.id.nav_current:\n fragmentManager(\"Current\", currentFragment);\n break;\n case R.id.nav_hourly:\n fragmentManager(\"Hourly\", hourlyFragment);\n break;\n case R.id.nav_daily:\n fragmentManager(\"Daily\", dailyFragment);\n break;\n default:\n taskLoadUp(item.getTitle().toString());\n Toast.makeText(this, item.getTitle(), Toast.LENGTH_SHORT).show();\n break;\n }\n\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n Fragment fragment = null;\n\n if (id == R.id.nav_short_code) {\n fragment = new FragmentShortCode();\n } else if (id == R.id.nav_offer) {\n fragment = new FragmentVAS();\n } else if (id == R.id.nav_news) {\n fragment = new FragmentOffer();\n } else if (id == R.id.nav_setting) {\n Intent i = new Intent(this, SettingActivity.class);\n startActivity(i);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n } else if (id == R.id.nav_share) {\n fragment = new AudioFragment();\n }\n\n drawer.closeDrawer(GravityCompat.START);\n changeFragment(fragment);\n\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_home) {\n // Handle the camera action\n } else if (id == R.id.nav_apply) {\nIntent i=new Intent(getApplicationContext(),busbook.class);\nstartActivity(i);\n\n } else if (id == R.id.nav_collab) {\n Intent i=new Intent(getApplicationContext(),cab.class);\n startActivity(i);\n\n } else if (id == R.id.nav_gallery) {\nIntent i=new Intent(getApplicationContext(),train.class);\nstartActivity(i);\n }\n else if (id == R.id.nav_comm) {\nIntent i=new Intent(getApplicationContext(),hotel.class);\nstartActivity(i);\n\n }\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public void onClick(View view) {\n drawer.openDrawer();\n }", "@Override\r\n\t\tpublic void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n\t\t\tdisplayView(position);\r\n\t\t}", "@Override\n public boolean onNavigationItemSelected(@NonNull MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n } else if (id == R.id.nav_about) {\n\n } else if (id == R.id.nav_exit) {\n exitApp();\n }\n\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_read_offline) {\n // Handle the camera action\n Toast.makeText(this, \"Chờ phiên bản tiếp nhé !\", Toast.LENGTH_SHORT).show();\n } else if (id == R.id.nav_like) {\n Toast.makeText(this, \"Đã bảo chờ phiên bản tiếp rồi !\", Toast.LENGTH_SHORT).show();\n } else if (id == R.id.nav_night_mode) {\n //mFrameLayoutSetting.setVisibility(View.VISIBLE);\n } else if (id == R.id.nav_setting) {\n Toast.makeText(this, \"Mệt em vl, chờ phiên bản sau nhé !\", Toast.LENGTH_SHORT).show();\n } else if (id == R.id.nav_version) {\n Toast.makeText(this, \"I am sorry ! Đừng gỡ app\", Toast.LENGTH_SHORT).show();\n } else if (id == R.id.nav_policy) {\n Toast.makeText(this, \"Dừng lại tại đây thôi !\", Toast.LENGTH_SHORT).show();\n } else if (id == R.id.nav_vote) {\n //SystemClock.sleep(1000);\n Toast.makeText(this, \"Em nhây vl !\", Toast.LENGTH_SHORT).show();\n } else if (id == R.id.nav_feedback) {\n Toast.makeText(this, \"Em gỡ mịa app đi !\", Toast.LENGTH_SHORT).show();\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }" ]
[ "0.7112345", "0.70579094", "0.6929277", "0.6897872", "0.68665236", "0.68139255", "0.67870075", "0.6764774", "0.6755591", "0.6740172", "0.67366695", "0.6727487", "0.67166823", "0.67042184", "0.6685011", "0.6669062", "0.6669062", "0.6633194", "0.66313225", "0.66257566", "0.66201043", "0.66195166", "0.66145927", "0.6607833", "0.65870905", "0.6582353", "0.6575544", "0.65753835", "0.65601397", "0.6549472", "0.65223217", "0.65118897", "0.650978", "0.6507295", "0.649584", "0.6485061", "0.6478375", "0.6471341", "0.6458503", "0.6455786", "0.6444588", "0.643932", "0.6426373", "0.64254636", "0.64230907", "0.6421398", "0.6407101", "0.6399596", "0.6399596", "0.6399596", "0.6399596", "0.6379853", "0.6375879", "0.636795", "0.636613", "0.636041", "0.6350219", "0.63499063", "0.6349006", "0.63484365", "0.6347389", "0.63462865", "0.63440573", "0.6343979", "0.6341265", "0.63398236", "0.63396627", "0.6339488", "0.6335374", "0.633525", "0.633463", "0.6332855", "0.63302433", "0.63293284", "0.6328248", "0.6326075", "0.63227475", "0.6322149", "0.6321163", "0.6319834", "0.631625", "0.6315534", "0.63152677", "0.63115084", "0.6308845", "0.63064677", "0.63020796", "0.63012844", "0.63012844", "0.6298173", "0.6294754", "0.6292227", "0.6290012", "0.6287731", "0.6283886", "0.6277611", "0.6277578", "0.62759227", "0.6275671", "0.6271584", "0.62704736" ]
0.0
-1
toggle nav drawer on selecting action bar app icon/title
@Override public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action bar actions click switch (item.getItemId()) { case R.id.action_settings: return true; default: return super.onOptionsItemSelected(item); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\nint home=item.getItemId();\r\n //noinspection SimplifiableIfStatement\r\n if (id == R.id.action_settings) {\r\n return true;\r\n }\r\nif(home==R.id.home){\r\n drawerlayout.openDrawer(Gravity.LEFT);\r\n}\r\n return super.onOptionsItemSelected(item);\r\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n try {\n getSupportActionBar().setTitle(\"Settings\");\n }catch(NullPointerException e){\n Toast.makeText(NavigationDrawerActivity.this, \"ActionBar \"+ e, Toast.LENGTH_SHORT).show();\n }\n //invalidateOptionsMenu();\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n//done: set a button to open drawer\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n if (!drawerLayout.isDrawerOpen(drawer))\n drawerLayout.openDrawer(drawer);\n else\n drawerLayout.closeDrawers();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n// getActionBar().setTitle(\"Select Destination\");\n }", "private void toggleDrawer() {\n DrawerLayout drawer = (DrawerLayout)findViewById(R.id.menu);\n if(drawer.isDrawerOpen(Gravity.START)) {\n drawer.closeDrawer(Gravity.START);\n }\n else drawer.openDrawer(Gravity.START);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n case android.R.id.home:\n mDrawerLayout.openDrawer(GravityCompat.START);\n return true;\n case R.id.action_settings:\n return true;\n\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 mDrawerLayout.openDrawer(GravityCompat.START);\n return true;\n case R.id.action_settings:\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n //noinspection SimplifiableIfStatement\r\n if (id == R.id.action_settings) {\r\n return true;\r\n } else if (id == android.R.id.home) {\r\n mDrawerLayout.openDrawer(GravityCompat.START);\r\n }\r\n return super.onOptionsItemSelected(item);\r\n }", "public void onDrawerOpened(View drawerView) {\n menuvalue = 1;\n getSupportActionBar().setHomeAsUpIndicator(R.mipmap.back_arrow);\n }", "private void toggleDrawer() {\n ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,\n R.string.navigation_drawer_open, R.string.navigation_drawer_close);\n drawerLayout.addDrawerListener(drawerToggle);\n drawerToggle.syncState();\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n menuItem.setChecked(true);\n // close drawer when item is tapped\n switch (menuItem.getItemId()) {\n case R.id.weather:\n Intent net = new Intent (MainActivity.this, WeatherActivity.class);\n startActivity(net);\n break;\n case R.id.settings:\n Intent conf = new Intent(MainActivity.this, PreferencesActivity.class);\n startActivity(conf);\n break;\n default:\n break;\n }\n mDrawerLayout.closeDrawers();\n\n // Add code here to update the UI based on the item selected\n // For example, swap UI fragments here\n\n return true;\n }", "public void onDrawerOpened(View drawerView) {\n \tactivity.getSupportActionBar().setTitle(\"Menua\");\n \tactivity.invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\r\n @Override\r\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n if (id == R.id.nav_device) {\r\n\r\n } else if (id == R.id.nav_scan) {\r\n Intent intent = new Intent(this, Scan.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n } else if (id == R.id.nav_listapp) {\r\n Intent intent = new Intent(this, Listapp.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n }else if (id == R.id.nav_permission) {\r\n Intent intent = new Intent(this, PermissionList.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n\r\n } else if (id == R.id.nav_network) {\r\n Intent intent = new Intent(this, Network.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n }else if (id == R.id.nav_findingip) {\r\n Intent intent = new Intent(this, FindingIP.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n } else if (id == R.id.nav_folderlock) {\r\n Intent intent = new Intent(this, Encryption.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n }else if (id == R.id.nav_about) {\r\n Intent intent = new Intent(this, About.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(intent);\r\n }else if (id == R.id.nav_share) {\r\n Intent intent = new Intent(Intent.ACTION_SEND);\r\n intent.setType(\"text/plain\");\r\n String shareDes = \"WIDefend - App to monitoring your device and protect from trojan. Download github.com/wishihab\";\r\n intent.putExtra(Intent.EXTRA_TEXT,shareDes);\r\n startActivity(Intent.createChooser(intent, \"Share with\"));\r\n }\r\n\r\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\r\n drawer.closeDrawer(GravityCompat.START);\r\n return true;\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n if (drawerLayout.isDrawerOpen(listViewSliding)){\n drawerLayout.closeDrawer(listViewSliding);\n }else{\n drawerLayout.openDrawer(listViewSliding);\n }\n break;\n\n default:\n break;\n }\n return true;\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n case android.R.id.home:\n mDrawerLayout.openDrawer(GravityCompat.START);\n return true;\n case R.id.action_camera:\n Toast.makeText(MainActivity.this, item.getTitle(), Toast.LENGTH_LONG).show();\n return true;\n case R.id.action_settings:\n Toast.makeText(MainActivity.this, item.getTitle(), Toast.LENGTH_LONG).show();\n return true;\n case R.id.action_edit_urls:\n Toast.makeText(MainActivity.this, item.getTitle(), Toast.LENGTH_LONG).show();\n return true;\n case R.id.action_about:\n //Toast.makeText(MainActivity.this, item.getTitle(), Toast.LENGTH_LONG).show();\n startActivity(new Intent(this, AboutActivity.class));\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n Intent intent = null;\n switch (id) {\n\n case R.id.home_h:\n intent = new Intent(this, MainActivity.class);\n break;\n\n case R.id.nav_info:\n intent = new Intent(this, Information.class);\n break;\n\n default:\n intent = new Intent(this, ToDo.class);\n }\n\n startActivity(intent);\n finish();\n /* Closing the drawer by getting reference to the drawer layout, and calling its closeDrawer() method. */\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START); // using START as the drawer is attached to the activity's start edge\n return true;\n }", "void displayDrawer() {\n //toolbar = (Toolbar) findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n actionbar = getSupportActionBar();\n actionbar.setDisplayHomeAsUpEnabled(true);\n\n actionbar.setHomeAsUpIndicator(R.drawable.ic_menu);\n\n navigationView.setNavigationItemSelectedListener(\n new NavigationView.OnNavigationItemSelectedListener() {\n @Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n // set item as selected to persist highlight\n menuItem.setChecked(true);\n // close drawer when item is tapped\n mdrawer.closeDrawers();\n\n String choice = menuItem.getTitle().toString();\n\n switch (choice) {\n case \"Register\":\n Intent i = new Intent(getBaseContext(), SignIn.class);\n startActivity(i);\n break;\n case \"Log In\":\n Intent p = new Intent(getBaseContext(), LoginActivity.class);\n startActivity(p);\n break;\n\n case \"Profile Picture\":\n Intent pic = new Intent(getBaseContext(), ImageUpload.class);\n startActivity(pic);\n break;\n\n case \"Users\":\n Intent users = new Intent(getBaseContext(), Userlist.class);\n startActivity(users);\n break;\n\n case \"Chats\":\n Intent chats = new Intent(getBaseContext(), ChatList.class);\n startActivity(chats);\n break;\n }\n\n // Add code here to update the UI based on the item selected\n // For example, swap UI fragments here\n\n return true;\n }\n });\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n //getSupportActionBar().setTitle(\"Navigation Drawer\");\n invalidateOptionsMenu();\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n \tLog.d(\"MainActivity\", \"onOptionsItemSelected\");\r\n if (mDrawerToggle.onOptionsItemSelected(item)) {\r\n \tLog.d(\"MainActivity\", \"======\");\r\n// \treturn true;\r\n }\r\n debugMemory(\"title:\"+item.getTitle()+\"--itemId:\"+item.getItemId()+\" android.id\"+android.R.id.home);\r\n \r\n switch (item.getItemId()) {\r\n\t\tcase R.id.action_search:\r\n\t\t\tLog.d(\"MainActivity\", \"===action_search==\");\r\n\t\t\tgetActionBar().setIcon(R.drawable.search_white);\r\n\t\t\tmDrawerToggle.setDrawerIndicatorEnabled(false);\r\n\t\t\tbreak;\r\n\t\tcase R.id.action_alarm:\r\n\t\t\tmDrawerToggle.setDrawerIndicatorEnabled(false);\r\n\t\t\tLog.d(\"MainActivity\", \"===action_alarm==\");\r\n\t\t\tbreak;\r\n\t\tcase android.R.id.home:\r\n\t\t\tif (mDrawerToggle.isDrawerIndicatorEnabled() == false) {\r\n\t\t\t\tgetActionBar().setIcon(null);\r\n\t\t\t\tmDrawerToggle.setDrawerIndicatorEnabled(true);\r\n\t\t\t\tdebugMemory(\"android.R.id.home\");\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t\t}\r\n \r\n // Handle your other action bar items...\r\n return super.onOptionsItemSelected(item);\r\n }", "public void onDrawerOpened(View drawerView) {\n getActionBar().setTitle(\"Opened Drawer\");\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 == android.R.id.home) {\n mDrawerLayout.openDrawer(GravityCompat.START);\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (drawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n switch (item.getItemId()) {\n case android.R.id.home:\n drawerLayout.openDrawer(GravityCompat.START);\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if(mDrawerToggle.onOptionsItemSelected(item)){\n return true;\n }\n\n\n// int id = item.getItemId();\n//\n// //noinspection SimplifiableIfStatement\n// if (id == R.id.action_settings) {\n// return true;\n// }\n\n return super.onOptionsItemSelected(item);\n }", "private void setupActionBar(String title) {\n Button openDrawer = findViewById(R.id.open_drawer);\n TextView activityTitle = findViewById(R.id.activity_title);\n\n Display display = getWindowManager().getDefaultDisplay();\n Point size = new Point();\n display.getSize(size);\n\n openDrawer.setBackgroundDrawable(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_menu).sizeDp(30).color(getResources().getColor(R.color.colorPrimary)));\n openDrawer.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n mainDrawer.openDrawer();\n }\n });\n\n activityTitle.setText(title); //sets the TextViews text\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(this, SettingsActivity.class);\n startActivity(intent);\n return true;\n }\n else if (id == R.id.drawer){\n DrawerLayout drawer = (DrawerLayout) this.findViewById(R.id.drawer_layout);\n drawer.openDrawer(mDrawerList);\n }\n\n return super.onOptionsItemSelected(item);\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n /* if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else */\n\n if (id == R.id.nav_share) {\n favortiesMethed();\n } else if (id == R.id.nav_send) {\n https://play.google.com/store/apps/details?navId=com.adeebhat.rabbitsvilla/\n try {\n Intent viewIntent =\n new Intent(\"android.intent.action.VIEW\",\n Uri.parse(\"https://play.google.com/store/apps/details?id=com.eclix.unit.converter.calculator\"));\n startActivity(viewIntent);\n\n } catch(Exception e) {\n Toast.makeText(getApplicationContext(),\"Unable to Connect Try Again...\",\n Toast.LENGTH_LONG).show();\n e.printStackTrace();\n }\n }else if(id == R.id.nav_fav){\n\n setFavortiesLayout();\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n getSupportActionBar().setTitle(\"Navigation!\");\n //invalidateOptionsMenu();\n //creates call to onPrepareOptionsMenu()\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n getActionBar().setTitle(R.string.drawer_open);\n invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_notes) {\n Intent intent=new Intent(this,MainActivityLauncher.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n startActivity(intent);\n } else if (id == R.id.nav_remainders) {\n Intent intent=new Intent(this,GetAllRemainders.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n startActivity(intent);\n } else if (id == R.id.nav_manage) {\n Intent intent=new Intent(this,SettingsActivity.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n startActivity(intent);\n } else if (id == R.id.help_feedback) {\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n getSupportActionBar().setTitle(\"Navigation!\");\n invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n if (drawerLayout.isDrawerOpen(linearLayout)) {\n drawerLayout.closeDrawers();\n } else {\n drawerLayout.openDrawer(linearLayout);\n }\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n if (actionBar != null) actionBar.setTitle(R.string.choose_to_do_list);\n invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n try {\n getSupportActionBar().setTitle(activityTitle);\n }catch(NullPointerException e){\n Toast.makeText(NavigationDrawerActivity.this, \"ActionBar \"+ e, Toast.LENGTH_SHORT).show();\n }\n //invalidateOptionsMenu();\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n Log.d(\"NICK\", \"CWECNEWKVNERIPNVIEWNFVIPEWNVIPEWNVPIEWNVPIEWNVPIEWNVPIRWNVPRWVPO\");\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n //drawerLayout = (DrawerLayout) findViewById(R.id.drawer_main);\n drawerLayout.openDrawer(GravityCompat.START);\n return true;\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 }", "public void onDrawerOpened(View drawerView) {\n getActionBar().setTitle(\"Guest Login\");\n invalidateOptionsMenu();\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item)\n {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n\n // Activate the navigation drawer toggle\n if (id == R.id.action_location_found)\n {\n Toast.makeText(Home.this, \"Action Location\", Toast.LENGTH_SHORT).show();\n }\n else if (id == R.id.action_refresh)\n {\n Toast.makeText(Home.this, \"Action Refresh\", Toast.LENGTH_SHORT).show();\n }\n else if (id == R.id.action_help)\n {\n Toast.makeText(Home.this, \"Action Help\", Toast.LENGTH_SHORT).show();\n }\n else if (id == R.id.action_check_updates)\n {\n Toast.makeText(Home.this, \"Action Check Updates\", Toast.LENGTH_SHORT).show();\n }\n\n if (mDrawerToggle.onOptionsItemSelected(item))\n {\n return true;\n }\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 mDrawer.openDrawer(GravityCompat.START);\n return true;\n }\n if (drawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n getSupportActionBar().setTitle(mDrawerTitle);\n ActivityCompat.invalidateOptionsMenu(NavDrawerFragmentActivity.this);\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n // Set item in checked state\n menuItem.setChecked(true);\n int id = menuItem.getItemId();\n switch (id){\n case R.id.Main:\n Intent intent = new Intent(MainActivity.this, MainActivity.class);\n startActivity(intent);\n break;\n\n case R.id.HV1:\n Intent intent1 = new Intent(MainActivity.this, HomeWork1.class);\n startActivity(intent1);\n break;\n case R.id.HV2:\n Intent intent2 = new Intent(MainActivity.this, HomeWork2.class);\n startActivity(intent2);\n break;\n case R.id.HV3:\n Intent intent3 = new Intent(MainActivity.this, HomeWork3.class);\n startActivity(intent3);\n break;\n case R.id.HV4:\n Intent intent4 = new Intent(MainActivity.this, HomeWork4.class);\n startActivity(intent4);\n break;\n case R.id.HV5:\n Intent intent5 = new Intent(MainActivity.this, HomeWork5.class);\n startActivity(intent5);\n break;}\n\n\n // TODO: handle navigation\n\n // Closing drawer on item click\n mDrawerLayout.closeDrawers();\n return true;\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n// getActionBar().setTitle(mDrawerTitle);\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n// getActionBar().setTitle(mDrawerTitle);\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n getSupportActionBar().setTitle(\"Navigation\");\n invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n\t switch (item.getItemId()) {\n\t case R.id.action_settings:\n\t \tToast.makeText(getApplicationContext(), \"Refresh!\", Toast.LENGTH_SHORT).show();\n\t break;\n\t }\n\t return true;\n\t}", "public void selectDrawerItem(MenuItem menuItem) {\n Fragment fragment = null;\n Class fragmentClass;\n switch(menuItem.getItemId()) {\n case R.id.nav_home:\n fragmentClass = MainFragment.class;\n startFragment(fragmentClass);\n break;\n case R.id.nav_fav:\n fragmentClass = FavoriteFragment.class;\n startFragment(fragmentClass);\n break;\n case R.id.nav_upd:\n openLink(\"https://play.google.com/store/apps/details?id=com.satyajit.gamex\");\n\n break;\n case R.id.nav_settings:\n fragmentClass = SettingsFragment.class;\n startFragment(fragmentClass);\n break;\n case R.id.nav_rate:\n openLink(\"https://play.google.com/store/apps/details?id=com.satyajit.gamex\");\n break;\n case R.id.nav_share:\n shareApp();\n break;\n }\n\n\n if (menuItem.getItemId()!= R.id.nav_share && menuItem.getItemId()!= R.id.nav_rate && menuItem.getItemId()!= R.id.nav_upd ) {\n // Highlight the selected item has been done by NavigationView\n menuItem.setChecked(true);\n // Set action bar title\n setTitle(menuItem.getTitle());\n\n }\n\n else {\n\n\n }\n // Close the navigation drawer\n mDrawer.closeDrawers();\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n case R.id.switchLayouts:\n if (isOn){\n setContentView(listViewL1);\n// setActionIcon(isOn);\n item.setIcon(R.mipmap.ic_testgrid);\n isOn = false;\n }else {\n setContentView(gridViewL2);\n //setActionIcon(isOn);\n item.setIcon(R.mipmap.ic_whitelist);\n isOn = true;\n }\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n // Handle your other action bar items...\n return super.onOptionsItemSelected(item);\n }", "@Test\n public void clickOnAndroidHomeIcon_OpensNavigationDrawer() {\n onView(withId(R.id.drawer_layout))\n .check(matches(isClosed(Gravity.LEFT))); // Left Drawer should be closed.\n\n // Open Drawer\n onView(withId(R.id.drawer_layout))\n .perform(open());\n\n // Check if drawer is open\n onView(withId(R.id.drawer_layout))\n .check(matches(isOpen(Gravity.LEFT))); // Left drawer is open open.\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_like) {\n Intent myWebLink = new Intent();\n myWebLink.setData(Uri.parse(\"https://github.com/nducthien/ProjectFinal\"));\n startActivity(myWebLink);\n } else if (id == R.id.nav_help) {\n Intent myWebLink1 = new Intent();\n myWebLink1.setData(Uri\n .parse(\"https://play.google.com/store/apps/details?id=com.bvl.weatherapp&hl=vi\"));\n startActivity(myWebLink1);\n\n } else if (id == R.id.nav_settings) {\n Intent setting = new Intent(getBaseContext(), SettingsActivity.class);\n startActivity(setting);\n\n } else if (id == R.id.nav_about) {\n Intent about = new Intent(getBaseContext(), AboutActivity.class);\n startActivity(about);\n\n } else if (id == R.id.nav_share) {\n Intent shareInten = new Intent();\n shareInten.setAction(Intent.ACTION_SEND);\n shareInten.putExtra(Intent.EXTRA_TEXT, \"Hey, download this app!\");\n shareInten.setType(\"text/plain\");\n startActivity(shareInten);\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (drawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (drawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n System.out.println(\"id = \" + id);\n\n if (id == 16908332) {\n mNavigationDrawerFragment.openDrawer();\n return true;\n }\n\n\n return super.onOptionsItemSelected(item);\n }", "public void doDrawerStuff() {\n Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);\n setSupportActionBar(myToolbar);\n\n mPlanetTitles = getResources().getStringArray(R.array.planets_array);\n mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);\n\n\n mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,myToolbar, R.string.drawer_open, R.string.drawer_close) {\n\n /** Called when a drawer has settled in a completely closed state. */\n public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n // getSupportActionBar().setTitle(mTitle);\n\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }\n\n /** Called when a drawer has settled in a completely open state. */\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n // getSupportActionBar().setTitle(mDrawerTitle);\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }\n };\n\n // Set the drawer toggle as the DrawerListener\n mDrawerLayout.setDrawerListener(mDrawerToggle);\n\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setHomeButtonEnabled(true);\n\n\n\n mDrawerList = (ListView) findViewById(R.id.left_drawer);\n\n // Set the adapter for the list view\n mDrawerList.setAdapter(new ArrayAdapter<String>(this,\n R.layout.drawer_list_item, mPlanetTitles));\n // Set the list's click listener\n mDrawerList.setOnItemClickListener(new DrawerItemClickListener());\n\n\n\n\n\n }", "@Test\n public void clickOnAndroidHomeIcon_OpensNavigation() {\n onView(withId(R.id.drawer_layout))\n .check(matches(isClosed(Gravity.LEFT))); // Left Drawer should be closed.\n\n // Open Drawer\n String navigateUpDesc = mActivityTestRule.getActivity()\n .getString(android.support.v7.appcompat.R.string.abc_action_bar_up_description);\n// onView(withContentDescription(navigateUpDesc)).perform(click());\n onView(withId(R.id.drawer_layout)).perform(open());\n // Check if drawer is open\n onView(withId(R.id.drawer_layout))\n .check(matches(isOpen(Gravity.LEFT))); // Left drawer is open open.\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_about) {\n startActivity(new Intent(HomeActivity.this, AboutActivity.class));\n // toolbar.setTitle(\"ABOUT US\");\n // Handle the camera action\n }\n else if (id == R.id.nav_magazines) {\n // Toast.makeText(this,\"Downloaded==\",Toast.LENGTH_LONG).show();\n //getSupportActionBar().setDisplayUseLogoEnabled(true);\n // toolbar.setLogo(R.drawable.nav_icon_logo);\n state=0;\n callDatabaseInitial();\n toolbar.setTitle(\"Alle utgivelser\");\n\n\n }\n\n\n else if (id == R.id.nav_downloaded_magazines) {\n // getSupportActionBar().setDisplayUseLogoEnabled(false);\n // Toast.makeText(this,\"Downloaded==\",Toast.LENGTH_LONG).show();\n\n state=1;\n callDatabaseInitial();\n toolbar.setTitle(\"LASTET NED NYHETER\");\n\n\n } else if (id == R.id.nav_favorite_magazines) {\n // getSupportActionBar().setDisplayUseLogoEnabled(false);\n state=2;\n callDatabaseInitial();\n toolbar.setTitle(\"FAVORITT NYHETER\");\n\n } else if (id == R.id.nav_my_profile) {\n // getSupportActionBar().setDisplayUseLogoEnabled(false);\n // if(isNetworkAvailable(this)) {\n startActivity(new Intent(HomeActivity.this, ChangeProfileActivity.class));\n// }else{\n// Toast.makeText(this,\"No internet connection !\",Toast.LENGTH_SHORT).show();\n// }\n\n } else if (id == R.id.nav_setting) {\n // getSupportActionBar().setDisplayUseLogoEnabled(false);\n openSettingsPage();\n toolbar.setTitle(\"INNSTILLINGER\");\n\n\n }\n// else if (id == R.id.nav_subscribe) {\n// // getSupportActionBar().setDisplayUseLogoEnabled(false);\n// startActivity(new Intent(HomeActivity.this, SubscriptionActivity.class));\n//\n//\n// }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\r\n return true;\r\n }\r\n\r\n switch (item.getItemId()) {\r\n case android.R.id.home:\r\n mDrawerLayout.openDrawer(GravityCompat.START);\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\n //noinspection SimplifiableIfStatement\n if (id == R.id.menu_star) {\n Toast.makeText(this,\"click star!\",Toast.LENGTH_SHORT).show();\n return true;\n } if (id == R.id.menu_search) {\n Toast.makeText(this,\"click search!\",Toast.LENGTH_SHORT).show();\n return true;\n } else if(id == android.R.id.home){\n mDrawerLayout.openDrawer(GravityCompat.START);\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (actionBarDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "public void onDrawerOpened(View drawerView) {\n\t\t\t\t\t invalidateOptionsMenu(); \n\t\t\t\t\t }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n DrawerLayout drawerLayout = findViewById(R.id.drawer_layout);\n\n switch (item.getItemId()) {\n case R.id.action_menu:\n drawerLayout.openDrawer(GravityCompat.START);\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n int id = item.getItemId();\n if (id == R.id.action_settings) {\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onNavigationItemSelected(@NonNull MenuItem item) {\n switch (item.getItemId()) {\n\n case R.id.ic_home: {\n Intent homeIntent = new Intent(ActivityConnect.this, MainActivity.class);\n ActivityConnect.this.startActivity(homeIntent);\n break;\n }\n case R.id.ic_search: {\n Intent searchIntent = new Intent(ActivityConnect.this, ActivitySearch.class);\n ActivityConnect.this.startActivity(searchIntent);\n break;\n }\n case R.id.ic_connect: {\n break;\n }\n case R.id.ic_settings: {\n Intent settingsIntent = new Intent(ActivityConnect.this, ActivitySettings.class);\n ActivityConnect.this.startActivity(settingsIntent);\n break;\n }\n case R.id.ic_help: {\n Intent helpIntent = new Intent(ActivityConnect.this, ActivityHelp.class);\n ActivityConnect.this.startActivity(helpIntent);\n break;\n }\n }\n //close navigation drawer\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n } else if (id == R.id.nav_collect) {\n Intent intent = new Intent(MainActivity.this, SearchActivity.class);\n intent.setAction(Constants.Action.SHOW_COLLECT);\n startActivity(intent);\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "public void onDrawerClosed(View view) {\n \tactivity.getSupportActionBar().setTitle(\"Txootx!\");\n \tactivity.invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n// getActionBar().setTitle(\"WXTJ Student Radio\");\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n\n if (_actionBarDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n\n switch(item.getItemId()) {\n case R.id.item_logout:\n LogOut();\n return true;\n case R.id.item_about:\n showErrorMessage(\"Clicked About\");\n return true;\n case R.id.item_refresh:\n Reload();\n return true;\n case R.id.item_search:\n LaunchSearch();\n return true;\n\n default:\n return super.onOptionsItemSelected(item);\n }\n //}\n // Handle other action bar items...\n //return super.onOptionsItemSelected(item);\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\n\t\t\t\tMainActivity.openDrawer();\n\t\t\t\t\n\t\t\t}", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if(id == R.id.nav_hot){\n\n }else if(id == R.id.nav_special){\n\n }else if(id == R.id.nav_preference){\n\n }else if(id == R.id.nav_findGame){\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n\n //noinspection SimplifiableIfStatement\n case android.R.id.home:\n drawerLayout.openDrawer(GravityCompat.START);\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "private void MenuHOOKS() {\n drawerLayout = findViewById(R.id.drawer_layout);\n navigationView = findViewById(R.id.navigation_view);\n burger_icon = findViewById(R.id.burger_icon);\n contentView = findViewById(R.id.content);\n\n //Navigation Drawer\n navigationView.bringToFront();\n navigationView.setNavigationItemSelectedListener(this);\n navigationView.setCheckedItem(R.id.nav_home);\n\n burger_icon.setOnClickListener(this);\n\n //Animation Function\n animateNavigationDrawer();\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n mDrawer.openDrawer(GravityCompat.START);\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 mDrawer.openDrawer(GravityCompat.START);\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n //getActionBar().setTitle(mDrawerTitle);\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n //getActionBar().setTitle(mDrawerTitle);\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "private void setupDrawer(){\n\n drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawerOpen,\n R.string.drawerClose){\n\n public void onDrawerOpened(View drawerView){\n\n super.onDrawerOpened(drawerView);\n getSupportActionBar().setTitle(R.string.app_name);\n invalidateOptionsMenu();\n }\n\n public void onDrawerClosed(View view){\n\n super.onDrawerClosed(view);\n getSupportActionBar().setTitle(activityTitle);\n invalidateOptionsMenu();\n }\n };\n drawerToggle.setDrawerIndicatorEnabled(true);\n drawerLayout.setDrawerListener(drawerToggle);\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 // Activate the navigation drawer toggle\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "public void onDrawerOpened(View drawerView) {\n\t\t\t\tLog.d(TAG, \"nav drawer opened state\");\n\t\t\t\tgetActionBar().setTitle(drawerTitle);\n\t\t\t\tinvalidateOptionsMenu();// goes to onPrepareOptionsMenu()\n\t\t\t}", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\r\n return true;\r\n }\r\n // Handle your other action bar items...\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n menuItem.setChecked(true);\n int id = menuItem.getItemId();\n // close drawer when item is tapped\n //INTENT YÖNLENDİRME YAPILIYOR....\n switch (id) {\n case R.id.navigation_item_1:\n Intent intent = new Intent(NewYaziEkle.this, ForAlarm.class);\n startActivity(intent);\n break;\n case R.id.navigation_item_2:\n intent = new Intent(NewYaziEkle.this, ForGps.class);\n startActivity(intent);\n break;\n case R.id.navigation_item_3:\n intent = new Intent(NewYaziEkle.this, ForPaylasim.class);\n startActivity(intent);\n break;\n case R.id.navigation_item_4:\n intent = new Intent(NewYaziEkle.this, Repository.class);\n startActivity(intent);\n break;\n case R.id.navigation_item_5:\n intent = new Intent(NewYaziEkle.this, Forsquare.class);\n\n startActivity(intent);\n break;\n case R.id.navigation_item_6:\n intent = new Intent(NewYaziEkle.this, ForWeather.class);\n startActivity(intent);\n break;\n }\n mDrawerLayout.closeDrawers();\n // Add code here to update the UI based on the item selected. For example, swap UI fragments here\n return true;\n }", "@Override\n public void onHomeButtonClick() {\n drawerLayout.openDrawer(Gravity.LEFT);\n\n }", "@Override\n public void onClick(View v) {\n mDrawerLayout.openDrawer(navrl);\n\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n mDrawer.openDrawer(GravityCompat.START);\n return true;\n case R.id.help:\n FragmentManager fragmentManager = getSupportFragmentManager();\n fragmentManager.beginTransaction().replace(R.id.flContent, new SettingsFragment()).commit();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "private void setupDrawer(){\n drawerToggle = new ActionBarDrawerToggle(\n this,\n drawerLayout,\n R.string.drawer_open,\n R.string.drawer_close) {\n\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }\n\n public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n getSupportActionBar().setTitle(appTitle);\n invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }\n };\n drawerToggle.setDrawerIndicatorEnabled(true);\n drawerLayout.addDrawerListener(drawerToggle);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n // Handle your other action bar items...\n\n return super.onOptionsItemSelected(item);\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.order_icon) {\n Intent intent = new Intent();\n intent.setClass(MainActivity.this,MainActivity.class );\n\n startActivity(intent);\n } else if (id == R.id.search_icon) {\n Intent intent = new Intent();\n intent.setClass(MainActivity.this,SearchActivity.class );\n\n startActivity(intent);\n } else if (id == R.id.personal_icon) {\n Intent intent = new Intent();\n intent.setClass(MainActivity.this,PersonInfoActivity.class );\n\n startActivity(intent);\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n// getActionBar().setTitle(mTitle);\n }", "public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n// getActionBar().setTitle(mTitle);\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_notes) {\n\n } else if (id == R.id.nav_todo) {\n\n Intent intent = new Intent(MainActivity.this, TodoActivity.class);\n\n startActivity(intent);\n\n\n\n } else if (id == R.id.nav_reminders) {\n Intent intent = new Intent(MainActivity.this, ReminderActivity.class);\n\n startActivity(intent);\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "public void onDrawerOpened(View drawerView) {\n\t\t\t\tsuper.onDrawerOpened(drawerView);\n\t\t\t\tgetSupportActionBar().setTitle(\"Munchies\");\n\t\t\t\tinvalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n\t\t\t}", "@Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.nav_camera) {\n // Handle the camera action\n } else if (id == R.id.nav_gallery) {\n\n } else if (id == R.id.nav_slideshow) {\n\n } else if (id == R.id.nav_manage) {\n\n } else if (id == R.id.nav_share) {\n\n } else if (id == R.id.nav_send) {\n\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onNavigationItemSelected(@NonNull MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n\n case R.id.nav_home:\n break;\n\n case R.id.nav_favourites:\n\n if (User.getInstance().getUser() == null) {\n Intent intent = new Intent(getApplicationContext(), LoginActivity.class);\n startActivity(intent);\n }\n\n Intent intent = new Intent(getApplicationContext(), PlaceItemListActivity.class);\n startActivity(intent);\n\n break;\n }\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@SuppressWarnings(\"StatementWithEmptyBody\")\n @Override\n public boolean onNavigationItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == R.id.offline) {\n Intent intent = new Intent(MainActivity.this, OfflineNews.class);\n startActivity(intent);\n }\n\n DrawerLayout drawer = findViewById(R.id.drawer_layout);\n drawer.closeDrawer(GravityCompat.START);\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n //when home icon is clicked\n if(id == R.id.home) {\n mDrawer.openDrawer(GravityCompat.START);\n return true;\n }\n\n //When Settings Menu is clicked\n if (id == R.id.action_settings) {\n startActivity(new Intent(this,SettingsActivity.class));\n return true;\n }\n\n if (id == R.id.share_app) {\n Intent sendIntent = new Intent();\n sendIntent.setAction(Intent.ACTION_SEND);\n sendIntent.putExtra(Intent.EXTRA_TEXT, \"Check out Nearest Places App for your smartphone. Download it today from -----link-----\");\n sendIntent.setType(\"text/plain\");\n startActivity(sendIntent);\n }\n return super.onOptionsItemSelected(item);\n }" ]
[ "0.71149343", "0.6932773", "0.68455756", "0.6820197", "0.6793385", "0.6775112", "0.6767155", "0.6742277", "0.67149836", "0.66992515", "0.669826", "0.66963315", "0.6685156", "0.6683178", "0.66573554", "0.66502845", "0.66501546", "0.66462004", "0.66326565", "0.6604643", "0.659865", "0.65799576", "0.65450305", "0.65444183", "0.6539203", "0.6538563", "0.6536514", "0.6514822", "0.6513119", "0.65099573", "0.65075207", "0.65055096", "0.6487119", "0.64780676", "0.6475931", "0.6468171", "0.64654416", "0.6465354", "0.6464212", "0.64502823", "0.64499485", "0.64499485", "0.64415085", "0.6436453", "0.64292514", "0.6424868", "0.64181924", "0.6418092", "0.6417357", "0.64153296", "0.64153296", "0.640845", "0.64010835", "0.639582", "0.63880247", "0.63879323", "0.63805604", "0.63779086", "0.63767606", "0.6374489", "0.63649124", "0.634906", "0.6344666", "0.6343962", "0.6342435", "0.6337638", "0.63375103", "0.63310075", "0.6329769", "0.6320772", "0.6320671", "0.6320671", "0.6310322", "0.6310322", "0.630795", "0.63072884", "0.6303393", "0.6303393", "0.62951463", "0.62829983", "0.6277018", "0.6271188", "0.6268613", "0.62590444", "0.62541854", "0.62496996", "0.62496996", "0.62496996", "0.62496996", "0.62496996", "0.62496996", "0.62496996", "0.62488854", "0.62335813", "0.62335813", "0.62334496", "0.62334454", "0.62302566", "0.6228247", "0.6227409", "0.6220484" ]
0.0
-1
/ Called when invalidateOptionsMenu() is triggered
@Override public boolean onPrepareOptionsMenu(Menu menu) { // if nav drawer is opened, hide the action items boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerView); menu.findItem(R.id.action_settings).setVisible(!drawerOpen); return super.onPrepareOptionsMenu(menu); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void onDrawerOpened(View drawerView) {\n\t\t\t\t\t invalidateOptionsMenu(); \n\t\t\t\t\t }", "@Override\r\n public void onPageSelected(int position) {\n invalidateOptionsMenu();\r\n }", "public void onSearchStarted() {\n mActivity.invalidateOptionsMenu();\n }", "public void onDrawerOpened(View drawerView) {\n invalidateOptionsMenu();\n }", "public void onDrawerClosed(View view) {\n\t\t\t\t\t invalidateOptionsMenu(); \n\t\t\t\t\t }", "public static void invalidateOptionsMenu(Activity act)\n {\n try {\n itsInvalidateOptionsMenuMeth.invoke(act);\n }\n catch (Exception e) {\n PasswdSafeUtil.showFatalMsg(e, act);\n }\n }", "public void onDrawerClosed(View view) {\n invalidateOptionsMenu();\n }", "@Override\n public void onPageSelected(int position) {\n invalidateOptionsMenu();\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu){\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.order_list_actions,menu);\n if(isFinalized){\n MenuItem item = menu.findItem(R.id.action_finalized);\n item.setVisible(false);\n //this.invalidateOptionsMenu();\n }\n return super.onCreateOptionsMenu(menu);\n }", "public void onDrawerOpened(View drawerView) {\n supportInvalidateOptionsMenu();\n }", "@Override\n public boolean onPrepareOptionsMenu (Menu menu) {\n \n return super.onPrepareOptionsMenu (menu);\n \n }", "@Override\n public boolean onPrepareOptionsMenu(android.view.Menu menu) {\n\n return super.onPrepareOptionsMenu(menu);\n }", "@Override\n public void onDrawerClosed(View drawerView) {\n invalidateOptionsMenu();\n Log.d(\"Apps Main\", \"Close drawer \");\n }", "@Override\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\t}", "@Override\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\t\tsuper.onCreateOptionsMenu(menu, inflater);\n\t\t//menu.clear();\n\t\tinflater.inflate(R.menu.soon_to_be, menu);\n\t\t//getActivity().getActionBar().show();\n\t\t//getActivity().getActionBar().setBackgroundDrawable(\n\t\t\t\t//new ColorDrawable(Color.rgb(223, 160, 23)));\n\t\t//return true;\n\t}", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n super.onCreateOptionsMenu(menu, inflater);\n //return true;\n }", "@Override\n public boolean onPrepareOptionsMenu(Menu menu) {\n\treturn super.onPrepareOptionsMenu(menu);\n\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.main, menu);\n invalidateOptionsMenu();\n return true;\n }", "@Override\n public boolean onPrepareOptionsMenu(Menu menu) {\n return super.onPrepareOptionsMenu(menu);\n }", "@Override\n public boolean onPrepareOptionsMenu(Menu menu) {\n return super.onPrepareOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n menu.add(0, 0, 0, \"Refresh\");\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.menu_main, menu);\n MenuItem item = menu.findItem(R.id.refresh);\n item.setVisible(false);\n this.invalidateOptionsMenu();\n return true;\n }", "@Override\n public boolean onPrepareOptionsMenu(Menu menu) {\n\n return true;\n }", "@Override\n public boolean onPrepareOptionsMenu(Menu menu) {\n menu.removeItem(R.id.action_settings);\n return super.onPrepareOptionsMenu(menu);\n }", "@Override\r\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\t\tsuper.onCreateOptionsMenu(menu, inflater);\r\n\t\tmenu.clear();\r\n\t\tinflater.inflate(R.menu.browsecourse, menu);\r\n\t}", "protected void refreshActionBar() {\n if (mActionBarController != null) {\n mActionBarController.refresh();\n }\n mActivity.invalidateOptionsMenu();\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu){\n super.onCreateOptionsMenu(menu);\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(toolbar_res, menu);\n updateMenuItemsVisibility(menu);\n return true;\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n super.onCreateOptionsMenu(menu, inflater);\n\n }", "@Override\n public boolean onPrepareOptionsMenu(Menu menu) {\n \tgetMenuInflater().inflate(R.menu.optionsbar, menu);\n \treturn super.onPrepareOptionsMenu(menu);\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n super.onCreateOptionsMenu(menu, inflater);\n }", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\r\n\t\treturn super.onCreateOptionsMenu(menu);\r\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return super.onCreateOptionsMenu(menu);\n }", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\r\n }", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\r\n }", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\r\n }", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\r\n }", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\r\n }", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\r\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n invalidateOptionsMenu();\n }", "@Override\n\tpublic void onCreateOptionsMenu( Menu menu, MenuInflater inflater )\n\t{\n\t\tsuper.onCreateOptionsMenu( menu, inflater );\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.reset, menu);\n\t\treturn true;\n\t}", "@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(android.view.Menu menu) {\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\n\r\n return true;\r\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n if (!fragmentNavigationDrawer.isDrawerOpen())\n restoreActionBar();\n return true;\n// return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\t\n\t\t \n return true;\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n \n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n \n return true;\n }", "@Override\n\tpublic boolean onPrepareOptionsMenu(Menu menu) {\n\t\treturn super.onPrepareOptionsMenu(menu);\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n \tpublic boolean onCreateOptionsMenu(Menu menu) {\n \t\treturn true;\n \t}", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\n menu.findItem(R.id.action_switch_provider).setVisible(true);\n menu.findItem(R.id.action_save_scheme).setVisible(false);\n super.onCreateOptionsMenu(menu, inflater);\n\n //return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu)\n {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n super.onCreateOptionsMenu(menu);\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n super.onCreateOptionsMenu(menu);\n return true;\n }", "@Override\n public boolean onPrepareOptionsMenu(Menu menu) {\n Timer timing = new Timer();\n timing.schedule(new TimerTask() {\n\n @Override\n public void run() {\n closeOptionsMenu();\n }\n }, 5000);\n return super.onPrepareOptionsMenu(menu);\n }", "@Override\npublic boolean onCreateOptionsMenu(Menu menu) \n{\n\tgetMenuInflater().inflate(R.menu.update_entry, menu);\n\treturn true;\n}", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n menu.clear();\n inflater.inflate(R.menu.menu_chat_list, menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return false;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return false;\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\tsuper.onCreateOptionsMenu(menu, inflater);\n\tinflater.inflate(R.menu.menu_main, menu);\n\tmenu.findItem(R.id.action_edit).setVisible(false);\n\tmenu.findItem(R.id.action_share).setVisible(false);\n\tmenu.findItem(R.id.action_settings).setVisible(true);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n super.onCreateOptionsMenu(menu);\n\n // MyApp myApp = MyApp.getInstance();\n\n MenuItem item = menu.findItem(R.id.action_matches);\n item.setVisible(false);\n\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n //getMenuInflater().inflate(R.menu.activity_main, menu);\n \tsuper.onCreateOptionsMenu(menu);\n getSupportMenuInflater().inflate(R.menu.actionbar, menu);\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n BatteryIcon = (MenuItem)menu.findItem(R.id.acb_battery);\n setActBarBatteryIcon(Callbacksplit.getsavedBatteryStateIcon());\n ConnectIcon = (MenuItem)menu.findItem(R.id.acb_connect);\n setActBarConnectIcon();\n \n ((MenuItem)menu.findItem(R.id.acb_m_5)).setVisible(false);\n\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n super.onCreateOptionsMenu(menu);\n\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n return true;\n }" ]
[ "0.73958796", "0.7307511", "0.72879606", "0.7284202", "0.72531104", "0.7167428", "0.7144019", "0.713819", "0.71283853", "0.7013687", "0.700654", "0.69704795", "0.69638264", "0.69468755", "0.6913638", "0.6904814", "0.6868166", "0.68448764", "0.6842651", "0.6842651", "0.68349206", "0.6820231", "0.6817213", "0.68126076", "0.6792232", "0.67618346", "0.6734443", "0.6729964", "0.6723818", "0.671477", "0.66941464", "0.66923606", "0.6691065", "0.6691065", "0.6691065", "0.6691065", "0.6691065", "0.6687162", "0.6687162", "0.6687162", "0.6687162", "0.6687162", "0.6687162", "0.66801864", "0.6671412", "0.66677815", "0.66668355", "0.66644907", "0.6663461", "0.66613644", "0.6658936", "0.66586095", "0.66584396", "0.66584396", "0.66565734", "0.6654596", "0.6649975", "0.66482604", "0.66480964", "0.6630848", "0.6630848", "0.6626908", "0.6625891", "0.6616315", "0.65997785", "0.65997785", "0.6593403", "0.6591916", "0.6588188", "0.65851957", "0.6581219", "0.6576677", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151", "0.6567151" ]
0.0
-1
update the main content by replacing fragments
private void displayView(int position) { Fragment fragment = null; Bundle bundle=new Bundle(); switch (position) { case 0: fragment = new Profile(); break; case 1: fragment = new SearchProjects(); break; case 2: fragment = new MyProjects(); break; case 3: break; default: break; } if (fragment != null) { FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.frame_container, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); mDrawerList.setSelection(position); setTitle(navMenuTitles[position]); mDrawerLayout.closeDrawer(mDrawerView); } else { // error in creating fragment Log.e("MainActivity", "Error in creating fragment"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void refresh(){\n // close loading dialogs if they are open\n Fragment dialog = getSupportFragmentManager().findFragmentByTag(\"loading\");\n if (dialog != null) {\n loadingDialog.dismiss();\n }\n\n // update timestamp\n if (timestamp != null) {\n TextView time = findViewById(R.id.result_time_text);\n time.setText(getString(R.string.last_result, timestamp));\n }\n\n // destroy and recreate fragments with latest data\n Fragment loadedFragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);\n Fragment newFragment;\n FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\n\n if (loadedFragment instanceof PsiFragment) {\n newFragment = PsiFragment.newInstance(psiValues);\n }\n else if (loadedFragment instanceof Pm25Fragment) {\n newFragment = Pm25Fragment.newInstance(pm25Values);\n }\n else{\n newFragment = HomeFragment.newInstance(psiValues,pm25Values);\n }\n transaction.replace(R.id.fragment_container, newFragment);\n transaction.commit();\n }", "private void reDoFragments() {\n pageAdapter.notifyChangeInPosition(pageAdapter.getCount());\n\n fragments.clear();\n\n int i = 1;\n for (Article a : articles) {\n String count = String.format(\"%d of %d\", i++, articles.size());\n fragments.add(NewsFragment.newInstance(a.getTitle(), a.getAuthor(), a.getDescription(), a.getUrlToImage(), a.getTime(), count, a.getUrl()));\n }\n\n pageAdapter.notifyDataSetChanged();\n pager.setCurrentItem(0);\n }", "private void refreshFragmentAfterdownloadedData() {\n Fragment fragmentToday = new FragmentToday();\n FragmentTransaction ft = getSupportFragmentManager().beginTransaction();\n ft.replace(R.id.fragmentToday, fragmentToday, \"FragmentToday\");\n ft.commit();\n\n Fragment fragment5days = new Fragment5days();\n FragmentTransaction ft5days = getSupportFragmentManager().beginTransaction();\n ft5days.replace(R.id.fragment5days, fragment5days, \"Fragment5days\");\n ft5days.commit();\n }", "public void run() {\n assert getFragmentManager() != null;\n Fragment currentFragment = getActivity().getSupportFragmentManager().findFragmentById(R.id.content_main);\n FragmentTransaction ft = getFragmentManager().beginTransaction();\n if (Build.VERSION.SDK_INT >= 26) {\n ft.setReorderingAllowed(false);\n }\n ft.detach(currentFragment).attach(currentFragment).commit();\n }", "@Override\n public void refreshFragment() {\n }", "void doRefreshContent();", "public void updateContent() {\n\t\t\n\t\tupdateResidencias();\n\t\tupdateUniversidades();\n\t\t\n\t}", "boolean updateContent();", "private void refreshContent() {\n\n mSwipeRefreshLayout.setRefreshing(false);\n }", "@AfterViews\n void syncViews() {\n\n setSupportActionBar(mToolbar);\n\n if (mFragmentNumber == REPOS_FRAGMENT_NUMBER) {\n currentFragment = RepoDataFragment_.instantiate(this, RepoDataFragment_.class.getName());\n }\n\n changeFrament(currentFragment);\n\n //mBottomBar = BottomBar.attachShy(mMainCoordinator, mNestedScrollView, getIntent().getExtras());\n\n mBottomBar = BottomBar.attach(this, getIntent().getExtras());\n\n mBottomBar.setItemsFromMenu(R.menu.main_bottom_menu, this);\n }", "private void updateFragment() {\n Fragment fragment = getSupportFragmentManager().findFragmentByTag(CURRENT_FRAGMENT);\n if (fragment != null) {\n FragmentTransaction ft = getSupportFragmentManager().beginTransaction();\n ft.detach(fragment).attach(fragment).commit();\n }\n }", "private void addFragments() {\n\n Fragment f = SideFilterFragment.newInstance();\n getFragmentManager().beginTransaction().replace(R.id.side_filter_container, f).commit();\n }", "public void updateFragment(int CAT_ID){\n ViewContentFragment f_c_s=new ViewContentFragment();\n if(CAT_ID>0){\n f_c_s.setCat_id(CAT_ID);\n }else{\n f_c_s.setCat_id(1);\n }\n // replace the fragment with the new fragment and add it to BackStack,\n // then pop it from BackStack to get to the old fragment without overlapping the\n // old fragments...\n\n getFragmentManager().beginTransaction().replace(R.id.content_Layout,f_c_s).\n addToBackStack(String.valueOf(CAT_ID)).commit();\n getFragmentManager().popBackStack();\n }", "private void replaceFragment(int pos) {\n Fragment fragment = null;\n switch (pos) {\n case 0:\n //mis tarjetas\n fragment = new CardsActivity();\n break;\n case 1:\n //buscador online\n fragment = new CardsActivityOnline();\n break;\n case 2:\n //active camera\n Intent it = new Intent(this, com.google.zxing.client.android.CaptureActivity.class);\n startActivityForResult(it, 0);\n break;\n case 3:\n ParseUser.getCurrentUser().logOut();\n finish();\n onBackPressed();\n break;\n default:\n //fragment = new CardsActivity();\n break;\n }\n\n if(null!=fragment) {\n FragmentManager fragmentManager = getSupportFragmentManager();\n FragmentTransaction transaction = fragmentManager.beginTransaction();\n transaction.replace(R.id.main_content, fragment);\n transaction.addToBackStack(null);\n transaction.commit();\n }\n }", "protected void switchContent(Fragment to) {\n if (mFragment != to) {\n FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\n transaction.replace(R.id.activity_my_movie_content,to).commitAllowingStateLoss();\n mFragment = to;\n }\n }", "private void fillUpFragment() {\n try {\n FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\n sensorFragment = getSensorFragment();\n transaction.replace(R.id.sensor_frame, sensorFragment, getSensorName());\n transaction.commit();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public abstract void updateFragmentUI();", "@Override\n public void onEstadoCambiado() {\n fragment = new ListadoPeticionesRecibidasVista();\n getFragmentManager().beginTransaction().replace(R.id.content_main, fragment ).commit();\n\n }", "@Override\n public void onResultViewFinished() {\n MainFragment mainFragment = new MainFragment();\n\n createTransactionAndReplaceFragment(mainFragment, getString(R.string.frg_tag_main));\n }", "private void fragmentChange(){\n HCFragment newFragment = new HCFragment();\n FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\n\n // Replace whatever is in the fragment_container view with this fragment,\n // and add the transaction to the back stack if needed\n transaction.replace(R.id.hc_layout, newFragment);\n transaction.addToBackStack(null);\n\n // Commit the transaction\n transaction.commit();\n }", "private void recreate_fragments(){\n GoogleMapsUtils google_maps_utils = new GoogleMapsUtils(getApplicationContext(), this, mToolbar_navig_utils);\n google_maps_utils.getLocationPermission();\n\n if(getPageAdapter()!=null)\n getPageAdapter().getMapsFragment().getMapView().removeAllViews();\n\n // Launch progressBar\n if(mProgressBar!=null) {\n runOnUiThread(() -> mProgressBar.setVisibility(View.VISIBLE));\n }\n }", "public void update(int index) {\n\n for (int i=0; i<tabs.length; i++) {\n if (i == index) {\n int img = getResources().getIdentifier(\"bt_menu_bottom_\" + (i+1) +\"_on\", \"drawable\", getPackageName());\n tabs[i].setTextColor(Color.parseColor(\"#5b5b5f\"));\n tabs[i].setCompoundDrawablesWithIntrinsicBounds(0, img, 0, 0);\n tabs[i].setBackgroundColor(Color.parseColor(\"#edeef0\"));\n } else {\n int img = getResources().getIdentifier(\"bt_menu_bottom_\" + (i+1) +\"_off\", \"drawable\", getPackageName());\n tabs[i].setTextColor(Color.parseColor(\"#FFFFFF\"));\n tabs[i].setCompoundDrawablesWithIntrinsicBounds(0, img, 0, 0);\n tabs[i].setBackgroundColor(Color.parseColor(\"#cd506c\"));\n }\n }\n\n FragmentManager manager = getSupportFragmentManager();\n SectionFragment section;\n if (index == 0) {\n section = PromoFragment.newInstance(HomeActivity.this);\n } else if (index == 1) {\n section = StoreFragment.newInstance(HomeActivity.this);\n } else if (index == 2) {\n section = ActivityFragment.newInstance(HomeActivity.this);\n } else {\n section = ProfileFragment.newInstance(HomeActivity.this);\n }\n\n FragmentTransaction transition = manager.beginTransaction();\n //transition.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);\n transition.replace(R.id.fl_tabs, section).commit();\n\n }", "private void changeFragment() {\n TeacherAddNotificationFragment fragment = new TeacherAddNotificationFragment();\n // Put classIds to bundle and set bundle to fragment\n Bundle bundle = new Bundle();\n bundle.putString(\"ListIDs\", classesIds);\n fragment.setArguments(bundle);\n\n // Replace fragment\n getFragmentManager().beginTransaction().replace(R.id.main, fragment)\n .addToBackStack(null)\n .commit();\n }", "public void updateDisplay() {\n\t\t\n\t\tif (!this.isAdded()) return;\n\t\t\n\t\tthis.layout.removeAllViews();\n\t\t\n\t\t/* Set the background parameters. */\n\t\tthis.layout.setBackgroundColor(this.appearance.getBackColour());\n\t\tif(this.appearance.getBackImage() != null)\n\t\t\tthis.layout.setBackground(this.appearance.getBackImage());\n\t\t\n\t\tif (url != null) {\n\t\t\tthis.webView.loadUrl(url);\n\t\t} else {\n\t\t\tthis.webView.loadData(html, \"text/html; charset=utf-8\", null);\n\n\t\t}\t\t\n\t\t\n\t\tthis.layout.addView(webView);\n\t\tthis.getActivity().setTitle(title);\n\t\t\t\t\n\t}", "@Override\r\n public void changeFragment() {\r\n fm.beginTransaction()\r\n .replace(R.id.fragmentContainer, new ListWonderFragment())\r\n .commit();\r\n }", "private void replaceFragment(int pos) {\n Fragment fragment = null;\n switch (pos) {\n case 0:\n Intent intent = new Intent(GestioneViaggioGalleriaActivity.this, MainActivity.class);\n startActivity(intent);\n break;\n case 1:\n Intent intent_creaViaggio = new Intent(GestioneViaggioGalleriaActivity.this, CreaIlTuoViaggioActivity.class);\n startActivity(intent_creaViaggio);\n break;\n case 2:\n Intent intent_viaggi = new Intent(GestioneViaggioGalleriaActivity.this, ProfiloViaggiActivity.class);\n intent_viaggi.putExtra(\"viaggio\", \"viaggio\");\n startActivity(intent_viaggi);\n break;\n case 3:\n Intent intent_preferiti = new Intent(GestioneViaggioGalleriaActivity.this, ProfiloViaggiActivity.class);\n intent_preferiti.putExtra(\"preferiti\", \"preferiti\");\n startActivity(intent_preferiti);\n break;\n case 4:\n Intent intent_impostazioni = new Intent(GestioneViaggioGalleriaActivity.this, SettingsActivity.class);\n startActivity(intent_impostazioni);\n break;\n case 5: new android.support.v7.app.AlertDialog.Builder(GestioneViaggioGalleriaActivity.this)\n .setTitle(\"Let's go\")\n .setMessage(\"Questa applicazione è stata creata da: \" +\n \"Alessandro Barlocco, Annalisa Bovone, Paola Silvestre\")\n .setPositiveButton(\"ok\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n dialog.dismiss();\n }\n })\n .setIcon(R.drawable.logo_pani_piccolo)\n .show();\n break;\n default:\n break;\n }\n\n if (fragment != null) {\n FragmentManager fragmentManager = getSupportFragmentManager();\n FragmentTransaction transaction = fragmentManager.beginTransaction();\n transaction.replace(R.id.activity_main, fragment);\n transaction.commit();\n }\n }", "public void updateContent(){\r\n\t\tthis.initRecords();\r\n\t\tlist.show(records);\r\n\t}", "@Override\n public void onComplete(@NonNull Task<Void> task) {\n ((MainActivity) getActivity()).replaceFragmentsAndReset(new AppointmentListFragment());\n }", "private void loadFragment(Fragment fragment) {\n FragmentManager fragmentManager = getSupportFragmentManager();\n FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();\n fragmentTransaction.replace(com.limkee1.R.id.flContent, fragment);\n fragmentTransaction.commit();\n\n }", "public void goMainStampCard() {\n FragmentManager fragmentManager = getSupportFragmentManager();\n FragmentTransaction fragmentTransaction = fragmentManager\n .beginTransaction();\n fragmentTransaction.setCustomAnimations(R.anim.abc_fade_in,\n R.anim.abc_fade_out);\n fragmentTransaction.addToBackStack(null);\n FragmentMainStampCard fragmentMain = FragmentMainStampCard\n .newInstances();\n fragmentTransaction.replace(R.id.container, fragmentMain);\n fragmentTransaction.commit();\n }", "private void loadFragment(String name) {\n FragmentTransaction fragmentTransaction = MainActivity.fm.beginTransaction();\n // replace the FrameLayout with the new Fragment\n fragmentTransaction.replace(R.id.mainFrameLayout, MainActivity.currentFragment);\n fragmentTransaction.addToBackStack(name);\n fragmentTransaction.commit();\n }", "private void setFragment(Fragment fragments) {\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.replace(R.id.framelayout,fragments);\n fragmentTransaction.commit();\n }", "private ScreenShotable replaceFragment(ScreenShotable screenShotable, String name) {\n switch (name) {\n case ContentFragment.GAMES:\n logger.logEvent(\"Games Menu\");\n Log.v(LOG_TAG, \"Games Menu\");\n getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, GamesFragment.newInstance()).setCustomAnimations(R.anim.abc_slide_in_bottom, R.anim.abc_slide_out_bottom).addToBackStack(\"Games\").commit();\n getSupportActionBar().setTitle(\"Games\");\n break;\n case ContentFragment.GROUPS:\n logger.logEvent(\"Groups Menu\");\n Log.v(LOG_TAG, \"Groups Menu\");\n getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, GroupsFragment.newInstance()).setCustomAnimations(R.anim.abc_slide_in_bottom, R.anim.abc_slide_out_bottom).commit();\n getSupportActionBar().setTitle(\"Groups\");\n break;\n case ContentFragment.FRIENDS:\n logger.logEvent(\"Friends Menu\");\n Log.v(LOG_TAG, \"Friends Menu\");\n getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, FriendStatus.newInstance()).setCustomAnimations(R.anim.abc_slide_in_bottom, R.anim.abc_slide_out_bottom).commit();\n getSupportActionBar().setTitle(\"Friends\");\n break;\n case ContentFragment.SETTINGS:\n logger.logEvent(\"Settings Menu\");\n Log.v(LOG_TAG, \"Settings Menu\");\n getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, SettingsFragment.newInstance()).setCustomAnimations(R.anim.abc_slide_in_bottom, R.anim.abc_slide_out_bottom).commit();\n getSupportActionBar().setTitle(\"Settings\");\n break;\n }\n return contentFragment;\n }", "public void replaceFragment(int id_content, Fragment fragment) {\r\n FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\r\n transaction.replace(id_content, fragment);\r\n transaction.commit();\r\n }", "@Override\n public void run() {\n Fragment fragment = getHomeFragment();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,\n android.R.anim.fade_out);\n fragmentTransaction.replace(R.id.frame, fragment, CURRENT_TAG);\n fragmentTransaction.commitAllowingStateLoss();\n }", "@Override\n public void run() {\n Fragment fragment = getHomeFragment();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,\n android.R.anim.fade_out);\n fragmentTransaction.replace(R.id.frame, fragment, CURRENT_TAG);\n fragmentTransaction.commitAllowingStateLoss();\n }", "@Override\n public void run() {\n Fragment fragment = getHomeFragment();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,\n android.R.anim.fade_out);\n fragmentTransaction.replace(R.id.frame, fragment, CURRENT_TAG);\n fragmentTransaction.commitAllowingStateLoss();\n }", "@Override\n public void run() {\n Fragment fragment = getHomeFragment();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,\n android.R.anim.fade_out);\n fragmentTransaction.replace(R.id.frame, fragment, CURRENT_TAG);\n fragmentTransaction.commitAllowingStateLoss();\n }", "@Override\n public void run() {\n Fragment fragment = getHomeFragment();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,\n android.R.anim.fade_out);\n fragmentTransaction.replace(R.id.frame, fragment, CURRENT_TAG);\n fragmentTransaction.commitAllowingStateLoss();\n }", "@Override\n public void run() {\n Fragment fragment = getHomeFragment();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,\n android.R.anim.fade_out);\n fragmentTransaction.replace(R.id.frame, fragment, CURRENT_TAG);\n fragmentTransaction.commitAllowingStateLoss();\n }", "private void showMainFragments() {\n\t\t// If the fragment is hidden, reveal it. Assume also that the rules fragment is\n\t\t// also hidden and the settings fragment is revealed, so detach that.\n\t\tif (mShuffleFrag.isHidden() || mRulesFrag.isHidden()) {\n\t\t\tFragmentTransaction transaction = getFragmentManager().beginTransaction();\n\t\t\ttransaction.show(mShuffleFrag);\n\t\t\ttransaction.show(mRulesFrag);\n\t\t\ttransaction.remove(getFragmentManager().findFragmentById(android.R.id.content));\n\t\t\ttransaction.commit();\n\t\t}\n\t}", "protected void replaceLoginFragment() {\n\n\n }", "@Override\n public void run() {\n Fragment fragment = getHomeFragment();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out);\n fragmentTransaction.replace(R.id.frame, fragment, CURRENT_TAG);\n fragmentTransaction.commitAllowingStateLoss();\n }", "@Override\r\n public void onRefresh() {\n\r\n refreshContent();\r\n\r\n }", "private void replaceFragment(Fragment fragment) {\n FragmentManager fragmentManager = getSupportFragmentManager();\n android.support.v4.app.FragmentTransaction transaction = fragmentManager.beginTransaction();\n transaction.addToBackStack(null);\n if (fragment == listFragment) {\n transaction.replace(R.id.fragment_content, fragment, LIST_FRAGMENT_TAG);\n } else if (fragment == supportMapFragment) {\n transaction.replace(R.id.fragment_content, fragment, SUPPORT_FRAGMENT_TAG);\n }\n transaction.commit();\n }", "private void toXW() {\n if (fragment_XW == null) {\n fragment_XW = new Fragment_XW();\n fragmenttransaction.add(R.id.frame_content, fragment_XW);\n } else {\n fragmenttransaction.show(fragment_XW);\n }\n }", "@Override\n public void onRefresh() {\n synchronizeContent();\n }", "private void getFragment(Fragment fragment) {\n // create a FragmentManager\n FragmentManager fm = getFragmentManager();\n // create a FragmentTransaction to begin the transaction and replace the Fragment\n FragmentTransaction fragmentTransaction = fm.beginTransaction();\n // replace the FrameLayout with new Fragment\n fragmentTransaction.replace(R.id.fragment_layout, fragment);\n // save the changes\n fragmentTransaction.commit();\n }", "public void replaceFragment1(Fragment destFragment)\n {\n FragmentManager fragmentManager = this.getSupportFragmentManager();\n\n // Begin Fragment transaction.\n FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();\n\n // Replace the layout holder with the required Fragment object.\n fragmentTransaction.replace(R.id.UpcomingFrame, destFragment);\n\n // Commit the Fragment replace action.\n fragmentTransaction.commit();\n }", "@Override\n public void onResume() {\n super.onResume();\n refreshContent();\n }", "public void updateArticleView(ServerObj serverObj){\n View v = getView();\n// String[] data = Ipsum.Articles;\n// article.setText(data[position]);\n// currentPosition = position;\n currentServerObj=serverObj;\n LinearLayout containerOfContents= (LinearLayout) v.findViewById(R.id.container_of_contents);\n containerOfContents.removeAllViews();\n ContentsViewBuilder contentsViewBuilder=new ContentsViewBuilder(activity);\n Log.d(\"myPavilion\",\"serverObj\"+serverObj.getJson());\n View contentsView=contentsViewBuilder.getView(serverObj.getContentsObj());\n containerOfContents.addView(contentsView);\n\n }", "public void refreshFragment() {\n currentUser = ((HomeActivity)getActivity()).getCurrentUser();\n stock = ((HomeActivity)getActivity()).getTransferStock();\n selectAll(ORDER_NAME);\n }", "void updateView();", "void updateView();", "private void setupFragments() {\n FragmentManager fm = getSupportFragmentManager();\n sb_frag = (StatusBar)fm.findFragmentById(R.id.statusmarket);\n\n if(sb_frag == null)\n {\n sb_frag = new StatusBar();\n fm.beginTransaction().add(R.id.statusmarket, sb_frag).commit();\n }\n sb_frag.setupInitial(currentPlayer);\n\n ai_frag = (AreaInfo) fm.findFragmentById(R.id.overviewlayout);\n\n //try find the fragment, if it doesnt exist then create it\n if (ai_frag == null) {\n //create the fragment if not exist\n ai_frag = new AreaInfo();\n fm.beginTransaction().add(R.id.overviewlayout, ai_frag).commit();\n }\n\n ai_frag.setCurrentArea(null);\n\n\n\n\n }", "private void updatePage() {\n\t\ttry {\n\t\t\tList<ParseUser> friendUsers = ParseUser.getQuery()\n\t\t\t\t\t\t\t\t\t\t\t\t\t.fromLocalDatastore()\n\t\t\t\t\t\t\t\t\t\t\t\t\t.whereNotEqualTo(\"facebookId\", currentUser.getString(\"facebookId\"))\n\t\t\t\t\t\t\t\t\t\t\t\t\t.find();\n\t\t\t\n\t\t\tpopulateViews(friendUsers);\n\t\t\n\t\t} catch (ParseException e) {\n\t\t\tLog.e(StealTheCheeseApplication.LOG_TAG, \"Fetch friends from localstore failed with message: \" + e);\n\t\t}\n\t}", "@Override\n public void onClick(View v) {\n\n if (v == thigsfrag1){\n\n thingstodonear = Sessiondata.getInstance().getThingsfrontdatanear();\n thingstodonear.get(0).setCtm(newtrip);\n Sessiondata.getInstance().setSnocreatenewtrip(thingstodonear.get(0).getSno());\n Sessiondata.getInstance().setUpdateresult(0);\n Sessiondata.getInstance().setFtplistval(7);\n\n Fragment fr = new NewUiView_itemInfo_Fragment();\n Bundle bundle = new Bundle();\n bundle.putSerializable(EXTRATRIPINFO, thingstodonear.get(0));\n fr.setArguments(bundle);\n FragmentChangeListener fc = (FragmentChangeListener) getActivity();\n fc.replaceFragment(fr);\n\n }\n\n else if (v == foodsfrag1){\n\n\n foodnear = Sessiondata.getInstance().getFoodfrontdatanear();\n foodnear.get(0).setCtm(newtrip);\n Sessiondata.getInstance().setSnocreatenewtrip(foodnear.get(0).getSno());\n Sessiondata.getInstance().setUpdateresult(0);\n Sessiondata.getInstance().setFtplistval(7);\n\n Fragment fr = new NewUiView_itemInfo_Fragment();\n Bundle bundle = new Bundle();\n bundle.putSerializable(EXTRATRIPINFO, foodnear.get(0));\n fr.setArguments(bundle);\n FragmentChangeListener fc = (FragmentChangeListener) getActivity();\n fc.replaceFragment(fr);\n }\nelse if (v == prayerfirst) {\n\n\n prayernear = Sessiondata.getInstance().getPrayerfrontdatanear();\n prayernear.get(0).setCtm(newtrip);\n Sessiondata.getInstance().setSnocreatenewtrip(prayernear.get(0).getSno());\n Sessiondata.getInstance().setUpdateresult(0);\n Sessiondata.getInstance().setFtplistval(7);\n\n Fragment fr = new NewUiView_itemInfo_Fragment();\n Bundle bundle = new Bundle();\n bundle.putSerializable(EXTRATRIPINFO, prayernear.get(0));\n fr.setArguments(bundle);\n FragmentChangeListener fc = (FragmentChangeListener) getActivity();\n fc.replaceFragment(fr);\n }\n\n\n else if(v == thingstodo){\n\n NearByelementsModel n = (NearByelementsModel) v.getTag();\n CreatedTripModel cc = C.getCtm();\n cc.setCategoryID(\"3\");\n cc.setCategorytype(\"Things to do info\");\n cc.setN(n);\n showguideFragment(cc);\n }\n\n }", "@Override\n public void onViewSelected (int wordPosition) {\n // replace the fragment\n replaceFragment(wordPosition);\n }", "private void replaceScreenWithNavBarContentAndMenu(Fragment header,\n\t\t\tString headerTag, Fragment content, String contentTag,\n\t\t\tFragment footer, String footerTag, FraMenu menu, String menuTag,\n\t\t\tFraSearch search, String searchTag, FraFont font, String fontTag,\n\t\t\tFraShare share, String shareTag, boolean addToBackStack) {\n\t\tfm = getSupportFragmentManager();\n\t\tft = fm.beginTransaction();\n\n\t\tft.replace(R.id.main_container_header, header, headerTag);\n\n\t\tft.replace(R.id.main_container_content, content, contentTag);\n\n\t\tft.replace(R.id.main_container_footer, footer, footerTag);\n\n\t\tft.replace(R.id.main_container_menu, menu, menuTag);\n\n\t\tft.replace(R.id.main_container_search, search, searchTag);\n\n\t\t// ft.replace(R.id.main_container_share, share, shareTag);\n\n\t\t// ft.replace(R.id.main_container_font, font, fontTag);\n\n\t\tif (addToBackStack) {\n\t\t\tft.addToBackStack(String.valueOf(System.identityHashCode(content)));\n\t\t}\n\t\tft.commitAllowingStateLoss();\n\t\tfm.executePendingTransactions();\n\t}", "public void updateContent(String new_content){\n\t\tif(content == null){\n\t\t\tcontent = \"\";\n\t\t}\n\t\tcontent = content.concat(new_content);\n\t\tupdateSize();\t\t\n\t}", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n setTheme(R.style.AppTheme);\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n writedb s=new writedb(this);\n s.wr(path);\n init();\n zhuye zhuye=new zhuye();\n FragmentManager f=getSupportFragmentManager();\n f.beginTransaction().replace(R.id.frame_content,zhuye).commit();\n\n\n }", "private void updateContent() {\n imageLoading.setVisibility(View.VISIBLE);\n content.setText(ContentFactory.pages.get(currentPage).getContent());\n title.setText(ContentFactory.pages.get(currentPage).getTitle());\n\n Picasso picasso = new Picasso.Builder(getApplicationContext()).listener(new Picasso.Listener() {\n\n @Override\n public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {\n if (exception instanceof IOException)\n picasso.load(R.drawable.missingimage).fit().centerCrop().into(image);\n }\n\n }).build();\n\n picasso.load(ContentFactory.pages.get(currentPage).getImageURL()).fit().centerCrop().into(image, new Callback() {\n @Override\n public void onSuccess() {\n imageLoading.setVisibility(View.INVISIBLE);\n }\n\n @Override\n public void onError() {\n imageLoading.setVisibility(View.INVISIBLE);\n }\n });\n\n }", "@SuppressWarnings(\"deprecation\")\n\tprotected void refreshActivityContents() {\n\t\t// Build scrollview, the primary viewgroup\n\t\tScrollView scrollView = new ScrollView(this);\n\t\tFrameLayout.LayoutParams scrollParams = new ScrollView.LayoutParams(\n\t\t\t\tLayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);\n\t\tscrollView.setLayoutParams(scrollParams);\n\t\tscrollView.addView(buildTable());\n\t\tsetContentView(scrollView);\n\t}", "private void resetFragment() {\n\t\tFragment fragment = hMapTabs.get(mSelectedTab).get(0);\n\t\thMapTabs.get(mSelectedTab).clear();\n\t\thMapTabs.get(mSelectedTab).add(fragment);\n\t\tFragmentManager manager = getSupportFragmentManager();\n\t\tFragmentTransaction ft = manager.beginTransaction();\n\t\tft.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out);\n\t\tft.replace(R.id.realtabcontent, fragment);\n\t\tft.commit();\n\n\t\tshouldDisplayHomeUp();\n\n\t}", "public void onClick(View v) {\n\n ProductFragment itemListFragment = ((MainActivity)getActivity()).getItemListFragment();\n itemListFragment.subtractFromTotalWeight(quantity, weight); //subtracting old weight before adding new weight\n itemListFragment.subtractFromTotalPrice(quantity, price); //subtracting old price before adding new price\n\n Integer newQuantity = (Integer.parseInt((String) ((TextView) singleProductDescrView.findViewById(R.id.updatingQuantityDescr)).getText()));\n quantity = newQuantity;\n android.support.v4.app.FragmentManager fm = getFragmentManager();\n FragmentTransaction ft = fm.beginTransaction();\n updateItemInList();\n ft.replace(R.id.container, ((MainActivity)getActivity()).getItemListFragment(), \"List\");\n ft.commit();\n\n\n }", "@Override\n\tprotected void refreshView() {\n\t\t\n\t}", "private void main() {\n // # I DON'T HAVE A MAIN DASHBOARD YET. MACAYLA MIGHT WANT #\n // # TO DESIGN THAT PART. FOR NOW, I HAVE A \"FAUX\" RESULTS #\n // # PAGE SHOWING, JUST SO I CAN GET A LOOK AT HOW THE RESULTS PAGE #\n // # WILL LOOK. #\n // ######################################################################\n\n ResultsFragment fragment = new ResultsFragment();\n String tag = ResultsFragment.class.getCanonicalName();\n getSupportFragmentManager().beginTransaction()\n .replace(R.id.fragment_frame, fragment, tag).commit();\n }", "private void updateCurrentFragment(Fragment newFragment, String tag) {\n FragmentTransaction ft = fm.beginTransaction();\n\n // remove current fragment\n if (currentFragment != null) {\n ft.remove(currentFragment);\n }\n\n // set, add and commit new fragment\n currentFragment = newFragment;\n ft.add(currentFragment, tag).commit();\n }", "public void refreshWeatherDetail()\n {\n FragmentTransaction transaction = mFragmentManager.beginTransaction();\n transaction.replace(R.id.id_activity_main, mSplashFragment, SplashFragment.TAG);\n transaction.commit();\n\n taskMode = Constants.TASK_MODE_REFRESH_WEATHER_DETAIL;\n mWeatherListItemsArray.clear();\n TaskGetOnlineData startingTask = new TaskGetOnlineData();\n startingTask.execute();\n killableTask = startingTask;\n }", "public void changeFragment(Fragment nextFragment) {\n actualFragment = nextFragment;\n FragmentManager fragmentManager = getSupportFragmentManager();\n FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();\n fragmentTransaction.replace(R.id.mainActivityFrameLayout, nextFragment, nextFragment.getClass()\n .getSimpleName());\n fragmentTransaction.commitAllowingStateLoss();\n }", "private void initFragment(Fragment newsFragment) {\n FragmentManager fragmentManager = getSupportFragmentManager();\n FragmentTransaction transaction = fragmentManager.beginTransaction();\n transaction.replace(R.id.fl_news, newsFragment);\n transaction.commit();\n\n }", "protected void changeContent() {\n byte[] data = Arrays.copyOf(content.getContent(),\n content.getContent().length + 1);\n data[content.getContent().length] = '2'; // append one byte\n content.setContent(data);\n LOG.info(\"document content changed\");\n }", "private void defaultFragment() {\n\n Fragment fragment = new Helpline();\n FragmentManager fm = getFragmentManager();\n //TODO: try this with add\n fm.beginTransaction().replace(R.id.content_frame,fragment).commit();\n }", "public static void replaceFragmentHistory(Fragment fragment, AppCompatActivity context) {\n /* if (isUsedBundle) {\n Bundle args = new Bundle();\n args.putInt(bundleParameterName, bundleValue);\n fragment.setArguments(args);\n }*/\n if (context != null) {\n try {\n FragmentTransaction transaction =\n context.getSupportFragmentManager().beginTransaction();\n transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_in_right);\n\n transaction.replace(R.id.menuContainer, fragment);\n transaction.addToBackStack(null);\n transaction.commitAllowingStateLoss();\n\n } catch (IllegalStateException e) {\n e.printStackTrace();\n context.finish();\n }\n }\n }", "public void RitiroLibri()\r\n {\r\n ((AppCompatActivity)getActivity()).getSupportActionBar().setTitle(\"Ritiro Libri\");\r\n FragmentManager fragmentManager = getFragmentManager();\r\n FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();\r\n fragmentTransaction.replace(R.id.main_conteiner, new SistudiaFragmentRitiroLibri());\r\n fragmentTransaction.commit();\r\n }", "public void updateViews() {\n updateViews(null);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.root_fragment, container, false);\n//replace root_frame with newGameView\n FragmentTransaction transaction = getFragmentManager()\n .beginTransaction();\n transaction.replace(R.id.root_frame, new NewGameView());\n transaction.commit();\n\n return view;\n }", "@Override\n public void onClick(View v) {\n CompteEnsg nextFrag = new CompteEnsg();\n getActivity().getFragmentManager().beginTransaction()\n .replace(R.id.content_frame, nextFrag, \"TAG_FRAGMENT\")\n .addToBackStack(null)\n .commit();\n }", "private void addFragments(JSONArray jArr, boolean addOrRemove) throws JSONException {\n fragsToInstantiate = 0;\n FragmentManager fragmentManager = getSupportFragmentManager();\n FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();\n getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,\n new APIGetFragment()).commit();\n\n ArrayList<DescriptionFragment> FRAGMENTS = new ArrayList<>();\n\n\n // iterate through all retrieved data to add object values into fragment\n for (int i = 0; i < jArr.length(); i++) {\n JSONObject json = jArr.getJSONObject(i);\n Iterator<String> keys = json.keys();\n\n while (keys.hasNext()) {\n String key = keys.next();\n if(VV)System.out.println(\"Key :\" + key + \" Value :\" + json.get(key));\n if(VV)System.out.println(json.getString(key));\n sName = json.getString(key);\n key = keys.next();\n sType = json.getString(key);\n key = keys.next();\n sDescription = json.getString(key);\n key = keys.next();\n sWiki = json.getString(key);\n if(keys.hasNext()){\n key = keys.next();\n sYoutube = json.getString(key);}\n FRAGMENTS.add(DescriptionFragment.newInstance(sName, sType, sDescription, sWiki, sYoutube, addOrRemove));\n fragsToInstantiate += 1;\n break;\n }\n }\n\n if(fragsToInstantiate == 0){\n FRAGMENTS.add(DescriptionFragment.newInstance(\"\", \"\", \"No Items Returned\", \"\", \"\", addOrRemove));\n fragmentTransaction.add(R.id.item0, FRAGMENTS.get(0));\n }\n\n /**\n * Iterate through retrieved fragments and add fragments into fragment manager\n * API returns a maximum 20 items\n */\n for(int i = 0; i < fragsToInstantiate; i++) {\n switch(i){\n case 0:\n fragmentTransaction.add(R.id.item0, FRAGMENTS.get(i));\n break;\n case 1:\n fragmentTransaction.add(R.id.item1, FRAGMENTS.get(i));\n break;\n case 2:\n fragmentTransaction.add(R.id.item2, FRAGMENTS.get(i));\n break;\n case 3:\n fragmentTransaction.add(R.id.item3, FRAGMENTS.get(i));\n break;\n case 4:\n fragmentTransaction.add(R.id.item4, FRAGMENTS.get(i));\n break;\n case 5:\n fragmentTransaction.add(R.id.item5, FRAGMENTS.get(i));\n break;\n case 6:\n fragmentTransaction.add(R.id.item6, FRAGMENTS.get(i));\n break;\n case 7:\n fragmentTransaction.add(R.id.item7, FRAGMENTS.get(i));\n break;\n case 8:\n fragmentTransaction.add(R.id.item8, FRAGMENTS.get(i));\n break;\n case 9:\n fragmentTransaction.add(R.id.item9, FRAGMENTS.get(i));\n break;\n case 10:\n fragmentTransaction.add(R.id.item10, FRAGMENTS.get(i));\n break;\n case 11:\n fragmentTransaction.add(R.id.item11, FRAGMENTS.get(i));\n break;\n case 12:\n fragmentTransaction.add(R.id.item12, FRAGMENTS.get(i));\n break;\n case 13:\n fragmentTransaction.add(R.id.item13, FRAGMENTS.get(i));\n break;\n case 14:\n fragmentTransaction.add(R.id.item14, FRAGMENTS.get(i));\n break;\n case 15:\n fragmentTransaction.add(R.id.item15, FRAGMENTS.get(i));\n break;\n case 16:\n fragmentTransaction.add(R.id.item16, FRAGMENTS.get(i));\n break;\n case 17:\n fragmentTransaction.add(R.id.item17, FRAGMENTS.get(i));\n break;\n case 18:\n fragmentTransaction.add(R.id.item18, FRAGMENTS.get(i));\n break;\n case 19:\n fragmentTransaction.add(R.id.item19, FRAGMENTS.get(i));\n break;\n }\n }\n fragmentTransaction.commit();\n }", "public void refresh() {\n // The actual work is in refreshInernal(), but we don't call it directly here, because:\n // 1. refresh() is called very often.\n // 2. to avoid nested fragment transaction.\n // refresh is often called during a fragment transaction, but updateTitle() may call\n // a callback which would initiate another fragment transaction.\n mDelayedOperations.removeCallbacks(mRefreshRunnable);\n mDelayedOperations.post(mRefreshRunnable);\n }", "public void updateUI() {\n List<Animal> animals;\n\n String searchQuery = LexiconPreferences.getSearchQuery(getActivity());\n\n // Check if there's a search query present\n if (searchQuery != null) {\n ArrayList<String> whereArgs = new ArrayList<>();\n whereArgs.add(LexiconPreferences.getFilterValue(getActivity()));\n\n animals = mAnimalManager.searchAnimals(\n mAnimalManager.createWhereClauseFromFilter(LexiconPreferences.getFilterKey(getActivity())),\n whereArgs,\n searchQuery\n );\n } else {\n animals = mAnimalManager.getAnimals(\n mAnimalManager.createWhereClauseFromFilter(LexiconPreferences.getFilterKey(getActivity())),\n new String[]{LexiconPreferences.getFilterValue(getActivity())}\n );\n }\n\n if (animals.size() > 0) {\n // If the fragment is already running, update the data in case something changed (some animal)\n if (mAnimalAdapter == null) {\n mAnimalAdapter = new AnimalAdapter(animals);\n mAnimalRecyclerView.setAdapter(mAnimalAdapter);\n } else {\n mAnimalAdapter.setAnimals(animals);\n mAnimalAdapter.notifyDataSetChanged();\n }\n } else {\n RelativeLayout emptyList = (RelativeLayout) mView.findViewById(R.id.list_empty);\n emptyList.setVisibility(View.VISIBLE);\n }\n }", "public void updateview(Fragment fragment , int layout , String text){\n try {\n if(NetworkUtil.isNetworkConnected((ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE)))\n {\n updateMainUI.update_view( layout , fragment , text);\n }\n else {\n NoInternetFragment noInternetFragment = new NoInternetFragment();\n noInternetFragment.setFragment(fragment , layout );\n noInternetFragment.setText(text);\n updateMainUI.update_view( layout , noInternetFragment , text);\n }\n }catch (Exception ex){\n ex.printStackTrace();\n }\n }", "private void updateFragmentUI() {\n ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(\"Shift Id: \" + mShift.getId());\n ((TextView) mRootView.findViewById(R.id.shift_starttime)).setText(TimeUtil.convertTimeStampToGenericString(mShift.getStartTimeStamp()));\n ((TextView) mRootView.findViewById(R.id.shift_startaddress)).setText((mShift.getStartLatitude() + \" , \" + mShift.getStartLongitude()));\n if (mShift.getEndTimestamp() == 0) {\n ((TextView) mRootView.findViewById(R.id.shift_endtime)).setText(R.string.shift_in_progress);\n ((TextView) mRootView.findViewById(R.id.shift_endaddress)).setText(R.string.shift_in_progress);\n } else {\n ((TextView) mRootView.findViewById(R.id.shift_endtime)).setText(TimeUtil.convertTimeStampToGenericString(mShift.getEndTimestamp()));\n ((TextView) mRootView.findViewById(R.id.shift_endaddress)).setText((mShift.getEndLatitude() + \" , \" + mShift.getEndLongitude()));\n }\n }", "@Override\n public void onClick(View v) {\n FragmentManager fragmentManager = ((AppCompatActivity) getContext()).getSupportFragmentManager();\n FragmentTransaction transaction = fragmentManager.beginTransaction();\n transaction.replace(R.id.rel_main_parentAllView, new FragmentFavoritesApp());\n transaction.commit();\n }", "private void showSection(int position) {\n FragmentManager fragmentManager = getSupportFragmentManager();\n fragmentManager.beginTransaction()\n .replace(R.id.container, PlaceholderFragment.newInstance(position + 1))\n .commit();\n\n\n }", "private void displayView(int position) {\r\n\t\t// update the main content by replacing fragments\r\n\t\tFragment fragment = null;\r\n\t\tString id = null;\r\n\t\tswitch (position) {\r\n\t\tcase 0:\r\n\t\t\tif (mSharedPrefs.getDeviceMode() == -1) {\r\n\t\t\t\tid = \"SetupFragment\";\r\n\t\t\t}\r\n\r\n\t\t\tif (mSharedPrefs.getDeviceMode() == 0) {\r\n\t\t\t\tid = \"OverviewFragment\";\r\n\t\t\t}\r\n\t\t\tif (mSharedPrefs.getDeviceMode() == 1) {\r\n\t\t\t\tid = \"BabyMonitorFragment\";\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase 1:\r\n\t\t\tif (mSharedPrefs.getDeviceMode() == -1) {\r\n\t\t\t\tid = \"Settings\";\r\n\t\t\t}\r\n\t\t\tif (mSharedPrefs.getDeviceMode() == 0) {\r\n\t\t\t\tloadStoredSetupOptions();\r\n\t\t\t\tid = \"SetupFragment\";\r\n\t\t\t}\r\n\t\t\tif (mSharedPrefs.getDeviceMode() == 1) {\r\n\t\t\t\tid = \"AbsenceFragment\";\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase 2:\r\n\t\t\tif (mSharedPrefs.getDeviceMode() == 0) {\r\n\t\t\t\tid = \"Settings\";\r\n\t\t\t}\r\n\t\t\tif (mSharedPrefs.getDeviceMode() == 1) {\r\n\t\t\t\tloadStoredSetupOptions();\r\n\t\t\t\tid = \"SetupFragment\";\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase 3:\r\n\t\t\tif (mSharedPrefs.getDeviceMode() == 1) {\r\n\t\t\t\tid = \"Settings\";\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tfragment = mFragmentMap.get(id);\r\n\t\tif (fragment == null) {\r\n\t\t\tfragment = createFragmentById(id);\r\n\t\t}\r\n\r\n\t\tif (fragment != null) {\r\n\t\t\tFragmentManager fragmentManager = getSupportFragmentManager();\r\n\t\t\tfragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();\r\n\t\t\tsetTitle(navMenuTitles[position]);\r\n\t\t\t// update selected item and title, then close the drawer\r\n\t\t\tmDrawerList.setItemChecked(position, true);\r\n\t\t\tmDrawerList.setSelection(position);\r\n\t\t\tinitNavigationDrawer();\r\n\t\t\tmDrawerLayout.closeDrawer(mDrawerList);\r\n\t\t} else {\r\n\t\t\t// error in creating fragment\r\n\t\t}\r\n\t}", "@Override\n\tpublic void refreshView() {\n\n\t}", "protected void replaceFragment(Fragment fragment, String id, int resId) {\n getSupportFragmentManager()\n .beginTransaction()\n .add(resId, fragment, id)\n .addToBackStack(id)\n .commit();\n }", "public void onContentChanged() {\n }", "private void updateViews() {\n titleTextView.setText(currentVolume.getTitle());\n descTextView.setText(Html.fromHtml(currentVolume.getDesc(), Html.FROM_HTML_MODE_COMPACT));\n authorsTextView.setText(currentVolume.getAuthors());\n\n retrieveImage();\n }", "@Override\n\tpublic void onClick(View v) {\n\t\tgetActivity().setContentView(R.layout.fragment);\n\n\t\tFragmentTransaction tx = getActivity().getSupportFragmentManager()\n\t\t\t\t.beginTransaction();\n\t\tswitch (v.getId()) {\n\n\t\tcase R.id.item1: {\n\t\t\ttx.replace(R.id.content_frame,\n\t\t\t\t\tFragment.instantiate(getActivity(), tab_array[0]));\n\t\t\ttx.commit();\n\t\t\tbreak;\n\t\t}\n\t\tcase R.id.item2: {\n\t\t\ttx.replace(R.id.content_frame,\n\t\t\t\t\tFragment.instantiate(getActivity(), tab_array[1]));\n\t\t\ttx.commit();\n\t\t\tbreak;\n\t\t}\n\t\tcase R.id.item3: {\n\t\t\ttx.replace(R.id.content_frame,\n\t\t\t\t\tFragment.instantiate(getActivity(), tab_array[2]));\n\t\t\ttx.commit();\n\t\t\tbreak;\n\t\t}\n\t\tcase R.id.item4: {\n\t\t\ttx.replace(R.id.content_frame,\n\t\t\t\t\tFragment.instantiate(getActivity(), tab_array[3]));\n\t\t\ttx.commit();\n\t\t\tbreak;\n\t\t}\n\n\t\t}\n\t}", "private void loadBookPageFragment() {\n\n FragmentManager manager = getFragmentManager();\n FragmentTransaction transaction = manager.beginTransaction();\n transaction.addToBackStack(\"ListView\"); // enables to press \"return\" and go back to the list view\n transaction.replace(R.id.main_fragment_container, new BookPageFragment());\n transaction.commit();\n }", "private void updateUI() {\n swipeRefreshLayout.setRefreshing(false);\n adapter.clearItems();\n itemList.addAll(DatabaseController.getInstance(getApplicationContext()).getItems());\n if (itemList.size() > 0){\n emptyTextView.setVisibility(View.GONE);\n adapter.notifyDataSetChanged();\n } else {\n emptyTextView.setVisibility(View.VISIBLE);\n }\n }", "private void updateContent() {\n if (product != null) {\n etProductName.setText(product.getName());\n etPrice.setText(product.getPrice().toString());\n }\n }", "public void loadAllMsgFragment() {\n // selecting appropriate nav menu item\n selectNavMenu();\n\n // set toolbar title\n setToolbarTitle();\n\n // if user select the current navigation menu again, don't do anything\n // just close the navigation drawer\n if (getSupportFragmentManager().findFragmentByTag(CURRENT_TAG) != null) {\n drawer.closeDrawers();\n\n // show or hide the fab button\n toggleFab();\n return;\n }\n\n // Sometimes, when fragment has huge data, screen seems hanging\n // when switching between navigation menus\n // So using runnable, the fragment is loaded with cross fade effect\n // This effect can be seen in GMail app\n Fragment fragment = getAllMsgFragment();\n FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,\n android.R.anim.fade_out);\n fragmentTransaction.replace(R.id.frame, fragment, CURRENT_TAG);\n fragmentTransaction.commitAllowingStateLoss();\n\n // show or hide the fab button\n toggleFab();\n\n //Closing drawer on item click\n drawer.closeDrawers();\n\n // refresh toolbar menu\n invalidateOptionsMenu();\n }", "private void buildMainFragment() {\n\t\tfinal List<Fragment> fragments = getFragments();\n\t\t//pageAdapter = new PageAdapter(getSupportFragmentManager(), fragments);\n\t\tfinal ViewPager pager = (ViewPager) findViewById(R.id.viewpager_program);\n\t\tpager.setAdapter(pageAdapter);\n\n\t\t// Set up ActionBar\n\t\tactionBar = getActionBar();\n\t\tactionBar.show();\n\t\tactionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);\n\t\t\n\t\tTab tab = actionBar\n\t\t\t\t.newTab()\n\t\t\t\t.setText(getIntent().getExtras().getString(\"pgr_name\"))\n\t\t\t\t.setTabListener(\n\t\t\t\t\t\tnew TabListener<ProgramExercisesFragment>(this,\n\t\t\t\t\t\t\t\tgetIntent().getExtras().getString(\"pgr_name\"),\n\t\t\t\t\t\t\t\tProgramExercisesFragment.class));\n\t\tactionBar.addTab(tab);\n\n\t\ttab = actionBar\n\t\t\t\t.newTab()\n\t\t\t\t.setText(\"Exercises\")\n\t\t\t\t.setTabListener(\n\t\t\t\t\t\tnew TabListener<ProgramAddExercisesFragment>(this, \"Exercises_Program\",\n\t\t\t\t\t\t\t\tProgramAddExercisesFragment.class));\n\t\tactionBar.addTab(tab);\n\t\t\n\t\t\n\t}", "public void refresh() { \r\n FacesContext context = FacesContext.getCurrentInstance(); \r\n Application application = context.getApplication(); \r\n ViewHandler viewHandler = application.getViewHandler(); \r\n UIViewRoot viewRoot = viewHandler.createView(context, context.getViewRoot().getViewId()); \r\n context.setViewRoot(viewRoot); \r\n context.renderResponse(); \r\n }", "private void showHome(){\n fragment = new HomeFragment();\n FragmentManager fragmentManager = getSupportFragmentManager();\n fragmentManager.beginTransaction().replace(R.id.mainLayout, fragment, fragment.getTag()).commit();\n }", "public void refresh() {\n\t\tgetData();\n\t\trender();\n\t}", "public void onUPP()\r\n {\r\n Fragment frag = getSupportFragmentManager().findFragmentById(R.id.fragmentSad);\r\n// //android.app.FragmentManager fm = getFragmentManager();\r\n// FragmentTransaction ft = getFragmentManager().beginTransaction();\r\n// ft.remove(frag);\r\n// ft.commit();\r\n//}\r\n\r\n FragmentManager fm = getSupportFragmentManager();\r\n fm.beginTransaction()\r\n .setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)\r\n .show(frag)\r\n .commit();\r\n\r\n }", "private void continueSetup(){\n bannerImages = ((App) getContext().getApplicationContext()).getBannersList();\n allCategoriesList = ((App) getContext().getApplicationContext()).getCategoriesList();\n\n setupSlidingBanner();\n\n // Add Products Fragment to specified FrameLayout\n productsFragment = new Products();\n Bundle bundle = new Bundle();\n bundle.putBoolean(\"isSubFragment\", true);\n productsFragment.setArguments(bundle);\n fragmentManager.beginTransaction().replace(R.id.products_fragment_home1, productsFragment).commit();\n\n // Add RecentlyViewed Fragment to specified FrameLayout\n recentlyViewed = new RecentlyViewed();\n fragmentManager.beginTransaction().replace(R.id.recently_viewed_fragment_home1, recentlyViewed).commit();\n }" ]
[ "0.7009121", "0.6948678", "0.6730658", "0.6675358", "0.66165197", "0.6611591", "0.66032475", "0.6463688", "0.6438722", "0.6436336", "0.64263254", "0.6314441", "0.62816167", "0.62546426", "0.6245493", "0.62142855", "0.6180705", "0.6153804", "0.61326784", "0.6046095", "0.60406494", "0.6032831", "0.60299814", "0.60283035", "0.60231405", "0.60076636", "0.5974443", "0.58924603", "0.5888391", "0.5888009", "0.5849495", "0.5844824", "0.5819717", "0.5806875", "0.58062935", "0.58062935", "0.58062935", "0.58062935", "0.58062935", "0.58062935", "0.5795964", "0.57846314", "0.5781241", "0.57755756", "0.5758578", "0.57530195", "0.5750622", "0.57296854", "0.5712867", "0.5700445", "0.56934613", "0.5674849", "0.56689954", "0.56689954", "0.56669754", "0.5660206", "0.5641385", "0.56355464", "0.5630693", "0.5614009", "0.56129426", "0.5597388", "0.55967975", "0.55934006", "0.55867726", "0.5578521", "0.5572677", "0.55603087", "0.55551594", "0.5552226", "0.5545824", "0.55431724", "0.55429024", "0.55366135", "0.5533442", "0.5524687", "0.55179024", "0.55134547", "0.55134237", "0.5507191", "0.5506044", "0.5504814", "0.55036724", "0.54996073", "0.5492445", "0.5489476", "0.5483355", "0.54785585", "0.5469473", "0.54609966", "0.5460706", "0.545744", "0.5457366", "0.5453899", "0.54496115", "0.5448593", "0.5447162", "0.54443425", "0.54402256", "0.543694", "0.54342467" ]
0.0
-1
When using the ActionBarDrawerToggle, you must call it during onPostCreate() and onConfigurationChanged()...
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(@Nullable Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n mDrawerToggle.syncState();\n }", "@Override\r\n\tprotected void onPostCreate(Bundle savedInstanceState) {\n\t\tsuper.onPostCreate(savedInstanceState);\r\n\t\tmDrawerToggle.syncState();\r\n\t}", "public void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n if (this.actionBarDrawerToggle != null) {\n this.actionBarDrawerToggle.syncState();\n }\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n actionBarDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n// actionBarDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) \n {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n //mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n mDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n myDrawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n\n // Sync the toggle state after onRestoreInstanceState has occurred.\n mDrawerToggle.syncState();\n }", "@Override\r\n protected void onPostCreate(Bundle savedInstanceState) {\r\n super.onPostCreate(savedInstanceState);\r\n // Sync the toggle state after onRestoreInstanceState has occurred.\r\n drawerToggle.syncState();\r\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n drawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n drawerToggle.syncState();\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n drawerToggle.syncState();\n }", "@Override\r\n\tprotected void onPostCreate(Bundle savedInstanceState) {\r\n\t\tsuper.onPostCreate(savedInstanceState);\r\n\t\t// Sync the toggle state after onRestoreInstanceState has occurred.\r\n\t\tmDrawerToggle.syncState();\r\n\t}", "@Override\n\tprotected void onPostCreate(Bundle savedInstanceState) {\n\t\tsuper.onPostCreate(savedInstanceState);\n\t\t// Sync the toggle state after onRestoreInstanceState has occured\n\t\tdrawerToggle.syncState();\n\t}", "private void setupDrawer(){\n drawerToggle = new ActionBarDrawerToggle(\n this,\n drawerLayout,\n R.string.drawer_open,\n R.string.drawer_close) {\n\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }\n\n public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n getSupportActionBar().setTitle(appTitle);\n invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }\n };\n drawerToggle.setDrawerIndicatorEnabled(true);\n drawerLayout.addDrawerListener(drawerToggle);\n }", "private void configureDrawerLayout(){\n this.drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);\n ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open, R.string.close);\n drawerLayout.addDrawerListener(toggle);\n toggle.syncState();\n }", "private void initializeActionDrawerToggle() {\n actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,\n R.string.navigation_view_open, R.string.navigation_view_closed);\n drawerLayout.addDrawerListener(actionBarDrawerToggle);\n actionBarDrawerToggle.syncState();\n }", "private void setupDrawer(){\n\n drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawerOpen,\n R.string.drawerClose){\n\n public void onDrawerOpened(View drawerView){\n\n super.onDrawerOpened(drawerView);\n getSupportActionBar().setTitle(R.string.app_name);\n invalidateOptionsMenu();\n }\n\n public void onDrawerClosed(View view){\n\n super.onDrawerClosed(view);\n getSupportActionBar().setTitle(activityTitle);\n invalidateOptionsMenu();\n }\n };\n drawerToggle.setDrawerIndicatorEnabled(true);\n drawerLayout.setDrawerListener(drawerToggle);\n }", "@Override\n public void onDrawerStateChanged(int newState) {\n }", "@Override\n public void onDrawerStateChanged(int newState) {\n }", "@Override\n public void onDrawerStateChanged(int newState) {\n }", "@Override\n public void onDrawerStateChanged(int newState) {\n }", "private ActionBarDrawerToggle setupDrawerToggle() {\n return new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);\n }", "@Override\n public void onDrawerStateChanged(int newState) {\n }", "private ActionBarDrawerToggle setupDrawerToggle() {\n return new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.drawer_open, R.string.drawer_close);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n actionBarTitleController.syncState();\n }", "private ActionBarDrawerToggle setupDrawerToggle() {\n return new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close);\n }", "private void toggleListener() {\n actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,\n R.string.drawerOpened, R.string.drawerClosed) {\n\n @Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n invalidateOptionsMenu();\n }\n\n @Override\n public void onDrawerClosed(View drawerView) {\n super.onDrawerClosed(drawerView);\n invalidateOptionsMenu();\n }\n };\n drawerLayout.addDrawerListener(actionBarDrawerToggle);\n }", "@Override\n public void onConfigurationChanged(Configuration newConfig) {\n super.onConfigurationChanged(newConfig);\n mDrawerToggle.onConfigurationChanged(newConfig);\n }", "private void toggleDrawer() {\n ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,\n R.string.navigation_drawer_open, R.string.navigation_drawer_close);\n drawerLayout.addDrawerListener(drawerToggle);\n drawerToggle.syncState();\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n }", "private ActionBarDrawerToggle setupDrawerToggle() {\n return new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.drawer_open, R.string.drawer_close);\n }", "private ActionBarDrawerToggle setupDrawerToggle() {\n return new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.drawer_open, R.string.drawer_close);\n }", "private void setupDrawer() {\n mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,\n R.string.navigation_drawer_open,\n R.string.navigation_drawer_close) {\n /** Called when drawer has been fully opened */\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n //getSupportActionBar().setTitle(\"Navigation Drawer\");\n invalidateOptionsMenu();\n }\n\n /** Called when drawer has been fully closed */\n public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n //getSupportActionBar().setTitle(mActivityTitle);\n invalidateOptionsMenu();\n }\n };\n\n mDrawerToggle.setDrawerIndicatorEnabled(true);\n mDrawerLayout.addDrawerListener(mDrawerToggle);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n Log.d(\"Apps Main\", \"Open drawer \");\n }", "private void initDrawers() {\n mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);\n mChatDrawerFragment = new ChatsDrawerFragment();\n mConvoDrawerFragment = new ConvosDrawerFragment();\n getSupportFragmentManager().beginTransaction().replace(R.id.left_drawer, mChatDrawerFragment).commit();\n getSupportFragmentManager().beginTransaction().replace(R.id.right_drawer, mConvoDrawerFragment).commit();\n\n ActionBar actionBar = getActionBar();\n actionBar.setDisplayHomeAsUpEnabled(true);\n actionBar.setHomeButtonEnabled(true);\n\n // ActionBarDrawerToggle ties together the the proper interactions\n // between the navigation drawer and the action bar app icon.\n mDrawerToggle = new ActionBarDrawerToggle(\n this, /* host Activity */\n mDrawerLayout, /* DrawerLayout object */\n R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */\n R.string.navigation_drawer_open, /* \"open drawer\" description for accessibility */\n R.string.navigation_drawer_close /* \"close drawer\" description for accessibility */\n ) {\n @Override\n public void onDrawerClosed(View drawerView) {\n super.onDrawerClosed(drawerView);\n if (mConvoDrawerFragment != null && mConvoDrawerFragment.getCurrentConvo() != null) {\n switchTitleToConvoInfo();\n }\n }\n\n @Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n if (mConvoDrawerFragment != null && mConvoDrawerFragment.getMainConvo() != null) {\n switchTitleToMainChatInfo();\n }\n }\n };\n\n // Defer code dependent on restoration of previous instance state.\n mDrawerLayout.post(new Runnable() {\n @Override\n public void run() {\n mDrawerToggle.syncState();\n }\n });\n\n mDrawerLayout.setDrawerListener(mDrawerToggle);\n invalidateOptionsMenu();\n }", "private void setUpDrawerLayout() {\n //setSupportActionBar(provideSupportActionbar());\n drawerToggle = new ActionBarDrawerToggle(\n this,\n mainDrawerLayout,\n provideSupportActionbar(),\n R.string.app_name,\n R.string.app_name\n );\n mainDrawerLayout.addDrawerListener(drawerToggle);\n drawerToggle.syncState();\n }", "@Override\n public void onDrawerClosed(View drawerView) {\n }", "@Override\n public void onDrawerClosed(View drawerView) {\n }", "private void setupDrawer() {\n //creates the drawer action bar object right here\n mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,\n R.string.drawer_open, R.string.drawer_close) {\n\n //Called when a drawer has settled in a completely open state.\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n getSupportActionBar().setTitle(\"Navigation!\");\n //invalidateOptionsMenu();\n //creates call to onPrepareOptionsMenu()\n }\n\n //Called when a drawer has settled in a completely closed state\n public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n getSupportActionBar().setTitle(mActivityTitle);\n //invalidateOptionsMenu();\n //creates call to onPrepareOptionsMenu()\n }\n };\n //Sets the drawer icon and display to be visible and true\n mDrawerToggle.setDrawerIndicatorEnabled(true);\n mDrawerLayout.setDrawerListener(mDrawerToggle);\n }", "@Override\n public void onConfigurationChanged(Configuration newConfig) {\n super.onConfigurationChanged(newConfig);\n\n // After configuration change has occurred\n mDrawerToggle.onConfigurationChanged(newConfig);\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n try {\n getSupportActionBar().setTitle(\"Settings\");\n }catch(NullPointerException e){\n Toast.makeText(NavigationDrawerActivity.this, \"ActionBar \"+ e, Toast.LENGTH_SHORT).show();\n }\n //invalidateOptionsMenu();\n }", "public void onDrawerOpened(View drawerView) {\n\t\t\t\t\t invalidateOptionsMenu(); \n\t\t\t\t\t }", "private void initViews(){\n mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);\n\n\n// toolbar.setTitleTextColor(getResources().getColor(android.R.color.white));\n// setSupportActionBar(toolbar);\n\n mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout , R.string.drawer_open, R.string.drawer_close) {\n\n /** Called when a drawer has settled in a completely closed state. */\n public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n //getActionBar().setTitle(mTitle);\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }\n\n /** Called when a drawer has settled in a completely open state. */\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n //getActionBar().setTitle(mDrawerTitle);\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }\n };\n\n\n // Set the drawer toggle as the DrawerListener\n mDrawerLayout.setDrawerListener(mDrawerToggle);\n mDrawerToggle.syncState();\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setHomeButtonEnabled(true);\n\n }", "public void onDrawerOpened(View drawerView) {\n supportInvalidateOptionsMenu();\n }", "public void onDrawerClosed(View view) {\n\t\t\t\t\t invalidateOptionsMenu(); \n\t\t\t\t\t }", "@Override\r\n\tpublic void onConfigurationChanged(Configuration newConfig) {\n\t\tsuper.onConfigurationChanged(newConfig);\r\n\t\tmDrawerToggle.onConfigurationChanged(newConfig);\r\n\t}", "public void onDrawerClosed(View view) {\n if (Build.VERSION.SDK_INT >= 11) {\n invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n } else {\n //Call it directly on gingerbread.\n onPrepareOptionsMenu(mMenu);\n }\n\n// startFullscreenIfNeeded();\n }", "@Override\n public void onDrawerClosed(View drawerView) {\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n }", "public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n// getActionBar().setTitle(\"WXTJ Student Radio\");\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n\n super.onDrawerOpened(drawerView);\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n\n super.onDrawerOpened(drawerView);\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n\t switch (item.getItemId()) {\n\t case R.id.action_settings:\n\t \tToast.makeText(getApplicationContext(), \"Refresh!\", Toast.LENGTH_SHORT).show();\n\t break;\n\t }\n\t return true;\n\t}", "public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n getSupportActionBar().setTitle(\"Stored configurations\");\n invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "@Override\n protected void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n // Sync the toggle state after onRestoreInstanceState has occurred.\n navDrToggle.syncState();\n }", "public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n// getActionBar().setTitle(mTitle);\n }", "public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n// getActionBar().setTitle(mTitle);\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n getSupportActionBar().setTitle(\"Navigation!\");\n //invalidateOptionsMenu();\n //creates call to onPrepareOptionsMenu()\n }", "@Override\n public void onDrawerClosed(View drawerView) {\n invalidateOptionsMenu();\n Log.d(\"Apps Main\", \"Close drawer \");\n }", "public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n try {\n getSupportActionBar().setTitle(activityTitle);\n }catch(NullPointerException e){\n Toast.makeText(NavigationDrawerActivity.this, \"ActionBar \"+ e, Toast.LENGTH_SHORT).show();\n }\n //invalidateOptionsMenu();\n }", "protected void onCreateDrawer() {\n toolbar = (Toolbar) findViewById(R.id.tool_bar);\n setSupportActionBar(toolbar);\n\n //Initializing NavigationView\n navigationView = (NavigationView) findViewById(R.id.navigation_view);\n\n navigationView.setNavigationItemSelectedListener(new NavigationViewItemListener());\n\n // Initializing Drawer Layout and ActionBarToggle\n drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);\n actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open_drawer, R.string.close_drawer){\n\n @Override\n public void onDrawerClosed(View drawerView) {\n // Code here will be triggered once the drawer closes as we don't want anything to happen so we leave this blank\n super.onDrawerClosed(drawerView);\n }\n\n @Override\n public void onDrawerOpened(View drawerView) {\n // Code here will be triggered once the drawer open as we don't want anything to happen so we leave this blank\n super.onDrawerOpened(drawerView);\n }\n };\n\n //Setting the actionbarToggle to drawer layout\n drawerLayout.addDrawerListener(actionBarDrawerToggle);\n\n //calling sync state is necessary or else your hamburger icon wont show up\n actionBarDrawerToggle.syncState();\n\n UpdateHeader(this, navigationView);\n\n if (YummySession.selectedItemPosition != -1) {\n navigationView.getMenu().getItem(YummySession.selectedItemPosition).setChecked(true);\n }\n\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n // getSupportActionBar().setTitle(mDrawerTitle);\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "public void doDrawerStuff() {\n Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);\n setSupportActionBar(myToolbar);\n\n mPlanetTitles = getResources().getStringArray(R.array.planets_array);\n mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);\n\n\n mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,myToolbar, R.string.drawer_open, R.string.drawer_close) {\n\n /** Called when a drawer has settled in a completely closed state. */\n public void onDrawerClosed(View view) {\n super.onDrawerClosed(view);\n // getSupportActionBar().setTitle(mTitle);\n\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }\n\n /** Called when a drawer has settled in a completely open state. */\n public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n // getSupportActionBar().setTitle(mDrawerTitle);\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }\n };\n\n // Set the drawer toggle as the DrawerListener\n mDrawerLayout.setDrawerListener(mDrawerToggle);\n\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setHomeButtonEnabled(true);\n\n\n\n mDrawerList = (ListView) findViewById(R.id.left_drawer);\n\n // Set the adapter for the list view\n mDrawerList.setAdapter(new ArrayAdapter<String>(this,\n R.layout.drawer_list_item, mPlanetTitles));\n // Set the list's click listener\n mDrawerList.setOnItemClickListener(new DrawerItemClickListener());\n\n\n\n\n\n }", "public void onDrawerOpened(View drawerView) {\n\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n //getActionBar().setTitle(mDrawerTitle);\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n //getActionBar().setTitle(mDrawerTitle);\n //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()\n }", "private void setupDrawerContent() {\n previousMenuItem = navigationView.getMenu().findItem(R.id.nav_category);\n previousMenuItem.setChecked(true);\n previousMenuItem.setCheckable(true);\n\n navigationView.setNavigationItemSelectedListener(\n new NavigationView.OnNavigationItemSelectedListener() {\n @Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n\n drawerLayout.closeDrawer(Gravity.LEFT);\n\n if (previousMenuItem.getItemId() == menuItem.getItemId())\n return true;\n\n menuItem.setCheckable(true);\n menuItem.setChecked(true);\n previousMenuItem.setChecked(false);\n previousMenuItem = menuItem;\n\n switch (menuItem.getItemId()) {\n case R.id.nav_category:\n displayView(CATEGORIES_FRAG, null);\n break;\n case R.id.nav_favorites:\n displayView(FAVORITE_FRAG, null);\n break;\n case R.id.nav_reminder:\n displayView(REMINDER_FRAG, null);\n break;\n case R.id.nav_about:\n displayView(ABOUT_FRAG, null);\n break;\n case R.id.nav_feedback:\n IntentHelper.sendEmail(BaseDrawerActivity.this);\n break;\n case R.id.nav_rate_us:\n IntentHelper.voteForAppInBazaar(BaseDrawerActivity.this);\n break;\n case R.id.nav_settings:\n displayView(SETTINGS_FRAG, null);\n break;\n\n }\n\n\n return true;\n }\n }\n\n );\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n\n DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);\n ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(\n this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);\n drawer.addDrawerListener(toggle);\n toggle.syncState();\n\n NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);\n navigationView.setNavigationItemSelectedListener(this);\n\n onNavigationItemSelected(navigationView.getMenu().getItem(0));\n navigationView.getMenu().getItem(0).setChecked(true);\n\n\n }", "@Override\n public void onConfigurationChanged(Configuration newConfig) {\n super.onConfigurationChanged(newConfig);\n this.drawerToggle.onConfigurationChanged(newConfig);\n }", "@Override\n public boolean onPrepareOptionsMenu(Menu menu) {\n // mDrawerLayout.isDrawerOpen(mDrawerView);\n return super.onPrepareOptionsMenu(menu);\n }", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n //getSupportActionBar().setTitle(\"Navigation Drawer\");\n invalidateOptionsMenu();\n }" ]
[ "0.81234926", "0.81234926", "0.8065619", "0.79623634", "0.7793273", "0.7783374", "0.7768122", "0.77499306", "0.7662742", "0.75863886", "0.75645584", "0.75645584", "0.75645584", "0.75645584", "0.75645584", "0.75645584", "0.7537642", "0.7497469", "0.74885434", "0.7462033", "0.7462033", "0.7462033", "0.74217755", "0.7259649", "0.7125927", "0.71169865", "0.7110886", "0.70239097", "0.69354856", "0.69354856", "0.69354856", "0.69354856", "0.692201", "0.6910647", "0.68687654", "0.6850878", "0.6842381", "0.68030375", "0.6794618", "0.6780996", "0.6766412", "0.676392", "0.6753024", "0.6753024", "0.6725676", "0.6675103", "0.6673001", "0.6628139", "0.6622799", "0.6622799", "0.65917194", "0.65843034", "0.6581641", "0.6575958", "0.657304", "0.6568145", "0.65547895", "0.6541893", "0.65413123", "0.6532684", "0.65271866", "0.651549", "0.651549", "0.651549", "0.651549", "0.651549", "0.651549", "0.651549", "0.651549", "0.651549", "0.651549", "0.651549", "0.6509848", "0.6501395", "0.6501395", "0.6501395", "0.6487713", "0.6477885", "0.64722174", "0.6453606", "0.6453606", "0.64400303", "0.6438617", "0.6424837", "0.6420191", "0.6411362", "0.6400795", "0.64000034", "0.6395681", "0.6395681", "0.6392994", "0.6384276", "0.6356805", "0.63535714", "0.6344961" ]
0.7286193
28
Creates a new VmAllocationPolicySimple object.
public VMAllocationPolicyRandom(List<? extends Host> list) { super(list); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public PowerVmAllocationPolicySimple(List<? extends PowerHost> list) {\n\t\tsuper(list);\n\t}", "public NatPolicy createNatPolicy();", "AllocationPolicy getAllocationPolicy(ReservationDAO reservations);", "public GAAlloc(VMCwMProblem instance) {\n super(instance, \"NSGAII\", VMCwMProblem.Encoding.INTEGER);\n AlgorithmFactory.getInstance().addProvider(new GAAllocAlgorithmProvider());\n }", "public static APIPolicy createDefaultAPIPolicy() {\n APIPolicy apiPolicy = new APIPolicy(SAMPLE_API_POLICY);\n apiPolicy.setUuid(UUID.randomUUID().toString());\n apiPolicy.setDisplayName(SAMPLE_API_POLICY);\n apiPolicy.setDescription(SAMPLE_API_POLICY_DESCRIPTION);\n apiPolicy.setUserLevel(APIMgtConstants.ThrottlePolicyConstants.API_LEVEL);\n QuotaPolicy defaultQuotaPolicy = new QuotaPolicy();\n defaultQuotaPolicy.setType(REQUEST_COUNT_TYPE);\n RequestCountLimit requestCountLimit = new RequestCountLimit(TIME_UNIT_SECONDS, 1000, 10000);\n defaultQuotaPolicy.setLimit(requestCountLimit);\n apiPolicy.setDefaultQuotaPolicy(defaultQuotaPolicy);\n apiPolicy.setPipelines(createDefaultPipelines());\n return apiPolicy;\n }", "AllocateNetworkResponse allocateVirtualisedNetworkResource(\n AllocateNetworkRequest allocateNetworkRequest, PoP poP) throws AdapterException;", "public static SubscriptionPolicy createDefaultSubscriptionPolicy() {\n SubscriptionPolicy subscriptionPolicy = new SubscriptionPolicy(SAMPLE_SUBSCRIPTION_POLICY);\n subscriptionPolicy.setUuid(UUID.randomUUID().toString());\n subscriptionPolicy.setDisplayName(SAMPLE_SUBSCRIPTION_POLICY);\n subscriptionPolicy.setDescription(SAMPLE_SUBSCRIPTION_POLICY_DESCRIPTION);\n QuotaPolicy defaultQuotaPolicy = new QuotaPolicy();\n defaultQuotaPolicy.setType(REQUEST_COUNT_TYPE);\n RequestCountLimit requestCountLimit = new RequestCountLimit(TIME_UNIT_SECONDS, 10000, 1000);\n defaultQuotaPolicy.setLimit(requestCountLimit);\n subscriptionPolicy.setDefaultQuotaPolicy(defaultQuotaPolicy);\n return subscriptionPolicy;\n }", "public static ApplicationPolicy createDefaultApplicationPolicy() {\n ApplicationPolicy applicationPolicy = new ApplicationPolicy(SAMPLE_APP_POLICY);\n applicationPolicy.setUuid(UUID.randomUUID().toString());\n applicationPolicy.setDisplayName(SAMPLE_APP_POLICY);\n applicationPolicy.setDescription(SAMPLE_APP_POLICY_DESCRIPTION);\n QuotaPolicy defaultQuotaPolicy = new QuotaPolicy();\n defaultQuotaPolicy.setType(REQUEST_COUNT_TYPE);\n RequestCountLimit requestCountLimit = new RequestCountLimit(TIME_UNIT_SECONDS, 10000, 1000);\n defaultQuotaPolicy.setLimit(requestCountLimit);\n applicationPolicy.setDefaultQuotaPolicy(defaultQuotaPolicy);\n return applicationPolicy;\n }", "public SplitPolicyGeneralizedHyperplane() {\n }", "public DistributionPolicyInternal() {}", "public suiluppo_equip_allocation create(long equip_allocat_id);", "public BinPackingAllocAlgorithm(VMCwMProblem instance) {\n super(instance);\n this.mappings = this.instance.getMappings();\n this.max_mig_percentile = this.instance.getMaxMigrationPercentile();\n this.pm_heap = buildPhysicalMachineHeap(this.instance.getPhysicalMachines(),\n this.mappings);\n this.vm_array = new VirtualMachine[this.instance.getVirtualMachines().size()];\n this.instance.getVirtualMachines().copyTo(this.vm_array);\n }", "public PlanElement createAllocation(Task t, Asset a){\n Date from = prefHelper.getReadyAt (t);\n Date to = prefHelper.getBestDate (t);\n\n double confidence = \n (((GLMAsset) a).hasOrganizationPG ()) ? allocHelper.MEDIUM_CONFIDENCE : allocHelper.HIGHEST_CONFIDENCE;\n\n if (isDebugEnabled())\n debug (getName () + \".createAllocation - ready at \" + from + \n\t \" - best \" + to + \" confidence \" + confidence);\n\n AspectValue [] values = new AspectValue [2];\n values[0] = AspectValue.newAspectValue (AspectType.START_TIME, from.getTime());\n values[1] = AspectValue.newAspectValue (AspectType.END_TIME, to.getTime());\n\n PlanElement pe = allocHelper.makeAllocation(this,\n\t\t\t\t\t\tldmf, realityPlan, t, a, \n\t\t\t\t\t\tvalues,\n\t\t\t\t\t\tconfidence,\n\t\t\t\t\t\tConstants.Role.TRANSPORTER);\n return pe;\n }", "public PowerVmAllocationPolicyAbstract(List<? extends Host> list) {\n\t\tsuper(list);\n\t}", "BasicScalingType createBasicScalingType();", "public DefaultSimplePolicyValueTestAbstract() {\n }", "public static CustomPolicy createDefaultCustomPolicy() {\n CustomPolicy customPolicy = new CustomPolicy(SAMPLE_CUSTOM_RULE);\n customPolicy.setKeyTemplate(\"$userId\");\n String siddhiQuery = \"FROM RequestStream SELECT userId, ( userId == '[email protected]' ) AS isEligible , \"\n + \"str:concat('[email protected]','') as throttleKey INSERT INTO EligibilityStream;\"\n + \"FROM EligibilityStream[isEligible==true]#throttler:timeBatch(1 min) SELECT throttleKey, \"\n + \"(count(userId) >= 5 as isThrottled, expiryTimeStamp group by throttleKey INSERT ALL EVENTS into \"\n + \"ResultStream;\";\n\n customPolicy.setSiddhiQuery(siddhiQuery);\n customPolicy.setDescription(\"Sample custom policy\");\n return customPolicy;\n }", "public MicrosoftGraphStsPolicy() {\n }", "Constraint createConstraint();", "Constraint createConstraint();", "public SharedActivationPolicyPermission(String policy) {\n\tthis(policy, init(policy));\n }", "public SampledPolicy() {\r\n super(ExecutablePolicyType.SAMPLED);\r\n }", "PolicyController createPolicyController(String name, Properties properties);", "@Test\n\tpublic void testSingleSkuAllocation() {\n\t\tfinal int qty = 1;\n\n\t\tinventoryDto.setQuantityOnHand(qty);\n\t\tassertEquals(AVAILABLE_QUANTITY_SHOULD_BE_MESSAGE + qty, qty, inventoryDto.getAvailableQuantityInStock());\n\n\t\torderSku1.setQuantity(qty);\n\n\t\tinventoryDto.setAllocatedQuantity(qty);\n\t\tassertEquals(\"Allocated Quantity should be \" + qty, qty, inventoryDto.getAllocatedQuantity());\n\t\tassertEquals(AVAILABLE_QUANTITY_SHOULD_BE_MESSAGE + 0, 0, inventoryDto.getAvailableQuantityInStock());\n\n\t\tassertTrue(\"There should be enough allocation for this sku\", productInventoryManagementService1.isSelfAllocationSufficient(orderSku1, 0));\n\t}", "public NatPolicy createNatPolicyFromConfig(String ref);", "public MonitoringPoliciesResponse createMonitoringPolicyProcess(CreateMPProcessesRequest object, String policyId) throws RestClientException, IOException {\n return client.create(getUrlBase().concat(parentResource).concat(\"/\").concat(policyId).concat(\"/\").concat(resource), object, MonitoringPoliciesResponse.class, 202);\n }", "ManualScalingType createManualScalingType();", "public SimpleBrushSizePolicy(double anchorX, double anchorY) {\n this.anchorX = anchorX;\n this.anchorY = anchorY;\n }", "@Test\n public void testPositiveAllocation() {\n Allocation allocation = new Allocation(\n doctors.get(0),\n surgeryRooms.get(0),\n (new Period(50, 10, 15))\n );\n boolean expected = true;\n boolean actual = hospital.allocate(allocation);\n assertEquals(expected, actual);\n }", "MinHeap createMinHeap(int capacity)\r\n\t{\r\n\t MinHeap minHeap = new MinHeap();\r\n\t minHeap.size = 0; // current size is 0\r\n\t minHeap.capacity = capacity;\r\n\t minHeap.array = new MinHeapNode[capacity];\r\n\t return minHeap;\r\n\t}", "public HeapImp() {\n\t\tthis(10000);\n\t}", "public static SimplePool simplePool(int poolSize) {\n return new SimplePool(poolSize);\n }", "public ApplicationDeltaHealthPolicy() {\n }", "public void setLBR_PaymentAllocationPriority (String LBR_PaymentAllocationPriority);", "AutomaticScalingType createAutomaticScalingType();", "public void createASPolicy(){\n\t\t\n\t\t// First create for replicated objects\n\t\t//System.out.println(\"Inside ObjectBasedAnalyzer: createASPolicy\");\n\t\t\n\t\tcreateReplicatedObjectsPolicy();\n\t\t\t\t\n\t\t// Now for rest of objects\n\t\t\n//\t\tcreateOnlyDistributedObjectsPolicy();\n\t\t\n\t\tIterator<String> iap = ASPolicyMap.keySet().iterator();\n\t\t\n\t\tSystem.out.println(\"---------------ASPolicy Start------------------\");\n//\t\t\n\t\twhile(iap.hasNext()){\n//\t\t\t\n//\t\t\t\n\t\t\tString serId = iap.next();\n\t\t\tSystem.out.println(\"AS Policy for:\" + serId);\n\t\t\tmanager.getASServer(serId).currentPolicy = ASPolicyMap.get(serId);\n\t\t\tSystem.out.println(\"No of policy entries for this server are:\" + manager.getASServer(serId).currentPolicy.policyMap.size());\n\t\t}\n//\t\t\n\t\tSystem.out.println(\"---------------ASPolicy End------------------\");\n\t\t\t\t\t\t\n\t}", "private boolean createMonetizationPlan(SubscriptionPolicy subPolicy) throws APIManagementException {\n\n Monetization monetizationImplementation = getMonetizationImplClass();\n if (monetizationImplementation != null) {\n try {\n return monetizationImplementation.createBillingPlan(subPolicy);\n } catch (MonetizationException e) {\n APIUtil.handleException(\"Failed to create monetization plan for : \" + subPolicy.getPolicyName(), e);\n }\n }\n return false;\n }", "Policy _get_policy(int policy_type);", "private void processAutoScalePolicy(BMap<?, ?> scalePolicy, ImageComponent component) {\n ScalingPolicy scalingPolicy = new ScalingPolicy();\n scalingPolicy.setReplicas(component.getReplicas());\n LinkedHashMap bScalePolicy = scalePolicy.getMap();\n boolean bOverridable = false;\n if (\"AutoScalingPolicy\".equals(scalePolicy.getType().getName())) {\n // Autoscaling\n image.setAutoScaling(true);\n HPA hpa = new HPA();\n hpa.setMaxReplicas(((BInteger) bScalePolicy.get(MAX_REPLICAS)).intValue());\n hpa.setMinReplicas(((BInteger) (bScalePolicy.get(\"minReplicas\"))).intValue());\n bOverridable = ((BBoolean) bScalePolicy.get(\"overridable\")).booleanValue();\n LinkedHashMap metricsMap = ((BMap) bScalePolicy.get(\"metrics\")).getMap();\n if (metricsMap.containsKey(AUTO_SCALING_METRIC_RESOURCE_CPU)) {\n hpa.addMetric(extractMetrics(metricsMap, AUTO_SCALING_METRIC_RESOURCE_CPU));\n }\n if (metricsMap.containsKey(AUTO_SCALING_METRIC_RESOURCE_MEMORY)) {\n hpa.addMetric(extractMetrics(metricsMap, AUTO_SCALING_METRIC_RESOURCE_MEMORY));\n }\n scalingPolicy.setHpa(hpa);\n } else {\n //Zero Scaling\n image.setZeroScaling(true);\n KPA kpa = new KPA();\n kpa.setMinReplicas(0);\n if (bScalePolicy.containsKey(MAX_REPLICAS)) {\n kpa.setMaxReplicas(((BInteger) bScalePolicy.get(MAX_REPLICAS)).intValue());\n }\n if (bScalePolicy.containsKey(CONCURRENCY_TARGET)) {\n kpa.setConcurrency(((BInteger) bScalePolicy.get(CONCURRENCY_TARGET)).intValue());\n }\n scalingPolicy.setKpa(kpa);\n }\n scalingPolicy.setOverridable(bOverridable);\n component.setScalingPolicy(scalingPolicy);\n }", "public VPhysicsSimple() {\n\t\tthis.particles = new ArrayList<VParticle>();\n\t\tthis.springs = new ArrayList<VSpring>();\n\t\tthis.behaviors = new ArrayList<BehaviorInterface>(1);\n\t\tthis.constraints = new ArrayList<VParticle>(10);\n\t\tsetNumIterations(50);\n\t\tsetfriction(0);\n\t}", "public CustomerPolicyProperties() {\n }", "public ProducerPlan()\r\n\t{\r\n\t\tgetLogger().info(\"Created: \"+this);\r\n\t}", "public com.vodafone.global.er.decoupling.binding.request.ProvisionSimpleUpdateServiceStatusRequest createProvisionSimpleUpdateServiceStatusRequest()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.ProvisionSimpleUpdateServiceStatusRequestImpl();\n }", "@JsonCreator\n public static NetworkPolicy fromString(String name) {\n return fromString(name, NetworkPolicy.class);\n }", "public static APIPolicy createDefaultAPIPolicyWithBandwidthLimit() {\n BandwidthLimit bandwidthLimit = new BandwidthLimit(TIME_UNIT_MONTH, 1, 1000, PolicyConstants.MB);\n QuotaPolicy defaultQuotaPolicy = new QuotaPolicy();\n defaultQuotaPolicy.setType(PolicyConstants.BANDWIDTH_TYPE);\n defaultQuotaPolicy.setLimit(bandwidthLimit);\n //set default API Policy\n APIPolicy apiPolicy = new APIPolicy(SAMPLE_API_POLICY);\n apiPolicy.setUuid(UUID.randomUUID().toString());\n apiPolicy.setDisplayName(SAMPLE_API_POLICY);\n apiPolicy.setDescription(SAMPLE_API_POLICY_DESCRIPTION);\n apiPolicy.setUserLevel(APIMgtConstants.ThrottlePolicyConstants.API_LEVEL);\n apiPolicy.setDefaultQuotaPolicy(defaultQuotaPolicy);\n return apiPolicy;\n }", "private void initializeAllocation(String allocationPorpertyName, Random random) {\n\t\tString allocations = getString(allocationPorpertyName);\n\t\tString[] allocationsAsStrings = allocations.split(\",\");\n\t\tdouble[] allocationsAsDoubles = new double[allocationsAsStrings.length];\n\t\t\n\t\tfor (int i = 0; i < allocationsAsDoubles.length; i++) {\n\t\t\tallocationsAsDoubles[i] = Double.parseDouble(allocationsAsStrings[i]);\n\t\t}\n\t\t\n\t\tif (allocationPorpertyName.equals(ABOUTS_ALLOCATIONS)) {\n\t\t\taboutsAllocations = new AllocationsUtil(allocationsAsDoubles, random);\n\t\t} else if (allocationPorpertyName.equals(MENTIONS_ALLOCATIONS)) {\n\t\t\tmentionsAllocations = new AllocationsUtil(allocationsAsDoubles, random);\n\t\t} else if (allocationPorpertyName.equals(ENTITY_POPULARITY)) {\n\t\t\tentityPopularity = new AllocationsUtil(allocationsAsDoubles, random);\n\t\t} else if (allocationPorpertyName.equals(USE_POPULAR_ENTITIES)) {\n\t\t\tusePopularEntities = new AllocationsUtil(allocationsAsDoubles, random);\n\t\t} else if (allocationPorpertyName.equals(CREATIVE_WORK_TYPES_ALLOCATION)) {\n\t\t\tcreativeWorkTypesAllocation = new AllocationsUtil(allocationsAsDoubles, random);\n\t\t} else if (allocationPorpertyName.equals(ABOUT_AND_MENTIONS_ALLOCATION)) {\n\t\t\taboutAndMentionsAllocation = new AllocationsUtil(allocationsAsDoubles, random);\n\t\t} else if (allocationPorpertyName.equals(EDITORIAL_OPERATIONS_ALLOCATION)) {\n\t\t\teditorialOperationsAllocation = new AllocationsUtil(allocationsAsDoubles, random);\n\t\t} else if (allocationPorpertyName.equals(AGGREGATION_OPERATIONS_ALLOCATION)) {\n\t\t\taggregationOperationsAllocation = new AllocationsUtil(allocationsAsDoubles, random);\n\t\t}\n\t\t\n//\t\tif (verbose) {\n//\t\t\tSystem.out.println(String.format(\"\\t%-33s : {%s}\", allocationPorpertyName, allocations));\n//\t\t}\n\t}", "static Thresholds create(final double nominalPointSpacing) {\n if (nominalPointSpacing <= 0) {\n throw new IllegalArgumentException(\n \"Nominal point spacing specification \" + nominalPointSpacing + \" is not greater than zero\"); //$NON-NLS-1$ //$NON-NLS-2$\n }\n \n /**\n * The nominal point spacing value specified in the constructor. In general,\n * this value is a rough estimate of the mean distance between neighboring\n * points (or vertices).\n */\n double ulp = Math.ulp(nominalPointSpacing);\n double precisionThreshold = PRECISION_THRESHOLD_FACTOR * ulp;\n double halfPlaneThreshold = HALF_PLANE_THRESHOLD_FACTOR * precisionThreshold;\n double inCircleThreshold = IN_CIRCLE_THRESHOLD_FACTOR * precisionThreshold;\n double delaunayThreshold = DELAUNAY_THRESHOLD_FACTOR * precisionThreshold;\n\n double vertexTolerance = nominalPointSpacing / VERTEX_TOLERANCE_FACTOR_DEFAULT;\n double vertexTolerance2 = vertexTolerance * vertexTolerance;\n \n return new Thresholds(nominalPointSpacing, halfPlaneThreshold, inCircleThreshold, delaunayThreshold, vertexTolerance, vertexTolerance2);\n }", "public final com.francetelecom.admindm.model.Parameter createPriority()\n\t\t\tthrows Fault {\n\t\tcom.francetelecom.admindm.model.Parameter param;\n\t\tparam = data.createOrRetrieveParameter(basePath + \"Priority\");\n\t\tparam.setNotification(0);\n\t\tparam.setStorageMode(StorageMode.DM_ONLY);\n\t\tparam.setType(ParameterType.UINT);\n\t\tparam.addCheck(new CheckMinimum(0));\n\t\tparam.addCheck(new CheckMaximum(4294967295L));\n\t\tparam.setValue(new Long(0));\n\t\tparam.addCheck(new CheckMaximum(99));\n\t\tparam.setWritable(false);\n\t\treturn param;\n\t}", "protected PolicySourceModel create(final Policy policy) {\n return PolicySourceModel.createPolicySourceModel(policy.getNamespaceVersion(),\n policy.getId(), policy.getName());\n }", "SUP createSUP();", "void clearPolicy() {\n policy = new Policy();\n }", "public BinaryAcceptancePolicy() {\n }", "public String getLBR_PaymentAllocationPriority();", "public void setDefaultPolicy(Policy defaultPolicy) {\n\t\tif (defaultPolicy == null)\n\t\t\tthrow new NullPointerException();\n\t\tthis.defaultPolicy = defaultPolicy;\n\t}", "public Heap() {\r\n\t\tthis(DEFAULT_INITIAL_CAPACITY, null);\r\n\t}", "public String setPolicy(String asgName, String policyName, int capacity,\n\t\t\tString adjustmentType) {\n\t\t// asClient.setRegion(usaRegion);\n\t\tPutScalingPolicyRequest request = new PutScalingPolicyRequest();\n\n\t\trequest.setAutoScalingGroupName(asgName);\n\t\trequest.setPolicyName(policyName); // This scales up so I've put up at\n\t\t\t\t\t\t\t\t\t\t\t// the end.\n\t\trequest.setScalingAdjustment(capacity); // scale up by specific capacity\n\t\trequest.setAdjustmentType(adjustmentType);\n\n\t\tPutScalingPolicyResult result = asClient.putScalingPolicy(request);\n\t\tString arn = result.getPolicyARN(); // You need the policy ARN in the\n\t\t\t\t\t\t\t\t\t\t\t// next step so make a note of it.\n\n\t\tEnableMetricsCollectionRequest request1 = new EnableMetricsCollectionRequest()\n\t\t\t\t.withAutoScalingGroupName(asgName).withGranularity(\"1Minute\");\n\t\tEnableMetricsCollectionResult response1 = asClient\n\t\t\t\t.enableMetricsCollection(request1);\n\n\t\treturn arn;\n\t}", "VM createVM();", "public EditPolicy() {\r\n super();\r\n }", "public void setScalePolicy(ScalePolicy policy) {\n\n\t}", "GenericHeap() { // default\r\n\r\n\t}", "public IpAllocationType ipAllocationType() {\n return this.innerProperties() == null ? null : this.innerProperties().ipAllocationType();\n }", "public HeapPriorityQueue () \n\t{\n\t\tthis(DEFAULT_SIZE);\n\t}", "public DefaultSimplePolicyValueTestAbstract(String s) {\n super(s);\n }", "public MinPriorityQueue(int cap)\r\n {\r\n heap = (Item[]) new Comparable[cap+1]; // reservamos un espacio adicional\r\n // para el dummy en la posicion 0\r\n size = 0;\r\n }", "Simple createSimple();", "public static SPSConfig createSPSConfig() {\n return new SPSConfig();\n }", "P createP();", "PrimitiveProperty createPrimitiveProperty();", "@VTID(17)\r\n java.lang.String getAllocationWeightExpression();", "public SharedActivationPolicyPermission(String policy, String action) {\n\tthis(policy, init(policy));\n }", "@SuppressWarnings(\"unchecked\")\r\n\tpublic MinHeap() { \r\n\t\theap = new MinHeapNode[1]; \r\n\t }", "public void setPolicy(com.vmware.converter.DVSPolicy policy) {\r\n this.policy = policy;\r\n }", "public static NewPaymentPG newPaymentPG(PaymentPG prototype) {\n return new PaymentPGImpl(prototype);\n }", "public PriorityQueue()\n {\n // initialise instance variables\n heap = new PriorityCustomer[100];\n size = 0;\n }", "public MinHeap(){\r\n nextAvail = 1;\r\n }", "AllocAlternative createAllocAlternative();", "public static void apiManagementCreateProductPolicy(\n com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {\n manager\n .productPolicies()\n .createOrUpdateWithResponse(\n \"rg1\",\n \"apimService1\",\n \"5702e97e5157a50f48dce801\",\n PolicyIdName.POLICY,\n new PolicyContractInner()\n .withValue(\n \"<policies>\\r\\n\"\n + \" <inbound>\\r\\n\"\n + \" <rate-limit calls=\\\"{{call-count}}\\\" renewal-period=\\\"15\\\"></rate-limit>\\r\\n\"\n + \" <log-to-eventhub logger-id=\\\"16\\\">\\r\\n\"\n + \" @( string.Join(\\\",\\\", DateTime.UtcNow,\"\n + \" context.Deployment.ServiceName, context.RequestId, context.Request.IpAddress,\"\n + \" context.Operation.Name) ) \\r\\n\"\n + \" </log-to-eventhub>\\r\\n\"\n + \" <quota-by-key calls=\\\"40\\\" counter-key=\\\"cc\\\" renewal-period=\\\"3600\\\"\"\n + \" increment-count=\\\"@(context.Request.Method == &quot;POST&quot; ? 1:2)\\\" />\\r\\n\"\n + \" <base />\\r\\n\"\n + \" </inbound>\\r\\n\"\n + \" <backend>\\r\\n\"\n + \" <base />\\r\\n\"\n + \" </backend>\\r\\n\"\n + \" <outbound>\\r\\n\"\n + \" <base />\\r\\n\"\n + \" </outbound>\\r\\n\"\n + \"</policies>\")\n .withFormat(PolicyContentFormat.XML),\n null,\n com.azure.core.util.Context.NONE);\n }", "public BinaryHeap(int capacity, HeapType heapType) {\n if (capacity < 1) {\n throw new IllegalArgumentException(\"Capacity must be greater that zero.\");\n } else {\n this.capacity = capacity;\n this.heapType = heapType;\n createHeap();\n }\n }", "ManagementLockObject create();", "public void setPolicyNo(java.lang.String policyNo) {\n this.policyNo = policyNo;\n }", "public void setPolicyNo(java.lang.String policyNo) {\n this.policyNo = policyNo;\n }", "public PriorityQueue(int initialCapacity, HeapType type) {\n super(PriorityQueueElement.class, initialCapacity, type);\n elementsMap = new HashMap<V, PriorityQueueElement<P, V>>();\n }", "private boolean upScaleVmNonCpuResource(final VerticalVmScaling scaling) {\n final Class<? extends ResourceManageable> resourceClass = scaling.getResourceClass();\n final ResourceManageable hostResource = scaling.getVm().getHost().getResource(resourceClass);\n final double extraAmountToAllocate = scaling.getResourceAmountToScale();\n if (!hostResource.isAmountAvailable(extraAmountToAllocate)) {\n return false;\n }\n\n final ResourceProvisioner provisioner = scaling.getVm().getHost().getProvisioner(resourceClass);\n final ResourceManageable vmResource = scaling.getVm().getResource(resourceClass);\n final double newTotalVmResource = (double) vmResource.getCapacity() + extraAmountToAllocate;\n if (!provisioner.allocateResourceForVm(scaling.getVm(), newTotalVmResource)) {\n showResourceIsUnavailable(scaling);\n return false;\n }\n\n LOGGER.info(\n \"{}: {}: {} more {} allocated to {}: new capacity is {}. Current resource usage is {}%\",\n scaling.getVm().getSimulation().clockStr(),\n scaling.getClass().getSimpleName(),\n (long) extraAmountToAllocate, resourceClass.getSimpleName(),\n scaling.getVm(), vmResource.getCapacity(),\n vmResource.getPercentUtilization() * 100);\n return true;\n }", "public Priority() {\r\n\t\tsuper();\r\n\t\t// TODO Auto-generated constructor stub\r\n\t}", "protected PolicyModelGenerator() {\n // nothing to initialize\n }", "static Sbpayment newInstance() {\n return new DefaultSbpayment();\n }", "@VTID(16)\r\n excel.XlAllocationMethod getAllocationMethod();", "ProfileStatusManager create( ProfileConfiguration profileConfiguration ) throws ProfileCreationException;", "public Allocation() {\n initComponents();\n }", "WithReplicasAndCreate withBasicSku();", "Assignment createAssignment();", "Assignment createAssignment();", "public ArrayHeapMinPQ() {\n heapArray = new ArrayList<>();\n itemMap = new HashMap<>();\n heapArray.add(null); //alway set index 0 null and heap starts from index 1.\n nextIndex = 1;\n }", "public void insert(ChargePolicy chargePolicy);", "@POST\n @Path(\"/{version:[vV][1]}/allocate\")\n @Consumes(MediaType.APPLICATION_JSON)\n @Produces(MediaType.APPLICATION_JSON)\n @Operation(description = \"Create a 3GPP Service Instance on a version provided\", responses = @ApiResponse(\n content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))\n public Response createServiceInstance(Allocate3gppService request, @PathParam(\"version\") String version,\n @Context ContainerRequestContext requestContext) throws ApiException {\n String requestId = requestHandlerUtils.getRequestId(requestContext);\n return processServiceInstanceRequest(request, Action.createInstance, version, requestId, null,\n requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));\n }", "public SimpleSemaphore2(int v) \n { this(v, v); }", "ClaimSoftgoal createClaimSoftgoal();", "public BinaryHeap() {\n }", "@Test\n public void syntheticSimple() {\n ConfigurableOperator cnb = new ConfigurableOperator(OpProps.prototype(1, Long.MAX_VALUE).cloneWithMemoryExpensive(true).cloneWithBound(false).cloneWithMemoryFactor(2.0d), ARBTRIARY_LEAF);\n ConfigurableOperator cb = new ConfigurableOperator(OpProps.prototype(1, Long.MAX_VALUE).cloneWithMemoryExpensive(true).cloneWithBound(true).cloneWithMemoryFactor(1.0d), cnb);\n Fragment f1 = new Fragment();\n f1.addOperator(cb);\n Wrapper w1 = new Wrapper(f1, 0);\n w1.overrideEndpoints(Collections.singletonList(N1));\n\n MemoryAllocationUtilities.setMemory(options, ImmutableMap.of(f1, w1), 10 + adjustReserve);\n assertEquals(Long.MAX_VALUE, cnb.getProps().getMemLimit());\n assertEquals(3, cb.getProps().getMemLimit());\n }", "@SuppressWarnings(\"unused\")\n private ZimletAclStatusPri() {\n this((String) null);\n }", "public static NewOverviewPG newOverviewPG(OverviewPG prototype) {\n return new OverviewPGImpl(prototype);\n }" ]
[ "0.61805546", "0.54398924", "0.49847862", "0.49194393", "0.48322845", "0.48273936", "0.48024118", "0.47472292", "0.47403926", "0.47342238", "0.47316644", "0.46905032", "0.46865", "0.45862162", "0.45358846", "0.4516558", "0.4513661", "0.45065054", "0.4499942", "0.4499942", "0.44921273", "0.44785917", "0.4477807", "0.4466701", "0.44520298", "0.4420076", "0.44135478", "0.4408676", "0.44004813", "0.43939397", "0.43854794", "0.43021953", "0.42888814", "0.42572704", "0.42456716", "0.42443353", "0.42351148", "0.42113796", "0.42010772", "0.41834077", "0.41820905", "0.41703668", "0.41667566", "0.41434708", "0.4138679", "0.41348308", "0.41328558", "0.41310874", "0.41290668", "0.4109241", "0.40965092", "0.40876484", "0.40826967", "0.40721267", "0.40598714", "0.40486735", "0.40421423", "0.40360886", "0.4028478", "0.40238842", "0.40086076", "0.4008265", "0.400128", "0.39906868", "0.39778924", "0.39502802", "0.3938199", "0.39363182", "0.39360952", "0.3930475", "0.39284977", "0.39082608", "0.3896418", "0.38939908", "0.3891607", "0.38834098", "0.38735172", "0.38503295", "0.38484845", "0.38423437", "0.38423437", "0.3840404", "0.38386655", "0.38313553", "0.38297784", "0.38245243", "0.38241082", "0.38221437", "0.3815906", "0.38132244", "0.38077635", "0.38077635", "0.38061717", "0.38048926", "0.38041434", "0.38040453", "0.37988865", "0.379771", "0.37862653", "0.3785949", "0.3781607" ]
0.0
-1
System.out.println("Heading: "+heading); System.out.println("Value of each row: "+rowvalues);
public void getDataType(String heading, String rowvalues) { String rowval[]=rowvalues.split(","); HashMap<String,String> hmap= new HashMap<String,String>(); //logic for datatype for(String val:rowval) { try { //checking for integer Integer.parseInt(val); hmap.put(val,"Interger"); } catch (NumberFormatException e) //exception if integer not found { //checking for string // System.out.println(val + " is String"); hmap.put(val,"String"); } try { String str1 = null; DateFormat formatter = null; Date str2 = null; if (val.matches("([0-9]{2})/([0-9]{2})/([0-9]{4})")) { formatter = new SimpleDateFormat("dd/MM/yyyy"); } else if (val.matches("([0-9]{2})-([0-9]{2})-([0-9]{4})")) { formatter = new SimpleDateFormat("dd-MM-yyyy"); } else if (val.matches("([0-9]{4})([0-9]{2})([0-9]{2})")) { formatter = new SimpleDateFormat("yyyyMMdd"); } else if (val.matches("([0-9]{4})-([0-9]{2})-([0-9]{2})")) { formatter = new SimpleDateFormat("yyyy-MM-dd"); } else if (val.matches("([0-9]{4})/([0-9]{2})/([0-9]{2})")) { formatter = new SimpleDateFormat("yyyy/MM/dd"); } //System.out.println(val + " is a valid integer number"); //checking for date str2=formatter.parse(val); hmap.put(val,"date"); } catch (Exception ex) { //Catch the Exception if date not found //hmap.put(val,"String"); } } //printing values for(Map.Entry<String, String> hm : hmap.entrySet()) { System.out.println(hm.getKey()+"--->"+hm.getValue()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void PrintResult() {\n try {\n res.beforeFirst();\n int columnsNumber = res.getMetaData().getColumnCount();\n while (res.next()) {\n for (int i = 1; i <= columnsNumber; i++) {\n if (i > 1) System.out.print(\", \");\n Object columnValue = res.getObject(i);\n System.out.print(res.getMetaData().getColumnName(i) + \" \" + columnValue);\n }\n System.out.println();\n }\n } catch (SQLException e) {\n e.printStackTrace();\n }\n }", "public void print() {\n for (int i = 0; i < headers.length; i++) {\n System.out.printf(headers[i] + \", \"); // Print column headers.\n }\n System.out.printf(\"\\n\");\n for (int i = 0; i < (data.length - 1); i++) {\n for (int j = 0; j < data[i].length; j++) {\n System.out.printf(data[i][j] + \" \"); // Print value at i,j.\n }\n System.out.printf(\"\\n\");\n }\n }", "public void readValuesfromtableWithoutHeadings()\n\t {\n\t\t open();\n\t\t List<Map<Object, String>> tab1= withColumns(\"Last Name \" ,\"First Name\",\"Email\", \"Due\" , \"Web Site\" , \"My Test\") \n\t\t\t\t .readRowsFrom(table);\n\t\t System.out.println(tab1);\n\t }", "@Test\n public void test(){\n ExcelUtil qa3Sheet = new ExcelUtil(\"src/test/resources/Vytrack testusers.xlsx\", \"QA3-short\");\n // 1 based , not 0 based\n int rowCount = qa3Sheet.rowCount();\n // 1 based, not 0 based\n int colCount = qa3Sheet.columnCount();\n System.out.println(\"rowCount = \" + rowCount);\n System.out.println(\"colCount = \" + colCount);\n\n List<String> columnsNames = qa3Sheet.getColumnsNames();\n System.out.println(\"columnsNames = \" + columnsNames);\n // 0 based, get specific cell value based on index\n String cellData = qa3Sheet.getCellData(2, 3);\n System.out.println(\"cellData = \" + cellData);\n\n // get all table values in a list\n List<Map<String, String>> dataList = qa3Sheet.getDataList();\n\n System.out.println(dataList.get(5).get(\"firstname\"));\n\n String[][] dataArray = qa3Sheet.getDataArray();\n\n System.out.println(dataArray[1][1]);\n\n }", "public String toString()\n {\n return row0 + \"\\n\" + row1 + \"\\n\" + row2 + \"\\n\" + row3;\n }", "public void displayData(){\n\n //Function to display the entries\n int i , j;\n for(i=0;i<number_of_rows;++i){\n\n for(j=0;j<number_of_cols;++j){\n\n System.out.print(dataEntries[i][j]);\n }\n System.out.println(\" \");\n }\n }", "public void printValues() {\n\t\tfor (int i = 0; i < 7; i++) {\n\t\t\tfor (int j = 0; j < 7; j++) {\n\t\t\t\tlblCenter[i][j].setText(\"\" + array.getElement(i, j));\n\t\t\t}\n\t\t\ttfWest[i].setText(\"\" + leftCol.getElement(i));\n\t\t\ttfSouth[i].setText(\"\" + bottomRow.getElement(i));\n\t\t}\n\t}", "public static void main(String[] args)\n {\n int[] array = { 32, 27, 64, 18, 95, 14, 90, 70, 60, 37 };\n System.out.printf(\"%s%8s%n\", \"Index\", \"Value\"); // column headings\n \n // output each array element's value\n for (int counter = 0; counter < array.length; counter++)\n System.out.printf(\"%5d%8d%n\", counter, array[counter]);\n}", "public void displaySelectValues(List<String> rowValues){\n\t\tfor(int i = 0; i < rowValues.size() ; i++){\n\t\t\tif(i == rowValues.size() - 1)\n\t\t\t\tSystem.out.print(rowValues.get(i));\n\t\t\telse\n\t\t\t\tSystem.out.print(rowValues.get(i) + \",\");\n\t\t}\n\t\tSystem.out.println();\n\t}", "private static void printRow(int[] row) {\r\n for (int i : row) {\r\n System.out.print(i);\r\n System.out.print(\"\\t\");\r\n }\r\n System.out.println();\r\n }", "public void show() {\n if(heading.isEmpty()) {\r\n System.out.println(\"Error:Table:show:no data in heading, nothing to show\");\r\n return;\r\n }\r\n if(rows.isEmpty()) {\r\n System.out.println(\"Error:Table:show:no data in rows, nothing to show\");\r\n return;\r\n }\r\n for(String h : heading) {\r\n System.out.print(h + \" | \");\r\n }\r\n System.out.println(\"\");\r\n Set<String> keys = rows.keySet();\r\n for(String k : keys) {\r\n rows.get(k).show();\r\n System.out.println(\"\");\r\n }\r\n System.out.println(\"\");\r\n }", "private ConfigurationHTMLPrinter doHeaderRow() {\n println(\"<tr>\").incrementIndent();\n doHeaderCell(\"Name\");\n doHeaderCell(\"Default value\");\n doHeaderCell(\"Aliases\");\n doHeaderCell(\"Value type\");\n doHeaderCell(\"Description\");\n return decrementIndent().println(\"</tr>\");\n }", "private void printContents(StringTableModel model) {\n\t\tStringBuilder buffy = new StringBuilder();\n\t\tint rows = model.getRowCount();\n\t\tint cols = model.getColumnCount();\n\t\tfor (int row = 0; row < rows; row++) {\n\t\t\tbuffy.append(\"row \" + row + \": \");\n\t\t\tfor (int col = 0; col < cols; col++) {\n\t\t\t\tObject columnValue = getModelValue(model, row, col);\n\t\t\t\tbuffy.append(columnValue).append(\", \");\n\t\t\t}\n\t\t\tbuffy.append('\\n');\n\t\t}\n\t\tSystem.out.println(\"model contents = \");\n\t\tSystem.out.println(buffy.toString());\n\t}", "public void show() {\n for (int i = 0; i < rowCount; i++) {\n for (int j = 0; j < columnCount; j++)\n System.out.printf(\"%9.4f \", data[i][j]);\n System.out.println();\n }\n }", "private void print_solution() {\n System.out.print(\"\\n\");\n for (int i = 0; i < rowsCount; i++) {\n for (int j = 0; j < colsCount; j++) {\n System.out.print(cells[i][j].getValue());\n }\n System.out.print(\"\\n\");\n }\n }", "public void printTable(){ \r\n System.out.println( \"Auction ID | Bid | Seller | Buyer \"\r\n + \" | Time | Item Info\");\r\n System.out.println(\"===========================================\"\r\n + \"========================================================================\"\r\n + \"========================\");\r\n for(Auction auctions : values()){\r\n System.out.println(auctions.toString());\r\n } \r\n }", "public static void printField(){\n System.out.println(\"---------\");\r\n for (char[] cell : output) {\r\n System.out.print(\"| \");\r\n for (char value : cell) {\r\n System.out.print(value + \" \");\r\n }\r\n System.out.print(\"|\\n\");\r\n }\r\n System.out.println(\"---------\");\r\n }", "public static void printAndValidate(Object[] headers, Collection<?> rows) throws IOException {\n\n\t\tif (headers != null) {\n\t\t\tSystem.out.println(Arrays.toString(headers));\n\t\t\tSystem.out.println(\"=======================\");\n\t\t}\n\n\t\tint rowCount = 1;\n\t\tBufferedWriter bw=null;\n//\t\tFileWriter fw=null;\n\t\tboolean append=false;\n\t\tFile outfile=new File(\"D:/javatest/PCSV/bin/out001.txt\");\n\t\t//按默认编码写出\n//\t\tfw = new FileWriter(outfile,append);\n//\t\tbw = new BufferedWriter(fw,50000);\n\t\tFileOutputStream fw=null;\n\t\tfw = new FileOutputStream(outfile,append);\n\t\t//按指定编码写出\n\t\tbw = new BufferedWriter(new OutputStreamWriter(fw, \"GBk\"),50000);\n\t\tfor (Object row : rows) {\n\t\t\tSystem.out.println((rowCount++) + \" \" + Arrays.toString((Object[]) row));\t\n\t\t\t//打印第9列\n//\t\t\tString[] srow=(String[])row;\n//\t\t\tSystem.out.println((rowCount++) + \" \" + srow[8]);\n\t\t\tbw.write(Arrays.toString((Object[]) row)+\"\\r\\n\");\n\t\t\tbw.flush();\t\t\t\n\t\t\tSystem.out.println(\"-----------------------\");\n\t\t}\n\t\tbw.close();\n\n\t}", "public void displayValues()\n {\n \tSystem.out.println(\"The name of a bicycle is \"+name);\n \tSystem.out.println(\"The cost of a bicycle is \"+cost);\n \tSystem.out.println(\"The total numer of gears \"+gears);\n \t\n \t\n }", "@Override\n public String toString(){\n return row + \",\" + column + \",\";\n }", "public void printVal()\n {\n for (int i=0;i<intData.length;i++)\n System.out.print(intData[i] + \" \");\n System.out.println();\n System.out.println(\"Sum: \" + sum + \", Avg: \" + avg + \", Prod: \" + prod);\n }", "public abstract String getHeaderRow();", "public void print() {\n\t\tfor (int i = 0; i < TABLE_SIZE; i++) {\n\t\t\tSystem.out.print(\"|\");\n\t\t\tif (array[i] != null) {\n\t\t\t\tSystem.out.print(array[i].value);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.print(\"|\\n\");\n\t}", "private void printTable() {\n System.out.println(\"COMPLETED SLR PARSE TABLE\");\n System.out.println(\"_________________________\");\n System.out.print(\"\\t|\");\n // print header\n for(int i = 0; i < pHeader.size(); i++) {\n pHeader.get(i);\n System.out.print(\"\\t\" + i + \"\\t|\");\n }\n System.out.println();\n // print body\n for(int i = 0; i < parseTable.size(); i++) {\n System.out.print(i + \"\\t|\");\n for(int j = 0; j < parseTable.get(i).size(); j++) {\n System.out.print(\"\\t\" + parseTable.get(i).get(j) + \"\\t|\");\n }\n System.out.println();\n }\n System.out.println();\n System.out.println(\"END OF SLR PARSE TABLE\");\n System.out.println();\n }", "public String toString() {\r\n return \"Row: \" + this.row + \"Column: \"+ this.col;\r\n }", "@Override\n public String toString() {\n\treturn \"\"+rowIndex+colIndex; \n }", "public void displayHashTable(HashTable2 hTable){\n\t\t\n\t\tSystem.out.println(\"Index \" + \"Value\");\n\t\tfor(int i=0; i < hTable.theArray.length; i++){\n\t\t\t\n\t\t\tSystem.out.println(\" \" + i + \" ==> \" + hTable.theArray[i] );\n\t\t\t\n\t\t}\n\t\t\n\t}", "public static void main(String[] args){\n final Object[][] table = new String[6][];\n //each line has 5 items\n table[0] = new String[] { \"Kilograms\", \"Pounds\", \"|\", \"Pounds\", \"Kilograms\" };\n table[1] = new String[] { \"1\", \"2.2 \", \"|\", \"20\", \"9.09\" };\n table[2] = new String[] { \"3\", \"6.6 \", \"|\", \"25\", \"11.36\" };\n table[3] = new String[] { \"...\", \" \", \" \", \" \", \" \" };\n table[4] = new String[] { \"197\", \"433.4 \", \"|\", \"510\", \"231.82\" };\n table[5] = new String[] { \"199\", \"437.8 \", \"|\", \"515\", \"234.09\" };\n \n for (final Object[] row : table) {\n //print out each row with proper spacing\n System.out.format(\"%15s%15s%15s%15s%15s\\n\", row);\n }\n }", "@Override\n public String toString(){\n\n ArrayList<String> headers = new ArrayList<>();\n ArrayList<String[]> records = new ArrayList<>();\n\n for(Col col : columns){\n headers.add(col.getName());\n }\n\n if(getRecordSize() < 1){\n return headers.toString();\n }\n\n for(int i = 0; i < getRecordSize(); i++){\n\n ArrayList<Rec> recs = getRecordsByRowIndex(i);\n String[] r = new String[recs.size()];\n\n for(int j = 0; j < recs.size(); j++){\n r[j] = recs.get(j).getLastEntry().getData();\n }\n\n records.add(r);\n\n }\n\n return displayTable(headers, records);\n\n }", "static void showMatrix()\n {\n String sGameField = \"Game field: \\n\";\n for (String [] row : sField) \n {\n for (String val : row) \n {\n sGameField += \" \" + val;\n }\n sGameField += \"\\n\";\n }\n System.out.println(sGameField);\n }", "public void display() {\n\tSystem.out.println(\"student id is \"+studentid+\"\\t\"+\"student name is \"+studentName+\"\\t\"+\"marks is \"+marks);\r\n}", "public int getRow()\n {\n return row;\n }", "public void print(){\n\t\tfor (int i = 0; i < numRows; i++) {\n\t\t\tfor (int j = 0; j < numCols; j++) {\n\t\t\t\tSystem.out.print(table[i][j] + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "public String print() throws JRException, IOException {\n\n// Connection con = null;\n//\n// try {\n//\n// Class.forName(\"com.mysql.jdbc.Driver\");\n// con = DriverManager.getConnection(\"jdbc:mysql://localhost:3306/hgrpweb_bd1\",\n// \"root\", \"root\");\n// } catch (Exception ex) {\n// ex.printStackTrace();\n// }\n String[] columns = new String[]{\n \"SeancesRealisesees\",\n \"NbGestantesZS\", \"NbGestantesHZ\", \"NbGestantesCPN2Plus\",\n \"DontRefereParCsZS\", \"DontRefereParCsHZ\", \"DontRefereParCsCPN2Plus\",\n \"FeAvec3CPNAu8emEt9emMoisZS\", \"FeAvec3CPNAu8emEt9emMoisHZ\",\n \"FeAyantConcultePour2emCpnZS\", \"FeAyantConcultePour2emCpnHZ\",\n \"FeAyantConcultePour3emCpnZS\", \"FeAyantConcultePour3emCpnHZ\",\n \"FeAyantConcultePour4emCpnOuPlusZS\", \"FeAyantConcultePour4emCpnOuPlusHZ\",\n \"FeARisqueDetecteesZS\", \"FeARisqueDetecteesHZ\",\n \"FeARisqueRefereesZS\", \"FeARisqueRefereesHZ\",\n \"FerAcideFolique1ereDoseZS\", \"FerAcideFolique1ereDoseHZ\",\n \"FerAcideFolique2ereDoseZS\", \"FerAcideFolique2ereDoseHZ\",\n \"FerAcideFolique3ereDoseZS\", \"FerAcideFolique3ereDoseHZ\",\n \"SulfadoxPyrimet1ereDoseZS\", \"SulfadoxPyrimet1ereDoseHZ\",\n \"SulfadoxPyrimet2ereDoseZS\", \"SulfadoxPyrimet2ereDoseHZ\",\n \"SulfadoxPyrimet3ereDoseVIHPlusZS\", \"SulfadoxPyrimet3ereDoseVIHPlusHZ\",\n \"FeAyantRecuVAT2emeA5emeDoseZS\", \"FeAyantRecuVAT2emeA5emeDoseHZ\",\n \"FeAyantCompletementVaccineesAvantGrossesseZS\", \"FeAyantCompletementVaccineesAvantGrossesseHZ\",\n \"FeEnceintesAyantAcquisUneMilZS\", \"FeEnceintesAyantAcquisUneMilHZ\",\n \"FeEnceintesAyantRecuMebendazole2emeTrimZS\", \"FeEnceintesAyantRecuMebendazole2emeTrimHZ\",\n \"VAT1ZS\", \"VAT1HZ\",\n \"VAT2ZS\", \"VAT2HZ\",\n \"VAT3ZS\", \"VAT3HZ\",\n \"VAT4ZS\", \"VAT4HZ\",\n \"VAT5ZS\", \"VAT5HZ\",\n \"QuiOntEteConseilleePourTestZS\", \"QuiOntEteConseilleePourTestHZ\",\n \"QuiOntEteTesteePourVIHZS\", \"QuiOntEteTesteePourVIHHZ\",\n \"QuiOnteuTestPositifZS\", \"QuiOnteuTestPositifHZ\",\n \"QuiOnEteInformeeDuResultatZS\", \"QuiOnEteInformeeDuResultatHZ\",\n \"QuiOnEuTestPositifEtInformeeDuResultatZS\", \"QuiOnEuTestPositifEtInformeeDuResultatHZ\",\n \"QuiOntEuGrossesseALIssuDunViolZS\", \"QuiOntEuGrossesseALIssuDunViolHZ\",\n \"NBAccouchementVIHPlus\", \"dontAyantRecuTritherapie\",\n \"NBEnfantsNesDeMereVIHPlus\", \"dontAyantPrislaTritherapie\",\n \"NbConsultationsZS\", \"NbConsultationsHZ\",\n \"NbConsultationsCPoN2Plus42eJr\", \"NbAccouchementAyantRecuVitamineZS\",\n \"NbAccouchementAyantRecuVitamineHZ\", \"NbAccouchementAyantRecuFerAcideFoliqueZS\",\n \"NbAccouchementAyantRecuFerAcideFoliqueHZ\", \"NbFemmeAyantPresenteeComplicationApresAccouchement\"};\n String[][] data = new String[][]{{\n \"1024\",\n NbGestantesZS(), NbGestantesHZ(), NbGestantesCPN2Plus(), DontRefereParCsZS(), DontRefereParCsHZ(), DontRefereParCsCPN2Plus(),\n FeAvec3CPNAu8emEt9emMoisZS(), FeAvec3CPNAu8emEt9emMoisHZ(), FeAyantConcultePour2emCpnZS(), FeAyantConcultePour2emCpnHZ(), FeAyantConcultePour3emCpnZS(), FeAyantConcultePour3emCpnHZ(),\n FeAyantConcultePour4emCpnOuPlusZS(), FeAyantConcultePour4emCpnOuPlusHZ(), FeARisqueDetecteesZS(), FeARisqueDetecteesHZ(), FeARisqueRefereesZS(), FeARisqueRefereesHZ(),\n FerAcideFolique1ereDoseZS(), FerAcideFolique1ereDoseHZ(), FerAcideFolique2ereDoseZS(), FerAcideFolique2ereDoseHZ(), FerAcideFolique3ereDoseZS(), FerAcideFolique3ereDoseHZ(),\n SulfadoxPyrimet1ereDoseZS(), SulfadoxPyrimet1ereDoseHZ(), SulfadoxPyrimet2ereDoseZS(), SulfadoxPyrimet2ereDoseHZ(), SulfadoxPyrimet3ereDoseVIHPlusZS(), SulfadoxPyrimet3ereDoseVIHPlusHZ(),\n FeAyantRecuVAT2emeA5emeDoseZS(), FeAyantRecuVAT2emeA5emeDoseHZ(), FeAyantCompletementVaccineesAvantGrossesseZS(), FeAyantCompletementVaccineesAvantGrossesseHZ(), FeEnceintesAyantAcquisUneMilZS(), FeEnceintesAyantAcquisUneMilHZ(),\n FeEnceintesAyantRecuMebendazole2emeTrimZS(), FeEnceintesAyantRecuMebendazole2emeTrimHZ(), VAT1ZS(), VAT1HZ(), VAT2ZS(), VAT2HZ(),\n VAT3ZS(), VAT3HZ(), VAT4ZS(), VAT4HZ(), VAT5ZS(), VAT5HZ(),\n QuiOntEteConseilleePourTestZS(), QuiOntEteConseilleePourTestHZ(), QuiOntEteTesteePourVIHZS(), QuiOntEteTesteePourVIHHZ(), QuiOnteuTestPositifZS(), QuiOnteuTestPositifHZ(),\n QuiOnEteInformeeDuResultatZS(), QuiOnEteInformeeDuResultatHZ(), QuiOnEuTestPositifEtInformeeDuResultatZS(), QuiOnEuTestPositifEtInformeeDuResultatHZ(), QuiOntEuGrossesseALIssuDunViolZS(), QuiOntEuGrossesseALIssuDunViolHZ(),\n NBAccouchementVIHPlus(), dontAyantRecuTritherapie(), NBEnfantsNesDeMereVIHPlus(), dontAyantPrislaTritherapie(), NbConsultationsZS(), NbConsultationsHZ(),\n NbConsultationsCPoN2Plus42eJr(), NbAccouchementAyantRecuVitamineZS(), NbAccouchementAyantRecuVitamineHZ(), NbAccouchementAyantRecuFerAcideFoliqueZS(), NbAccouchementAyantRecuFerAcideFoliqueHZ(), NbFemmeAyantPresenteeComplicationApresAccouchement()}};\n\n String reportPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath(\"/rapports/cpn.jasper\");\n JasperPrint jasperPrint = JasperFillManager.fillReport(reportPath, null, new JRTableModelDataSource(new JTable(data, columns).getModel()));\n HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();\n httpServletResponse.setContentType(\"application/pdf\");\n httpServletResponse.addHeader(\"Content-disposition\", \"inline; filename=Rapport mensuel.pdf\");\n ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();\n servletOutputStream.write(JasperExportManager.exportReportToPdf(jasperPrint));\n servletOutputStream.flush();\n servletOutputStream.close();\n FacesContext.getCurrentInstance().renderResponse();\n FacesContext.getCurrentInstance().responseComplete();\n return null;\n }", "public static void printResultSet( ResultSet rs ) throws SQLException {\n ResultSetMetaData rsmd = rs.getMetaData();\n int columnCount;\n int labelLength;\n int k;\n int i;\n String line = \"\";\n String label = null;\n \n columnCount = rsmd.getColumnCount();\n for (k=1; k<=columnCount; k++) {\n label = rsmd.getColumnLabel( k );\n System.out.print( label + '\\t' );\n \n // construct line with exact same length as the label\n labelLength = label.length();\n label = \"\";\n for (i=0; i<labelLength; i++)\n label += '=';\n line += label + '\\t';\n }\n \n System.out.println();\n System.out.println(line);\n \n while ( rs.next() ) {\n for (k=1; k<=columnCount; k++) {\n System.out.print( rs.getString( k ) + '\\t' );\n }\n \n System.out.println();\n }\n \n System.out.println();\n }", "private String printRow(Result res){\n Iterator<Pair<String ,byte[]>> iter =outList.iterator();\n String row = \"\";\n while(iter.hasNext()){\n Pair<String ,byte[]> col = iter.next();\n String val = appendFromCol(col.getFirst(), res);\n row += val + delim;\n }\n // strip out last delim\n return row.substring(0, row.length()-1);\n }", "public String toString()\n\t{\n\t\treturn _RowData.toString();\n\t}", "public String toString() {\n return row + \",\" + col;\n }", "public String toString(){\r\n return \"{\"+ this.getRowIndex()+\",\"+ this.getColumnIndex()+\"}\";\r\n }", "public void displayTable() {\n System.out.print(\"\\nSpreadsheet Table Details :\\nRows : \" + rowHeaders + \"\\nColumns:\" + colHeaders);\n new SheetParser(tableData).displaySheet();\n }", "public void extractAllRows()\n\n\t{\n\t\topen();\n\n\t\tList<WebElement> rows= inTable(table).getRowElements();\n\t\tfor(WebElement e :rows)\n\t\t{\n\t\t\tSystem.out.println(e.getText());\n\t\t}\n\t}", "public List getRows() \n {\n return rows;\n }", "@Override\n public String toString() {\n //create a string in the following format “<row>,<column>”\n String out = \"\";\n out += row + \", \" + column;\n return out;\n }", "public void printTable() {\n System.out.print(\"\\033[H\\033[2J\"); // Clear the text in console\n System.out.println(getCell(0, 0) + \"|\" + getCell(0, 1) + \"|\" + getCell(0, 2));\n System.out.println(\"-+-+-\");\n System.out.println(getCell(1, 0) + \"|\" + getCell(1, 1) + \"|\" + getCell(1, 2));\n System.out.println(\"-+-+-\");\n System.out.println(getCell(2, 0) + \"|\" + getCell(2, 1) + \"|\" + getCell(2, 2));\n }", "@Override\r\n public String toString() {\r\n StringBuilder sb = new StringBuilder();\r\n for (int i = 0; i < dimension; i++) {\r\n sb.append(rowToString(i)).append(\"\\n\");\r\n }\r\n //remove the last unnecessary carriage return from the string.\r\n return sb.toString().substring(0, sb.length() - 1);\r\n }", "public double[] getRowVals() {\n return rowVals;\n }", "@Override\r\n public String toString() { return new String( \"(\" + row + \", \" + col + \")\" ); }", "public void get_TableValues(){\r\n\tFFM=99;\r\n\tADFM=99;\r\n\tDF=0;\r\n\tFLOAD=0;\r\n\t\r\n}", "public void print() {\n int rows = this.getNumRows();\n int cols = this.getNumColumns();\n\n for (int r = 0; r < rows; r++) {\n\n for (int c = 0; c < cols; c++) {\n System.out.print(this.getString(r, c) + \", \");\n }\n\n System.out.println(\" \");\n }\n }", "public String toString() {\n return String.format(\"%s%s\", column, row);\n }", "public void print() {\n\n for (int i = 0; i < this.rows; i++) {\n for (int j = 0; j < this.cols; j++) {\n System.out.format(\"%.4f\", data[i][j]);\n if (j != this.cols - 1)\n System.out.print(\" \");\n }\n System.out.println(\"\");\n }\n }", "protected void _printTableRow(int index, Vector v) {\n System.out.print(index + \") \");\n for (int i = 0; i < v.size(); ++i) {\n System.out.print(\"\\t\\\"\" + v.elementAt(i) + \"\\\"\");\n }\n System.out.println();\n }", "public int getRowNum(){ return this.rowNum; }", "public final void printAndValidate(Map<String, List<String[]>> allRows) {\n\t\tfor (Map.Entry<String, List<String[]>> e : allRows.entrySet()) {\n\t\t\tprintln(\"Rows of '\" + e.getKey() + \"'\\n-----------------------\");\n\t\t\tfor (String[] row : e.getValue()) {\n\t\t\t\tprintln(Arrays.toString(row));\n\t\t\t}\n\t\t}\n\t\t//printAndValidate();\n\t}", "public void readTableData2() {\n\t\tint colCount = driver.findElements(By.xpath(\"//*[@id='industry-filter-results']/div[2]/table/tbody/tr[1]/th\"))\n\t\t\t\t.size();\n\t\tSystem.out.println(\"colCount\" + colCount);\n\t\t// Find row size\n\t\tint rowCount = driver\n\t\t\t\t.findElements(By.xpath(\"//*[@id='industry-filter-results']/div[2]/table/tbody/tr/td/parent::*\")).size();\n\t\tSystem.out.println(\"rowCount\" + rowCount);\n\t\t// Find xpath for 1st row and 1st column. Break into multiple parts such\n\t\t// that row and column no can be iterated.\n\t\tString firstPart = \"(//*[@id='industry-filter-results']/div[2]/table/tbody/tr/td[2]/parent::tr)[\";\n\t\tString secondPart = \"]\";\n\t\t// Loop through rows one by one. Start from 1st row till row count.\n\t\tfor (int i = 1; i <= rowCount; i++) {\n\t\t\t\tString finalPart = firstPart + i + secondPart;\n\t\t\t\tSystem.out.println(finalPart);\n\t\t\t\tString text = driver.findElement(By.xpath(finalPart)).getText();\n\t\t\t\tSystem.out.print(text + \" | \");\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "@Override\r\n public String toString() { return \"{\" + rowIndex + \", \" + colIndex + '}'; }", "public void readTableData1() {\n\t\t// Find row size\n\t\tList<WebElement> rowCount = driver.findElements(By.xpath(\"//*[@id='industry-filter-results']/div[2]/table/tbody/tr/td/parent::*\"));\n\t\tfor(WebElement data:rowCount){\n\t\t\tSystem.out.println(data.getText());\n\t\t}\n\t}", "public static void printFitnessErrors(String header, DoubleMatrix matrix) {\n\t\tSystem.out.println(header);\n\t\tSystem.out.print(\"[ \");\n\t\tfor(int i = 0; i < matrix.getColumns(); i++) {\n\t\t\tfor(int j = 0 ; j < matrix.getRows(); j++) {\n\t\t\t\tSystem.out.printf(\"%.3f \", matrix.get(i, j));\n\t\t\t}\t\t\t\n\t\t}\n\t\tSystem.out.print(\"]\\n\");\n\t}", "public Row[] getRows() {return rows;}", "private ArrayList<String[]> getTableRowData() \n {\n int numRow, numCol;\n ArrayList<String[]> data = new ArrayList<>();\n numRow = jtModel.getRowCount(); \n numCol = jtModel.getColumnCount();\n String[] row;\n for(int i = 0; i< numRow; i++)\n {\n row = new String[numCol];\n for(int j = 0; j< numCol; j++)\n {\n row[j] = jtModel.getValueAt(i, j).toString();\n } \n data.add(row);\n } \n return data;\n }", "for( int i=0;i<=rowcount;i++)\r\n \r\n {\r\n XSSFRow row=sheet.getRow(i);\r\n XSSFCell cell=row.getCell(0);\r\n String s=cell.toString(); // for reading multiple data types from Excel sheet\r\n System.out.println(s);\r\n \r\n }", "private void printHeader () {\n System.out.println(\"COMPLETED HEADER PARSING\");\n System.out.println(\"________________________\");\n for(String header : parseTableHeader.keySet()) {\n System.out.print(header);\n System.out.println(parseTableHeader.get(header));\n }\n }", "void displayColumnHeaders() {\n\t\tSystem.out.print(\" \");\n\t\tfor (int j = 0; j < 3; j++)\n\t\t\tSystem.out.print(\"|col \" + j);\n\t\tSystem.out.println();\n\t}", "void displayValues(int[][] matrixCID){\n\t\tSystem.out.println(\"CID\\tPOP\\tLENGTH\\tCSIZE\\tCHUNKS\");\n\t\tfor(int i = 0; i < matrixCID.length; i++){\n\t\t\tfor(int j = 0; j < matrixCID[i].length; j++){\n\t\t\t\tSystem.out.print(matrixCID[i][j]+\"\\t\");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\t\n\t}", "public String toString() {\n return \"mass||\" + iMass + \"\\t\\tintensity||\" + iIntensity;\n\n }", "@Override\r\n\t public void onEachRow(String rowID, O2GRow rowData) {\n\t O2GTableColumnCollection collection = rowData.getColumns();\r\n\t for (int i = 0; i < collection.size(); i++) {\r\n\t O2GTableColumn column = collection.get(i);\r\n\t System.out.println(column.getId() + \"=\" + rowData.getCell(i) + \";\");\r\n\t }\r\n\t\t}", "private static void printOutput (int[][] results)\n {\n for (int i=0; i<=results[0].length-1; i++)\n {\n System.out.println(results[0][i] +\",\"+ results[1][i]);\n }\n System.out.println();\n }", "public void printAllValues ()\n\t{\n\t\tfor (int index = 0; index < count; index = index + 1 ) {\n\t\t\t\n\t\t\tif (index%5 == 0){\n\t\t\t\t\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t\t\n\t\tSystem.out.print(array1[index] + \"\\t\");\t\n\t\t}\n\t}", "public String toString()\n\t{\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(\" 1 2 3 4 5 6 7 8\\n\");\n\t\tfor(int i = 0; i < 8; i++)\n\t\t{\n\t\t\tsb.append((char) (i + FIRST_ROW) + \" \");\n\t\t\tfor(int i2 = 0; i2 < 8; i2++)\n\t\t\t{\n\t\t\t\tsb.append(\" \" + fields[i][i2]);\n\t\t\t\tif(i2 == 7)\n\t\t\t\t{\n\t\t\t\t\tsb.append(\"\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn sb.toString();\n\t}", "public void display() {\n\t\tdisplayColumnHeaders();\n\t\taddHyphens();\n\t\tfor (int row = 0; row < 3; row++) {\n\t\t\taddSpaces();\n\t\t\tSystem.out.print(\" row \" + row + ' ');\n\t\t\tfor (int col = 0; col < 3; col++)\n\t\t\t\tSystem.out.print(\"| \" + getMark(row, col) + \" \");\n\t\t\tSystem.out.println(\"|\");\n\t\t\taddSpaces();\n\t\t\taddHyphens();\n\t\t}\n\t}", "public static void printOutputs(String header, DoubleMatrix left, DoubleMatrix right) {\t\n\t\tSystem.out.println(header);\n\t\tfor(int i = 0; i < left.getRows(); i++) {\n\t\t\tif(left.get(i, 0) < 0) {\n\t\t\t\tSystem.out.printf(\"[%.3f \",left.get(i, 0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.printf(\"[ %.3f \",left.get(i, 0));\n\t\t\t}\n\t\t\t\n\t\t\tif(left.get(i, 0) < 0) {\n\t\t\t\tSystem.out.printf(\"%.3f ]\\n\",right.get(i, 0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.printf(\" %.3f ]\\n\",right.get(i, 0));\n\t\t\t}\n\t\t}\n\t}", "public void displayGrid()\n {\n\t\t\n\tfor (int y=0; y<cases.length; y++)\n\t{\n for (int x=0; x<cases[y].length; x++)\n {\n\t\tSystem.out.print(\"|\"+cases[y][x].getValue());\n }\n System.out.println(\"|\");\n\t}\n }", "public static void printAll() {\n // Print all the data in the hashtable\n RocksIterator iter = db.newIterator();\n\n for (iter.seekToFirst(); iter.isValid(); iter.next()) {\n System.out.println(new String(iter.key()) + \"\\t=\\t\" + ByteIntUtilities.convertByteArrayToDouble(iter.value()));\n }\n\n iter.close();\n }", "public void browseAllCells() throws IOException, InvalidFormatException {\n Sheet sheet = workbook.getSheetAt(0);\n\n // Create a DataFormatter to format and get each cell's value as String\n DataFormatter dataFormatter = new DataFormatter();\n\n System.out.println(\"\\n\\nIterating over Rows and Columns using Iterator\\n\");\n Iterator<Row> rowIterator = sheet.rowIterator();\n while (rowIterator.hasNext()) {\n Row row = rowIterator.next();\n\n // Now let's iterate over the columns of the current row\n Iterator<Cell> cellIterator = row.cellIterator();\n\n while (cellIterator.hasNext()) {\n Cell cell = cellIterator.next();\n String cellValue = dataFormatter.formatCellValue(cell);\n System.out.print(cellValue + \"\\t\");\n }\n System.out.println();\n }\n // Closing the workbook\n this.workbook.close();\n\n\n }", "public void print() {\r\n\r\n\t\tfor (int row=0; row<10; row++) \r\n\t\t{\r\n\t\t\tfor (int col=0; col<10; col++)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.print(\"\\t\"+nums[row][col]); //separated by tabs\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\t}", "public String toString () {\n return \"(\" + col + \",\" + row + \")\";\n }", "public static void main(String args[]) throws Exception\n {\n Class.forName(\"com.mysql.jdbc.Driver\");\n Connection con = DriverManager.getConnection(\"jdbc:mysql://localhost:3306/sql\",\"root\",\"\");\n Statement stmt = con.createStatement(); //Default method for ResultSet.TYPE_FORWARD_ONLY\n \n // send a SQL query to retrieve records\n ResultSet res = stmt.executeQuery(\"select *from CM\");\n // process the data\n \n int idIndex = res.findColumn(\"id\");\n int nameIndex = res.findColumn(\"name\");\nint ageIndex = res.findColumn(\"age\");\nint addressIndex = res.findColumn(\"address\");\nint salaryIndex=res.findColumn(\"salary\");\n\nwhile(res.next()) {\n int id =res.getInt(idIndex);\n String name = res.getString (nameIndex);\n int age = res.getInt (ageIndex);\n String address = res.getString (addressIndex);\n String salary =res.getString(salaryIndex);\n \n System.out.println(res.getInt(idIndex) \n + \"\\t\" + res.getString(nameIndex) + \n \"\\t\" +res.getInt(ageIndex) + \n \"\\t\" + res.getString(addressIndex) + \n \"\\t\"+ res.getDouble(salaryIndex));\n}\n // close the database connection\n res.close();\n stmt.close();\n con.close();\n }", "public void printResults(ResultSet resultSet) throws SQLException {\n\t\tResultSetMetaData rsmd = resultSet.getMetaData();\n\t\tint columnsNumber = rsmd.getColumnCount();\n\t\tint count = 1;\n\t\twhile (resultSet.next()) {\n\t\t\tSystem.out.println(\"Record: \" + count);\n\t\t for (int i = 1; i <= columnsNumber; i++) {\n\t\t String columnValue = resultSet.getString(i);\n\t\t System.out.print(rsmd.getColumnName(i) + \": \" + columnValue + \", \");\n\t\t }\n\t\t System.out.println(\"\");\n\t\t count++;\n\t\t}\n\t}", "RowValues createRowValues();", "public static void printToScreen(ResultSetMetaData metaData, ResultSet results) throws SQLException {\n results.last();\n int numberOfRows = results.getRow();\n int numberOfColumns = metaData.getColumnCount();\n\n //store column names\n String[] columnNames = new String[numberOfColumns];\n for (int i = 1; i <= numberOfColumns; i++) {\n String columnName = metaData.getColumnName(i);\n columnNames[i - 1] = columnName;\n }\n\n //print results\n results.first();\n for (int i = 0; i < numberOfRows; i++) {\n\n String columnName = \"\";\n for (int c = 0; c < numberOfColumns; c++) {\n columnName = columnNames[c];\n String value;\n if (columnName.equals(\"population\")) {\n value = String.valueOf(results.getInt(columnName));\n } else {\n value = results.getString(columnName);\n }\n System.out.print(columnName + \"= \" + value + \" \");\n }\n System.out.println();\n results.next();\n }\n }", "public void printData()\n {\n reader.printData();\n }", "public void displayResult()\n {\n for(int i = 0; i < this.etatPopulation.size(); i++)\n {\n String line = \"\";\n for (int j = 0; j < this.etatPopulation.get(i).size(); j++)\n {\n line += this.etatPopulation.get(i).get(j).toString() + \" \";\n }\n System.out.println(line);\n }\n }", "public void parseAndPrintRecords() {\n ArrayList<Employee> employees;\n\n employees = parseData(data);\n\n System.out.printf(\"%10s%10s%10s\\n\", \"Last\", \"First\", \"Salary\");\n for(Employee employee : employees) {\n System.out.printf(\"%10s%10s%10d\\n\", employee.lName, employee.fName, employee.salary);\n }\n\n }", "public static void main(String[] args) throws IOException, InvalidFormatException {\n Workbook workbook = WorkbookFactory.create(new File(SAMPLE_XLSX_FILE_PATH));\r\n\r\n // Retrieving the number of sheets in the Workbook\r\n System.out.println(\"Workbook has \" + workbook.getNumberOfSheets() + \" Sheets : \");\r\n\r\n /*\r\n =============================================================\r\n Iterating over all the sheets in the workbook (Multiple ways)\r\n =============================================================\r\n */\r\n\r\n // 1. You can obtain a sheetIterator and iterate over it\r\n Iterator<Sheet> sheetIterator = workbook.sheetIterator();\r\n System.out.println(\"Retrieving Sheets using Iterator\");\r\n while (sheetIterator.hasNext()) {\r\n Sheet sheet = sheetIterator.next();\r\n System.out.println(\"=> \" + sheet.getSheetName());\r\n int noOfRows = sheet.getLastRowNum();\r\n System.out.println(\"Number of Rows are \" + \"\" + noOfRows);\r\n }\r\n\r\n\r\n\r\n /*\r\n ==================================================================\r\n Iterating over all the rows and columns in a Sheet (Multiple ways)\r\n ==================================================================\r\n */\r\n \r\n // Getting the Sheet at index zero\r\n Sheet sheet = workbook.getSheetAt(0);\r\n\r\n // Create a DataFormatter to format and get each cell's value as String\r\n DataFormatter dataFormatter = new DataFormatter();\r\n\r\n // 1. You can obtain a rowIterator and columnIterator and iterate over them\r\n System.out.println(\"\\n\\nIterating over Rows and Columns using Iterator\\n\");\r\n Iterator<Row> rowIterator = sheet.rowIterator();\r\n int noOfColumns=0;\r\n \r\n while (rowIterator.hasNext()) {\r\n Row row =(Row) rowIterator.next();\r\n\r\n // Now let's iterate over the columns of the current row\r\n Iterator<Cell> cellIterator = row.cellIterator();\r\n \r\n while (cellIterator.hasNext()) {\r\n Cell cell = cellIterator.next();\r\n String cellValue = dataFormatter.formatCellValue(cell);\r\n System.out.print(cellValue + \"\\t\");\r\n \r\n }\r\n System.out.println();\r\n\r\n noOfColumns=row.getLastCellNum();\r\n //System.out.println(\"Number of Columns are ******* \" + \"\" + noOfColumns);\r\n }\r\n \r\n int noOfRows = sheet.getLastRowNum();\r\n System.out.println(\"Number of Rows are \" + \"\" + noOfRows);\r\n System.out.println(\"Number of Columns are \" + \"\" + noOfColumns);\r\n \r\n \r\n \r\n \r\n \r\n // Getting the Sheet at index zero\r\n Sheet sheet1 = workbook.getSheetAt(1);\r\n System.out.println(\"\\n\\nName of Sheet:\"+ sheet1);\r\n\r\n // Create a DataFormatter to format and get each cell's value as String\r\n DataFormatter dataFormatter1 = new DataFormatter();\r\n\r\n // 1. You can obtain a rowIterator and columnIterator and iterate over them\r\n System.out.println(\"\\nIterating over Rows and Columns using Iterator\\n\");\r\n Iterator<Row> rowIterator1 = sheet1.rowIterator();\r\n int noOfColumns1=0;\r\n \r\n while (rowIterator1.hasNext()) {\r\n Row row =(Row) rowIterator1.next();\r\n\r\n // Now let's iterate over the columns of the current row\r\n Iterator<Cell> cellIterator = row.cellIterator();\r\n \r\n while (cellIterator.hasNext()) {\r\n Cell cell = cellIterator.next();\r\n String cellValue = dataFormatter1.formatCellValue(cell);\r\n System.out.print(cellValue + \"\\t\");\r\n \r\n }\r\n System.out.println();\r\n\r\n noOfColumns1=row.getLastCellNum();\r\n //System.out.println(\"Number of Columns are ******* \" + \"\" + noOfColumns);\r\n }\r\n \r\n int noOfRows1 = sheet1.getLastRowNum();\r\n System.out.println(\"Number of Rows are \" + \"\" + noOfRows1);\r\n System.out.println(\"Number of Columns are \" + \"\" + noOfColumns1);\r\n \r\n \r\n \r\n \r\n \r\n // Getting the Sheet at index zero\r\n Sheet sheet11 = workbook.getSheetAt(2);\r\n System.out.println(\"\\n\\nName of Sheet:\"+ sheet11);\r\n \r\n // Create a DataFormatter to format and get each cell's value as String\r\n DataFormatter dataFormatter11 = new DataFormatter();\r\n\r\n // You can obtain a rowIterator and columnIterator and iterate over them\r\n System.out.println(\"\\n\\nIterating over Rows and Columns using Iterator\\n\");\r\n Iterator<Row> rowIterator11 = sheet11.rowIterator();\r\n int noOfColumns11=0;\r\n \r\n while (rowIterator11.hasNext()) {\r\n Row row =(Row) rowIterator11.next();\r\n\r\n // Now let's iterate over the columns of the current row\r\n Iterator<Cell> cellIterator = row.cellIterator();\r\n \r\n while (cellIterator.hasNext()) {\r\n Cell cell = cellIterator.next();\r\n String cellValue = dataFormatter11.formatCellValue(cell);\r\n System.out.print(cellValue + \"\\t\");\r\n \r\n }\r\n System.out.println();\r\n\r\n noOfColumns11=row.getLastCellNum();\r\n //System.out.println(\"Number of Columns are ******* \" + \"\" + noOfColumns);\r\n }\r\n \r\n int noOfRows11 = sheet11.getLastRowNum();\r\n System.out.println(\"Number of Rows are \" + \"\" + noOfRows11);\r\n System.out.println(\"Number of Columns are \" + \"\" + noOfColumns11);\r\n // Closing the workbook\r\n workbook.close();\r\n }", "public String toString()\n {\n final String NEWLINE = System.getProperty(\"line.separator\");\n StringBuffer result = new StringBuffer(table).append(NEWLINE);\n for (Iterator iterator = data.keySet().iterator();\n iterator.hasNext(); )\n {\n String column = (String) iterator.next();\n result\n .append(\"\\t\")\n .append(column)\n .append(\" = \")\n .append(isColumnNull(column) ? \"NULL\" : data.get(column))\n .append(NEWLINE)\n ;\n }\n \n return result.toString();\n }", "void printData()\n {\n System.out.println(\"Studentname=\" +name);\n System.out.println(\"Student city =\"+city);\n System.out.println(\"Student age = \"+age);\n }", "static public void printTable(int list[][])\r\n\t{\r\n\t\tfor(int i = 0; i < h; i++)\r\n\t\t{\r\n\t\t\tfor(int j = 0; j < w; j++)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.print(list[i][j] + \" \");\r\n\t\t\t}\r\n\t\t\tSystem.out.println(\"\");\r\n\t\t}\r\n\t}", "public void displayHuffCodesTable() {\n\t\tStringBuffer toPrint = new StringBuffer();\n\t\t\n\t\tfor (int i = 0; i < this.huffCodeVals.length; i++) {\n\t\t\t\n\t\t\tif (this.huffCodeVals[i] != null) {\n\t\t\t\tif (i == 9) {\n\t\t\t\t\ttoPrint.append(\"\\\\t\");\n\t\t\t\t\t\n\t\t\t\t} else if (i == 10) {\n\t\t\t\t\ttoPrint.append(\"\\\\n\");\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\ttoPrint.append((char) i);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttoPrint.append(\":\" + this.huffCodeVals[i] + \"\\n\");\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(toPrint.toString());\n\t}", "public void outDisTable()\n\t{\n\t\tfor(int i = 0; i < sqNum; i++)\n\t\t{\n\t\t\tfor(int j = 0; j < sqNum; j++)\n\t\t\t{\n\t\t\t\tSystem.out.printf(\"%-18s\", \"[\" + i + \",\" + j + \"]:\" + String.format(\" %.8f\", dm[i][j]));\n\t\t\t}\n\t\t\tSystem.out.print(\"\\r\\n\");\n\t\t}\n\t}", "@Override\n public String toString() {\n StringBuilder matrixValues = new StringBuilder(\"\\nMatrix : \"\n + values.length + \"x\" + values[0].length + \"\\n\");\n for (int[] row : values) {\n for (int value : row) {\n matrixValues.append(value + \" \");\n }\n matrixValues.append(\"\\n\");\n }\n return matrixValues.toString();\n }", "public static void printResults(ArrayList<Map<String, String>> myTable){\n\t\tfor(Map<String, String> dataTable: myTable){\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.print(\"[\");\n\t\t\tfor(Map.Entry<String, String> dataMap: dataTable.entrySet()){\n\t\t\t\tSystem.out.print(\"[\"+dataMap.getKey() + \", \" + dataMap.getValue() + \"]\");\n\t\t\t}\n\t\t\tSystem.out.print(\"]\");\n\t\t}\n\t\tSystem.out.println();\n\t}", "public int getRow()\n {\n return row;\n }", "public void printTable(){\n \tfor (int i = 0; i < Table.size(); i++) {\n \t\tList<T> data = Table.get(i);\n \t\ttry {\n \t\t\tSystem.out.println(\"Bucket: \" + i);\n \t\t\tSystem.out.println(data.getFirst());\n \t\t\tSystem.out.println(\"+ \" + (data.getLength() - 1) + \" more at this bucket\\n\\n\");\n \t\t} catch (NoSuchElementException e) {\n \t\t\tSystem.out.println(\"This bucket is empty.\\n\\n\");\n \t\t}\n \t}\n }", "private void printData() {\n\n\t\tfor (int i = 0; i < data.size(); i++) {\n\t\t\tlog(\" *** data index \" + i + \" = \" + data.elementAt(i));\n\t\t}\n\t}", "@Override\n\tpublic String toString(){\n\t\tStringBuilder sb=new StringBuilder();\n\t\tif(!isHeading){\n\t\t\tsb.append(timestamp);\n\t\t\tfor(Object val: values){\n\t\t\t\tsb.append(\" , \").append(String.valueOf(val));\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tfor(int i=0;i<values.length;i++){\n\t\t\t\tif(i>0)sb.append(\" , \");\n\t\t\t\tsb.append(String.valueOf(values[i]));\n\t\t\t}\n\t\t}\n\t\treturn sb.toString();\n\t}", "public int getRows() {\n\treturn rows;\n }", "public void print() {\n\t\t\n\t\tfor (int j = 0; j < height(); j++) {\n\t\t\tfor (int i = 0; i < width(); i++) {\n\t\t\t\tSystem.out.printf(\"%3d \", valueAt(i, j));\n\t\t\t}\n\t\t\tSystem.out.printf(\"\\n\");\n\t\t}\n\t\tSystem.out.printf(\"\\n\");\t\n\t}", "public void printTable() {\r\n \tif (table.size() == 0)\r\n Logger.error(\"Table \" + table.getType() + \" is empty!\");\r\n else {\r\n table.forEachRow(new EachRowListenerPrint());\r\n }\r\n }", "public int row();", "public int getRow(){\r\n // return statement\r\n return row;\r\n }", "public int getRow()\r\n {\r\n return row;\r\n }" ]
[ "0.6950462", "0.6666129", "0.6491755", "0.6406187", "0.6375102", "0.6304926", "0.626485", "0.626223", "0.6099751", "0.6084485", "0.6076777", "0.60582817", "0.6052625", "0.6014599", "0.6003203", "0.59865075", "0.5952564", "0.5933239", "0.5927785", "0.59163207", "0.59021735", "0.58816916", "0.58625185", "0.58584976", "0.58552927", "0.58389634", "0.5807616", "0.5791065", "0.5767997", "0.5761934", "0.5756099", "0.5743529", "0.5738365", "0.57343924", "0.57242334", "0.57075167", "0.5707174", "0.5688892", "0.56885654", "0.56869054", "0.568474", "0.5683662", "0.567652", "0.56705534", "0.5670512", "0.5664989", "0.5654427", "0.5640674", "0.5637744", "0.56335723", "0.56327784", "0.5629608", "0.56236947", "0.56235194", "0.56179863", "0.5614307", "0.56091994", "0.56059116", "0.55962616", "0.55935735", "0.5573986", "0.5568276", "0.5566453", "0.55660284", "0.5553731", "0.55410653", "0.55382854", "0.55302274", "0.55290574", "0.55261815", "0.5526004", "0.5522327", "0.5520789", "0.55177164", "0.5513025", "0.5508026", "0.5505583", "0.5500108", "0.5495256", "0.549484", "0.54928213", "0.5488733", "0.5483169", "0.54813296", "0.5481182", "0.54804176", "0.5480271", "0.5476127", "0.54615545", "0.5461143", "0.5458228", "0.5453558", "0.54530656", "0.5447613", "0.54449683", "0.54363596", "0.5435922", "0.5435326", "0.54245013", "0.54228044", "0.5421789" ]
0.0
-1
Create an entity for this test. This is a static method, as tests for other entities might also need it, if they test an entity which requires the current entity.
public static Skill createEntity(EntityManager em) { Skill skill = new Skill().name(DEFAULT_NAME).agentSharing(DEFAULT_AGENT_SHARING); return skill; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Entity createEntity();", "T createEntity();", "protected abstract ENTITY createEntity();", "void create(E entity);", "void create(T entity);", "E create(E entity);", "E create(E entity);", "TestEntity buildEntity () {\n TestEntity testEntity = new TestEntity();\n testEntity.setName(\"Test name\");\n testEntity.setCheck(true);\n testEntity.setDateCreated(new Date(System.currentTimeMillis()));\n testEntity.setDescription(\"description\");\n\n Specialization specialization = new Specialization();\n specialization.setName(\"Frontend\");\n specialization.setLevel(\"Senior\");\n specialization.setYears(10);\n\n testEntity.setSpecialization(specialization);\n\n return testEntity;\n }", "protected abstract EntityBase createEntity() throws Exception;", "public static TestEntity createEntity(EntityManager em) {\n TestEntity testEntity = new TestEntity();\n // Add required entity\n User user = UserResourceIntTest.createEntity(em);\n em.persist(user);\n em.flush();\n testEntity.setUserOneToMany(user);\n return testEntity;\n }", "void create(T entity) throws Exception;", "@Override\n protected void createEntity() {\n ProjectStatus status = createProjectStatus(5);\n setEntity(status);\n }", "protected T createSimulatedExistingEntity() {\n final T entity = createNewEntity();\n entity.setId(IDUtil.randomPositiveLong());\n\n when(getDAO().findOne(entity.getId())).thenReturn(entity);\n return entity;\n }", "public Entity newEntity() { return newMyEntity(); }", "public Entity newEntity() { return newMyEntity(); }", "public static TranshipTube createEntity(EntityManager em) {\n TranshipTube transhipTube = new TranshipTube()\n .status(DEFAULT_STATUS)\n .memo(DEFAULT_MEMO)\n .columnsInTube(DEFAULT_COLUMNS_IN_TUBE)\n .rowsInTube(DEFAULT_ROWS_IN_TUBE);\n // Add required entity\n TranshipBox transhipBox = TranshipBoxResourceIntTest.createEntity(em);\n em.persist(transhipBox);\n em.flush();\n transhipTube.setTranshipBox(transhipBox);\n // Add required entity\n FrozenTube frozenTube = FrozenTubeResourceIntTest.createEntity(em);\n em.persist(frozenTube);\n em.flush();\n transhipTube.setFrozenTube(frozenTube);\n return transhipTube;\n }", "public static Student createEntity(EntityManager em) {\n Student student = new Student()\n .firstName(DEFAULT_FIRST_NAME)\n .middleName(DEFAULT_MIDDLE_NAME)\n .lastName(DEFAULT_LAST_NAME)\n .studentRegNumber(DEFAULT_STUDENT_REG_NUMBER)\n .dateOfBirth(DEFAULT_DATE_OF_BIRTH)\n .regDocType(DEFAULT_REG_DOC_TYPE)\n .registrationDocumentNumber(DEFAULT_REGISTRATION_DOCUMENT_NUMBER)\n .gender(DEFAULT_GENDER)\n .nationality(DEFAULT_NATIONALITY)\n .dateJoined(DEFAULT_DATE_JOINED)\n .deleted(DEFAULT_DELETED)\n .wxtJwtPq55wd(DEFAULT_WXT_JWT_PQ_55_WD);\n // Add required entity\n NextOfKin nextOfKin;\n if (TestUtil.findAll(em, NextOfKin.class).isEmpty()) {\n nextOfKin = NextOfKinResourceIT.createEntity(em);\n em.persist(nextOfKin);\n em.flush();\n } else {\n nextOfKin = TestUtil.findAll(em, NextOfKin.class).get(0);\n }\n student.getRelatives().add(nextOfKin);\n return student;\n }", "@PostConstruct\n protected void initNewEntity() {\n setNewEntity(getService().create());\n }", "public static Emprunt createEntity(EntityManager em) {\n Emprunt emprunt = new Emprunt()\n .dateEmprunt(DEFAULT_DATE_EMPRUNT)\n .dateRetour(DEFAULT_DATE_RETOUR);\n // Add required entity\n Usager usager = UsagerResourceIntTest.createEntity(em);\n em.persist(usager);\n em.flush();\n emprunt.setUsager(usager);\n // Add required entity\n Exemplaire exemplaire = ExemplaireResourceIntTest.createEntity(em);\n em.persist(exemplaire);\n em.flush();\n emprunt.setExemplaire(exemplaire);\n return emprunt;\n }", "@Override\n public EntityResponse createEntity(String entitySetName, OEntity entity) {\n return super.createEntity(entitySetName, entity);\n }", "public ClientEntity newEntity() {\r\n if (entityType == null) {\r\n entityType = getEntityType(entitySet);\r\n }\r\n return odataClient.getObjectFactory().newEntity(new FullQualifiedName(NAMESPAVE, entityType));\r\n }", "ID create(T entity);", "public static MotherBed createEntity(EntityManager em) {\n MotherBed motherBed = new MotherBed()\n .value(DEFAULT_VALUE)\n .status(DEFAULT_STATUS);\n // Add required entity\n Nursery nursery = NurseryResourceIntTest.createEntity(em);\n em.persist(nursery);\n em.flush();\n motherBed.setNursery(nursery);\n return motherBed;\n }", "@Override\n public EntityResponse createEntity(String entitySetName, OEntityKey entityKey, String navProp, OEntity entity) {\n return super.createEntity(entitySetName, entityKey, navProp, entity);\n }", "private FailingEntity createFailingEntity() {\n FailingEntity entity = app.createAndManageChild(EntitySpec.create(FailingEntity.class)\n .configure(FailingEntity.FAIL_ON_START, true));\n return entity;\n }", "public <T extends Entity> T createEntity(EntitySpec<T> spec) {\n Map<String,Entity> entitiesByEntityId = MutableMap.of();\n Map<String,EntitySpec<?>> specsByEntityId = MutableMap.of();\n \n T entity = createEntityAndDescendantsUninitialized(spec, entitiesByEntityId, specsByEntityId);\n initEntityAndDescendants(entity.getId(), entitiesByEntityId, specsByEntityId);\n return entity;\n }", "public static Prestamo createEntity(EntityManager em) {\n Prestamo prestamo = new Prestamo().observaciones(DEFAULT_OBSERVACIONES).fechaFin(DEFAULT_FECHA_FIN);\n // Add required entity\n Libro libro;\n if (TestUtil.findAll(em, Libro.class).isEmpty()) {\n libro = LibroResourceIT.createEntity(em);\n em.persist(libro);\n em.flush();\n } else {\n libro = TestUtil.findAll(em, Libro.class).get(0);\n }\n prestamo.setLibro(libro);\n // Add required entity\n Persona persona;\n if (TestUtil.findAll(em, Persona.class).isEmpty()) {\n persona = PersonaResourceIT.createEntity(em);\n em.persist(persona);\n em.flush();\n } else {\n persona = TestUtil.findAll(em, Persona.class).get(0);\n }\n prestamo.setPersona(persona);\n // Add required entity\n User user = UserResourceIT.createEntity(em);\n em.persist(user);\n em.flush();\n prestamo.setUser(user);\n return prestamo;\n }", "default E create(E entity)\n throws TechnicalException, ConflictException {\n return create(entity, null);\n }", "public static Rentee createEntity(EntityManager em) {\n Rentee rentee = new Rentee();\n rentee = new Rentee()\n .firstName(DEFAULT_FIRST_NAME)\n .lastName(DEFAULT_LAST_NAME)\n .email(DEFAULT_EMAIL)\n .phoneNumber(DEFAULT_PHONE_NUMBER)\n .password(DEFAULT_PASSWORD);\n return rentee;\n }", "public static Pocket createEntity(EntityManager em) {\n Pocket pocket = new Pocket()\n .key(DEFAULT_KEY)\n .label(DEFAULT_LABEL)\n .startDateTime(DEFAULT_START_DATE_TIME)\n .endDateTime(DEFAULT_END_DATE_TIME)\n .amount(DEFAULT_AMOUNT)\n .reserved(DEFAULT_RESERVED);\n // Add required entity\n Balance balance = BalanceResourceIntTest.createEntity(em);\n em.persist(balance);\n em.flush();\n pocket.setBalance(balance);\n return pocket;\n }", "public static ItemSubstitution createEntity(EntityManager em) {\n ItemSubstitution itemSubstitution = new ItemSubstitution()\n .timestamp(DEFAULT_TIMESTAMP)\n .type(DEFAULT_TYPE)\n .substituteType(DEFAULT_SUBSTITUTE_TYPE)\n .substituteNo(DEFAULT_SUBSTITUTE_NO)\n .description(DEFAULT_DESCRIPTION)\n .isInterchangeable(DEFAULT_IS_INTERCHANGEABLE)\n .relationsLevel(DEFAULT_RELATIONS_LEVEL)\n .isCheckedToOriginal(DEFAULT_IS_CHECKED_TO_ORIGINAL)\n .origCheckDate(DEFAULT_ORIG_CHECK_DATE);\n // Add required entity\n Item item;\n if (TestUtil.findAll(em, Item.class).isEmpty()) {\n item = ItemResourceIT.createEntity(em);\n em.persist(item);\n em.flush();\n } else {\n item = TestUtil.findAll(em, Item.class).get(0);\n }\n itemSubstitution.getItems().add(item);\n return itemSubstitution;\n }", "E create(E entity, RequestContext context)\n throws TechnicalException, ConflictException;", "public static A createEntity(EntityManager em) {\n A a = new A();\n return a;\n }", "public static Edge createEntity(EntityManager em) {\n Edge edge = new Edge()\n .description(DEFAULT_DESCRIPTION);\n // Add required entity\n Stone from = StoneResourceIntTest.createEntity(em);\n em.persist(from);\n em.flush();\n edge.setFrom(from);\n // Add required entity\n Stone to = StoneResourceIntTest.createEntity(em);\n em.persist(to);\n em.flush();\n edge.setTo(to);\n return edge;\n }", "public static QuizQuestion createEntity(EntityManager em) {\n QuizQuestion quizQuestion = new QuizQuestion()\n .text(DEFAULT_TEXT)\n .description(DEFAULT_DESCRIPTION);\n // Add required entity\n Quiz quiz;\n if (TestUtil.findAll(em, Quiz.class).isEmpty()) {\n quiz = QuizResourceIT.createEntity(em);\n em.persist(quiz);\n em.flush();\n } else {\n quiz = TestUtil.findAll(em, Quiz.class).get(0);\n }\n quizQuestion.setQuiz(quiz);\n return quizQuestion;\n }", "public static Partida createEntity(EntityManager em) {\n Partida partida = new Partida()\n .dataPartida(DEFAULT_DATA_PARTIDA);\n return partida;\n }", "public T create(T entity) {\n\t \tgetEntityManager().getTransaction().begin();\n\t getEntityManager().persist(entity);\n\t getEntityManager().getTransaction().commit();\n\t getEntityManager().close();\n\t return entity;\n\t }", "public static Emprunt createEntity(EntityManager em) {\n Emprunt emprunt = new Emprunt()\n .dateEmprunt(DEFAULT_DATE_EMPRUNT);\n return emprunt;\n }", "public static SitAndGo createEntity(EntityManager em) {\n SitAndGo sitAndGo = new SitAndGo()\n .format(DEFAULT_FORMAT)\n .buyIn(DEFAULT_BUY_IN)\n .ranking(DEFAULT_RANKING)\n .profit(DEFAULT_PROFIT)\n .bounty(DEFAULT_BOUNTY);\n return sitAndGo;\n }", "public static Exercise createEntity(EntityManager em) {\n Exercise exercise = new Exercise()\n .minutes(DEFAULT_MINUTES);\n return exercise;\n }", "@Override\n\tpublic Entity createEntity() {\n\t\tEntity entity = new Entity(LINKS_ENTITY_KIND);\n\t\tentity.setProperty(id_property, ID);\n\t\tentity.setProperty(url_property, url);\n\t\tentity.setProperty(CategoryID_property, CategoryID);\n\t\tentity.setProperty(note_property, note);\n\t\tentity.setProperty(createdOn_property, createdOn);\n\t\tentity.setProperty(updatedOn_property, updatedOn);\t\t\t\n\t\treturn entity;\n\t}", "public static House createEntity(EntityManager em) {\n House house = new House()\n .houseName(DEFAULT_HOUSE_NAME)\n .houseNo(DEFAULT_HOUSE_NO)\n .address(DEFAULT_ADDRESS)\n .houseToFloorNo(DEFAULT_HOUSE_TO_FLOOR_NO)\n .ownToFloorNo(DEFAULT_OWN_TO_FLOOR_NO)\n .lat(DEFAULT_LAT)\n .lon(DEFAULT_LON)\n .createdate(DEFAULT_CREATEDATE)\n .createBy(DEFAULT_CREATE_BY)\n .updateDate(DEFAULT_UPDATE_DATE)\n .updateBy(DEFAULT_UPDATE_BY)\n .image(DEFAULT_IMAGE)\n .imageContentType(DEFAULT_IMAGE_CONTENT_TYPE);\n // Add required entity\n Country country = CountryResourceIntTest.createEntity(em);\n em.persist(country);\n em.flush();\n house.setCountry(country);\n // Add required entity\n State state = StateResourceIntTest.createEntity(em);\n em.persist(state);\n em.flush();\n house.setState(state);\n // Add required entity\n City city = CityResourceIntTest.createEntity(em);\n em.persist(city);\n em.flush();\n house.setCity(city);\n // Add required entity\n Profile profile = ProfileResourceIntTest.createEntity(em);\n em.persist(profile);\n em.flush();\n house.setProfile(profile);\n // Add required entity\n User user = UserResourceIntTest.createEntity(em);\n em.persist(user);\n em.flush();\n house.setUser(user);\n return house;\n }", "public static CourtType createEntity(EntityManager em) {\n CourtType courtType = new CourtType()\n .type(DEFAULT_TYPE);\n return courtType;\n }", "@Override\r\n public void createNewEntity(String entityName) {\n\r\n }", "public static Ailment createEntity(EntityManager em) {\n Ailment ailment = new Ailment()\n .name(DEFAULT_NAME)\n .symptoms(DEFAULT_SYMPTOMS)\n .treatments(DEFAULT_TREATMENTS);\n return ailment;\n }", "public static Articulo createEntity(EntityManager em) {\n Articulo articulo = new Articulo()\n .titulo(DEFAULT_TITULO)\n .contenido(DEFAULT_CONTENIDO)\n .fechaCreacion(DEFAULT_FECHA_CREACION);\n return articulo;\n }", "void create(Student entity);", "public static TipoLocal createEntity(EntityManager em) {\n TipoLocal tipoLocal = new TipoLocal()\n .tipo(DEFAULT_TIPO);\n return tipoLocal;\n }", "public static Testtable2 createEntity(EntityManager em) {\n Testtable2 testtable2 = new Testtable2();\n testtable2.setColumn2(DEFAULT_COLUMN_2);\n return testtable2;\n }", "@Override\n\tprotected CoreEntity createNewEntity() {\n\t\treturn null;\n\t}", "public static OrderItem createEntity(EntityManager em) {\n OrderItem orderItem = new OrderItem().quantity(DEFAULT_QUANTITY).totalPrice(DEFAULT_TOTAL_PRICE).status(DEFAULT_STATUS);\n return orderItem;\n }", "public static Arrete createEntity(EntityManager em) {\n Arrete arrete = new Arrete()\n .intituleArrete(DEFAULT_INTITULE_ARRETE)\n .numeroArrete(DEFAULT_NUMERO_ARRETE)\n .dateSignature(DEFAULT_DATE_SIGNATURE)\n .nombreAgrement(DEFAULT_NOMBRE_AGREMENT);\n return arrete;\n }", "public static Tenant createEntity() {\n return new Tenant();\n }", "public static MyOrders createEntity(EntityManager em) {\n MyOrders myOrders = new MyOrders();\n return myOrders;\n }", "public static Enseigner createEntity(EntityManager em) {\n Enseigner enseigner = new Enseigner().dateDebut(DEFAULT_DATE_DEBUT).dateFin(DEFAULT_DATE_FIN);\n return enseigner;\n }", "@Test\n public void eventEntityConstructionTest() {\n\n Event event = new EventEntity();\n\n assertThat(event).isNotNull();\n\n }", "public static EnteteVente createEntity(EntityManager em) {\n EnteteVente enteteVente = new EnteteVente()\n .enteteVenteType(DEFAULT_ENTETE_VENTE_TYPE)\n .enteteVenteTotalHT(DEFAULT_ENTETE_VENTE_TOTAL_HT)\n .enteteVenteTotalTTC(DEFAULT_ENTETE_VENTE_TOTAL_TTC)\n .enteteVenteDateCreation(DEFAULT_ENTETE_VENTE_DATE_CREATION);\n return enteteVente;\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 static Organizer createEntity(EntityManager em) {\n Organizer organizer = new Organizer()\n .name(DEFAULT_NAME)\n .description(DEFAULT_DESCRIPTION)\n .facebook(DEFAULT_FACEBOOK)\n .twitter(DEFAULT_TWITTER);\n // Add required entity\n User user = UserResourceIntTest.createEntity(em);\n em.persist(user);\n em.flush();\n organizer.setUser(user);\n return organizer;\n }", "public static Note createEntity(EntityManager em) {\n Note note = new Note().content(DEFAULT_CONTENT).title(DEFAULT_TITLE).xpos(DEFAULT_XPOS).ypos(DEFAULT_YPOS);\n return note;\n }", "public static FillingGapsTestItem createEntity(EntityManager em) {\n FillingGapsTestItem fillingGapsTestItem = new FillingGapsTestItem()\n .question(DEFAULT_QUESTION);\n return fillingGapsTestItem;\n }", "public Entity build();", "@Test\n public void createQuejaEntityTest() {\n PodamFactory factory = new PodamFactoryImpl();\n QuejaEntity newEntity = factory.manufacturePojo(QuejaEntity.class);\n QuejaEntity result = quejaPersistence.create(newEntity);\n\n Assert.assertNotNull(result);\n QuejaEntity entity = em.find(QuejaEntity.class, result.getId());\n Assert.assertNotNull(entity);\n Assert.assertEquals(newEntity.getName(), entity.getName());\n}", "public abstract boolean create(T entity) throws ServiceException;", "public static Acheteur createEntity(EntityManager em) {\n Acheteur acheteur = new Acheteur()\n .typeClient(DEFAULT_TYPE_CLIENT)\n .nom(DEFAULT_NOM)\n .prenom(DEFAULT_PRENOM)\n .tel(DEFAULT_TEL)\n .cnib(DEFAULT_CNIB)\n .email(DEFAULT_EMAIL)\n .adresse(DEFAULT_ADRESSE)\n .numroBanquaire(DEFAULT_NUMRO_BANQUAIRE)\n .deleted(DEFAULT_DELETED);\n return acheteur;\n }", "public static RoomGenericProduct createEntity(EntityManager em) {\n RoomGenericProduct roomGenericProduct = new RoomGenericProduct()\n .quantity(DEFAULT_QUANTITY)\n .quantityUnit(DEFAULT_QUANTITY_UNIT);\n return roomGenericProduct;\n }", "public static TypeOeuvre createEntity(EntityManager em) {\n TypeOeuvre typeOeuvre = new TypeOeuvre()\n .intitule(DEFAULT_INTITULE);\n return typeOeuvre;\n }", "public static Reservation createEntity(EntityManager em) {\n Reservation reservation = ReservationTest.buildReservationTest(1L);\n //reservation.setUser(User.builder().email(\"adfad\").name(\"\").build());\n return reservation;\n }", "@Test\n public void testNewEntity() throws Exception {\n\n }", "public static Model createEntity(EntityManager em) {\n\t\tModel model = new Model().name(DEFAULT_NAME).type(DEFAULT_TYPE).algorithm(DEFAULT_ALGORITHM)\n\t\t\t\t.status(DEFAULT_STATUS).owner(DEFAULT_OWNER).performanceMetrics(DEFAULT_PERFORMANCE_METRICS)\n\t\t\t\t.modelLocation(DEFAULT_MODEL_LOCATION).featureSignificance(DEFAULT_FEATURE_SIGNIFICANCE)\n\t\t\t\t.builderConfig(DEFAULT_BUILDER_CONFIG).createdDate(DEFAULT_CREATED_DATE)\n\t\t\t\t.deployedDate(DEFAULT_DEPLOYED_DATE).trainingDataset(DEFAULT_TRAINING_DATASET)\n .library(DEFAULT_LIBRARY).project(DEFAULT_PROJECT).version(DEFAULT_VERSION);\n\t\treturn model;\n\t}", "public static ProcessExecution createEntity(EntityManager em) {\n ProcessExecution processExecution = new ProcessExecution()\n .execution(DEFAULT_EXECUTION);\n return processExecution;\n }", "public static Paiement createEntity(EntityManager em) {\n Paiement paiement = new Paiement()\n .dateTransation(DEFAULT_DATE_TRANSATION)\n .montantTTC(DEFAULT_MONTANT_TTC);\n return paiement;\n }", "public static Article createEntity(EntityManager em) {\n Article article = new Article()\n .name(DEFAULT_NAME)\n .content(DEFAULT_CONTENT)\n .creationDate(DEFAULT_CREATION_DATE)\n .modificationDate(DEFAULT_MODIFICATION_DATE);\n return article;\n }", "T makePersistent(T entity);", "void buildFromEntity(E entity);", "public static XepLoai createEntity(EntityManager em) {\n XepLoai xepLoai = new XepLoai()\n .tenXepLoai(DEFAULT_TEN_XEP_LOAI);\n return xepLoai;\n }", "public static Lot createEntity(EntityManager em) {\n Lot lot = new Lot()\n .createdAt(DEFAULT_CREATED_AT)\n .updatedAt(DEFAULT_UPDATED_AT)\n .qte(DEFAULT_QTE)\n .qtUg(DEFAULT_QT_UG)\n .num(DEFAULT_NUM)\n .dateFabrication(DEFAULT_DATE_FABRICATION)\n .peremption(DEFAULT_PEREMPTION)\n .peremptionstatus(DEFAULT_PEREMPTIONSTATUS);\n return lot;\n }", "private MetaEntityImpl createMetaEntity(Class<?> entityType) {\n String className = entityType.getSimpleName();\n MetaEntityImpl managedEntity = new MetaEntityImpl();\n managedEntity.setEntityType(entityType);\n managedEntity.setName(className);\n ((MetaTableImpl) managedEntity.getTable()).setName(className);\n ((MetaTableImpl) managedEntity.getTable()).setKeySpace(environment.getConfiguration().getKeySpace());\n return managedEntity;\n }", "public TransporteTerrestreEntity createTransporte(TransporteTerrestreEntity transporteEntity) throws BusinessLogicException {\n LOGGER.log(Level.INFO, \"Inicia proceso de creación del transporte\");\n super.createTransporte(transporteEntity);\n\n \n persistence.create(transporteEntity);\n LOGGER.log(Level.INFO, \"Termina proceso de creación del transporte\");\n return transporteEntity;\n }", "public static TaskComment createEntity(EntityManager em) {\n TaskComment taskComment = new TaskComment()\n .value(DEFAULT_VALUE);\n // Add required entity\n Task newTask = TaskResourceIT.createEntity(em);\n Task task = TestUtil.findAll(em, Task.class).stream()\n .filter(x -> x.getId().equals(newTask.getId()))\n .findAny().orElse(null);\n if (task == null) {\n task = newTask;\n em.persist(task);\n em.flush();\n }\n taskComment.setTask(task);\n return taskComment;\n }", "public static EmployeeCars createEntity(EntityManager em) {\n EmployeeCars employeeCars = new EmployeeCars()\n .previousReading(DEFAULT_PREVIOUS_READING)\n .currentReading(DEFAULT_CURRENT_READING)\n .workingDays(DEFAULT_WORKING_DAYS)\n .updateDate(DEFAULT_UPDATE_DATE);\n // Add required entity\n Employee employee = EmployeeResourceIT.createEntity(em);\n em.persist(employee);\n em.flush();\n employeeCars.setEmployee(employee);\n // Add required entity\n Car car = CarResourceIT.createEntity(em);\n em.persist(car);\n em.flush();\n employeeCars.setCar(car);\n return employeeCars;\n }", "public static Personel createEntity(EntityManager em) {\n Personel personel = new Personel()\n .fistname(DEFAULT_FISTNAME)\n .lastname(DEFAULT_LASTNAME)\n .sexe(DEFAULT_SEXE);\n return personel;\n }", "public static Ordre createEntity(EntityManager em) {\n Ordre ordre = new Ordre()\n .name(DEFAULT_NAME)\n .status(DEFAULT_STATUS)\n .price(DEFAULT_PRICE)\n .creationDate(DEFAULT_CREATION_DATE);\n return ordre;\n }", "public static Territorio createEntity(EntityManager em) {\n Territorio territorio = new Territorio().nome(DEFAULT_NOME);\n return territorio;\n }", "@Override\n @LogMethod\n public T create(T entity) throws InventoryException {\n \tInventoryHelper.checkNull(entity, \"entity\");\n repository.persist(entity);\n return repository.getByKey(entity.getId());\n }", "public static Poen createEntity(EntityManager em) {\n Poen poen = new Poen()\n .tip(DEFAULT_TIP);\n return poen;\n }", "public static Expediente createEntity(EntityManager em) {\n Expediente expediente = new Expediente()\n .horarioEntrada(DEFAULT_HORARIO_ENTRADA)\n .horarioSaida(DEFAULT_HORARIO_SAIDA)\n .diaSemana(DEFAULT_DIA_SEMANA);\n return expediente;\n }", "public static Unidade createEntity(EntityManager em) {\n Unidade unidade = new Unidade()\n .descricao(DEFAULT_DESCRICAO)\n .sigla(DEFAULT_SIGLA)\n .situacao(DEFAULT_SITUACAO)\n .controleDeEstoque(DEFAULT_CONTROLE_DE_ESTOQUE)\n .idAlmoxarifado(DEFAULT_ID_ALMOXARIFADO)\n .andar(DEFAULT_ANDAR)\n .capacidade(DEFAULT_CAPACIDADE)\n .horarioInicio(DEFAULT_HORARIO_INICIO)\n .horarioFim(DEFAULT_HORARIO_FIM)\n .localExame(DEFAULT_LOCAL_EXAME)\n .rotinaDeFuncionamento(DEFAULT_ROTINA_DE_FUNCIONAMENTO)\n .anexoDocumento(DEFAULT_ANEXO_DOCUMENTO)\n .setor(DEFAULT_SETOR)\n .idCentroDeAtividade(DEFAULT_ID_CENTRO_DE_ATIVIDADE)\n .idChefia(DEFAULT_ID_CHEFIA);\n // Add required entity\n TipoUnidade tipoUnidade;\n if (TestUtil.findAll(em, TipoUnidade.class).isEmpty()) {\n tipoUnidade = TipoUnidadeResourceIT.createEntity(em);\n em.persist(tipoUnidade);\n em.flush();\n } else {\n tipoUnidade = TestUtil.findAll(em, TipoUnidade.class).get(0);\n }\n unidade.setTipoUnidade(tipoUnidade);\n return unidade;\n }", "public void spawnEntity(AEntityB_Existing entity){\r\n\t\tBuilderEntityExisting builder = new BuilderEntityExisting(entity.world.world);\r\n\t\tbuilder.loadedFromSavedNBT = true;\r\n\t\tbuilder.setPositionAndRotation(entity.position.x, entity.position.y, entity.position.z, (float) -entity.angles.y, (float) entity.angles.x);\r\n\t\tbuilder.entity = entity;\r\n\t\tworld.spawnEntity(builder);\r\n }", "public static Book createEntity() {\n Book book = new Book()\n .idBook(DEFAULT_ID_BOOK)\n .isbn(DEFAULT_ISBN)\n .title(DEFAULT_TITLE)\n .author(DEFAULT_AUTHOR)\n .year(DEFAULT_YEAR)\n .publisher(DEFAULT_PUBLISHER)\n .url_s(DEFAULT_URL_S)\n .url_m(DEFAULT_URL_M)\n .url_l(DEFAULT_URL_L);\n return book;\n }", "private void createTestData() {\n StoreEntity store = new StoreEntity();\n store.setStoreName(DEFAULT_STORE_NAME);\n store.setPecEmail(DEFAULT_PEC);\n store.setPhone(DEFAULT_PHONE);\n store.setImagePath(DEFAULT_IMAGE_PATH);\n store.setDefaultPassCode(STORE_DEFAULT_PASS_CODE);\n store.setStoreCap(DEFAULT_STORE_CAP);\n store.setCustomersInside(DEFAULT_CUSTOMERS_INSIDE);\n store.setAddress(new AddressEntity());\n\n // Create users for store.\n UserEntity manager = new UserEntity();\n manager.setUsercode(USER_CODE_MANAGER);\n manager.setRole(UserRole.MANAGER);\n\n UserEntity employee = new UserEntity();\n employee.setUsercode(USER_CODE_EMPLOYEE);\n employee.setRole(UserRole.EMPLOYEE);\n\n store.addUser(manager);\n store.addUser(employee);\n\n // Create a new ticket.\n TicketEntity ticket = new TicketEntity();\n ticket.setPassCode(INIT_PASS_CODE);\n ticket.setCustomerId(INIT_CUSTOMER_ID);\n ticket.setDate(new Date(new java.util.Date().getTime()));\n\n ticket.setArrivalTime(new Time(new java.util.Date().getTime()));\n ticket.setPassStatus(PassStatus.VALID);\n ticket.setQueueNumber(INIT_TICKET_QUEUE_NUMBER);\n store.addTicket(ticket);\n\n // Persist data.\n em.getTransaction().begin();\n\n em.persist(store);\n em.flush();\n\n // Saving ID generated from SQL after the persist.\n LAST_TICKET_ID = ticket.getTicketId();\n LAST_STORE_ID = store.getStoreId();\n LAST_MANAGER_ID = manager.getUserId();\n LAST_EMPLOYEE_ID = employee.getUserId();\n\n em.getTransaction().commit();\n }", "@Test\n public void testNewEntity_0args() {\n // newEntity() is not implemented!\n }", "public Camp newEntity() { return new Camp(); }", "public static NoteMaster createEntity(EntityManager em) {\n NoteMaster noteMaster = new NoteMaster()\n .semestre(DEFAULT_SEMESTRE)\n .noteCC1(DEFAULT_NOTE_CC_1)\n .noteCC2(DEFAULT_NOTE_CC_2)\n .noteFinal(DEFAULT_NOTE_FINAL)\n .date(DEFAULT_DATE);\n return noteMaster;\n }", "T create() throws PersistException;", "private EntityDef createEntityDef(Class<?> entityClass)\n {\n\t\tif (entityClass.isAnnotationPresent(InheritanceSingleTable.class)) {\n return new SingleTableSubclass.SingleTableSuperclass(entityClass);\n } else if (entityClass.getSuperclass().isAnnotationPresent(InheritanceSingleTable.class)) {\n return new SingleTableSubclass(entityClass);\n } else {\n return new EntityDef(entityClass);\n }\n\t}", "public static Restaurant createEntity(EntityManager em) {\n Restaurant restaurant = new Restaurant()\n .restaurantName(DEFAULT_RESTAURANT_NAME)\n .deliveryPrice(DEFAULT_DELIVERY_PRICE)\n .restaurantAddress(DEFAULT_RESTAURANT_ADDRESS)\n .restaurantCity(DEFAULT_RESTAURANT_CITY);\n return restaurant;\n }", "@Override\n\tpublic EmploieType creer(EmploieType entity) throws InvalideTogetException {\n\t\treturn emploieTypeRepository.save(entity);\n\t}", "public static Team createEntity(EntityManager em) {\n Team team = new Team().name(DEFAULT_NAME).description(DEFAULT_DESCRIPTION)\n .level(DEFAULT_LEVEL).totalMember(DEFAULT_TOTAL_MEMBER)\n .extraGroupName(DEFAULT_EXTRA_GROUP_NAME)\n .extraGroupDescription(DEFAULT_EXTRA_GROUP_DESCRIPTION)\n .extraGroupTotalMember(DEFAULT_EXTRA_GROUP_TOTAL_MEMBER);\n return team;\n }", "public static Produit createEntity(EntityManager em) {\n Produit produit = new Produit()\n .designation(DEFAULT_DESIGNATION)\n .soldeInit(DEFAULT_SOLDE_INIT)\n .prixAchat(DEFAULT_PRIX_ACHAT)\n .prixVente(DEFAULT_PRIX_VENTE)\n .quantiteDispo(DEFAULT_QUANTITE_DISPO)\n .quantiteInit(DEFAULT_QUANTITE_INIT)\n .seuilReaprov(DEFAULT_SEUIL_REAPROV)\n .reference(DEFAULT_REFERENCE);\n return produit;\n }", "public void constructEntity (EntityBuilder entityBuilder, Position position){\n entityBuilder.createEntity();\n entityBuilder.buildPosition(position);\n entityBuilder.buildName();\n entityBuilder.buildPosition();\n entityBuilder.buildContComp();\n entityBuilder.buildPhysComp(length, width);\n entityBuilder.buildGraphComp(length, width);\n }" ]
[ "0.77223766", "0.75040364", "0.7487764", "0.7361146", "0.7314088", "0.7155444", "0.7155444", "0.71508443", "0.71501833", "0.7076941", "0.7016207", "0.68038535", "0.6752083", "0.6740013", "0.6740013", "0.67108333", "0.6680824", "0.6665985", "0.663898", "0.6624753", "0.66239864", "0.66062766", "0.6588076", "0.65741205", "0.65738904", "0.6565422", "0.65507466", "0.65312135", "0.65289855", "0.64802164", "0.6419721", "0.6386806", "0.63750476", "0.63672817", "0.631241", "0.62969697", "0.6293083", "0.62576646", "0.62457734", "0.62417525", "0.6239994", "0.62176675", "0.62077993", "0.61826813", "0.6180988", "0.61741346", "0.6169904", "0.6163465", "0.6160396", "0.61590004", "0.6154072", "0.61496913", "0.61431074", "0.61355835", "0.6134142", "0.6128584", "0.6123726", "0.6121456", "0.61063594", "0.61055994", "0.61029744", "0.609226", "0.6091219", "0.6081656", "0.6073185", "0.60684645", "0.6066391", "0.60655123", "0.60635966", "0.6057748", "0.60507774", "0.6040563", "0.60374224", "0.6031736", "0.6027124", "0.6022088", "0.6020535", "0.6019904", "0.6015163", "0.6012759", "0.60126454", "0.600218", "0.6001131", "0.60010207", "0.60006684", "0.5995131", "0.59929967", "0.59806895", "0.59771955", "0.59735453", "0.5972616", "0.59671843", "0.596312", "0.596249", "0.595235", "0.5945475", "0.5943175", "0.5941982", "0.59372675", "0.59296906", "0.5929454" ]
0.0
-1
Create an updated entity for this test. This is a static method, as tests for other entities might also need it, if they test an entity which requires the current entity.
public static Skill createUpdatedEntity(EntityManager em) { Skill skill = new Skill().name(UPDATED_NAME).agentSharing(UPDATED_AGENT_SHARING); return skill; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static Student createUpdatedEntity(EntityManager em) {\n Student student = new Student()\n .firstName(UPDATED_FIRST_NAME)\n .middleName(UPDATED_MIDDLE_NAME)\n .lastName(UPDATED_LAST_NAME)\n .studentRegNumber(UPDATED_STUDENT_REG_NUMBER)\n .dateOfBirth(UPDATED_DATE_OF_BIRTH)\n .regDocType(UPDATED_REG_DOC_TYPE)\n .registrationDocumentNumber(UPDATED_REGISTRATION_DOCUMENT_NUMBER)\n .gender(UPDATED_GENDER)\n .nationality(UPDATED_NATIONALITY)\n .dateJoined(UPDATED_DATE_JOINED)\n .deleted(UPDATED_DELETED)\n .wxtJwtPq55wd(UPDATED_WXT_JWT_PQ_55_WD);\n // Add required entity\n NextOfKin nextOfKin;\n if (TestUtil.findAll(em, NextOfKin.class).isEmpty()) {\n nextOfKin = NextOfKinResourceIT.createUpdatedEntity(em);\n em.persist(nextOfKin);\n em.flush();\n } else {\n nextOfKin = TestUtil.findAll(em, NextOfKin.class).get(0);\n }\n student.getRelatives().add(nextOfKin);\n return student;\n }", "protected T createSimulatedExistingEntity() {\n final T entity = createNewEntity();\n entity.setId(IDUtil.randomPositiveLong());\n\n when(getDAO().findOne(entity.getId())).thenReturn(entity);\n return entity;\n }", "public static Prestamo createUpdatedEntity(EntityManager em) {\n Prestamo prestamo = new Prestamo().observaciones(UPDATED_OBSERVACIONES).fechaFin(UPDATED_FECHA_FIN);\n // Add required entity\n Libro libro;\n if (TestUtil.findAll(em, Libro.class).isEmpty()) {\n libro = LibroResourceIT.createUpdatedEntity(em);\n em.persist(libro);\n em.flush();\n } else {\n libro = TestUtil.findAll(em, Libro.class).get(0);\n }\n prestamo.setLibro(libro);\n // Add required entity\n Persona persona;\n if (TestUtil.findAll(em, Persona.class).isEmpty()) {\n persona = PersonaResourceIT.createUpdatedEntity(em);\n em.persist(persona);\n em.flush();\n } else {\n persona = TestUtil.findAll(em, Persona.class).get(0);\n }\n prestamo.setPersona(persona);\n // Add required entity\n User user = UserResourceIT.createEntity(em);\n em.persist(user);\n em.flush();\n prestamo.setUser(user);\n return prestamo;\n }", "public static SitAndGo createUpdatedEntity(EntityManager em) {\n SitAndGo sitAndGo = new SitAndGo()\n .format(UPDATED_FORMAT)\n .buyIn(UPDATED_BUY_IN)\n .ranking(UPDATED_RANKING)\n .profit(UPDATED_PROFIT)\n .bounty(UPDATED_BOUNTY);\n return sitAndGo;\n }", "Entity createEntity();", "public static ItemSubstitution createUpdatedEntity(EntityManager em) {\n ItemSubstitution itemSubstitution = new ItemSubstitution()\n .timestamp(UPDATED_TIMESTAMP)\n .type(UPDATED_TYPE)\n .substituteType(UPDATED_SUBSTITUTE_TYPE)\n .substituteNo(UPDATED_SUBSTITUTE_NO)\n .description(UPDATED_DESCRIPTION)\n .isInterchangeable(UPDATED_IS_INTERCHANGEABLE)\n .relationsLevel(UPDATED_RELATIONS_LEVEL)\n .isCheckedToOriginal(UPDATED_IS_CHECKED_TO_ORIGINAL)\n .origCheckDate(UPDATED_ORIG_CHECK_DATE);\n // Add required entity\n Item item;\n if (TestUtil.findAll(em, Item.class).isEmpty()) {\n item = ItemResourceIT.createUpdatedEntity(em);\n em.persist(item);\n em.flush();\n } else {\n item = TestUtil.findAll(em, Item.class).get(0);\n }\n itemSubstitution.getItems().add(item);\n return itemSubstitution;\n }", "@PostConstruct\n protected void initNewEntity() {\n setNewEntity(getService().create());\n }", "public static A createUpdatedEntity(EntityManager em) {\n A a = new A();\n return a;\n }", "public static Testtable2 createUpdatedEntity(EntityManager em) {\n Testtable2 testtable2 = new Testtable2();\n testtable2.setColumn2(UPDATED_COLUMN_2);\n return testtable2;\n }", "public static XepLoai createUpdatedEntity(EntityManager em) {\n XepLoai xepLoai = new XepLoai()\n .tenXepLoai(UPDATED_TEN_XEP_LOAI);\n return xepLoai;\n }", "public static QuizQuestion createUpdatedEntity(EntityManager em) {\n QuizQuestion quizQuestion = new QuizQuestion()\n .text(UPDATED_TEXT)\n .description(UPDATED_DESCRIPTION);\n // Add required entity\n Quiz quiz;\n if (TestUtil.findAll(em, Quiz.class).isEmpty()) {\n quiz = QuizResourceIT.createUpdatedEntity(em);\n em.persist(quiz);\n em.flush();\n } else {\n quiz = TestUtil.findAll(em, Quiz.class).get(0);\n }\n quizQuestion.setQuiz(quiz);\n return quizQuestion;\n }", "public static OrderItem createUpdatedEntity(EntityManager em) {\n OrderItem orderItem = new OrderItem().quantity(UPDATED_QUANTITY).totalPrice(UPDATED_TOTAL_PRICE).status(UPDATED_STATUS);\n return orderItem;\n }", "public static Arrete createUpdatedEntity(EntityManager em) {\n Arrete arrete = new Arrete()\n .intituleArrete(UPDATED_INTITULE_ARRETE)\n .numeroArrete(UPDATED_NUMERO_ARRETE)\n .dateSignature(UPDATED_DATE_SIGNATURE)\n .nombreAgrement(UPDATED_NOMBRE_AGREMENT);\n return arrete;\n }", "public static Unidade createUpdatedEntity(EntityManager em) {\n Unidade unidade = new Unidade()\n .descricao(UPDATED_DESCRICAO)\n .sigla(UPDATED_SIGLA)\n .situacao(UPDATED_SITUACAO)\n .controleDeEstoque(UPDATED_CONTROLE_DE_ESTOQUE)\n .idAlmoxarifado(UPDATED_ID_ALMOXARIFADO)\n .andar(UPDATED_ANDAR)\n .capacidade(UPDATED_CAPACIDADE)\n .horarioInicio(UPDATED_HORARIO_INICIO)\n .horarioFim(UPDATED_HORARIO_FIM)\n .localExame(UPDATED_LOCAL_EXAME)\n .rotinaDeFuncionamento(UPDATED_ROTINA_DE_FUNCIONAMENTO)\n .anexoDocumento(UPDATED_ANEXO_DOCUMENTO)\n .setor(UPDATED_SETOR)\n .idCentroDeAtividade(UPDATED_ID_CENTRO_DE_ATIVIDADE)\n .idChefia(UPDATED_ID_CHEFIA);\n // Add required entity\n TipoUnidade tipoUnidade;\n if (TestUtil.findAll(em, TipoUnidade.class).isEmpty()) {\n tipoUnidade = TipoUnidadeResourceIT.createUpdatedEntity(em);\n em.persist(tipoUnidade);\n em.flush();\n } else {\n tipoUnidade = TestUtil.findAll(em, TipoUnidade.class).get(0);\n }\n unidade.setTipoUnidade(tipoUnidade);\n return unidade;\n }", "public static Note createUpdatedEntity(EntityManager em) {\n Note note = new Note().content(UPDATED_CONTENT).title(UPDATED_TITLE).xpos(UPDATED_XPOS).ypos(UPDATED_YPOS);\n return note;\n }", "@Override\n protected void createEntity() {\n ProjectStatus status = createProjectStatus(5);\n setEntity(status);\n }", "@Test\r\n public void testUpdate() throws Exception {\r\n MonitoriaEntity entity = data.get(0);\r\n PodamFactory pf = new PodamFactoryImpl();\r\n MonitoriaEntity nuevaEntity = pf.manufacturePojo(MonitoriaEntity.class);\r\n nuevaEntity.setId(entity.getId());\r\n persistence.update(nuevaEntity);\r\n// Assert.assertEquals(nuevaEntity.getName(), resp.getName());\r\n }", "public static Restaurant createUpdatedEntity(EntityManager em) {\n Restaurant restaurant = new Restaurant()\n .restaurantName(UPDATED_RESTAURANT_NAME)\n .deliveryPrice(UPDATED_DELIVERY_PRICE)\n .restaurantAddress(UPDATED_RESTAURANT_ADDRESS)\n .restaurantCity(UPDATED_RESTAURANT_CITY);\n return restaurant;\n }", "public static Enseigner createUpdatedEntity(EntityManager em) {\n Enseigner enseigner = new Enseigner().dateDebut(UPDATED_DATE_DEBUT).dateFin(UPDATED_DATE_FIN);\n return enseigner;\n }", "public static Lot createUpdatedEntity(EntityManager em) {\n Lot lot = new Lot()\n .createdAt(UPDATED_CREATED_AT)\n .updatedAt(UPDATED_UPDATED_AT)\n .qte(UPDATED_QTE)\n .qtUg(UPDATED_QT_UG)\n .num(UPDATED_NUM)\n .dateFabrication(UPDATED_DATE_FABRICATION)\n .peremption(UPDATED_PEREMPTION)\n .peremptionstatus(UPDATED_PEREMPTIONSTATUS);\n return lot;\n }", "void createOrUpdate(T entity);", "public static EnteteVente createUpdatedEntity(EntityManager em) {\n EnteteVente enteteVente = new EnteteVente()\n .enteteVenteType(UPDATED_ENTETE_VENTE_TYPE)\n .enteteVenteTotalHT(UPDATED_ENTETE_VENTE_TOTAL_HT)\n .enteteVenteTotalTTC(UPDATED_ENTETE_VENTE_TOTAL_TTC)\n .enteteVenteDateCreation(UPDATED_ENTETE_VENTE_DATE_CREATION);\n return enteteVente;\n }", "public static TaskComment createUpdatedEntity(EntityManager em) {\n TaskComment taskComment = new TaskComment()\n .value(UPDATED_VALUE);\n // Add required entity\n Task newTask = TaskResourceIT.createUpdatedEntity(em);\n Task task = TestUtil.findAll(em, Task.class).stream()\n .filter(x -> x.getId().equals(newTask.getId()))\n .findAny().orElse(null);\n if (task == null) {\n task = newTask;\n em.persist(task);\n em.flush();\n }\n taskComment.setTask(task);\n return taskComment;\n }", "protected abstract ENTITY createEntity();", "public static Bounty createUpdatedEntity() {\n Bounty bounty = new Bounty()\n// .status(UPDATED_STATUS)\n// .issueUrl(UPDATED_URL)\n .amount(UPDATED_AMOUNT)\n// .experience(UPDATED_EXPERIENCE)\n// .commitment(UPDATED_COMMITMENT)\n// .type(UPDATED_TYPE)\n// .category(UPDATED_CATEGORY)\n// .keywords(UPDATED_KEYWORDS)\n .permission(UPDATED_PERMISSION)\n .expiryDate(UPDATED_EXPIRES);\n return bounty;\n }", "public static Articulo createUpdatedEntity(EntityManager em) {\n Articulo articulo = new Articulo()\n .titulo(UPDATED_TITULO)\n .contenido(UPDATED_CONTENIDO)\n .fechaCreacion(UPDATED_FECHA_CREACION);\n return articulo;\n }", "TestEntity buildEntity () {\n TestEntity testEntity = new TestEntity();\n testEntity.setName(\"Test name\");\n testEntity.setCheck(true);\n testEntity.setDateCreated(new Date(System.currentTimeMillis()));\n testEntity.setDescription(\"description\");\n\n Specialization specialization = new Specialization();\n specialization.setName(\"Frontend\");\n specialization.setLevel(\"Senior\");\n specialization.setYears(10);\n\n testEntity.setSpecialization(specialization);\n\n return testEntity;\n }", "public static GoodsReceiptDetails createUpdatedEntity(EntityManager em) {\n GoodsReceiptDetails goodsReceiptDetails = new GoodsReceiptDetails()\n .grnQty(UPDATED_GRN_QTY);\n return goodsReceiptDetails;\n }", "public static Emprunt createUpdatedEntity(EntityManager em) {\n Emprunt emprunt = new Emprunt()\n .dateEmprunt(UPDATED_DATE_EMPRUNT);\n return emprunt;\n }", "public static AnnotationType createUpdatedEntity() {\n return new AnnotationType()\n .name(UPDATED_NAME)\n .label(UPDATED_LABEL)\n .description(UPDATED_DESCRIPTION)\n .emotional(UPDATED_EMOTIONAL)\n .weight(UPDATED_WEIGHT)\n .color(UPDATED_COLOR)\n .projectId(DEFAULT_PROJECT_ID);\n }", "public static Invoice createUpdatedEntity(EntityManager em) {\n Invoice invoice = new Invoice()\n .companyName(UPDATED_COMPANY_NAME)\n .userName(UPDATED_USER_NAME)\n .userLastName(UPDATED_USER_LAST_NAME)\n .userEmail(UPDATED_USER_EMAIL)\n .dateCreated(UPDATED_DATE_CREATED)\n .total(UPDATED_TOTAL)\n .subTotal(UPDATED_SUB_TOTAL)\n .tax(UPDATED_TAX)\n .purchaseDescription(UPDATED_PURCHASE_DESCRIPTION)\n .itemQuantity(UPDATED_ITEM_QUANTITY)\n .itemPrice(UPDATED_ITEM_PRICE);\n return invoice;\n }", "public static TypeOeuvre createUpdatedEntity(EntityManager em) {\n TypeOeuvre typeOeuvre = new TypeOeuvre()\n .intitule(UPDATED_INTITULE);\n return typeOeuvre;\n }", "public static Demand createUpdatedEntity(EntityManager em) {\n Demand demand = new Demand()\n .name(UPDATED_NAME)\n .value(UPDATED_VALUE);\n return demand;\n }", "public static Acheteur createUpdatedEntity(EntityManager em) {\n Acheteur acheteur = new Acheteur()\n .typeClient(UPDATED_TYPE_CLIENT)\n .nom(UPDATED_NOM)\n .prenom(UPDATED_PRENOM)\n .tel(UPDATED_TEL)\n .cnib(UPDATED_CNIB)\n .email(UPDATED_EMAIL)\n .adresse(UPDATED_ADRESSE)\n .numroBanquaire(UPDATED_NUMRO_BANQUAIRE)\n .deleted(UPDATED_DELETED);\n return acheteur;\n }", "T createEntity();", "public static MGachaRendition createUpdatedEntity(EntityManager em) {\n MGachaRendition mGachaRendition = new MGachaRendition()\n .mainPrefabName(UPDATED_MAIN_PREFAB_NAME)\n .resultExpectedUpPrefabName(UPDATED_RESULT_EXPECTED_UP_PREFAB_NAME)\n .resultQuestionPrefabName(UPDATED_RESULT_QUESTION_PREFAB_NAME)\n .soundSwitchEventName(UPDATED_SOUND_SWITCH_EVENT_NAME);\n return mGachaRendition;\n }", "E create(E entity);", "E create(E entity);", "public static BII createUpdatedEntity() {\n BII bII = new BII()\n .name(UPDATED_NAME)\n .type(UPDATED_TYPE)\n .biiId(UPDATED_BII_ID)\n .detectionTimestamp(UPDATED_DETECTION_TIMESTAMP)\n .sourceId(UPDATED_SOURCE_ID)\n .detectionSystemName(UPDATED_DETECTION_SYSTEM_NAME)\n .detectedValue(UPDATED_DETECTED_VALUE)\n .detectionContext(UPDATED_DETECTION_CONTEXT)\n .etc(UPDATED_ETC)\n .etcetc(UPDATED_ETCETC);\n return bII;\n }", "public static EnrollmentDate createUpdatedEntity(EntityManager em) {\n EnrollmentDate enrollmentDate = new EnrollmentDate()\n .name(UPDATED_NAME)\n .isPreEnrollment(UPDATED_IS_PRE_ENROLLMENT)\n .startDate(UPDATED_START_DATE)\n .endDate(UPDATED_END_DATE);\n // Add required entity\n Semester semester;\n if (TestUtil.findAll(em, Semester.class).isEmpty()) {\n semester = SemesterResourceIT.createUpdatedEntity(em);\n em.persist(semester);\n em.flush();\n } else {\n semester = TestUtil.findAll(em, Semester.class).get(0);\n }\n enrollmentDate.setSemester(semester);\n return enrollmentDate;\n }", "public static Posicion createUpdatedEntity(EntityManager em) {\n Posicion posicion = new Posicion()\n .titulo(UPDATED_TITULO)\n .descripcion(UPDATED_DESCRIPCION)\n .numeroPuestos(UPDATED_NUMERO_PUESTOS)\n .salarioMinimo(UPDATED_SALARIO_MINIMO)\n .salarioMaximo(UPDATED_SALARIO_MAXIMO)\n .fechaAlta(UPDATED_FECHA_ALTA)\n .fechaNecesidad(UPDATED_FECHA_NECESIDAD);\n return posicion;\n }", "@Test\n void updateSuccess () {\n TestEntity testEntity = buildEntity();\n Api2 instance = new Api2();\n Long result = instance.save(testEntity);\n\n String name = \"Edited name\";\n boolean check = false;\n String description = \"edited description\";\n\n if (result != null) {\n testEntity.setName(name);\n testEntity.setCheck(check);\n testEntity.setDescription(description);\n instance.update(testEntity);\n\n Optional<TestEntity> optionalTestEntity = instance.getById(TestEntity.class, testEntity.getId());\n assertTrue(optionalTestEntity.isPresent());\n\n if (optionalTestEntity.isPresent()) {\n TestEntity entity = optionalTestEntity.get();\n\n assertEquals(entity.getName(), name);\n assertEquals(entity.getDescription(), description);\n assertEquals(entity.isCheck(), check);\n } else {\n fail();\n }\n } else {\n fail();\n }\n }", "public static Poen createUpdatedEntity(EntityManager em) {\n Poen poen = new Poen()\n .tip(UPDATED_TIP);\n return poen;\n }", "public static OrderDetailInfo createUpdatedEntity(EntityManager em) {\n OrderDetailInfo orderDetailInfo = new OrderDetailInfo()\n .productName(UPDATED_PRODUCT_NAME)\n .priceProduct(UPDATED_PRICE_PRODUCT)\n .quantityOrder(UPDATED_QUANTITY_ORDER)\n .amount(UPDATED_AMOUNT)\n .orderDate(UPDATED_ORDER_DATE);\n return orderDetailInfo;\n }", "public static ProcessExecution createUpdatedEntity(EntityManager em) {\n ProcessExecution processExecution = new ProcessExecution()\n .execution(UPDATED_EXECUTION);\n return processExecution;\n }", "public static Incident createUpdatedEntity(EntityManager em) {\n Incident incident = new Incident()\n .title(UPDATED_TITLE)\n .risk(UPDATED_RISK)\n .notes(UPDATED_NOTES);\n return incident;\n }", "public static Territorio createUpdatedEntity(EntityManager em) {\n Territorio territorio = new Territorio().nome(UPDATED_NOME);\n return territorio;\n }", "public static Invite createUpdatedEntity(EntityManager em) {\n Invite invite = new Invite()\n .nom(UPDATED_NOM)\n .prenom(UPDATED_PRENOM)\n .mail(UPDATED_MAIL)\n .mdp(UPDATED_MDP)\n .login(UPDATED_LOGIN)\n .points(UPDATED_POINTS);\n return invite;\n }", "public static DataModel createUpdatedEntity(EntityManager em) {\n DataModel dataModel = new DataModel()\n .key(UPDATED_KEY)\n .label(UPDATED_LABEL)\n .dataFormat(UPDATED_DATA_FORMAT)\n .maxLength(UPDATED_MAX_LENGTH)\n .precision(UPDATED_PRECISION)\n .modelValues(UPDATED_MODEL_VALUES);\n return dataModel;\n }", "void create(T entity);", "public static Horaire createUpdatedEntity(EntityManager em) {\n Horaire horaire = new Horaire()\n .heureDepart(UPDATED_HEURE_DEPART)\n .heureFin(UPDATED_HEURE_FIN)\n .dateJour(UPDATED_DATE_JOUR);\n return horaire;\n }", "public static Empleado createUpdatedEntity(EntityManager em) {\n Empleado empleado = new Empleado()\n .nombre(UPDATED_NOMBRE)\n .primerApellido(UPDATED_PRIMER_APELLIDO)\n .segundoApellido(UPDATED_SEGUNDO_APELLIDO)\n .sexo(UPDATED_SEXO)\n .fechaNacimiento(UPDATED_FECHA_NACIMIENTO)\n .fechaIngreso(UPDATED_FECHA_INGRESO)\n .salario(UPDATED_SALARIO)\n .puesto(UPDATED_PUESTO)\n .estado(UPDATED_ESTADO);\n return empleado;\n }", "void create(E entity);", "public static Allegato createUpdatedEntity(EntityManager em) {\n Allegato allegato = new Allegato()\n .nomeAttachment(UPDATED_NOME_ATTACHMENT)\n .algoritmoCompressione(UPDATED_ALGORITMO_COMPRESSIONE)\n .formatoAttachment(UPDATED_FORMATO_ATTACHMENT)\n .descrizioneAttachment(UPDATED_DESCRIZIONE_ATTACHMENT)\n .attachment(UPDATED_ATTACHMENT);\n return allegato;\n }", "public static NoteMaster createUpdatedEntity(EntityManager em) {\n NoteMaster noteMaster = new NoteMaster()\n .semestre(UPDATED_SEMESTRE)\n .noteCC1(UPDATED_NOTE_CC_1)\n .noteCC2(UPDATED_NOTE_CC_2)\n .noteFinal(UPDATED_NOTE_FINAL)\n .date(UPDATED_DATE);\n return noteMaster;\n }", "public static TaskExecution createUpdatedEntity(EntityManager em) {\n TaskExecution taskExecution = new TaskExecution()\n .jobOrderTimestamp(UPDATED_JOB_ORDER_TIMESTAMP)\n .taskExecutionStatus(UPDATED_TASK_EXECUTION_STATUS)\n .taskExecutionStartTimestamp(UPDATED_TASK_EXECUTION_START_TIMESTAMP)\n .taskExecutionEndTimestamp(UPDATED_TASK_EXECUTION_END_TIMESTAMP);\n return taskExecution;\n }", "public static WorkPlace createUpdatedEntity(EntityManager em) {\n WorkPlace workPlace = new WorkPlace()\n .doctorIdpCode(UPDATED_DOCTOR_IDP_CODE)\n .name(UPDATED_NAME)\n .locationName(UPDATED_LOCATION_NAME)\n .location(UPDATED_LOCATION);\n return workPlace;\n }", "public static EventAttendance createUpdatedEntity(EntityManager em) {\n EventAttendance eventAttendance = new EventAttendance()\n .attendanceDate(UPDATED_ATTENDANCE_DATE);\n return eventAttendance;\n }", "public static Fornecedor createUpdatedEntity(EntityManager em) {\n Fornecedor fornecedor = new Fornecedor()\n .tipo(UPDATED_TIPO)\n .cpf(UPDATED_CPF)\n .cnpj(UPDATED_CNPJ)\n .primeiroNome(UPDATED_PRIMEIRO_NOME)\n .nomeMeio(UPDATED_NOME_MEIO)\n .sobreNome(UPDATED_SOBRE_NOME)\n .saudacao(UPDATED_SAUDACAO)\n .titulo(UPDATED_TITULO)\n .cep(UPDATED_CEP)\n .tipoLogradouro(UPDATED_TIPO_LOGRADOURO)\n .nomeLogradouro(UPDATED_NOME_LOGRADOURO)\n .complemento(UPDATED_COMPLEMENTO);\n return fornecedor;\n }", "public Entity newEntity() { return newMyEntity(); }", "public Entity newEntity() { return newMyEntity(); }", "public static Transaction createUpdatedEntity(EntityManager em) {\n Transaction transaction = new Transaction()\n .date(UPDATED_DATE);\n return transaction;\n }", "public static Author createUpdatedEntity(EntityManager em) {\n Author author = new Author()\n .firstName(UPDATED_FIRST_NAME)\n .lastName(UPDATED_LAST_NAME);\n return author;\n }", "public static IndActivation createUpdatedEntity(EntityManager em) {\n IndActivation indActivation = new IndActivation()\n .name(UPDATED_NAME)\n .activity(UPDATED_ACTIVITY)\n .customerId(UPDATED_CUSTOMER_ID)\n .individualId(UPDATED_INDIVIDUAL_ID);\n return indActivation;\n }", "public void updateEntity();", "public EntityType initUpdateEntity(DtoType dto) throws ClassNotFoundException, IllegalArgumentException, IllegalAccessException;", "public static MQuestSpecialReward createUpdatedEntity(EntityManager em) {\n MQuestSpecialReward mQuestSpecialReward = new MQuestSpecialReward()\n .groupId(UPDATED_GROUP_ID)\n .weight(UPDATED_WEIGHT)\n .rank(UPDATED_RANK)\n .contentType(UPDATED_CONTENT_TYPE)\n .contentId(UPDATED_CONTENT_ID)\n .contentAmount(UPDATED_CONTENT_AMOUNT);\n return mQuestSpecialReward;\n }", "protected abstract EntityBase createEntity() throws Exception;", "public static Sectie createUpdatedEntity(EntityManager em) {\n Sectie sectie = new Sectie()\n .sectieId(UPDATED_SECTIE_ID)\n .nume(UPDATED_NUME)\n .sefId(UPDATED_SEF_ID)\n .tag(UPDATED_TAG)\n .nrPaturi(UPDATED_NR_PATURI);\n return sectie;\n }", "public static RolEmpleado createUpdatedEntity(EntityManager em) {\n RolEmpleado rolEmpleado = new RolEmpleado();\n return rolEmpleado;\n }", "public static ExUser createUpdatedEntity(EntityManager em) {\n ExUser exUser = new ExUser()\n .userKey(UPDATED_USER_KEY);\n return exUser;\n }", "public static ConceptDataType createUpdatedEntity(EntityManager em) {\n ConceptDataType conceptDataType = new ConceptDataType()\n .uuid(UPDATED_UUID)\n .name(UPDATED_NAME)\n .hl7Abbreviation(UPDATED_HL_7_ABBREVIATION)\n .description(UPDATED_DESCRIPTION);\n return conceptDataType;\n }", "public static Info createUpdatedEntity(EntityManager em) {\n Info info = new Info()\n .nom(UPDATED_NOM)\n .prenom(UPDATED_PRENOM)\n .etablissement(UPDATED_ETABLISSEMENT);\n return info;\n }", "public static Dishestype createUpdatedEntity(EntityManager em) {\n Dishestype dishestype = new Dishestype()\n .name(UPDATED_NAME)\n .state(UPDATED_STATE)\n .creator(UPDATED_CREATOR)\n .createdate(UPDATED_CREATEDATE)\n .modifier(UPDATED_MODIFIER)\n .modifierdate(UPDATED_MODIFIERDATE)\n .modifiernum(UPDATED_MODIFIERNUM)\n .logicdelete(UPDATED_LOGICDELETE)\n .other(UPDATED_OTHER);\n return dishestype;\n }", "public static UserDetails createUpdatedEntity(EntityManager em) {\n UserDetails userDetails = new UserDetails()\n .studentCardNumber(UPDATED_STUDENT_CARD_NUMBER)\n .name(UPDATED_NAME)\n .surname(UPDATED_SURNAME)\n .telephoneNumber(UPDATED_TELEPHONE_NUMBER)\n .studyYear(UPDATED_STUDY_YEAR)\n .faculty(UPDATED_FACULTY)\n .fieldOfStudy(UPDATED_FIELD_OF_STUDY);\n return userDetails;\n }", "public static QueryData createUpdatedEntity(EntityManager em) {\n QueryData queryData = new QueryData()\n .dataValue(UPDATED_DATA_VALUE);\n return queryData;\n }", "E update(E entity);", "E update(E entity);", "public static Pessoa createUpdatedEntity(EntityManager em) {\n Pessoa pessoa = new Pessoa()\n .nome(UPDATED_NOME)\n .email(UPDATED_EMAIL)\n .telefone(UPDATED_TELEFONE)\n .dataNascimento(UPDATED_DATA_NASCIMENTO)\n .cadastro(UPDATED_CADASTRO);\n return pessoa;\n }", "public static Source createUpdatedEntity(EntityManager em) {\n Source source = new Source()\n .idGloden(UPDATED_ID_GLODEN)\n .name(UPDATED_NAME)\n .description(UPDATED_DESCRIPTION)\n .updateDate(UPDATED_UPDATE_DATE)\n .creationDate(UPDATED_CREATION_DATE);\n return source;\n }", "public static InventoryProvider createUpdatedEntity(EntityManager em) {\n InventoryProvider inventoryProvider = new InventoryProvider()\n .idInventoryProvider(UPDATED_ID_INVENTORY_PROVIDER)\n .code(UPDATED_CODE)\n .name(UPDATED_NAME)\n .price(UPDATED_PRICE)\n .cuantity(UPDATED_CUANTITY);\n return inventoryProvider;\n }", "public static Userextra createUpdatedEntity(EntityManager em) {\n Userextra userextra = new Userextra().accountype(UPDATED_ACCOUNTYPE);\n // Add required entity\n User user = UserResourceIT.createEntity(em);\n em.persist(user);\n em.flush();\n userextra.setUser(user);\n return userextra;\n }", "void create(T entity) throws Exception;", "public static ListWrkStatus createUpdatedEntity(EntityManager em) {\n ListWrkStatus listWrkStatus = new ListWrkStatus()\n .code(UPDATED_CODE)\n .name(UPDATED_NAME)\n .fullName(UPDATED_FULL_NAME)\n .isCurrentFlag(UPDATED_IS_CURRENT_FLAG)\n .description(UPDATED_DESCRIPTION)\n .dateCreate(UPDATED_DATE_CREATE)\n .dateEdit(UPDATED_DATE_EDIT)\n .creator(UPDATED_CREATOR)\n .editor(UPDATED_EDITOR);\n // Add required entity\n ListWrkKind listWrkKind;\n if (TestUtil.findAll(em, ListWrkKind.class).isEmpty()) {\n listWrkKind = ListWrkKindResourceIT.createUpdatedEntity(em);\n em.persist(listWrkKind);\n em.flush();\n } else {\n listWrkKind = TestUtil.findAll(em, ListWrkKind.class).get(0);\n }\n listWrkStatus.setIdWrkKind(listWrkKind);\n return listWrkStatus;\n }", "public static DoctorAssistant createUpdatedEntity(EntityManager em) {\n DoctorAssistant doctorAssistant = new DoctorAssistant()\n .canPrescribe(UPDATED_CAN_PRESCRIBE);\n return doctorAssistant;\n }", "public static Kpi createUpdatedEntity(EntityManager em) {\n Kpi kpi = new Kpi()\n .title(UPDATED_TITLE)\n .reward(UPDATED_REWARD)\n .rewardDistribution(UPDATED_REWARD_DISTRIBUTION)\n .gradingProcess(UPDATED_GRADING_PROCESS)\n .active(UPDATED_ACTIVE)\n .purpose(UPDATED_PURPOSE)\n .scopeOfWork(UPDATED_SCOPE_OF_WORK)\n .rewardDistributionInfo(UPDATED_REWARD_DISTRIBUTION_INFO)\n .reporting(UPDATED_REPORTING)\n .fiatPoolFactor(UPDATED_FIAT_POOL_FACTOR)\n .grading(UPDATED_GRADING);\n return kpi;\n }", "private FailingEntity createFailingEntity() {\n FailingEntity entity = app.createAndManageChild(EntitySpec.create(FailingEntity.class)\n .configure(FailingEntity.FAIL_ON_START, true));\n return entity;\n }", "public static Location createUpdatedEntity(EntityManager em) {\n Location location = new Location()\n .name(UPDATED_NAME)\n .latitude(UPDATED_LATITUDE)\n .longitude(UPDATED_LONGITUDE)\n .details(UPDATED_DETAILS)\n .activated(UPDATED_ACTIVATED);\n return location;\n }", "public static Favorite createUpdatedEntity(EntityManager em) {\n Favorite favorite = new Favorite();\n return favorite;\n }", "public static ModePassation createUpdatedEntity(EntityManager em) {\n ModePassation modePassation = new ModePassation()\n .libelle(UPDATED_LIBELLE)\n .code(UPDATED_CODE)\n .description(UPDATED_DESCRIPTION);\n return modePassation;\n }", "public static TipoObra createUpdatedEntity(EntityManager em) {\n TipoObra tipoObra = new TipoObra().descripcion(UPDATED_DESCRIPCION);\n return tipoObra;\n }", "public static LifeConstantUnit createUpdatedEntity(EntityManager em) {\n LifeConstantUnit lifeConstantUnit = new LifeConstantUnit()\n .name(UPDATED_NAME)\n .description(UPDATED_DESCRIPTION);\n return lifeConstantUnit;\n }", "public static Timbre createUpdatedEntity(EntityManager em) {\n Timbre timbre = new Timbre().timbre(UPDATED_TIMBRE);\n return timbre;\n }", "public static UserExtra createUpdatedEntity(EntityManager em) {\n UserExtra userExtra = new UserExtra().currentParkingSpot(UPDATED_CURRENT_PARKING_SPOT).timeOfParking(UPDATED_TIME_OF_PARKING);\n return userExtra;\n }", "public static MChallengeQuestWorld createUpdatedEntity(EntityManager em) {\n MChallengeQuestWorld mChallengeQuestWorld = new MChallengeQuestWorld()\n .setId(UPDATED_SET_ID)\n .number(UPDATED_NUMBER)\n .name(UPDATED_NAME)\n .imagePath(UPDATED_IMAGE_PATH)\n .backgroundImagePath(UPDATED_BACKGROUND_IMAGE_PATH)\n .description(UPDATED_DESCRIPTION)\n .stageUnlockPattern(UPDATED_STAGE_UNLOCK_PATTERN)\n .arousalBanner(UPDATED_AROUSAL_BANNER)\n .specialRewardContentType(UPDATED_SPECIAL_REWARD_CONTENT_TYPE)\n .specialRewardContentId(UPDATED_SPECIAL_REWARD_CONTENT_ID)\n .isEnableCoop(UPDATED_IS_ENABLE_COOP);\n return mChallengeQuestWorld;\n }", "public static TypeIntervention createUpdatedEntity(EntityManager em) {\n TypeIntervention typeIntervention = new TypeIntervention()\n .libelle(UPDATED_LIBELLE);\n return typeIntervention;\n }", "public static ItemSubstitution createEntity(EntityManager em) {\n ItemSubstitution itemSubstitution = new ItemSubstitution()\n .timestamp(DEFAULT_TIMESTAMP)\n .type(DEFAULT_TYPE)\n .substituteType(DEFAULT_SUBSTITUTE_TYPE)\n .substituteNo(DEFAULT_SUBSTITUTE_NO)\n .description(DEFAULT_DESCRIPTION)\n .isInterchangeable(DEFAULT_IS_INTERCHANGEABLE)\n .relationsLevel(DEFAULT_RELATIONS_LEVEL)\n .isCheckedToOriginal(DEFAULT_IS_CHECKED_TO_ORIGINAL)\n .origCheckDate(DEFAULT_ORIG_CHECK_DATE);\n // Add required entity\n Item item;\n if (TestUtil.findAll(em, Item.class).isEmpty()) {\n item = ItemResourceIT.createEntity(em);\n em.persist(item);\n em.flush();\n } else {\n item = TestUtil.findAll(em, Item.class).get(0);\n }\n itemSubstitution.getItems().add(item);\n return itemSubstitution;\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 static TestEntity createEntity(EntityManager em) {\n TestEntity testEntity = new TestEntity();\n // Add required entity\n User user = UserResourceIntTest.createEntity(em);\n em.persist(user);\n em.flush();\n testEntity.setUserOneToMany(user);\n return testEntity;\n }", "public static Category createUpdatedEntity(EntityManager em) {\n Category category = new Category()\n .label(UPDATED_LABEL)\n .primaryColor(UPDATED_PRIMARY_COLOR)\n .secondaryColor(UPDATED_SECONDARY_COLOR);\n // Add required entity\n User user = UserResourceIT.createEntity(em);\n em.persist(user);\n em.flush();\n category.setOwner(user);\n return category;\n }", "public static Course createUpdatedEntity(EntityManager em) {\n Course course = new Course()\n .title(UPDATED_TITLE)\n .description(UPDATED_DESCRIPTION)\n .courseStartDate(UPDATED_COURSE_START_DATE)\n .courseEndDate(UPDATED_COURSE_END_DATE)\n .registerStartDate(UPDATED_REGISTER_START_DATE)\n .registerEndDate(UPDATED_REGISTER_END_DATE)\n .duration(UPDATED_DURATION)\n .maximumNumberOfParticipants(UPDATED_MAXIMUM_NUMBER_OF_PARTICIPANTS)\n .minimalNumberOfParticipants(UPDATED_MINIMAL_NUMBER_OF_PARTICIPANTS)\n .lecturerName(UPDATED_LECTURER_NAME)\n .lecturerSurname(UPDATED_LECTURER_SURNAME)\n .pointPerCourse(UPDATED_POINT_PER_COURSE)\n .isVisibleInApp(UPDATED_IS_VISIBLE_IN_APP);\n return course;\n }" ]
[ "0.6945028", "0.67900705", "0.67889315", "0.67169404", "0.66941833", "0.66931623", "0.66679513", "0.66362596", "0.6619976", "0.65133643", "0.65087175", "0.6446217", "0.6421794", "0.64206475", "0.6419418", "0.641517", "0.6413087", "0.64091843", "0.6402996", "0.639374", "0.63922644", "0.6388175", "0.6381835", "0.63630456", "0.634127", "0.634072", "0.6330444", "0.63226116", "0.6317662", "0.6311514", "0.62980366", "0.627498", "0.6269573", "0.6268518", "0.6265717", "0.62603503", "0.62574524", "0.62574524", "0.6255155", "0.6237565", "0.6225771", "0.6181023", "0.61758405", "0.6172608", "0.6164235", "0.6161741", "0.61557513", "0.6135307", "0.61340946", "0.6131546", "0.6124192", "0.61166006", "0.611649", "0.6116124", "0.6115375", "0.61140627", "0.6101552", "0.6100518", "0.60900265", "0.608713", "0.608713", "0.60731435", "0.6066821", "0.60626507", "0.6060522", "0.6054922", "0.6049032", "0.60482746", "0.6044313", "0.60309184", "0.60286766", "0.60255575", "0.6022931", "0.60139066", "0.6010617", "0.60053253", "0.6001589", "0.6001589", "0.59954095", "0.5985867", "0.59800303", "0.5979216", "0.59720093", "0.59667325", "0.5964406", "0.59611356", "0.5953408", "0.5947692", "0.5944089", "0.59435433", "0.59417593", "0.5937945", "0.5936329", "0.5935179", "0.59326464", "0.5924206", "0.5920713", "0.5916986", "0.5911594", "0.5911217", "0.5909146" ]
0.0
-1
Create the Skill with an existing ID
@Test @Transactional void createSkillWithExistingId() throws Exception { skill.setId(1L); SkillDTO skillDTO = skillMapper.toDto(skill); int databaseSizeBeforeCreate = skillRepository.findAll().size(); // An entity with an existing ID cannot be created, so this API call must fail restSkillMockMvc .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(skillDTO))) .andExpect(status().isBadRequest()); // Validate the Skill in the database List<Skill> skillList = skillRepository.findAll(); assertThat(skillList).hasSize(databaseSizeBeforeCreate); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void AddSkill(int aSkill_ID)\n\t{\n\t\tSkill aSkill= new Skill(aSkill_ID);\n\t\taSkill.user_Id=this.id;\n\t\tmySkills.add(aSkill);\n\t}", "public void AddNewSkill()\n\t{\n\t\t\n\t}", "Skill saveSkill(Skill skill);", "public com.transerainc.aha.gen.agent.SkillDocument.Skill addNewSkill()\n {\n synchronized (monitor())\n {\n check_orphaned();\n com.transerainc.aha.gen.agent.SkillDocument.Skill target = null;\n target = (com.transerainc.aha.gen.agent.SkillDocument.Skill)get_store().add_element_user(SKILL$0);\n return target;\n }\n }", "public ResponseEntity<Void> createSkills(@ApiParam(value = \"skill object that needs to be added to data base\" ,required=true ) @Valid @RequestBody Skill skill) {\n skillService.addSkillDetails(skill);\n return new ResponseEntity<Void>(HttpStatus.OK);\n }", "int getSkillId();", "public Builder setSkillId(int value) {\n \n skillId_ = value;\n onChanged();\n return this;\n }", "@Override\n\tpublic void addSkill(Skill theSkill) {\n\t\tSession currentSession = sessionFactory.getCurrentSession();\n\t\t\n\t\t//add/update the skill\n\t\tcurrentSession.saveOrUpdate(theSkill);\n\t}", "@Operation(httpMethods = \"POST\", path = \"/{userId}/{skill}\")\n public Future<?> addSkill(final SocialRequestItem request) throws ProtocolException {\n final SecurityToken token = request.getToken();\n\n final Set<UserId> userIds = request.getUsers();\n final UserId userId = userIds.iterator().next();\n\n final String skill = request.getParameter(\"skill\");\n final Future<?> result = this.fSkillSPI.addSkill(userId, skill, token);\n\n return result;\n }", "@Override\n public Skill addSkill(Skill skill) {\n return _skills.put(skill.getId(), skill);\n }", "@PostMapping(\"/addSkill\")\n\tpublic String addSkill(@ModelAttribute(\"skill\") Skill theSkill) {\n\t\tskillService.addSkill(theSkill);\n\t\treturn \"redirect:/skill/list\";\n\t}", "public void createStudent(String name, String ID){}", "public Skill() {\n\t\tsuper();\n\t}", "public void setSkillId(Integer skillId) {\n this.skillId = skillId;\n }", "Skill getSkill(Long skillId) throws DbException;", "@Transactional\n public SkillDTO save(SkillDTO dto) {\n if (dto == null) {\n return null;\n }\n\n final Skill skill;\n\n if (dto.isIdSet()) {\n Skill skillTmp = skillRepository.findOne(dto.id);\n if (skillTmp != null) {\n skill = skillTmp;\n } else {\n skill = new Skill();\n skill.setId(dto.id);\n }\n } else {\n skill = new Skill();\n }\n\n skill.setName(dto.name);\n\n skill.setPosition(dto.position);\n\n skill.setOnInit(dto.onInit);\n\n skill.setCreationDate(dto.creationDate);\n\n skill.setCreationAuthor(dto.creationAuthor);\n\n skill.setLastModificationDate(dto.lastModificationDate);\n\n skill.setLastModificationAuthor(dto.lastModificationAuthor);\n\n skill.setVersion(dto.version);\n\n if (dto.skill2 == null) {\n skill.setSkill2(null);\n } else {\n Skill skill2 = skill.getSkill2();\n if (skill2 == null || (skill2.getId().compareTo(dto.skill2.id) != 0)) {\n skill.setSkill2(skillRepository.findOne(dto.skill2.id));\n }\n }\n\n if (dto.script == null) {\n skill.setScript(null);\n } else {\n Script script = skill.getScript();\n if (script == null || (script.getId().compareTo(dto.script.id) != 0)) {\n skill.setScript(scriptRepository.findOne(dto.script.id));\n }\n }\n\n skill.getTheChars().clear();\n if (dto.theChars != null) {\n dto.theChars.stream().forEach(anChar -> skill.addAnChar(characterRepository.findOne(anChar.id)));\n }\n\n return toDTO(skillRepository.save(skill));\n }", "@Override\n public void save(Skill skill) {\n skillRepository.save(skill);\n }", "void skill( String key, String value ){\n developer.skills.add( value );\n }", "public Skill(String skillName, double skillDamage, int skillManaCost, double skillHeal){\n name = skillName;\n damage = skillDamage;\n manaCost = skillManaCost;\n heal = skillHeal;\n//sets up skills to return as their name.\n }", "void updateSkill(Skill skill);", "@Override\n\t\n\tpublic void saveSkill(Skill skill) {\n\t\tskillRepository.save(skill);\n\t\t\n\t}", "public void createSurvey(int tid);", "public void addSkill(Skill newskill) {\n skills.addElement(newskill);\n }", "private void addSkill(Skill skill) {\n Species.Characteristic att = skill.getGoverningAtt();\n int ability = character.getSpecies().getCharacteristicValue(att);\n skill.setAbility(ability);\n\n skillList.add(skill);\n }", "public org.oep.cmon.dao.tlct.model.DanhMucGiayTo create(long id);", "@java.lang.Override\n public int getSkillId() {\n return skillId_;\n }", "void changeSkill(Long pokemonId, int newSkill);", "@java.lang.Override\n public int getSkillId() {\n return skillId_;\n }", "public Integer getSkillId() {\n return skillId;\n }", "protected void addSkill(String name) {\r\n\t\tthis.skills.add(name.toLowerCase());\r\n\t}", "Skill getSkill(String name);", "public Skills chooseSkill();", "public static void increaseSkill(int skillId, Player player){\n\t\tint playerNumber = getPlayerNumber(player);\n\t\tplayerSkillsArray[playerNumber][skillId]++;\n\t\tbackupSkills();\n\t\tsaveSkills();\n\t}", "public static Skill createEntity(EntityManager em) {\n Skill skill = new Skill().name(DEFAULT_NAME).agentSharing(DEFAULT_AGENT_SHARING);\n return skill;\n }", "public Skill() {\n shortName = new SimpleStringProperty(\"\");\n description = new SimpleStringProperty(\"\");\n }", "public abstract SkillData skill();", "public ResponseEntity<Void> deleteSkillDetails(@Min(1L)@ApiParam(value = \"skill Id od the skills that needs to be deleted\",required=true) @PathVariable(\"skillId\") Long skillId) {\n \tSkill newSkill= skillService.findSkillById(skillId);\n\t\t\n\t\tif(newSkill==null) {\n\t\t\tthrow new ResourceNotFoundException(\"Skill with id \"+skillId+\" is not found\");\n\t\t}\n\t\t\n\t\telse {\n\t\t\t\n//\t\t\tLOGGER.trace(\" Trying to trace skills to delete details\");\n\t\t\tskillService.deleteSkillDetails(skillId);\n\t\t\treturn new ResponseEntity<>(HttpStatus.ACCEPTED);\n\t\t}\n }", "public de.fraunhofer.fokus.movepla.model.Entitlement create(\n long entitlementId);", "public Builder clearSkillId() {\n \n skillId_ = 0;\n onChanged();\n return this;\n }", "org.hl7.fhir.Identifier addNewIdentifier();", "public void Skill() {\n\t\tBuilding ig = new Iglu(this.GetWater());\n\t\tthis.GetWater().GetBuilding().ReplaceBuilding(ig);\n\t}", "public Skill find(Long id) {\n\t\treturn entityManager.find(Skill.class, id);\n\t}", "@Override\n public void onSkillClick(int skill_id, int position) {\n\n Intent intent = new Intent(MainActivity.this, SkillActivity.class);\n intent.putExtra(\"REQUESTED_SKILL\", skill_id);\n startActivity(intent);\n }", "@PostMapping(\"/experiences\")\n @Timed\n public ResponseEntity<Experience> createExperience(@Valid @RequestBody Experience experience) throws URISyntaxException {\n log.debug(\"REST request to save Experience : {}\", experience);\n if (experience.getId() != null) {\n throw new BadRequestAlertException(\"A new experience cannot already have an ID\", ENTITY_NAME, \"idexists\");\n }\n Experience result = experienceRepository.save(experience);\n return ResponseEntity.created(new URI(\"/api/experiences/\" + result.getId()))\n .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))\n .body(result);\n }", "@Override\n\tpublic Skill getSkill(int theId) {\n\t\tSession currentSession = sessionFactory.getCurrentSession();\n\t\t\n\t\t//now retrieve/read from database using the primary key\n\t\tSkill theSkill = currentSession.get(Skill.class, theId);\n\t\t\n\t\treturn theSkill;\n\t}", "void addId(II identifier);", "public Object create() {\n executeCallbacks(CallbackType.BEFORE_CREATE);\n\n executeCallbacks(CallbackType.BEFORE_VALIDATION);\n executeValidations();\n executeValidationsOnCreate();\n executeCallbacks(CallbackType.AFTER_VALIDATION);\n\n if (errors.size() > 0) return this;\n\n Adapter adapter = getAdapter();\n if (getId() == null && adapter.shouldPrefetchPrimaryKey(getTableName())) {\n this.id = adapter.getNextSequenceValue(getSequenceName());\n }\n\n StringBuilder sql = new StringBuilder();\n sql.append(\"INSERT INTO \").append(getTableName()).append(\" (\");\n sql.append(quotedColumnNames(includePrimaryKey));\n sql.append(\") VALUES (\").append(quotedAttributeValues(includePrimaryKey)).append(\")\");\n\n id = adapter.insert(sql.toString(), getClass().getName() + \" Create\");\n\n readAssociations();\n readAggregations();\n\n newRecord = false;\n\n executeCallbacks(CallbackType.AFTER_CREATE);\n\n return id;\n }", "public static Skill createUpdatedEntity(EntityManager em) {\n Skill skill = new Skill().name(UPDATED_NAME).agentSharing(UPDATED_AGENT_SHARING);\n return skill;\n }", "public void setSkill(com.transerainc.aha.gen.agent.SkillDocument.Skill skill)\n {\n synchronized (monitor())\n {\n check_orphaned();\n com.transerainc.aha.gen.agent.SkillDocument.Skill target = null;\n target = (com.transerainc.aha.gen.agent.SkillDocument.Skill)get_store().find_element_user(SKILL$0, 0);\n if (target == null)\n {\n target = (com.transerainc.aha.gen.agent.SkillDocument.Skill)get_store().add_element_user(SKILL$0);\n }\n target.set(skill);\n }\n }", "public org.oep.cmon.dao.dvc.model.ThuTuc2GiayTo create(long id);", "public Skill(Player player){\n this.player = player;\n this.name = player.name;\n this.intellect = player.intellect;\n this.defense = player.defense;\n this.attack = player.attack;\n this.weapon = player.weapon;\n this.armor = player.armor;\n this.defense = player.defense;\n\n }", "public void setSkill(int skill){\n\t\tskillSelection = skill;\n\t}", "WithCreate withSku(SkuName skuName);", "@Query(\"MATCH(sp:ServiceProvider),(s:Skills) WHERE sp.email={email} and s.skillName={skillName} CREATE (sp)-[hs:has_skills]->(s) RETURN sp\")\n public ServiceProvider setHasSkillsRelation(@Param(\"email\") String email, @Param(\"skillName\") String skillName);", "public Todo create(long todoId);", "int insert(JindouyunRole record);", "public org.oep.usermgt.model.Citizen create(long citizenId);", "II addId();", "@Test\r\n\tvoid testUpdateSkillRecordShouldPass() {\r\n\t\tController ctrl = new Controller();\r\n\t\t\r\n\t\tint playerSru = 1000;\r\n\t\t\r\n\t\t//Passing\r\n\t\tint standardLevel = 5;\r\n\t\tint spinLevel = 4;\r\n\t\tint popLevel = 3;\r\n\t\tString passingNotes = \"Passing\";\r\n\t\t\r\n\t\t//Tackling\r\n\t\tint frontLevel= 4;\r\n\t\tint rearLevel = 4;\r\n\t\tint sideLevel = 3;\r\n\t\tint scrabbleLevel = 2;\r\n\t\tString tacklingNotes = \"Tackling\";\r\n\t\t\r\n\t\t//Kicking\r\n\t\tint dropLevel= 4;\r\n\t\tint puntLevel = 5;\r\n\t\tint grubberLevel = 3;\r\n\t\tint goalLevel = 3;\r\n\t\tString kickingNotes = \"Kicking\";\r\n\t\r\n\t\tboolean successful = ctrl.createNewSkillRecord(playerSru, standardLevel, spinLevel, popLevel, passingNotes,\r\n\t\t\t\tfrontLevel, rearLevel, sideLevel, scrabbleLevel, tacklingNotes,\r\n\t\t\t\tdropLevel, puntLevel, grubberLevel, goalLevel, kickingNotes);\r\n\t\t\r\n\t\tassertTrue(successful);\r\n\t}", "public void assignId(int id);", "@BodyParser.Of(BodyParser.Json.class)\n public Result create(Long id) {\n Script script = Script.find.byId(id);\n if (script != null) {\n JsonNode json = request().body().asJson();\n String name = json.findPath(\"name\").textValue();\n String description = json.findPath(\"description\").textValue();\n\n models.Preset preset = models.Preset.createDummyPreset(name, description, script);\n\n return ok(Json.toJson(preset));\n }\n return notFound();\n }", "@POST(\"/AddWeapon\")\n\tint addWeapon(@Body Weapon weapon,@Body int id) throws GameNotFoundException;", "public irestads.model.AdsItem create(long adsItemId);", "int insert(RoleResource record);", "public void setSkillPrediction(Skills skill);", "public SkillEntry addSkill(final SkillEntry newSkill, final boolean store) {\n if (newSkill == null) {\n return null;\n }\n\n // Add a skill to the L2Player skills and its Func objects to the calculator set of the L2Player\n final SkillEntry oldSkill = super.addSkill(newSkill);\n if (isTransformed()) {\n getTransformation().setStateUpdate(true);\n }\n if (newSkill == oldSkill) {\n return oldSkill;\n }\n\n // Add or update a L2Player skill in the character_skills table of the database\n if (store && !isPhantom()) {\n CharacterSkillDAO.getInstance().replace(this, newSkill);\n }\n\n return oldSkill;\n }", "@Inject\n public SkillHandler(ISkillService skillService) {\n if (skillService == null) {\n throw new NullPointerException(\"skill service was null\");\n }\n\n this.fSkillSPI = skillService;\n }", "@SuppressWarnings(\"unchecked\")\n\t@PostMapping(\"/add-skill-master\")\n\tpublic String addskillMasterPost(@ModelAttribute HrmsSkillMasterModel skill, Model model, HttpSession session) {\n\n\t\tlogger.info(\"Method : addskillMasterPost starts\");\n\n\t\tString userId = \"\";\n\t\tString companyId = \"\";\n\t\ttry {\n\t\t\tuserId = (String) session.getAttribute(\"USER_ID\");\n\t\t\tcompanyId = (String) session.getAttribute(\"COMPANY_ID\");\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tskill.setCreatedBy(userId);\n\t\tskill.setCompanyId(companyId);\n\t\tJsonResponse<Object> resp = new JsonResponse<Object>();\n\t\ttry {\n\n\t\t\tresp = restClient.postForObject(env.getEmployeeUrl() + \"restAddskills\", skill, JsonResponse.class);\n\n\t\t} catch (RestClientException e) {\n\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tif (resp.getMessage() != \"\") {\n\t\t\tsession.setAttribute(\"message\", resp.getMessage());\n\t\t\tsession.setAttribute(\"sessionskill\", skill);\n\t\t\treturn \"redirect:/employee/add-skill-master\";\n\t\t}\n\t\tlogger.info(\"Method : addskillMasterPost ends\");\n\n\t\treturn \"redirect:/employee/view-skill-master\";\n\t}", "Tank() {\n\n print(\"Tank \" + id + \" is created!\");\n print(\"Tank \" + id + \" is created!\");\n }", "AchievementModel createAchievementModel(AchievementModel achievementModel);", "public String addStudent (String name,String admin){\n Document doc = new Document(\"name\", name);\n doc.put(\"skills\",Arrays.asList());\n studentSkills.insertOne(doc);\n this.createNewToken(doc.get(\"_id\").toString(),admin);\n return doc.get(\"_id\").toString();\n}", "public Skill toEntity(SkillDTO dto) {\n return toEntity(dto, 1);\n }", "public Optional<DbStudentEntity> create(\n final Id id,\n final String name,\n final String address,\n final String rollNo,\n final String collegeCode,\n final String courseCode);", "int insertPerson(UUID id, Person person);", "WithCreate withSku(Sku sku);", "public TbljobSkill() {\n this(\"tbljob_skill\", null);\n }", "@Test\n public void testUpgradeSkill_01() {\n System.out.println(\"upgradeSkill\");\n \n// Skill s = mock(Skill.class);\n// when(s.getName()).thenReturn(\"Java\");\n// when(s.getType()).thenReturn(\"Technical\");\n// when(s.getCost()).thenReturn(2);\n// when(s.getLevel()).thenReturn(4);\n// when(s.getCostFormula()).thenReturn(Skill.PLUS_2);\n Skill s = new Skill(\"Java\",\"Technical\",2,4,Skill.PLUS_2);\n \n SkillsList instance = new SkillsList();\n instance.add(s);\n instance.upgradeSkill(\"Java\");\n int result = instance.get(\"Java\").getLevel();\n assertTrue(result==5);\n }", "private void addSkills() {\n userSkills = new ArrayList<Skill>();\n // set all the skills that the user inputs to new Skills\n final String skill = actvAddMoreSkills.getText().toString().trim();\n // store the database reference to \"Skill\" as a shortcut\n final DatabaseReference skillsRef = FirebaseDatabase.getInstance().getReference(\"Skill\");\n // if the user does not add the last skill they fill in to the recycler view, then we want to grab it\n // and store it as a new skill\n if (!skill.isEmpty()) {\n final Skill userLastInputSkill = new Skill(skill);\n userSkills.add(userLastInputSkill);\n }\n userSkills.addAll(skills);\n // index through the arraylist to add the skills to the database and link them with the current user\n for (int i = 0; i < userSkills.size(); i++) {\n // we need to bind our index to a final integer in order to link it to the database\n final int index = i;\n // we now go through all the skills already in the database to see if the skill that the user input is already there or not\n skillsRef.orderByChild(\"skill\").equalTo(userSkills.get(index).getSkill())\n .addListenerForSingleValueEvent(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot dataSnapshot) {\n // if the skill is already in the database then we continue through the if statement\n if (dataSnapshot.exists()) {\n // skill already exists in database\n // create hashmap for UserID\n final HashMap<String, String> userIdDataMap = new HashMap<String, String>();\n pushToUsersPerSkill(userIdDataMap, index);\n // get the skill object ID from the database\n // we now set another listener for the exact skill in the database to find its specific id\n pushToSkillsPerUser(index);\n // if the skill that the user input is not already in the database then we run through the else case\n } else {\n firebaseData.child(\"Skill\").push().setValue(userSkills.get(index));\n // create a hashmap for the UserID\n final HashMap<String, String> userIdDataMap = new HashMap<String, String>();\n pushToUsersPerSkill(userIdDataMap, index);\n // get the skill object ID from the database\n // we now set another listener for the exact skill in the database to find its specific id\n pushToSkillsPerUser(index);\n }\n }\n @Override\n public void onCancelled(@NonNull DatabaseError databaseError) {\n // log the error\n Log.e(\"Adding Skills\", databaseError.toString());\n }\n });\n }\n }", "int insertSelective(JindouyunRole record);", "public interface PostSkillsAPI {\n @PUT(\"current_user/add_skills\")\n Call<User> postSkills(@HeaderMap Map<String, String> headers,@Body @Root(\"user_skills\") PostSkills skillObj);\n}", "@Override\n public Lesson create(Long memberId, LessonRequest request) throws Exception {\n // find Instructor with memberId,\n Optional<Instructor> instr = instructorService.findInstructorById(memberId);\n // then create Lesson with given info from lessonRequest\n Lesson lesson = new Lesson();\n lesson.setInstructor(instr.get());\n lesson.setDescription(request.getDescription());\n lesson.setStartTime(request.getStartTime());\n lesson.setEndTime(request.getEndTime());\n lesson.setStatus(\"OPEN\");\n\n LessonTime.checkIfStartTimeIsFirst(lesson.getStartTime(),lesson.getEndTime());\n // LessonTime lessonTime = new LessonTime();\n lessonTime.checkOverlapBetweenLessons(lesson.getEndTime(),lesson.getStartTime(),lesson.getInstructor());\n\n // persist into DB -> go via LessonRepository\n return lessonRepository.save(lesson);\n\n }", "public abstract boolean hasSkill(Skill skill);", "private void configureRestorationPulse(final int skillId) {\r\n restoration[skillId] = new SkillRestoration(skillId);\r\n }", "public static int attemptSkillUp(int skillId, Player player){ \n\t\ttry{\n\t\t\tif(DwarfCraftPlayerSkills.getSkillLevel(skillId, player) == -1){return -2;}\n\t\t\tif(DwarfCraftPlayerSkills.getSkillLevel(skillId, player) == 30){return -2;}\n\t\t\tint[] skillCost;\n\t\t\tskillCost = new int[8];\n\t\t\tint newSkillLevel = DwarfCraftPlayerSkills.getSkillLevel(skillId, player);\n\t\t\t/* Dan thinks skillId could be removed from the arguments in this function\n\t\t\t getSkillTrainingCost */\n\t\t\tskillCost = Skills.values()[skillId].getSkillTrainingCost(skillId, newSkillLevel, player);\n\t\t\tfor (int i = 0; i < skillCost[0];i++){\n\t\t\t\t//check inventory quantity for needed items\n\t\t\t\tif (DwarfCraftInventory.countInventoryItems(skillCost[1+2*i], player) < skillCost[2+2*i]){return -1;}\n\t\t\t}\n\t\t\treturn 1;\n\t\t}\n\t\t\tcatch(NumberFormatException f) {return 0;}\n\t}", "@PostMapping(\"/attractions\")\n @Timed\n public ResponseEntity<Attraction> createAttraction(@RequestBody Attraction attraction) throws URISyntaxException {\n log.debug(\"REST request to save Attraction : {}\", attraction);\n if (attraction.getId() != null) {\n throw new BadRequestAlertException(\"A new attraction cannot already have an ID\", ENTITY_NAME, \"idexists\");\n }\n Attraction result = attractionRepository.save(attraction);\n return ResponseEntity.created(new URI(\"/api/attractions/\" + result.getId()))\n .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))\n .body(result);\n }", "Resource create(Session session, IRI identifier, IRI type);", "public void createCourse(String courseName, int courseCode){}", "@Override\n\tpublic void create(String id, String code) {\n\t\tStringBuilder qString = new StringBuilder(\"INSERT INTO required_nomenclature (id_required_nomenclature, code) VALUES (?, ?)\");\n\t jdbcTemplate.update(qString.toString(), id, code);\n\t}", "public LongFilter getSkillId() {\n\t\treturn skillId;\n\t}", "@SneakyThrows\n @Override\n public DeveloperSkill findByID(Long id) {\n return null; //parse.get(Math.toIntExact(id));\n }", "@Test\n public void testUpgradeSkill_04() {\n System.out.println(\"upgradeSkill\");\n \n Skill s = mock(Skill.class);\n when(s.getName()).thenReturn(\"Java\");\n when(s.getType()).thenReturn(\"Technical\");\n when(s.getCost()).thenReturn(2);\n when(s.getLevel()).thenReturn(10);\n when(s.getCostFormula()).thenReturn(Skill.PLUS_2);\n \n SkillsList instance = new SkillsList();\n instance.add(s);\n instance.upgradeSkill(\"Java\");\n int result = instance.get(\"Java\").getLevel();\n assertTrue(result==10);\n }", "public LanguageSkill() {\n\t}", "public void setSkillId(LongFilter skillId) {\n\t\tthis.skillId = skillId;\n\t}", "public TbljobSkill(String alias) {\n this(alias, TBLJOB_SKILL);\n }", "public CsclAppointeeMaster create(long id_);", "@RequestMapping(method = RequestMethod.POST)\n @ResponseStatus(HttpStatus.CREATED)\n public void create(@RequestBody Penalty penalty, HttpServletResponse response) throws Exception {\n Penalty p = rep.save(penalty);\n\n URI location = ServletUriComponentsBuilder\n .fromCurrentRequest().path(\"/{id}\")\n .buildAndExpand(p.getId()).toUri();\n\n response.setHeader(\"location\", location.toString());\n throw new TechnicalException(\"test\");\n }", "private Long createNewTestPackageRecord(Long userid) {\r\n\t\tTesttargetRecord result = getDbContext().insertInto(TESTTARGET, TESTTARGET.USER_ID).values(userid)\r\n\t\t\t\t.returning(TESTTARGET.ID).fetchOne();\r\n\t\treturn result.getId();\r\n\t}", "public long createDemo() {\n mDemoId = insertDemo(\"unnamed\");\n return mDemoId;\n }", "@Test\n public void getId_stylistsInstantiateWithAnId_1() {\n Stylist testStylist = new Stylist(\"Xena\");\n testStylist.save();\n assertEquals(testStylist.getId() > 0);\n }", "void create(int id, int authorId, String title);" ]
[ "0.704702", "0.7037742", "0.68250144", "0.66034335", "0.6589577", "0.63959056", "0.634495", "0.62619364", "0.62216973", "0.61631626", "0.60877234", "0.6072855", "0.6064057", "0.6054182", "0.59205246", "0.5856195", "0.58261967", "0.5814231", "0.57758427", "0.57468677", "0.5746636", "0.57435167", "0.5739221", "0.5736412", "0.57168", "0.5698747", "0.56909674", "0.56740016", "0.564639", "0.5587723", "0.55715626", "0.55133736", "0.54997844", "0.549084", "0.54686034", "0.54301333", "0.5400095", "0.53342116", "0.53306884", "0.53275687", "0.5325399", "0.53098243", "0.5293019", "0.5257546", "0.5220179", "0.5205732", "0.5198728", "0.5166176", "0.51608604", "0.5157264", "0.51313674", "0.51210344", "0.5116645", "0.5116209", "0.5099795", "0.50692177", "0.50646937", "0.5054533", "0.5051682", "0.5032653", "0.50268215", "0.5017306", "0.50011", "0.49941832", "0.49899945", "0.4988884", "0.4983161", "0.49779794", "0.4961635", "0.49608403", "0.4946512", "0.4945645", "0.49416843", "0.49306732", "0.49274746", "0.49234882", "0.49223584", "0.49194083", "0.4898591", "0.4892624", "0.48906234", "0.4890117", "0.48893908", "0.48862758", "0.4886142", "0.48735592", "0.4863914", "0.48623493", "0.48598388", "0.48515224", "0.48438394", "0.4833906", "0.4833222", "0.48322988", "0.48319826", "0.4829362", "0.4826341", "0.4824521", "0.48213485", "0.48106104" ]
0.6684883
3
sum of all individual fitnesses
public void findTotalFit() { for (int i=0;i<popSize;i++) { totalFitness+=this.getFitness(i); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static double sumOfSquares(LeastSquaresFit fit, double[] x,\n\t\t\t\t double[] y)\n {\n\tAdder.Kahan adder = new Adder.Kahan();\n\tAdder.Kahan.State state = adder.getState();\n\tint m = x.length;\n\tfor (int i = 0; i < m; i++) {\n\t double term = y[i] - fit.valueAt(x[i]);\n\t term *= term;\n\t double yy = term - state.c;\n\t double t = state.total + yy;\n\t state.c = (t - state.total) - yy;\n\t state.total = t;\n\t}\n\treturn state.total;\n }", "void calcFittest(){\n System.out.println(\"Wall hugs\");\n System.out.println(this.wallHugs);\n\n System.out.println(\"Freedom points\");\n System.out.println(this.freedomPoints);\n\n System.out.println(\"Visited points\");\n System.out.println(this.vistedPoints);\n\n this.fitnessScore = freedomPoints - wallHugs - vistedPoints;\n System.out.println(\"Individual fit score: \" + fitnessScore);\n }", "public static void evaluateFitnesses() {\n for (Polynomial p : Population) {\n p.setRawFitness(getRawFitness(p, data));\n if (debug) {\n printPopulation(true);\n }\n }\n }", "private Double CPLXCalculateWeightedSUM(int numTerms) {\n Double result = 0.0;\r\n\r\n for (int counter = 0; counter < numTerms; counter++) \r\n {\r\n result += CPLXCalculateWeightedSUMTerm(counter);\r\n }\r\n\r\n return result;\r\n }", "double getSum();", "double getSum();", "public double getRegressionSumSquares() {\n return getRegressionSumSquares(getSlope());\n }", "public ArrayList<Double> getAverageFitnesses() { return avgFitnesses; }", "private double calculateTotalFeesEarned(ArrayList<Pair<Fees, Time>> timeslots) {\n double sumOfFees = 0.00;\n for (DayOfWeek day : DayOfWeek.values()) {\n sumOfFees += calculateFeesEarnedEachDayOfWeek(timeslots, day);\n }\n return sumOfFees;\n }", "public void calcularFitness() {\n double fit = 0;\r\n for (int x=0; x < this.genotipo.length;x++){\r\n if (x!=this.genotipo.length-1){\r\n fit+=distancias[this.genotipo[x]][this.genotipo[x+1]];\r\n }else{\r\n fit+=distancias[this.genotipo[x]][this.genotipo[0]];\r\n }\r\n }\r\n this.fitness = fit;\r\n }", "public double getOutcomeWeightSum() { return outcome_w_sum; }", "private void EvalFitness(){\r\n _FitVal=0;\r\n for(int i=0; i<7;i++)\r\n for(int j=i+1;j<8;j++){\r\n if( _Data[i]==_Data[j]) _FitVal++;\r\n if(j-i==Math.abs(_Data[i]-_Data[j])) _FitVal++;\r\n }\r\n }", "public double sumXs() {\n double $ = 0;\n for (int ¢ = 0; ¢ < xVals.size(); ++¢)\n $ += unbox(cantBeNull(xVals.get(¢)));\n return $;\n }\n\n // calculate the sum of all the y values\n public double sumYs() {\n double $ = 0;\n for (int ¢ = 0; ¢ < yVals.size(); ++¢)\n $ += unbox(cantBeNull(yVals.get(¢)));\n return $;\n }", "public double sumXYs() {\n double $ = 0;\n for (int ¢ = 0; ¢ < yVals.size(); ++¢)\n $ += unbox(cantBeNull(xVals.get(¢))) * unbox(cantBeNull(yVals.get(¢)));\n return $;\n }\n\n // calculate the linear regression\n public LinearLine calcLinearRegression() {\n double $;\n final double n = xVals.size();\n final double a = (n * sumXYs() - sumXs() * sumYs()) / (n * sumXXs() - sumXs() * sumXs());\n $ = 1 / n * sumYs() - a / n * sumXs();\n return new LinearLine(a, $);\n }", "public double getTotalSumSquares() {\n if (n < 2) {\n return Double.NaN;\n }\n return sumYY;\n }", "public int sumEquipmentWeight(){\n int sum = 0;\n for (Equipment e: equipment){\n sum += e.getWeight();\n }\n return sum;\n }", "@Test\n\tpublic void testSum() {\n\t\tassertEquals(155, g1.sum(), .0001);\n\t\tassertEquals(226, g2.sum(), .0001);\n\t\tassertEquals(298, g3.sum(), .0001);\n\t}", "public double sumXXs() {\n double $ = 0;\n for (int ¢ = 0; ¢ < xVals.size(); ++¢)\n $ += unbox(cantBeNull(xVals.get(¢))) * unbox(cantBeNull(xVals.get(¢)));\n return $;\n }\n\n // calculate the sum of all the squares of the y values\n public double sumYYs() {\n double $ = 0;\n for (int ¢ = 0; ¢ < yVals.size(); ++¢)\n $ += unbox(cantBeNull(yVals.get(¢))) * unbox(cantBeNull(yVals.get(¢)));\n return $;\n }", "public double getSUM() {\n return sum;\n }", "private int getIndividual(double fitSum) {\n double sum = 0;\n\n // I need a double number between 0 and fitSum\n double goal = rand.nextDouble() * Math.abs(fitSum);\n\n \n\n\n for (int i = 0; i < fitScores.size(); i++) {\n sum += Math.abs(fitScores.get(i));\n\n if (sum >= goal) {\n return i;\n }\n }\n System.out.println(\"The goal fit \" + goal + \" The sum of fit \" + sum);\n\n // not working\n return -1;\n\n }", "public double[] getFitParameters() {\r\n\t\treturn a;\r\n\t}", "private static double SumY(int degree, double[] _y, double[] _x)\n {\n double sum = 0.;\n for(int i = 0; i < _y.length; i++)\n {\n sum += _y[i] * Math.pow(_x[i], degree);\n }\n return sum;\n }", "public int calcSum() {\n\t\tint sum = 0;\n\t\tfor (int count = 0; count < data.size(); count++)\n\t\t\tsum += (int)data.get(count);\n\t\treturn sum;\n\t}", "public int getSum() {\n int result = 0;\n\n for (Map.Entry<Integer, Integer> entry : this.entrySet()) {\n result += entry.getKey() * entry.getValue();\n }\n\n return result;\n }", "public float getSumOfMarks() {\r\n\r\n float sum = 0f;\r\n for (int i = 0; i < numberOfCourses; i++)\r\n sum += marks[i];\r\n return sum;\r\n }", "public double getSumResidualsSqr() {\n double[] params = getParams();\n if (params != null) {\n return params[numParams];\n } else {\n return Double.NaN;\n }\n }", "private double getRegressionSumSquares(double slope) {\n return slope * slope * sumXX;\n }", "public final double getObsWeightedSum() {\n return (myJsum);\n }", "public double sum()\r\n {\r\n double sum = 0.0;\r\n for (Double c : this.values())\r\n sum += c;\r\n\r\n return sum;\r\n }", "public float averageAnswers() {\n\t\tfloat out = 0;\n\t\t\n\t\tIterator<SolveResult> iter = super.iterator();\n\t\t\n\t\twhile(iter.hasNext()) {\n\t\t\tSolveResult thisResult = iter.next();\n\t\t\tfloat clues = ResultSet.clueCount(thisResult.puzzle);\n\t\t\tfloat cardinality = thisResult.puzzle.getCardinality();\n\t\t\tfloat conflicts = thisResult.puzzle.conflictCount();\n\t\t\t\n\t\t\tif(!(cardinality - clues - conflicts < 0)) {\n\t\t\t\tout += ((cardinality - clues - conflicts) / (81 - clues));\n\t\t\t}\n\t\t}\n\t\treturn out / super.size();\n\t}", "private void calculateRealizedProfit() {\n\n // Calculate the realized profit for this stock. Realized profit is\n // the sum of money already gained or lost for all the shares sold for\n // this stock.\n this.realizedProfit = 0 ;\n for( final Trade buyTrade : this.allCashBuyTrades ) {\n final List<Trade> sellTrades = buyTrade.getSellTrades() ;\n if( sellTrades != null ) {\n for( final Trade sellTrade : sellTrades ) {\n this.realizedProfit += sellTrade.getMatchedUnits() *\n ( sellTrade.getAvgPrice() - buyTrade.getAvgPrice() ) ;\n }\n }\n }\n }", "public double calcFitness(int[] genes) {\n\t\treturn 0;\n\t}", "public int getSum()\n {\n return die1.getFacevalue() + die2.getFacevalue();\n }", "public double getSumXX() { \n\t\treturn sumX1X1; \n\t}", "public ArrayList<Double> getHighestFitnesses() { return highFitnesses; }", "@Override\n\tpublic double valuta_figli() {\n\t\treturn simple_fitness();\n\t}", "public double sum() {\n/* 196 */ return this.mean * this.count;\n/* */ }", "public abstract double totalWeight();", "public abstract void calculateSufficientStatistics();", "public double elementSum() {\n return ops.elementSum(mat);\n }", "public double evaluate(){\n trialsSoFar++;\n double tot = 0;\n int ix = 0;\n while (ix < genome.getGenome().size()) {\n // directly access the current value field of each bandit\n boolean block = true;\n for (int j=0; j<blockSize; j++) {\n if (genome.getGenome().get(ix).getX() != 1)\n block = false;\n ix++;\n }\n if (block) {\n tot += blockSize;\n }\n }\n return tot;\n }", "double calculateSoma(List<Double> weights);", "public int sumEquipmentPrice(){\n int sum = 0;\n for (Equipment e: equipment){\n sum += e.getPrice();\n }\n return sum;\n }", "boolean sumResiduals(double[] x) {\n if (x == null) {\n return false;\n }\n /*\n * x[numParams] = sumResiduals(x, xData, yData, zData); return true;\n */\n// for (double d : x) {\n// System.out.print(String.format(\"%f, \", d));\n// }\n// System.out.println();\n double e;\n x[numParams] = 0.0;\n for (int i = 0; i < xData.length; i++) {\n for (int j = 0; j < yData.length; j++) {\n e = evaluate(x, xData[i], yData[j]) - zData[j * xData.length + i];\n// System.out.println(String.format(\"%f\", evaluate(x, xData[i], yData[j])));\n x[numParams] = x[numParams] + (e * e);\n }\n }\n return true;\n }", "private double sumWeights(int index, Image image){\n double sum = 0;\n for(int i= 0; i<400 ; i++){\n sum+=perceptrons.get(i).getWeight(index)\n *normalizeImageValue(image.getImage()[i]);\n }\n return sum;\n }", "public double sumOfFrequencies() {\r\n\t\tdouble output = 0.0;\r\n\t\tfor(int i=0; i<this.treeNodes.length; i++) {\r\n\t\t\toutput += this.treeNodes[i].getFrequency();\r\n\t\t}\r\n\t\treturn output;\r\n\t}", "public double getPrereqWeightSum() { return prereq_w_sum; }", "public double getSumY() { \n\t\treturn sumY; \n\t}", "protected int sumAll() {\n\t\tint total = 0;\n\t\t//iterate all rows\n\t\tfor(int i = 0;i<size();i++){\n\t\t\t//itreate all columns\n\t\t\tfor(int j = 0;j<size();j++){\n\t\t\t\tInteger cell = matrix.get(i).get(j);\n\t\t\t\ttotal+=cell;\n\t\t\t}\n\t\t}\n\t\treturn total;\n\t}", "public double calculateSatisfaction(){\n\n\t\tdouble satisfaction=0;\n\t\tif(calculateSurveyQuantity()>=10){\n\n\t\t\tfor(int i=0; i<surveys.length; i++){\n\n\t\t\t\tif(surveys[i]!=null){\n\n\t\t\t\t\tsatisfaction+=surveys[i].calculateSatisfaction();\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tsatisfaction/=calculateSurveyQuantity();\n\n\t\t}\n\n\t\treturn satisfaction;\n\n\t}", "double getMeanProfit() {\n ArrayList<Double> allProfits = new ArrayList<>();\n\n for (Firm firm : firms) {\n List<Double> profitsOfFirm = firm.getProfits();\n allProfits.addAll(profitsOfFirm.subList(profitsOfFirm.size() - SimulationManager.sizeOfExaminationInterval, profitsOfFirm.size()));\n }\n\n return Calculation.round(Calculation.getMean(allProfits), 2);\n }", "public int getSum() {\n\t\t\treturn 0;\r\n\t\t}", "public double sum() {\n double sum = x;\n Lista iter = new Lista(this);\n while (iter.next != null) {\n sum += iter.next.x;\n iter = iter.next;\n }\n return sum;\n }", "private Double calculateTotalFitness() {\n double totalFitnessScore = 0;\n\n IgniteCache<Long, Chromosome> cache = ignite.cache(GAGridConstants.POPULATION_CACHE);\n\n SqlFieldsQuery sql = new SqlFieldsQuery(\"select SUM(FITNESSSCORE) from Chromosome\");\n\n // Iterate over the result set.\n try (QueryCursor<List<?>> cursor = cache.query(sql)) {\n for (List<?> row : cursor)\n totalFitnessScore = (Double)row.get(0);\n }\n\n return totalFitnessScore;\n }", "private double computeSumAlpha()\n\t{\n\t\tdouble sum = 0;\n\t\tdouble[] a = svm.getAlphas();\n\t\tfor(double d : a)\n\t\t\tsum += Math.abs(d);\n\t\treturn sum;\n\t}", "public int getTotalPoints() {\n \tint total = 0;\n \tfor (int i = 0; i < assignments.size(); i++) {\n \t\ttotal += assignments.get(i).getWorth();\n \t}\n \treturn total;\n }", "public abstract double evaluateFitness();", "public double calcTotalEarnings() {\n double total = 0;\n for (int i = 0; i < numRegions; i++) {\n total += regionList[i].calcEarnings();\n }\n return total;\n }", "public int sum()\r\n {\r\n return die1.getFaceValue() + die2.getFaceValue();\r\n }", "public static void sumTotalScore() {\n totalScore += addRandomScore();;\n }", "double CalculateFitness(double fun) \n\t {\n\t\t double result=0;\n\t\t if(fun>=0)\n\t\t {\n\t\t\t result=1/(fun+1);\n\t\t }\n\t\t else\n\t\t {\n\t\t\t \n\t\t\t result=0;\n\t\t }\n\t\t return result;\n\t }", "public double getXSumSquares() {\n if (n < 2) {\n return Double.NaN;\n }\n return sumXX;\n }", "public double getSumXY() { \n\t\treturn sumX1Y; \n\t}", "void fit(DataSet dataSet);", "public int totalWorth() {\n\t\tint val = 0;\n\t\tfor (Card c : cards) {\n\t\t\tval += c.value();\n\t\t}\n\t\treturn val;\n\t}", "public IRealVector sumWeighted(Collection<WeightedTerm> terms) throws Exception {\n IRealVector vector = null;\n for (WeightedTerm tw : terms) {\n if (wordToVector.hasWord(tw.term)) {\n if (vector == null) {\n vector = wordToVector.getWordVector(tw.term).clone();\n double factor = 1 + Math.log(tw.weight);\n vector.multiply(factor);\n }\n else {\n IRealVector v = wordToVector.getWordVector(tw.term).clone();\n double factor = 1 + Math.log(tw.weight); \n vector.add(v.multiply(factor));\n }\n }\n } \n return vector; \n }", "public double getSumX() { \n\t\treturn sumX1; \n\t}", "@Override\n public double calcCost() {\n return calcSalesFee()+calcTaxes();\n }", "private int sumValue(int[] yt){\n\t\tint temp = 0;\n\t\tfor(int i=0;i<=3;i++){\n\t\t\ttemp += pow(yt[i]-y[i],2);\n\t\t}\n\t\treturn temp;\n\t}", "private float getSubSum(){\n float sum = 0;\n for(int i = 0; i < subList.size(); i++){\n sum = sum + subList.get(i).getCost();\n }\n return sum;\n }", "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 double sumOfSquares(float... fValues) {\n double result = 0.0;\n for (float value : fValues) {\n result += value * value;\n }\n\n assert result >= 0.0 : result;\n return result;\n }", "public static void calculateFitness(Individual[] individuals) {\n for (Individual individual : individuals) {\n individual.fitness = 0;\n for (int i = 0; i < dataSet.size(); i++) {\n for (Rule rule : individual.rulebase) {\n boolean match = true;\n int[] data = dataSet.get(i).getVariables();\n\n for (int j = 0; j < data.length; j++) {\n\n String variable = String.valueOf(data[j]);\n //String variable = \"\" + data[j];\n String[] rulebase = rule.cond;\n\n if ((rulebase[j].equals(variable) != true) && (rulebase[j].equals(\"#\") != true)) {\n match = false;\n }\n }\n\n if (match) {\n String output = String.valueOf(dataSet.get(i).getOutput());\n if (rule.output.equals(output)) {\n individual.fitness++;\n }\n break;\n }\n }\n }\n }\n }", "public void makeStochastic() {\n \n double sum = 0.0;\n \n for(T row : getFirstDimension()) {\n \n // sum all values\n for(T col : getMatches(row)) {\n \n if(get(row, col)!=null) {\n sum += get(row, col);\n }\n \n }\n }\n \n \n for(T row : getFirstDimension()) {\n \n // sum all values\n for(T col : getMatches(row)) {\n \n if(get(row, col)!=null) {\n set(row, col, get(row, col)/sum);\n }\n \n }\n }\n }", "@Test\n public void testSumActualAddedModifiedSizeSquared()\n {\n assertEquals(this.linealRegressionCalculator.sumActualAddedModifiedSizeSquared(), 7604693.0, 0.01);\n }", "public double givenWorkWeeksEstimateIncomeAll(int workWeeks){\n\t return formatReturnValue((workWeeks * givenWorkWeeksEstimateIncomeGetSlopeAll()) + givenWorkWeeksEstimateIncomeGetInterceptAll());\n\t}", "@Override\r\n\tprotected double evaluate(double[] values) throws EvaluationException {\r\n\t\tdouble sum = 0;\r\n\t\tfor (int i = 0 ; i < values.length ; i++){\r\n\t\t\tsum += values[i];\r\n\t\t}\r\n\t\treturn sum;\r\n\t}", "public int score() {\n int sum = 0;\n for (Candidate c : chosen) {\n sum += c.score(compatibilityScoreSet);\n }\n return sum;\n }", "public double eigenValueTotal(){\n if(!this.pcaDone)this.pca();\n return this.eigenValueTotal;\n }", "public long sum() {\n\t\tlong result = 0;\n\t\tfor (int i=0; i<numElements; i++) {\n\t\t\tresult += theElements[i];\n\t\t}\n\t\treturn result;\n\t}", "public double calcNetForceExertedByY(Planet[] allpt) {\n\t\tdouble f = 0;\n\t\tfor (Planet p : allpt) {\n\t\t\tif (this.equals(p)) {continue;}\n\t\t\tf += calcForceExertedByY(p);\n\t\t}\n\t\treturn f;\n\t}", "public void testF() {\n\t\tfor (int k = 0; k < usedSS; k++) {\n\t\t\tList<Integer> subStr = vals.subList(k*compSize, (k+1)*compSize);\n\t\t\tint sum = (int) subStr.stream().filter(i -> i != BipartiteMatching.FREE).count();\n\t\t\tfData.add(sum);\t\t\t\n\t\t}\n\t}", "private double calcProbability(int index) {\n\t\treturn (double) fitnesses[index] / sumOfFitnesses();\n\t}", "private double calculateFeesEarnedEachDayOfWeek(ArrayList<Pair<Fees, Time>> timeslots, DayOfWeek day) {\n return daysOfWeek[day.ordinal()] * timeslots.stream()\n .filter(p -> convertDayOfWeek(p.getValue().getDay()).equals(day))\n .mapToDouble(p -> p.getValue().getTuitionHours() * p.getKey().getFeesValue())\n .sum();\n }", "default double totalWeight() {\n return edges().stream().mapToDouble(E::weight).sum();\n }", "public double getBestSolutionEvaluation();", "public int linearEstimateForSize()\n {\n int ret = 1;\n if (parameterisedDimensions != null)\n for (int i = 0; i < parameterisedDimensions.length; i++)\n ret *= linearEstimateForSize(parameterisedDimensions[i]);\n if (simpleDimensions != null)\n for (int i = 0; i < simpleDimensions.length; i++)\n ret *= linearEstimateForSize(simpleDimensions[i]);\n return ret;\n }", "public abstract double getConstraintFitness();", "double getTotalProfit();", "public Integer calculateSum() {\n logger.debug(\"Calculating and returning the sum of expenses.\");\n return listOfTargets.stream().map(T::getAmount).reduce(0, Integer::sum);\n }", "public int sumCalories() {\n int calories = 0;\n\n for (Food f : units) {\n calories += f.getCalories();\n }\n\n return calories;\n }", "public double udregnSamletPris() {\n\t\tdouble result = 0;\n\t\tfor (Salgslinje s : salgslinjer) {\n\t\t\tresult += s.getPris();\n\t\t}\n\t\treturn result;\n\t}", "public void setSUM(double value) {\n this.sum = value;\n }", "public int sum()\n {\n return sum(0,0,size);\n }", "private void updateCenterSquareSum() {\n\t\tfor(KMeansCluster cluster : clusters) {\n\t\t\tKMeansNode center = cluster.getCenter();\n\t\t\tdouble squareSum = 0;\n\t\t\tfor(Entry<?, Double> entry : center.getVector().entrySet()) {\n\t\t\t\tsquareSum += entry.getValue() * entry.getValue();\n\t\t\t}\n\t\t\tsquareSum = Math.sqrt(squareSum);\n\t\t\tcenterTfidfSquireSum.put(cluster, squareSum);\n\t\t\t\n\t\t}\n\t}", "void CalculateProbabilities()\n\t{\n\t int i;\n\t double maxfit;\n\t maxfit=fitness[0];\n\t for (i=1;i<FoodNumber;i++)\n\t {\n\t if (fitness[i]>maxfit)\n\t maxfit=fitness[i];\n\t }\n\n\t for (i=0;i<FoodNumber;i++)\n\t {\n\t prob[i]=(0.9*(fitness[i]/maxfit))+0.1;\n\t }\n\n\t}", "public double sum() {\n double resultat = 0;\n for (int i = 0; i < tab.size(); i++) {\n resultat += CalculatorArray.sum(tab.get(i));\n }\n System.out.println(\"Sum colonne:\" + resultat);\n return resultat;\n }", "public int computePredatorsPreyDistanceSum() {\r\n int sum=0;\r\n for(Predator p:predators){\r\n sum+=p.calculatePredatorPreyDistance(prey, false);\r\n sum+=p.calculatePredatorPreyDistance(prey, true);\r\n }\r\n return sum;\r\n }", "int getEvaluations();", "public void evaluatePopulation() {\n // reset the total fitness score\n totalFitness = 0;\n\n for (int i = 0; i < populationSize; i++) {\n population.get(i).setRawFitness(\n FeederCollection.getFeeders().get(i).GetFitness());\n totalFitness += population.get(i).getRawFitness();\n }\n\n // set the normalized fitness for each population member\n for (Genotype g : population) {\n // normalized fitness = raw fitness / total fitness\n g.setNormalizedFitness((g.getRawFitness() / totalFitness));\n }\n\n // sort the popoulation\n Collections.sort(population, Genotype.FitnessOrder);\n\n highFitnesses.add(population.get(0).getRawFitness());\n avgFitnesses.add(totalFitness / population.size());\n\n\n }" ]
[ "0.67908466", "0.66457653", "0.6629603", "0.6496637", "0.6252867", "0.6252867", "0.6189326", "0.61354613", "0.6056825", "0.6046027", "0.60397667", "0.6024955", "0.59893525", "0.588029", "0.58715785", "0.587123", "0.58466023", "0.5839535", "0.57666755", "0.57385623", "0.5734741", "0.5720305", "0.57086694", "0.57042956", "0.56954145", "0.5675178", "0.5645844", "0.56145954", "0.56075287", "0.55741215", "0.55676764", "0.55574685", "0.55444014", "0.55355203", "0.5535015", "0.55345553", "0.5527308", "0.55263954", "0.55144733", "0.5449314", "0.54392296", "0.54341155", "0.5430414", "0.54303986", "0.54236746", "0.5417941", "0.5411674", "0.54010963", "0.53965366", "0.5390418", "0.538404", "0.5383199", "0.5382136", "0.5381304", "0.53741777", "0.5370831", "0.5369436", "0.5360561", "0.5358207", "0.53303254", "0.5319605", "0.528989", "0.5281785", "0.5280315", "0.52737117", "0.5270547", "0.5267755", "0.5267685", "0.5263202", "0.52573246", "0.5252764", "0.52470154", "0.5243971", "0.52373093", "0.5233637", "0.5233488", "0.5231375", "0.522569", "0.5221115", "0.52107775", "0.5205284", "0.5190636", "0.518863", "0.51836807", "0.51773167", "0.51609355", "0.51562124", "0.5153872", "0.5153527", "0.5152633", "0.51446235", "0.51402944", "0.51388", "0.51214343", "0.5121032", "0.5120764", "0.511962", "0.5116626", "0.51136", "0.51110905" ]
0.71350837
0
static methods save data in a csv file only saves gen and bna strings
public void writeToCsv(String fileName) throws Exception { FileWriter writer=new FileWriter(fileName); writer.append(Integer.toString(this.gen)); writer.append('\n'); for(int i=0;i<popSize;i++) { writer.append(getBna(i)); writer.append('\n'); } writer.close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 }", "CSV createCSV();", "public void saveAsCsv() {\n\n try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(\"saves/data.csv\"))){\n for(Publication book : library){\n StringBuilder stringBuilder = new StringBuilder();\n\n stringBuilder.append(\"\\\"\").append(book.getClass().getSimpleName()).append(\"\\\"\"); // type\n stringBuilder.append(\",\"); // delimiter\n stringBuilder.append(\"\\\"\").append(book.getTitle()).append(\"\\\"\"); // title\n stringBuilder.append(\",\");\n stringBuilder.append(\"\\\"\").append(book.getAuthor().toString()).append(\"\\\"\"); // author\n stringBuilder.append(\",\");\n stringBuilder.append(\"\\\"\").append(book.getPages()).append(\"\\\"\"); // pages\n stringBuilder.append(\",\");\n stringBuilder.append(\"\\\"\").append(book.getIsbn()).append(\"\\\"\"); // isbn\n stringBuilder.append(\",\");\n stringBuilder.append(\"\\\"\").append(book.getReleaseYear()).append(\"\\\"\"); // year\n stringBuilder.append(\"\\n\");\n\n bufferedWriter.write(stringBuilder.toString()); // creates a line of one publication information and puts it to file\n }\n } catch (IOException e){\n System.out.println(\"IOException occurred: \" + e.getMessage());\n }\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}", "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 saveData(int argLowAlpha, int argHighAlpha, int argLowBeta, int argHighBeta, int argLowGamma, int argMidGamma, int argDelta, int argTheta) {\n\n try {\n File sdCard = Environment.getExternalStorageDirectory();\n File dir = new File(sdCard.getAbsolutePath() + \"/cerebro_files/\");\n dir.mkdirs();\n\n if (fileCountFlag == 0) {\n File[] files = dir.listFiles();\n int numberOfFiles = files.length;\n String index = new Integer(numberOfFiles + 1).toString();\n Toast.makeText(getApplicationContext(), \"Number of files is: \"+index, Toast.LENGTH_SHORT).show();\n filename = \"file\" + index + \".csv\";\n fileCountFlag = 1;\n }\n\n //File file = new File(dir, \"filename1.csv\"+index);\n File file = new File(dir, filename);\n //Toast.makeText(getApplicationContext(), \"init file\",Toast.LENGTH_SHORT).show();\n\n FileOutputStream f = new FileOutputStream(file, true);\n\n //Toast.makeText(getApplicationContext(), \"got output stream\",Toast.LENGTH_SHORT).show();\n\n //String strLowAlpha = new Integer(lowAlpha).toString();\n String strHighAlpha = new Integer(argHighAlpha).toString();\n String strLowBeta = new Integer(argLowBeta).toString();\n String strHighBeta = new Integer(argHighBeta).toString();\n String strLowGamma = new Integer(argLowGamma).toString();\n String strMidGamma = new Integer(argMidGamma).toString();\n String strDelta = new Integer(argDelta).toString();\n String strTheta = new Integer(argTheta).toString();\n\n //string1 = string1 + \"\\n\";\n\n String strCSV = new Integer(argLowAlpha).toString();\n\n strCSV = strCSV+','+strHighAlpha+','+strLowBeta+','+strHighBeta+','+strLowGamma+','+strMidGamma+','+strDelta+','+strTheta+'\\n';\n\n //f.write(string.getBytes());\n //bf.write(passData.getBytes());\n f.write(strCSV.getBytes());\n //Toast.makeText(getApplicationContext(), \"Done writing\",Toast.LENGTH_SHORT).show();\n f.close();\n //Toast.makeText(getApplicationContext(), \"File buffer closed\",Toast.LENGTH_SHORT).show();\n } catch (Exception e) {\n e.printStackTrace();\n Toast.makeText(getApplicationContext(), \"failed to write\",Toast.LENGTH_SHORT).show();\n }\n }", "public void saveFile()\n\t{\n\t\tStringBuilder sb = new StringBuilder();\n\t\tString newLine = System.getProperty(\"line.separator\");\n\t\t\n\t\tfor(CSVItem cItem : itemList)\n\t\t{\n\t\t\tsb.append(cItem.buildCSVString()).append(newLine);\n\t\t\t\n\t\t}\n\t\tString fileString = sb.toString();\n\t\t\n\t\t File newTextFile = new File(filePath);\n\n FileWriter fw;\n\t\ttry {\n\t\t\tfw = new FileWriter(newTextFile);\n\t\t\t fw.write(fileString);\n\t\t fw.close();\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\n\t}", "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 void save() {\n CSVWriter csvWriter = new CSVWriter();\n csvWriter.writeToTalks(\"phase1/src/Resources/Talks.csv\", this.getTalkManager()); //Not implemented yet\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}", "private void saveMarkovToCSVFileInformation(){\n //Clear out the current NewCensusColumnDetails before saving.\n this.currentMarkovChain.setNewCensusColumnDetails(new ArrayList<NewCensusColumnDetails>());\n \n ArrayList<NewCensusColumnDetails> newCensusColumnDetails = new ArrayList<>();\n \n ArrayList<cerl.gui.utilities.Class> censusClasses = this.currentMarkovChain.getCensusClasses();\n List<SurveyColumnValuesGrouping> surveyGroupings = this.currentMarkovChain.getSelectSurveyClass().getSurveyColumnValuesGroupings();\n\n /**\n * These will be used to find the min and max values stored in the grid. \n * \n * Row data starts at index 1.\n * Column data starts at index 2.\n */\n int rowToStartAt = START_EDITABLE_ROW;\n \n for(int surveyCounter = 0; surveyCounter < surveyGroupings.size(); surveyCounter++){ //rows\n int currentColumnNumber = START_EDITABLE_COL;\n SurveyColumnValuesGrouping surveyGrouping = surveyGroupings.get(surveyCounter);\n\n double newTotalRandomNumber = 0;\n ArrayList<Integer> oldValueLookUpColumns = new ArrayList<Integer>();\n\n for(int censusCounter = 0; censusCounter < censusClasses.size(); censusCounter++){ //columns\n cerl.gui.utilities.Class censusClass = censusClasses.get(censusCounter);\n oldValueLookUpColumns.add(censusClass.getColumnNumber());\n\n double[] minMaxValues = this.myTable.getMinMaxObject(rowToStartAt + surveyCounter, currentColumnNumber);\n\n double foundMin = minMaxValues[0];\n double foundMax = minMaxValues[1];\n\n double foundRandomNumber = 0.0;\n if(foundMin == foundMax){\n foundRandomNumber = foundMax;\n }else {\n foundRandomNumber = ThreadLocalRandom.current().nextDouble(foundMin, foundMax);\n foundRandomNumber = Math.round(foundRandomNumber * 100.0) / 100.0;\n }\n\n newTotalRandomNumber += foundRandomNumber;\n if(currentColumnNumber < END_EDITABLE_COL){\n currentColumnNumber++;\n }\n }\n\n //set min and max numbers\n //New column header that will appear in the new csv file\n NewCensusColumnDetails details = new NewCensusColumnDetails(\n surveyGrouping.toString(), \n newTotalRandomNumber,\n oldValueLookUpColumns,\n 0\n );\n\n newCensusColumnDetails.add(details);\n }\n \n newCensusColumnDetails = setCensusTotalColumns(newCensusColumnDetails);\n \n //Add the new NewCensusColumnDetails to the current MarkovChain object\n this.currentMarkovChain.setNewCensusColumnDetails(newCensusColumnDetails);\n }", "public void createCSV() {\n\t\t// Need to integrate CSV calling logic\n\t}", "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 void exportToCSV();", "private static void SaveTable(Class<?> itemClass, List<CSVItem> data) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException {\n\t\tString tl = (String)itemClass.getMethod(\"readTitle\").invoke(null, null);\n\t\tString val = \"\";\n\t\tString fn = (String)itemClass.getField(\"file\").get(val);\n\t\t\n\t\t\n\t\t\n\t\tfn = \"C:\\\\Users\\\\Chebakov.AA\\\\neo4j\\\\import\\\\pitc\\\\\" + fn + \".csv\";\n\t\ttry (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(fn), \"UTF8\")) { //\"cp1251\"\n\t\t\tout.write(tl + \"\\r\\n\");\n\t\t\tdata.stream()\n\t\t\t\t.map(v -> v.readDataRow())\n\t\t\t\t.forEach(v -> {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tout.write(v + \"\\r\\n\");\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (UnsupportedEncodingException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void saveToFile(Agent agent, String _login)\n {\n File file = new File(_login + \".csv\");\n FileWriter fw;\n BufferedWriter bw;\n try {\n fw = new FileWriter(file, false);\n bw = new BufferedWriter (fw);\n String csvData = agent.getCSVData();\n bw.write(csvData);\n bw.close();\n fw.close();\n }\n catch(IOException ioEx) {\n JOptionPane.showMessageDialog(null, ioEx.getMessage());\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}", "@Override\n\tpublic void exportToCSV() {\n\n\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}", "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 }", "@Override\r\n\tpublic void actionPerformed(ActionEvent ae) {\n\t\tFile file = FileChooser.SaveCsvFile();\r\n\t\tif(file==null)\r\n\t\t\treturn;\r\n\t\tBufferedWriter bw = null;\r\n\t\ttry {\r\n\t\t\tbw = new BufferedWriter(new FileWriter(file));\r\n\t\t\tSystem.out.println(file.getAbsolutePath());\r\n\t\t\tbw.write(\"Phonenumber\");\r\n\t\t\tbw.newLine();\r\n\t\t\tfor(int i = 0;i<CSVFrame.model.getRowCount();i++) {\r\n\t\t\t\tRecord r = CSVFrame.model.getRowAt(i);\r\n\t\t\t\tSystem.out.println(r.getPhone());\r\n\t\t\t\tbw.write(r.getPhone());\r\n\t\t\t\tbw.newLine();\r\n\t\t\t}\r\n\t\t\tJOptionPane.showMessageDialog(null, \"Finished creating suppression file\");\r\n\t\t} catch(IOException ex) {\r\n\t\t\tex.printStackTrace();\r\n\t\t}\r\n\t\tfinally {\r\n\t\t\ttry {\r\n\t\t\t\tbw.close();\r\n\t\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}\r\n\t\t}\r\n\t}", "static void saveVertexesInfoToCSV(\r\n ITaxonomy taxonomy,\r\n String strCSVFilename,\r\n boolean includeProb) throws IOException, Exception\r\n {\r\n BufferedWriter writer; // Writer\r\n \r\n String strLine; // Line written\r\n \r\n char sep = ';'; // Separator dield\r\n \r\n // We create a writer for the text file\r\n \r\n writer = new BufferedWriter(new FileWriter(strCSVFilename, false));\r\n \r\n // We write the titles\r\n \r\n strLine = \"Synset ID\" + sep\r\n + \"Words\" + sep\r\n + \"ParentsID\" + sep\r\n + \"IC value\" + sep;\r\n \r\n if (includeProb)\r\n {\r\n strLine += \"Probability\" + sep;\r\n }\r\n \r\n strLine += \"Depth\" + sep\r\n + \"Longest depth\" + sep\r\n + \"# Children\" + sep\r\n + \"# Parents\" + sep\r\n + \"# Subsumers\" + sep\r\n + \"# Hyponyms\" + sep\r\n + \"# Leaves\" + \"\\n\";\r\n \r\n writer.write(strLine);\r\n \r\n // We write the info for each taxonomy node\r\n \r\n for (IVertex vertex: taxonomy.getVertexes())\r\n {\r\n // We get the vertx info into a linte\r\n \r\n strLine = getVertexLine(vertex, sep, includeProb);\r\n \r\n // We write the vertx line\r\n \r\n writer.write(strLine);\r\n }\r\n \r\n // We close the file\r\n \r\n writer.close();\r\n }", "private void CreateNewFile() {\n\tcheckState();\n\t\n\tif (CanR=CanW=true)\n\t{\n\t\t\n\t\ttry {\n\t\t root = Environment.getExternalStorageDirectory();\n\t\t \n\t\t if (root.canWrite()){\n\t\t gpxfile = new File(root, \"Speed_SD.csv\");\n\t\t gpxwriter = new FileWriter(gpxfile,true);\n\t\t out = new BufferedWriter(gpxwriter);\nout.append(\"\"+\",\"+\"\"+\",\"+\"\");\n\t\t out.newLine();\n\t\t }\n\t\t} catch (IOException e) {\n\t\t //Log.e(, \"Could not write file \" + e.getMessage());\ne.printStackTrace();\n\t\t\n\t}\n\t\t\n}\n\t\t}", "private void toSave() {\n File file4=new File(\"trial.txt\");\n try\n {\n String row;\n BufferedWriter bw=new BufferedWriter(new FileWriter(file4));\n for(int i=0;i<jt.getRowCount();i++)\n {\n row = \"\";\n for(int j=0;j<jt.getColumnCount();j++)\n {\n row += (jt.getValueAt(i, j) +\",\");\n }\n row = row.substring(0, row.length()-1);\n //System.out.println(row);\n bw.write(row);\n bw.newLine();\n }\n bw.close();\n \n \n JOptionPane.showMessageDialog(rootPane,\"Details saved succesfully\");\n }\n \n catch(Exception ex)\n {\n JOptionPane.showMessageDialog(rootPane,\"Exception occured\");\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 }", "public static void savecars(){\n Cars xx = new Cars();\n System.out.println(\"save cars\");\n String outtext;\n try {\n File rentfile = new File(\"cars.csv\");\n FileWriter out = new FileWriter(rentfile);\n for (int i = 0; i < listcars.size();i++) {\n xx = listcars.get(i);\n String newline = System.getProperty(\"line.separator\");\n outtext = xx.getBrand()+ \";\"+ xx.getModel()+ \";\"+ xx.getReference()+ \";\"+ xx.getYear()+ newline;\n out.write(outtext);\n }\n out.close();\n System.out.println(\"cars data saved in cars.csv\");\n } catch (IOException i) {\n i.printStackTrace();\n }\n }", "private void miSalvareActionPerformed(java.awt.event.ActionEvent evt) { \n if (!model.isEmpty()) {\n int response = JOptionPane.showConfirmDialog(this, \"Doriti sa salvati lista de contacte?\", \"Salvare\", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);\n if (response == JOptionPane.YES_OPTION) {\n try {\n JFileChooser chooser = new JFileChooser();\n chooser.showSaveDialog(this);\n File list = new File(chooser.getSelectedFile().getAbsolutePath() + \".csv\");\n PrintWriter writer = new PrintWriter(list);\n StringBuilder sb = new StringBuilder();\n\n sb.append(\"Nume\");\n sb.append(\",\");\n sb.append(\"Prenume\");\n sb.append(\",\");\n sb.append(\"Data nasterii\");\n sb.append(\",\");\n sb.append(\"Numar Telefon\");\n sb.append(\",\");\n sb.append(\"\\r\\n\");\n\n listaContacte.stream().map((c) -> {\n sb.append(c.getNume());\n return c;\n }).map((c) -> {\n sb.append(\",\");\n sb.append(c.getPrenume());\n return c;\n }).map((c) -> {\n sb.append(\",\");\n String dataNasterii[] = c.getDataNasterii().toString().split(\"-\");\n String a = dataNasterii[0];\n String l = dataNasterii[1];\n String z = dataNasterii[2];\n String dt = z + \".\" + l + \".\" + a;\n sb.append(dt);\n sb.append(\",\");\n sb.append(c.getNrTel().toString());\n return c;\n }).forEachOrdered((_item) -> {\n sb.append(\"\\r\\n\");\n });\n\n writer.write(sb.toString());\n writer.close();\n\n } catch (FileNotFoundException ex) {\n Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);\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}", "void createCsv(String location);", "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 }", "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}", "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 }", "@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 }", "String toCSVString();", "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}", "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 }", "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 }", "private void saveCSV(ActionEvent actionEvent) {\n JFileChooser fileChooser = new JFileChooser();\n fileChooser.setCurrentDirectory(new File(System.getProperty(\"user.home\")));\n int result = fileChooser.showOpenDialog(this);\n if (result == JFileChooser.APPROVE_OPTION) {\n String selectedFile = fileChooser.getSelectedFile().getAbsolutePath();\n StatisticsFile statisticsFile = new StatisticsFile(selectedFile);\n try{\n statisticsFile.writeInCvs(my_map.getSettlements());\n }catch(IOException ioException){\n ioException.printStackTrace();\n }\n }\n }", "public File exportData() {\n File zephyrlogFolder = new File(Environment.getExternalStorageDirectory(), \"QuestionnaireActs\");\n\n boolean dirExists = zephyrlogFolder.exists();\n //if the directory doesn't exist, create it\n if (!dirExists) {\n dirExists = zephyrlogFolder.mkdirs();\n //if it still doesn't exist, give up and exit\n if (!dirExists) {\n Toast.makeText(this, \"Could not create ZephyrLogs directory!\", Toast.LENGTH_LONG).show();\n }\n }\n\n\n //create a data file and write into it\n File file = new File(zephyrlogFolder, \"Questionnaire_\"+promptName+\".txt\");\n try {\n FileWriter writer;\n if(!file.exists()){\n boolean created = file.createNewFile();\n if (!created) throw new IOException(\"Could not create data file\");\n writer = new FileWriter(file, true);\n //if this is a new file, write the CSV format at the top\n writer.write(\"Ονοματεπώνυμο: \"+promptName+\"\\n\"+\"Score: \"+myscore+\"\\n\\n\");\n } else {\n writer = new FileWriter(file, true);\n }\n writer.write(\"Ονοματεπώνυμο: \"+promptName+\"\\n\"+\"Score: \"+myscore+\"\\n\\n\");\n writer.close();\n } catch (FileNotFoundException e) {\n Toast.makeText(this, \"Could not create logging file!\", Toast.LENGTH_LONG).show();\n e.printStackTrace();\n } catch (UnsupportedEncodingException e) {\n Toast.makeText(this, \"Unsupported encoding exception thrown trying to write file!\", Toast.LENGTH_LONG).show();\n e.printStackTrace();\n } catch (IOException e) {\n Toast.makeText(this, \"IO Exception trying to write to data file!\", Toast.LENGTH_LONG).show();\n e.printStackTrace();\n }\n return file;\n }", "static void saveEdgesInfoToCSV(\r\n ITaxonomy taxonomy,\r\n String strCSVFilename) throws IOException, Exception\r\n {\r\n BufferedWriter writer; // Writer\r\n \r\n String strLine; // Line written\r\n \r\n char sep = ';'; // Separator dield\r\n \r\n // We create a writer for the text file\r\n \r\n writer = new BufferedWriter(new FileWriter(strCSVFilename, false));\r\n \r\n // We write the titles\r\n \r\n strLine = \"Source ID\" + sep\r\n + \"Target ID\" + sep\r\n + \"CondProbability\" + sep\r\n + \"IC weight\" + \"\\n\";\r\n \r\n writer.write(strLine);\r\n \r\n // We write the info for each taxonomy node\r\n \r\n for (IEdge edge: taxonomy.getEdges())\r\n {\r\n // We get the vertx info into a linte\r\n \r\n strLine = getEdgeLine(edge, sep);\r\n \r\n // We write the vertx line\r\n \r\n writer.write(strLine);\r\n }\r\n \r\n // We close the file\r\n \r\n writer.close();\r\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 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}", "private void saveDialog() {\n JFileChooser chooser = new JFileChooser();\n \n FileFilter ff = new FileFilter() {\n\n @Override\n public boolean accept(File f) {\n // TODO Auto-generated method stub\n return f.getName().endsWith(FILE_EXTENSION);\n }\n\n @Override\n public String getDescription() {\n return \"CSV\";\n }\n\n };\n chooser.addChoosableFileFilter(ff);\n chooser.setAcceptAllFileFilterUsed(true);\n chooser.setFileFilter(ff);\n chooser.showSaveDialog(null);\n this.file = chooser.getSelectedFile();\n //this.file = new File(chooser.getSelectedFile().getName() + INSTANCE.FILE_EXTENSION);\n\n\n try {\n\n if (file != null) {\n this.saveData();\n this.isModifed = false;\n }\n\n } catch (Exception e) {\n JOptionPane.showMessageDialog(null, e.getMessage(), \"Error Saving File\", JOptionPane.ERROR_MESSAGE);\n\n }\n\n }", "public void save() {\n\t\tInputManager.resetWriter(false);\n\t\tInputManager.writer(InputManager.newDelimeterOne + \" \" + InputManager.newDelimeterTwo);\n\t\tfor(Row r: rows) {\n\t\t\tInputManager.writer(r.toString());\n\t\t}\n\t}", "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 }", "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 main(String[] args) throws IOException {\n\t\tint id_telefone = 4;\n\t\t\n\t\tFileInputStream fis = new FileInputStream(SAMPLE_CSV_FILE_PATH);\n\t\tInputStreamReader isr = new InputStreamReader(fis, \"UTF-8\");\n\t\t\n\t\t@SuppressWarnings(\"deprecation\")\n\t\tCSVReader reader = new CSVReader(isr, ';' , '\"' , 0);\n \tString[] nextLine;\n \t\n// \tWriter writer = Files.newBufferedWriter(Paths.get(\"saida.csv\"));\n// \tCSVWriter csvWriter = new CSVWriter(writer,\n// CSVWriter.DEFAULT_SEPARATOR,\n// CSVWriter.NO_QUOTE_CHARACTER,\n// CSVWriter.DEFAULT_ESCAPE_CHARACTER,\n// CSVWriter.DEFAULT_LINE_END);\n \t\n \tFile file = new File(\"Clientes.sql\");\n \n BufferedWriter fr = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),\"UTF-8\"));\n \t\n \twhile ((nextLine = reader.readNext()) != null) {\n \t\t\n if (nextLine != null) {\n \t\n// \tSystem.out.println(nextLine.length);\n \t\n \tString id = nextLine[0];\n \tif(!id.isEmpty()) {\n \t\n \t\tid = id.substring(5);\n \t\tid = id.replace(\".\", \"\");\n \t\t\n \t\tboolean temCEP = false;\n \t\t\n \t\tif(nextLine.length > 12) temCEP = true;\n \t\t\n \t\tString CEP = \"\";\n \t\tif(temCEP) {\n \t\t CEP = nextLine[12];\n CEP = CEP.replace(\".\", \"\");\n CEP = CEP.replaceAll(\"-\",\"\");\n CEP = CEP.replaceAll(\" \",\"\");\n \t\t};\n \n \t\n \n \tfr.write(\"INSERT INTO hmprojetos.cliente values (\" \n + id \n + \",'\" + nextLine[1]\n \t\t+ \"','\" + nextLine[2]\n \t\t\t\t+ \"','\" + nextLine[3]\n \t\t\t\t\t\t+ \"','\" + nextLine[4]\n \t\t\t\t\t\t\t\t+ \"','\" + nextLine[5]\n \t\t\t\t\t\t\t\t\t\t+ \"','\" + CEP\n \t\t\t\t\t\t\t\t\t\t\t\t+ \"','\" + nextLine[10]\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t+ \"','\" + nextLine[11]\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t+ \"','\" + nextLine[6]\n + \"');\\n\");\n \t\n \t//Criação dos INSERTS dos telefones\n \tif(!nextLine[7].isEmpty()) {\n \tfr.write(\"INSERT INTO hmprojetos.telefone values (\"\n \t\t\t+ id_telefone\n \t\t\t+ \",'','\" + nextLine[7]\n \t\t\t+ \"',\"\n \t\t\t+ id \n \t\t\t+ \");\\n\"\n \t\t\t);\n \t\tid_telefone++;\n \t}\n \tif(!nextLine[8].isEmpty()) {\n \tfr.write(\"INSERT INTO hmprojetos.telefone values (\"\n \t\t\t+ id_telefone\n \t\t\t+ \",'','\" + nextLine[8]\n \t\t\t+ \"',\"\n \t\t\t+ id \n \t\t\t+ \");\\n\"\n \t\t\t);\n \t\tid_telefone++;\n \t}\n \tif(!nextLine[9].isEmpty()) {\n \tfr.write(\"INSERT INTO hmprojetos.telefone values (\"\n \t\t\t+ id_telefone\n \t\t\t+ \",'','\" + nextLine[9]\n \t\t\t+ \"',\"\n \t\t\t+ id \n \t\t\t+ \");\\n\"\n \t\t\t);\n \t\tid_telefone++;\n \t}\n \t\n \t}\n }\n \t}\n \t\n \tfr.close();\n \tSystem.out.println(\"Done\");\n\t}", "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}", "public void loadCSVData() throws IOException, SQLException {\r\n //SQL statement to load csv information into data table\r\n String insertvaluesSQL = \"INSERT INTO data\"\r\n + \"(InvoiceNo, StockCode, Description, Quantity, InvoiceDate, UnitPrice, CustomerID, Country)\"\r\n + \" VALUES (?,?,?,?,?,?,?,?);\";\r\n\r\n //code to read csv file taken from W03 practical\r\n BufferedReader br = new BufferedReader(new FileReader(filePath));\r\n String line = br.readLine();\r\n String[] informationArray;\r\n while (line != null) {\r\n informationArray = line.split(\",\");\r\n PreparedStatement preparedStatement = connection.prepareStatement(insertvaluesSQL);\r\n //the first '?' corresponds to the 0th term in the information array\r\n //the second '?' corresponds to the 1st term in the information array\r\n for (int i = 1; i < 9; i++) {\r\n preparedStatement.setString(i, informationArray[i - 1]);\r\n }\r\n preparedStatement.executeUpdate();\r\n line = br.readLine();\r\n }\r\n Statement statement = connection.createStatement();\r\n statement.executeUpdate(\"DELETE FROM data WHERE InvoiceNo = 'InvoiceNo';\");\r\n statement.close();\r\n }", "public void saveGift(Gift gift, String username){\n\n\t\tString path = FILEPATH + username+\".csv\";\n\t\tSimpleDateFormat formatter = new SimpleDateFormat(\"dd/MM/yy\");\n\t\tPrintStream fileOut = null;\n\t\t\n\t\ttry {\n\t\t\n\t\t\tfileOut = new PrintStream(new FileOutputStream(path, true));\n\t\t\t\t\n\t\t\tfileOut.print(gift.getFriendName());\n\t\t\tfileOut.print(\",\");\n\t\t\tfileOut.print(formatter.format(gift.getDate()));\n\t\t\tfileOut.print(\",\");\n\t\t\t\tfileOut.println(gift.getCropName());\n\t\t\t\t\n\t\t} catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t \n\t\t} finally {\n\t\t\tif (fileOut != null) {\n\t\t\t\tfileOut.close();\n\t\t\t}\n\t\t}\t\n\t}", "private void createSaveData(){\n try {\n File f = new File(filePath, highScores);\n FileWriter output = new FileWriter(f);\n BufferedWriter writer = new BufferedWriter(output);\n\n writer.write(\"0-0-0-0-0\");\n writer.newLine();\n writer.write(\".....-.....-.....-.....-.....\");\n writer.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "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 }", "private boolean writeData(String aCSVFilename)\n {\n try\n {\n // open the chosen file\n File file = new File(aCSVFilename);\n BufferedWriter bufWtr = new BufferedWriter(new FileWriter(file));\n\n // write each line to text file\n writeKeyValuePairs(bufWtr);\n\n //close the file\n bufWtr.close();\n return true;\n }\n catch (Exception e)\n {\n return false;\n }\n }", "public void guardarJugadores() {\n\n\t\tString ficheroEnMesa = String.format(\"jugadoresEnMesa%d.csv\", id);\n\t\tString ficheroRetirados = \"jugadoresRetirados.csv\";\n\n\t\tGestionCSV.escribirCSV(ficheroEnMesa, jugadoresEnMesa);\n\t\tGestionCSV.escribirCSV(ficheroRetirados, jugadoresRetirados);\n\n\t}", "String[] toCSV() throws Exception;", "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 void saveCSV(Collection<? extends Collection<String>> data, File file) {\r\n\t\tfinal FileWriter out;\r\n\t\tString output;\r\n\r\n\t\ttry {\r\n\t\t\tout = new FileWriter(file);\r\n\r\n\t\t\tfor (Collection<String> row : data) {\r\n\t\t\t\toutput = \"\";\r\n\r\n\t\t\t\tfor (String value : row)\r\n\t\t\t\t\toutput += value + \",\";\r\n\r\n\t\t\t\t// Remove the last comma.\r\n\t\t\t\toutput = output.substring(0, output.length() - 1);\r\n\r\n\t\t\t\toutput += \"\\n\";\r\n\r\n\t\t\t\tout.append(output);\r\n\t\t\t}\r\n\r\n\t\t\tout.flush();\r\n\t\t\tout.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "private void saveToFile(){\n this.currentMarkovChain.setMarkovName(this.txtMarkovChainName.getText());\n saveMarkovToCSVFileInformation();\n \n //Save to file\n Result result = DigPopGUIUtilityClass.saveDigPopGUIInformationSaveFile(\n this.digPopGUIInformation,\n this.digPopGUIInformation.getFilePath());\n }", "@Override\n public void importCSV(File file) {\n System.out.println(\"oi\");\n System.out.println(file.isFile()+\" \"+file.getAbsolutePath());\n if(file.isFile() && file.getPath().toLowerCase().contains(\".csv\")){\n System.out.println(\"Entro\");\n try {\n final Reader reader = new FileReader(file);\n final BufferedReader bufferReader = new BufferedReader(reader);\n String[] cabecalho = bufferReader.readLine().split(\",\");\n int tipo;\n if(cabecalho.length == 3){\n if(cabecalho[2].equalsIgnoreCase(\"SIGLA\")){\n tipo = 1;\n System.out.println(\"TIPO PAIS\");\n }\n else {\n tipo = 2;\n System.out.println(\"TIPO CIDADE\");\n }\n }else {\n tipo = 3;\n System.out.println(\"TIPO ESTADO\");\n }\n \n while(true){\n String linha = bufferReader.readLine();\n if(linha == null){\n break;\n }\n String[] row = linha.split(\",\");\n switch (tipo) {\n case 1:\n Pais pais = new Pais();\n pais.setId(Long.parseLong(row[0]));\n pais.setNome(row[1]);\n pais.setSigla(row[2]);\n new PaisDaoImpl().insert(pais);\n break;\n case 2:\n Cidade cidade = new Cidade();\n cidade.setId(Long.parseLong(row[0]));\n cidade.setNome(row[1]);\n cidade.setEstado(Long.parseLong(row[2]));\n new CidadeDaoImpl().insert(cidade);\n break;\n default:\n Estado estado = new Estado();\n estado.setId(Long.parseLong(row[0]));\n estado.setNome(row[1]);\n estado.setUf(row[2]);\n estado.setPais(Long.parseLong(row[3]));\n new EstadoDaoImpl().insert(estado);\n break;\n }\n }\n \n } catch (FileNotFoundException ex) {\n Logger.getLogger(SQLUtilsImpl.class.getName()).log(Level.SEVERE, null, ex);\n } catch (IOException ex) {\n Logger.getLogger(SQLUtilsImpl.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }", "private void 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 insertdata(String file) {\n\r\n\r\n final String csvFile = file;\r\n\r\n try (BufferedReader br = new BufferedReader(new FileReader(csvFile))) {\r\n\r\n\r\n while ((line = br.readLine()) != null) {\r\n\r\n\r\n // use comma as separator\r\n String[] country = line.split(\",\");\r\n\r\n if (country.length == 12) {\r\n model_lacakMobil = new Model_LacakMobil();\r\n realmHelper = new RealmHelper(realm);\r\n\r\n model_lacakMobil.setNama_mobil(country[1]);\r\n model_lacakMobil.setNo_plat(country[2]);\r\n model_lacakMobil.setNamaunit(country[3]);\r\n model_lacakMobil.setFinance(country[4]);\r\n model_lacakMobil.setOvd(country[5]);\r\n model_lacakMobil.setSaldo(country[6]);\r\n model_lacakMobil.setCabang(country[7]);\r\n model_lacakMobil.setNoka(country[8]);\r\n model_lacakMobil.setNosin(country[9]);\r\n model_lacakMobil.setTahun(country[10]);\r\n model_lacakMobil.setWarna(country[11]);\r\n realmHelper.save(model_lacakMobil);\r\n\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n } finally {\r\n// fixing_data();\r\n\r\n }\r\n }", "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 saveContenttoFile(ArrayList<String> content,ArrayList<String> header, String pathResult){\n\t\ttry{\n\t\t\t//File file = new File(path+\"/\"+gene+\".csv\");\n\t\t\tFile file = new File(pathResult);\n\t\t\tif(!file.exists()){\n\n\t\t\t}\n\t\t\tFileWriter fw = new FileWriter(file,true);\n\t\t\tBufferedWriter bw = new BufferedWriter(fw, 1000000);\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tbw.write(content.get(0));\n\t\t\tcontent.remove(0); \n\t\t\tfor(String str: content) {\n\t\t\t\tif(str!=null ){\n\t\t\t\t\tbw.append(\",\" +\"\\\"\"+str+\"\\\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tbw.newLine();\n\t\t\tbw.close();\n\t\t\tfw.close();\n\t\t}catch(IOException ioe){\n\t\t\tSystem.out.println(\"IOException occurred:\");\n\t\t\tioe.printStackTrace();\n\t\t}\n\t\treturn;\n\t}", "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 ValidationInfo createCsv() {\n LocaleModule lm = LocaleManager.getInstance().getModule(LocaleModuleResource.Main);\n\n ValidationInfo vi = new ValidationInfo();\n if (_rows == null || _rows.size() == 0) {\n vi.setMessageWarning(lm.getString(\"general_export_nothing\"));\n return vi;\n }\n\n String fullFilePath = getFileName();\n\n StringBuilder sb = new StringBuilder();\n\n //create header\n String headerRow = _rows.get(0).createCsvRow(true);\n\n sb.append(headerRow + System.lineSeparator());\n\n try {\n //create rows\n for (Exportable e : _rows) {\n String rowString = e.createCsvRow(false);\n sb.append(rowString + System.lineSeparator());\n }\n\n //Output\n String strContent = sb.toString();\n Utils.writeFile(strContent, fullFilePath);\n\n vi.setMessageSuccess(String.format(lm.getString(\"general_export_success\"),\n _rows.size(), fullFilePath));\n } catch (Exception ex) {\n vi.setMessageError(lm.getString(\"general_export_error\"));\n }\n\n //open\n Utils.openFolder(fullFilePath);\n\n return vi;\n }", "public void Read_Csv() {\n\t\t\n\t\tFile file = new File(\"Faucets.csv\");\n\t\tif(file.exists() == false) {\n\t\t\ttry {\n\t\t\t\t if (file.createNewFile()) {\n\t\t\t\t System.out.println(\"File created: \" + file.getName());\n\t\t\t\t } else {\n\t\t\t\t System.out.println(\"File already exists... Error\");\n\t\t\t\t }\n\t\t\t\t \n\t\t\t\tFileWriter myWriter = new FileWriter(\"Faucets.csv\");\n\t\t\t\tmyWriter.write(\"Freebitco.in,3600,228,\");\n\t\t\t\tmyWriter.close();\n\t\t\t\t\n\t\t\t\t\n\t\t\t}catch (IOException e) {\n\t\t\t\tSystem.out.println(\"Error\");\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t//Reading the file\n\t\tString line = null;\n\t\ttry {\n\t\t\tFileReader fileReader = new FileReader(\"Faucets.csv\");\n\t\t\tBufferedReader bufferedReader = new BufferedReader(fileReader);\n\t\t\t\n\t\t\tint x = 0;\n\t\t\tint commacounter = 0;\n\t\t\tint commaposition[] = new int[3];\n\t\t\twhile((line = bufferedReader.readLine()) != null) {\n\t\t\t\t\n\t\t\t\twhile(x < line.length()) {\n\t\t\t\t\t\n\t\t\t\t\tif(line.charAt(x) == ',') {\n\t\t\t\t\t\tcommaposition[commacounter] = x;\n\t\t\t\t\t\tcommacounter +=1;\n\t\t\t\t\t}\n\t\t\t\t\tif(commacounter == 3) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tFaucets.site[amount_counter] = line.substring(0, commaposition[0]);\n\t\t\t\t\t\tFaucets.time[amount_counter] = Integer.parseInt(line.substring(commaposition[0]+1, commaposition[1]));\n\t\t\t\t\t\tFaucets.amount[amount_counter] = Integer.parseInt(line.substring(commaposition[1]+1, commaposition[2]));\n\t\t\t\t\t\tamount_counter += 1;\n\t\t\t\t\t\tcommacounter=0;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tx+=1;\n\t\t\t\t}\n\t\t\t\tx=0;\n\t\t\t}\n\t\t\tbufferedReader.close();\n\t\t\t\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException ex) {\n\t\t\tex.printStackTrace();\n\t\t}\n\t\t\n\t\n\t\t\t\n\t}", "public static void queryAndDataToCSV() throws IOException {\r\n\t\t@SuppressWarnings(\"resource\")\r\n\t\tBufferedWriter writer = new BufferedWriter(new FileWriter(\"Graph\"+x+\".csv\"));\r\n\t\tArrayList<ArrayList<String>> dataset =ReadInDataset.finalDataset;\r\n\t\tfor (int i=0; i< dataset.size(); i++) {\r\n\t\t\tString entry= dataset.get(i).get(1)+\",\"+ dataset.get(i).get(2);\r\n\t\t\tif (i< Queries.NumberOfQueries) {\r\n\t\t\t\tfor (int x=0; x<(Queries.NumberOfDimensions/2)-1;x++) {\r\n\t\t\t\tentry = entry+\",\"+query.get(i).get(x).get(0) +\",\" +query.get(i).get(x).get(1);\r\n\t\t\t\tentry = entry+\",\"+query.get(i).get(x+1).get(0) +\",\" +query.get(i).get(x+1).get(1);\r\n\t\t\t\t\r\n\t\t\t}}\r\n\t\t\twriter.write(entry);\r\n\t\t\twriter.newLine();\r\n\t\t}\r\n\t\twriter.close();\r\n\t}", "public void ach_doc_type_csv_test () {\n\t\t\n\t}", "private void saveGenres(){\n\t\tFile genreList = new File(Paths.get(\"genres.txt\").toString());\n\t\ttry{\n\t\t\tBufferedWriter writer = new BufferedWriter(new FileWriter(genreList));\n\t\t\tfor (String s : genres){\n\t\t\t\twriter.write(s);\n\t\t\t\twriter.newLine();\n\t\t\t}\n\t\t\twriter.close();\n\t\t} catch(IOException ex){\n\t\t\t\n\t\t}\n\t}", "public void saveBooks(){\n\t\ttry{\t\n\t\t\tPrintWriter pw = new PrintWriter(new FileWriter(\"../bin/books.csv\"));\t\n\t\t\tIterator bookIterator = bookMap.keySet().iterator();\n\t\t\twhile(bookIterator.hasNext() != false){\n\t\t\t\tString current = bookIterator.next().toString();\n\t\t\t\tfor(int i=0;i<bookMap.get(current).size();i++){\t\n\t\t\t\t\tpw.write(bookMap.get(current).get(i).getTitle() \n\t\t\t\t\t\t+ \",\" + bookMap.get(current).get(i).getAuthor()\n\t\t\t\t\t\t+ \",\" + bookMap.get(current).get(i).getYear()\n\t\t\t\t\t\t+ \",\" + bookMap.get(current).get(i).getType()\n\t\t\t\t\t\t+ \",\" + bookMap.get(current).get(i).getId());\n\t\t\t\t\tpw.write(\"\\n\");\n\t\t\t\t}\n\t\t\t}\t\n\t\t\tpw.close();\n\t\t\tSystem.out.println(\"\\tDone!\");\n\t\t}catch(IOException e){\n\t\t\tSystem.out.println(e.toString());\n\t\t}\n\n\t}", "public String getCSVData()\n {\n return (Integer.toString(this.getID()) + \",\" +\n this.getName());\n }", "private void exportFiles()\n\t{\n\t\tloading.setVisibility(View.VISIBLE);\n\t\t\n\t\t// Report String\n\t\t//----------------\n\t\tString reportString = \"Date,Location Latitude, Location Longitude,Vehicle,Description\\n\";\t\n\t\t\n\t\tStringBuilder reportBuilder = new StringBuilder();\n\t\treportBuilder.append(reportString);\n\t\t\n\t\tString objectString = \"\"+ \n\t\t\t\tincident.getDate()+\",\" +\n\t\t\t\tincident.getLatitude() + \",\" +\n\t\t\t\tincident.getLongitude()+\",\" +\n\t\t\t\tincident.getVehicleReg()+\",\" +\n\t\t\t\tincident.getDescription()+\",\" + \"\\n\";\n\t\t\n\t\treportBuilder.append(objectString);\n\t\t\n\t\t// Witnesses String\n\t\t//----------------\n\t\tString witnessString = \"witnessName,witnessEmail,witnessNumber,witnessStatement\\n\";\n\t\t\n\t\tStringBuilder witnessesBuilder = new StringBuilder();\n\t\twitnessesBuilder.append(witnessString);\n\t\t\n\t\tfor(int i=0; i<incident.getWitnesses().size(); i++)\n\t\t{\n\t\t\tobjectString = \"\"+ \n\t\t\t\t\tincident.getWitnesses().get(i).get(\"witnessName\")+\",\" +\n\t\t\t\t\tincident.getWitnesses().get(i).get(\"witnessEmail\") + \",\" +\n\t\t\t\t\tincident.getWitnesses().get(i).get(\"witnessNumber\")+\",\" +\n\t\t\t\t\tincident.getWitnesses().get(i).get(\"witnessStatement\")+\",\" + \"\\n\";\n\t\t\t\n\t\t\twitnessesBuilder.append(objectString);\n\t\t}\n\t\t//-------------------------------------------------\n\t\t\n\t\t// Create file\n\t\t//===========================================\n\t\t// Incident Report\n\t\t//-------------------------------------------------\n\t\tfinal File reportFile = new File(getFilesDir() + \"/\" + \"incident_report.csv\");\n\t\treportFile.setReadable(true,false);\n\t\t\n\t\tif( reportFile != null )\n\t\t{\n\t\t try \n\t\t {\n\t\t \tFileOutputStream fOut = openFileOutput(\"incident_report.csv\", Context.MODE_WORLD_READABLE);\n\t\t \tOutputStreamWriter osw = new OutputStreamWriter(fOut); \n\t\t \tosw.write(reportBuilder.toString());\n\t\t\t\tosw.flush();\n\t\t\t\tosw.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t//-------------------------------------------------\n\t\t\n\t\t// Witnesses file\n\t\t//-------------------------------------------------\n\t\tfinal File witnessesFile = new File(getFilesDir() + \"/\" + \"witnesses.csv\");\n\t\twitnessesFile.setReadable(true,false);\n\t\t\n\t\tif( witnessesFile != null )\n\t\t{\n\t\t try \n\t\t {\n\t\t \tFileOutputStream fOut = openFileOutput(\"witnesses.csv\", Context.MODE_WORLD_READABLE);\n\t\t \tOutputStreamWriter osw = new OutputStreamWriter(fOut); \n\t\t \tosw.write(witnessesBuilder.toString());\n\t\t\t\tosw.flush();\n\t\t\t\tosw.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t//-------------------------------------------------\n\t\t\n\t\t// Media files\n\t\t//-------------------------------------------------\t\n\t\tParseQuery<ParseObject> query = ParseQuery.getQuery(\"DCIncident\");\n\t\tquery.getInBackground(incident.getId(),new GetCallback<ParseObject>() \n\t\t{\n\t\t\t@Override\n\t\t\tpublic void done(final ParseObject parseIncident, ParseException e) \n\t\t\t{\n\t\t\t\tif(e == null)\n\t\t\t\t{\t\t\t\t\t\n\t\t\t\t\t// Get number of photos attached\n\t\t\t\t\tParseQuery<ParseObject> queryPhotos = parseIncident.getRelation(\"incidentPhotos\").getQuery();\n\t\t\t\t\tqueryPhotos.findInBackground(new FindCallback<ParseObject>()\n\t\t\t\t\t{\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void done(List<ParseObject> parsePhotos, ParseException e) \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tArrayList<byte[]> bytes = new ArrayList<byte[]>();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor(int i=0; i<parsePhotos.size(); i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Get photo from the parse\n\t\t\t\t\t\t\t\tParseFile photo = (ParseFile) parsePhotos.get(i).get(\"photoFile\");\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tbytes.add(photo.getData());\n\t\t\t\t\t\t\t\t} catch (ParseException e1) {\n\t\t\t\t\t\t\t\t\te1.printStackTrace();\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\tphotoFiles = AssetsUtilities.saveIncidentPhoto(ReviewReportActivity.this, bytes);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Video\n\t\t\t\t\t\t\tParseFile parseVideo = (ParseFile) parseIncident.get(\"incidentVideo\");\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(parseVideo != null)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tparseVideo.getDataInBackground(new GetDataCallback()\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\tpublic void done(byte[] data, ParseException e) \n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(e == null)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t// Save file\n\t\t\t\t\t\t\t\t\t\t\tvideoFile = AssetsUtilities.saveIncidentVideo(ReviewReportActivity.this,data);\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tfinishSendingEmail(reportFile, witnessesFile);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tfinishSendingEmail(reportFile, witnessesFile);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "private 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 }", "public static void main(String arr[]) {\n\t\t\n\t\tMap<String,String>map = new LinkedHashMap<String,String>();\n\t\t\n\t\tFileWriter fileWriter = null;\n\t\t\t\t\n\t\ttry {\n\t\t\tfileWriter = new FileWriter(fileName);\n\n\t\t\t//Write the CSV file header\n\t\t\tfileWriter.append(FILE_HEADER.toString());\n\t\t\t\n\t\t\t//Add a new line separator after the header\n\t\t\tfileWriter.append(NEW_LINE_SEPARATOR);\n\t\t\t\n\t\t\t//Write a new student object list to the CSV file\n\t\t\t\n\t\t\tfor(int i = 1; i <500000; i++){\n\t\t\t\t\n\t\t\t\tfileWriter.append(String.valueOf(i));\n\t\t\t\tfileWriter.append(COMMA_DELIMITER);\n\n\t\t\t\tfileWriter.append(\"ABC\"+i);\n\t\t\t\tfileWriter.append(COMMA_DELIMITER);\n\n\t\t\t\tfileWriter.append(\"lastname\"+i);\n\t\t\t\tfileWriter.append(COMMA_DELIMITER);\n\n\t\t\t\tfileWriter.append(\"M\"+i);\n\t\t\t\tfileWriter.append(COMMA_DELIMITER);\n\n\t\t\t\tfileWriter.append(String.valueOf(i));\n\t\t\t\tfileWriter.append(NEW_LINE_SEPARATOR);\n\n\t\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(\"CSV file was created successfully !!!\");\n\t\t\t\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(\"Error in CsvFileWriter !!!\");\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\t\n\t\t\ttry {\n\t\t\t\tfileWriter.flush();\n\t\t\t\tfileWriter.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.out.println(\"Error while flushing/closing fileWriter !!!\");\n e.printStackTrace();\n\t\t\t}\n\t\t\t\n\t\t}\n\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 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 }", "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 }", "public static void main(String[] args) throws IOException {\n\t\tFileWriter fw = new FileWriter(\"C:\\\\Users\\\\·ùÇÑ¿­\\\\Desktop\\\\Data.csv\");\n\t\tfor(int i = 11; i <16; i++) {\n\t\t\tString data = \"Linssse #\" + i + \"\\n\";\n\t\t\tfw.write(data);\n\t\t}\n\t\t}", "@Override\n\tprotected String objectToCSVRecord(Object object) {\n\t\tStringBuilder str = new StringBuilder();\n\t\tstr.append(((Item) object).getItemno());\n\t\tstr.append(\",\");\n\t\tstr.append(((Item) object).getItemName());\n\t\tstr.append(\",\");\n\t\tstr.append(((Item) object).getUnitPrice());\n\t\tstr.append(\",\");\n \tString one=str.toString();\n \treturn one;\n\t\t\n\t\t \n\t}", "private void export(){\n //get available number for file name\n int number = getPosition();\n\n //creates the file\n final File file = new File(Environment.getExternalStorageDirectory().getPath() + \"/csv_\" + number + \".csv\");\n\n //creates a output stream and then streams the file to the external storage\n try {\n file.createNewFile();\n FileOutputStream fOut = new FileOutputStream(file);\n OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);\n myOutWriter.append(csvFile.toString());\n\n //closes the writer and stream\n\n myOutWriter.close();\n\n fOut.flush();\n fOut.close();\n\n Toast.makeText(this, \"CSV created\", Toast.LENGTH_LONG).show();\n\n Intent intentShareFile = new Intent(Intent.ACTION_SEND);\n\n //opens the chooser pop-up to choose share function\n if(file.exists()) {\n intentShareFile.setType(\"text/*\");\n intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));\n\n intentShareFile.putExtra(Intent.EXTRA_SUBJECT,\"CSV\");\n intentShareFile.putExtra(Intent.EXTRA_TEXT, \"The exported CSV File\");\n\n StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();\n StrictMode.setVmPolicy(builder.build());\n\n startActivity(Intent.createChooser(intentShareFile, \"Share File\"));\n }\n } catch (IOException e) {\n e.printStackTrace();\n Log.d(\"csvError\", e.getMessage());\n }\n }", "@FXML\n public void handleExport() throws Exception{\n \n Writer writer = null;\n String filename = file.getText();\n file.clear();\n \n try {\n File file = new File(filename+\".csv\");\n writer = new BufferedWriter(new FileWriter(file));\n for (MarkLayer1 mark : data) {\n\n String text = mark.getStunum()+\";\" + mark.getCoursename() + \";\" + mark.getClassM()\n + \";\"+ mark.getExam()+\";\"+mark.getFinalM()+\"\\n\";\n\n writer.write(text);\n msg.setText(\"Export Success\");\n }\n } catch (Exception ex) {\n ex.printStackTrace();\n msg.setText(\"Error with export\");\n }\n finally {\n\n writer.flush();\n writer.close();\n } \n \n }", "public static void csvMake() throws ClassNotFoundException, SQLException, IOException{\n\t\tClass.forName(\"org.h2.Driver\");\n\t\tConnection conn = DriverManager.getConnection(DB, user, pass);\n\t\tCSV newFile = new CSV();\n\t\tnewFile.make(conn);\n\t\tconn.close();\n\t}", "public void writeToCSV(String path) throws IOException, SQLException {\n\t\tWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path), \"UTF-8\"));\n\t\t// Title\n\t\tout.write(\"pageId;title;earliest year;latest year;mean year;\");\n\t\t// IBM\n\t\tout.write(\n\t\t\t\t\"Anger;Disgust;Fear;Joy;Sadness;Analytical;Confident;Tentative;Openness;Conscientiousness;Extraversion;Agreeableness;Emotional Range;\");\n\t\t// LIWC\n\t\tout.write(\n\t\t\t\t\"LIWC;Word Count;Analytical thinking;Clout;Authentic;Emotional tone;Dictionary Words;Positive Emotion;Negative Emotion;Anxiety;Anger;Sadness;Tentative;Certainty;Power;Risk;Death;\");\n\t\tout.write(\"AlchemyTone;mixed;score;type;\");\n\t\tout.write(\"\\n\");\n\t\tfor (Page page : this.getExtractsFromDatabase()) {\n\t\t\tint pageId = page.getPageId();\n\t\t\tString title = page.getTitle();\n\t\t\tToneAnalysis ibmTone = page.getIbmTone();\n\t\t\tReceptivitiAnalysis liwcTone = page.getLiwcTone();\n\t\t\tDocumentSentiment docSentiment = page.getDocumentSentiment();\n\t\t\tint earliestYear = page.getEarliestYear();\n\t\t\tint latestYear = page.getLatestYear();\n\t\t\tint meanYear = 0;\n\t\t\tif (earliestYear == 0) {\n\t\t\t\tmeanYear = latestYear;\n\t\t\t} else {\n\t\t\t\tmeanYear = (earliestYear + latestYear) / 2;\n\t\t\t}\n\t\t\tif (ibmTone != null) {\n\t\t\t\tout.write(pageId + \";\" + title + \";\" + earliestYear + \";\" + latestYear + \";\" + meanYear + \";\");\n\t\t\t\tElementTone documentTone = ibmTone.getDocumentTone();\n\t\t\t\tList<ToneCategory> toneCategories = documentTone.getTones();\n\t\t\t\tfor (ToneCategory toneCategory : toneCategories) {\n\t\t\t\t\tList<ToneScore> toneScores = toneCategory.getTones();\n\t\t\t\t\tfor (ToneScore toneScore : toneScores) {\n\t\t\t\t\t\t// String name = toneScore.getName();\n\t\t\t\t\t\tdouble score = toneScore.getScore();\n\t\t\t\t\t\tout.write(String.valueOf(score).replace('.', ','));\n\t\t\t\t\t\tout.write(\";\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tout.write(\";\");\n\n\t\t\t\tif (liwcTone != null) {\n\t\t\t\t\tDouble wordCount = liwcTone.getLiwcScores().getWc();\n\t\t\t\t\tDouble analyticalThinking = liwcTone.getLiwcScores().getAnalytic();\n\t\t\t\t\tDouble clout = liwcTone.getLiwcScores().getClout();\n\t\t\t\t\tDouble authentic = liwcTone.getLiwcScores().getAuthentic();\n\t\t\t\t\tDouble emotionalTone = liwcTone.getLiwcScores().getTone();\n\t\t\t\t\tDouble dictionaryWords = liwcTone.getLiwcScores().getDic();\n\n\t\t\t\t\tDouble posEmo = liwcTone.getLiwcScores().getCategories().getPosemo();\n\t\t\t\t\tDouble negEmo = liwcTone.getLiwcScores().getCategories().getNegemo();\n\t\t\t\t\tDouble anxiety = liwcTone.getLiwcScores().getCategories().getAnx();\n\t\t\t\t\tDouble anger = liwcTone.getLiwcScores().getCategories().getAnger();\n\t\t\t\t\tDouble sadness = liwcTone.getLiwcScores().getCategories().getSad();\n\t\t\t\t\tDouble tentative = liwcTone.getLiwcScores().getCategories().getTentat();\n\t\t\t\t\tDouble certainty = liwcTone.getLiwcScores().getCategories().getCertain();\n\t\t\t\t\tDouble power = liwcTone.getLiwcScores().getCategories().getPower();\n\t\t\t\t\tDouble risk = liwcTone.getLiwcScores().getCategories().getRisk();\n\t\t\t\t\tDouble death = liwcTone.getLiwcScores().getCategories().getDeath();\n\n\t\t\t\t\tout.write(wordCount + \";\");\n\t\t\t\t\tout.write(String.valueOf(analyticalThinking).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(clout).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(authentic).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(emotionalTone).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(dictionaryWords).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(posEmo).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(negEmo).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(anxiety).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(anger).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(sadness).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(tentative).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(certainty).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(power).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(risk).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(death).replace('.', ',') + \";\");\n\t\t\t\t}\n\t\t\t\tout.write(\";\");\n\t\t\t\tif (docSentiment != null) {\n\t\t\t\t\tString mixed = docSentiment.getSentiment().getMixed();\n\t\t\t\t\tDouble score = docSentiment.getSentiment().getScore();\n\t\t\t\t\tString type = docSentiment.getSentiment().getType().toString();\n\t\t\t\t\tout.write(String.valueOf(mixed).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(score).replace('.', ',') + \";\");\n\t\t\t\t\tout.write(String.valueOf(type).replace('.', ',') + \";\");\n\t\t\t\t}\n\t\t\t\tout.write(\"\\n\");\n\t\t\t}\n\t\t}\n\t\tout.close();\n\t\tSystem.out.println(\"Export finished.\");\n\n\t}", "@Override\n\tpublic void configuration(String csv) {\n\n\t}", "private void writeBatchToFile(ArrayList<SensorEntry> batch) {\n\n\t\tFile file = new File(currFolder + \"/\" + entriesRecorded + \".csv\");\n\n\t\ttry {\n\n\t\t\tFileOutputStream outputStream = new FileOutputStream(file);\n\n\t\t\tif (!file.exists()) {\n\t\t\t\tfile.createNewFile();\n\t\t\t\toutputStream.write(Constants.INS_DATA_HEADER.getBytes());\n\t\t\t}\n\n\t\t\tfor (SensorEntry e : batch)\n\t\t\t\toutputStream.write((e.toRawString() + \",\" + e.getTimeRecorded() + \"\\n\").getBytes());\n\n\t\t\toutputStream.close();\n\n\t\t\tsetsOfEntriesRecorded++;\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "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 }", "public void EntradaySalida(String NombreDoc) {\r\n\t\treturnVal=fileChooser.showOpenDialog(null);\r\n\t\tif(returnVal==JFileChooser.APPROVE_OPTION) {\r\n\t\t\tfile=fileChooser.getSelectedFile();\r\n\t\t\tStringTokenizer st;\r\n\t\t\ttry{\r\n\t\t\t\tJOptionPane.showMessageDialog(this.pr, \"Ahora escogeras donde lo quieres guardar\");\r\n\t\t\t\tJFileChooser f = new JFileChooser();\r\n\t\t\t\tf.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); \r\n\t\t\t\tf.showSaveDialog(null);\r\n\t\t\t\tPrintWriter pw=new PrintWriter(f.getSelectedFile()+\"\\\\ResultadosISR_\" + NombreDoc+\".csv\");\r\n\t\t\t System.out.println(f.getCurrentDirectory());\r\n\t\t\t System.out.println(f.getSelectedFile());\r\n\r\n\t\t\t\tbr=new BufferedReader(new FileReader(file));\r\n\t\t\t\tpw.println(\"Nombre,RFC,Sueldo mensual,Ingreso anual,Aguinaldo,Aguinaldo exento,Aguinaldo gravado,Prima vacacional,Prima vacacional excenta,Prima vacacional gravada,Total ingresos gravan,Medicos y hospitales,Gastos funerarios,SGMM,Hipotecarios,Donativos,Subcuenta retiro,Transporte escolar,Nivel educativo,Maximo a deducir colegiatura,Colegiatura pagada,Total deducciones (sin retiro),Deduccion permitida 10%,Monto ISR,Cuota fija,Porcentaje excedente,Pago excedente,Total a pagar\");\r\n\t\t\t\t\r\n\t\t\t\twhile((currentLine=br.readLine())!=null) {\r\n\t\t\t\t\tst=new StringTokenizer(currentLine);\r\n\t\t\t\t\t\r\n\t\t\t\t\tString name=st.nextToken(\",\");//\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tString rfc=st.nextToken(\",\");//\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble sueldo=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint sueldoM= sueldo.intValue();//\r\n\r\n\t\t\t\t\tDouble Aguinaldo=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint aguinaldo=Aguinaldo.intValue();\r\n\r\n\t\t\t\t\tDouble Primav=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint PrimaV=Primav.intValue();\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble MyH=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint myh=MyH.intValue();\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble GF=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint Funerarios=GF.intValue();\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble SGMM=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint sgmm=SGMM.intValue();\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble Hip=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint hipotecarios=Hip.intValue();\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble Donat=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint Donativos=Donat.intValue();\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble SubR=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint subR=SubR.intValue();\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble Transp=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint transpE=Transp.intValue();\r\n\t\t\t\t\t\r\n\t\t\t\t\tString NivelE=st.nextToken(\",\");\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble Colegiatura=(Double.parseDouble(st.nextToken(\",\")));\r\n\t\t\t\t\tint ColegiaturaP=Colegiatura.intValue();\r\n\t\t\t\t\t\r\n\t\t\t\t\tthis.calculo(name, rfc, sueldoM, aguinaldo, PrimaV,myh,Funerarios, sgmm,hipotecarios,Donativos,subR,transpE,NivelE,ColegiaturaP);\r\n\t\t\t\t\t \r\n\t\t\t\t pw.println(this.nombre+\",\"+this.RFC+\",\"+this.SueldoM+\",\"+this.IngresoA+\",\"+this.Aguinaldo+\",\"+this.AguinaldoE+\",\"+this.AguinaldoG+\",\"+this.PrimaV+\",\"+this.PrimaVE+\",\"+this.PrimaVG+\",\"+this.TotalIngresosG+\",\"+this.MyH+\",\"+this.GatsosFun+\",\"+this.SGMM+\",\"+this.Hipotecarios+\",\"+this.Donativos+\",\"+this.SubRetiro+\",\"+this.TransporteE+\",\"+this.NivelE+\",\"+this.MaxDedColeg+\",\"+this.Colegiatura+\",\"+this.TotalDedNoRetiro+\",\"+this.DedPerm+\",\"+this.MontoISR+\",\"+this.CuotaFija+\",\"+this.PorcExced+\",\"+this.PagoEx+\",\"+this.Total);\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t pw.close(); \r\n\t\t\t br.close();\r\n\t\t\t JOptionPane.showMessageDialog(null, \"El ISR ha sido calculado con exito. El archivo ha sido guardado en la carpeta seleccionada\");\r\n\t\t\t\t\r\n\t\t\t \r\n\t\t\t\t//this.sb.setMessage(\"Archivo guardado Exitosamente\");\r\n\t\t\t}/*catch(Exception error) {\r\n\t\t\t\tJOptionPane.showMessageDialog(this.pr,\"Error, Archivo no valido\");\r\n\t\t\t}*/\r\n\t\t\t\tcatch(IndexOutOfBoundsException error) {\r\n\t\t\t\tJOptionPane.showMessageDialog(this.pr,\"Out of bounds\");\r\n\t\t\t}\tcatch(FileNotFoundException error) {\r\n\t\t\t\tJOptionPane.showMessageDialog(this.pr,\"No se encontro el archivo\");\r\n\t\t\t}\tcatch(IOException error) {\r\n\t\t\t\tJOptionPane.showMessageDialog(this.pr,\"IOException\");\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Override\r\n\tpublic boolean exportGridToCsv(File file, List<Domino> dominos) {\r\n\t\t//Return value used to verify if the export worked properly\r\n\t\tboolean exportSuccesful = true;\r\n\t\t\r\n\t\tint nbDominosParLigne = this.nbColumns / 2;\r\n\t\tint nbDominos = dominos.size();\r\n\t\t\r\n\t\ttry{\r\n\t\t\tthis.myFileWriter = new FileWriter(file.getAbsolutePath());\r\n\t\t\tthis.myFileWriter = new OutputStreamWriter(new FileOutputStream(file.getAbsolutePath()), StandardCharsets.UTF_8);\r\n\t\t\tthis.myBufferedWriter = new BufferedWriter(this.myFileWriter);\r\n\t\t\t\r\n\t\t\t//Initialization : will write \"I hear I say\" this.nbColumns time\r\n\t\t\tfor(int i=0; i<this.nbColumns; i+=2){\r\n\t\t\t\tthis.myBufferedWriter.append(\"I hear;I say;\");\r\n\t\t\t}\r\n\t\t\tthis.myBufferedWriter.newLine();\r\n\t\t\t\r\n\t\t\tStringBuilder ligne = new StringBuilder(64);\r\n\t\t\tfor (int idx = 1; idx <= nbDominos; idx++)\r\n\t\t\t{\r\n\t\t\t\tDomino currentDomino = dominos.get(idx - 1);\r\n\t\t\t\tligne.append(currentDomino.getFirstWord());\r\n\t\t\t\tligne.append(\";\");\r\n\t\t\t\tligne.append(currentDomino.getSecondWord());\r\n\t\t\t\tligne.append(\";\");\r\n\t\t\t\tif (idx % nbDominosParLigne == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.myBufferedWriter.append(ligne);\r\n\t\t\t\t\tthis.myBufferedWriter.newLine();\r\n\t\t\t\t\tligne = new StringBuilder(64);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(IOException exception){\r\n\t\t\texportSuccesful = false;\r\n\t\t\texception.printStackTrace();\r\n\t\t}\r\n\t\tfinally {\r\n\t\t\ttry {\r\n\t\t\t\tthis.myBufferedWriter.flush();\r\n\t\t\t\tthis.myBufferedWriter.close();\r\n\t\t\t\tthis.myFileWriter.close();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\texportSuccesful = false;\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\treturn exportSuccesful;\r\n\t}", "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}", "public final void entryRuleSaveCSV() throws RecognitionException {\n try {\n // InternalCsv.g:255:1: ( ruleSaveCSV EOF )\n // InternalCsv.g:256:1: ruleSaveCSV EOF\n {\n if ( state.backtracking==0 ) {\n before(grammarAccess.getSaveCSVRule()); \n }\n pushFollow(FOLLOW_1);\n ruleSaveCSV();\n\n state._fsp--;\n if (state.failed) return ;\n if ( state.backtracking==0 ) {\n after(grammarAccess.getSaveCSVRule()); \n }\n match(input,EOF,FOLLOW_2); if (state.failed) return ;\n\n }\n\n }\n catch (RecognitionException re) {\n reportError(re);\n recover(input,re);\n }\n finally {\n }\n return ;\n }", "public String getCSVString() {\n return getId() + \",\" + noOfRounds + \",\" + caliber + \",\" + manufacturer + \",\" + price;\n }", "public void saveToFile()\n\t{\t\n\t\tsetCourseToFileString(courseToFileString);\n\t\t\ttry \n\t {\n\t FileWriter fw = new FileWriter(fileName);\n\t fw.write (this.getCourseToFileString ( ));\n\t for(Student b : this.getStudents ( ))\t \t\n\t \tfw.write(b.toFileString ( ));\n\t \tfw.close ( );\n\t } \n\t catch (Exception ex) \n\t {\n\t ex.printStackTrace();\n\t }\n\t\t\tthis.saveNeed = false;\n\n\t}", "@Override\n public void saveDataFromCsvFile(List<TimetableUpload> inputData) {\n Map<String, Timetable> timetables = new HashMap<>();\n Semester semester = semesterService.getLatestSemester();\n Long latestVersionInSemester = timetableService.getLatestTimetableVersionInSemester(semester.getId());\n\n //timetableUpload = eden red od csv fajlot\n for (TimetableUpload timetableUpload : inputData) {\n //odreduvanje na modul\n String studentGroup = timetableUpload.getModule();\n String identifier = timetableUpload.getProfessor() + \" \" + timetableUpload.getSubject() + \" \" + timetableUpload.getRoom() + \" \" + studentGroup + \" \" + timetableUpload.getDay();\n\n if (!timetables.containsKey(identifier)) {\n\n //vnesuvanje na profesori i asistenti\n Professor professor = professorService.getProfessorByName(timetableUpload.getProfessor());\n if(professor == null) {\n professorService.saveProfessor(timetableUpload.getProfessor());\n professor = professorService.getProfessorByName(timetableUpload.getProfessor());\n }\n\n Subject subject = subjectService.getSubjectByName(timetableUpload.getSubject());\n if (subject == null) {\n subjectService.saveSubject(timetableUpload.getSubject());\n subject = subjectService.getSubjectByName(timetableUpload.getSubject());\n }\n\n Timetable newTimetable = new Timetable(8 + Long.parseLong(timetableUpload.getHourFrom()),\n 9 + Long.parseLong(timetableUpload.getHourFrom()), Long.parseLong(timetableUpload.getDay()), timetableUpload.getRoom(),\n studentGroup, professor, subject, semester, latestVersionInSemester + 1);\n timetables.put(identifier, newTimetable);\n } else {\n Timetable existingTimetable = timetables.get(identifier);\n existingTimetable.setHourTo(existingTimetable.getHourTo() + 1);\n timetables.replace(identifier, existingTimetable);\n }\n timetableService.saveAll(timetables.values());\n }\n }", "public void salvar() throws IOException {\n\t\tString pathToCsv = \"/home/rodrigo/git/Sistema-covid-19/src/Clinica/Database.csv\";\n\t\tFileWriter csvWriter = new FileWriter(pathToCsv, true);\n\t\t\n\t\tcsvWriter.append(this.login);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.password);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.name);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.adress);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.cnpj);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.employers);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.phoneNumber);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.email);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.stock);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.schedule);\n\t\tcsvWriter.append(\"\\n\");\n\n\t\tcsvWriter.flush();\n\t\tcsvWriter.close();\n\t\t\n\t}", "private void startLogFile() {\n try {\n createLogFile();\n // First line of file contains field names\n String [] header = new String [] {\"Job\", \"Step\", \"Total Residents\", \"Domestic\", \"Employed\", \"Student\", \"Rebel\", \"Heard original rumor\", \"Heard new rumor\", \"Run\"};\n dataCSVFile_identity.writeLine(header);\n\n // activity\n String [] header_actions = new String [] {\"Job\",\"Step\",\"total residents\", \"At Home\", \"Work\", \"Searching for Work\",\n \"School\", \"Socialiazing\", \"Church\", \"Getting Water\", \"Rebel\", \"Run\"};\n\n dataCSVFile_action.writeLine(header_actions);\n\n String [] header_network = new String [] {\"Job\", \"Step\", \"node1\", \"node2\", \"weight\"};\n dataCSVFile_network.writeLine(header_network);\n\n String [] header_working = new String [] {\"Job\", \"Step\", \"Business\", \"School\", \"Health Facility\", \"Religious Facility\", \n \"Formal\", \"Informal\", \"Searching\", \"Inactive\", \"Formal at home\", \"Informal at home\", \"Run\"};\n dataCSVFile_working.writeLine(header_working);\n \n String [] header_rebels = new String [] {\"Job\", \"Step\", \"AgeGroup\", \"HHDiscrepancy\", \"Identity\", \"Count\" };\n dataCSVFile_rebels.writeLine(header_rebels);\n\n String[] header_residents = new String [] {\"Job\", \"Step\", \"Resident\", \"Age\", \"Employment status\", \"Laid off\", \"Action\", \n \"Daily water use\", \"Remaining water\", \"Required water\",\n \"Identity\",\"Is initial rebel\", \n \"Heard original rumor\", \"Heard new rumor\", \"Energy\", \"Current Aggression\", \"Aggression Rate\", \"Formal Business Capacity\", \n \"Informal Business Capacity\", \"School Capacity\", \"Has School\", \"Has formal employer\", \"Has informal Employer\", \n \"Formal income\", \"Informal income\", \"Searching income\", \"Inactive income\", \"Household Income\", \"Has electricity\", \"Has sanitation\",\n \"Has water\", \"Household expenditures\", \"Rent cost\", \"Water cost\", \"Electric cost\", \"Sanitation cost\", \n \"Transportation cost\", \"Other cost\", \"Food cost\", \"Discrepancy\", \"Run\", \"Preference\"};\n \n \n dataCSVFile_residents.writeLine(header_residents);\n\n String [] header_degreestats = new String [] {\"Job\", \"Step\", \"max degree\", \"min degree\", \"mean degree\", \"sum degree\", \"mean connections\", \"Run\"};\n dataCSVFile_degreestats.writeLine(header_degreestats);\n\n }\n\n catch (IOException ex) {\n Logger.getLogger(Kibera.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public void saveFile() throws FileNotFoundException {\r\n try {\r\n PrintWriter out = new PrintWriter(FILE_NAME);\r\n //This puts back the labels that the loadFile removed\r\n out.println(\"date,cust_email,cust_location,product_id,product_quantity\");\r\n int i = 0;\r\n\r\n while (i < orderInfo.size()) {\r\n String saved = orderInfo.get(i).toString();\r\n out.println(saved);\r\n i++;\r\n }\r\n out.close();\r\n } catch (FileNotFoundException e) {\r\n }\r\n\r\n }", "public static void save(Ride r, String path){\n try{\n FileWriter csvWriter = new FileWriter(path, true);\n csvWriter.append(r.getRideId().toString());\n csvWriter.append(\",\");\n csvWriter.append(r.getCarModel());\n csvWriter.append(\",\");\n csvWriter.append(r.getLocation());\n csvWriter.append(\",\");\n csvWriter.append(r.getDestination());\n csvWriter.append(\",\");\n csvWriter.append(r.getDepartureTime());\n csvWriter.append(\",\");\n csvWriter.append(Integer.toString(r.getAvailableSeats()));\n csvWriter.append(\",\");\n csvWriter.append(Double.toString(r.getPrice()));\n csvWriter.append(\"\\n\");\n\n csvWriter.flush();\n csvWriter.close();\n }catch(Exception e){\n Display.error(\"Couldn't Schedule Ride [Database Error]\");\n e.printStackTrace();\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 }", "private void saveDataToFile() {\n boolean isLoggedInNew = na.isLoggedIn();\n boolean isLoggedIn = uL.isLoggedIn();\n // path for new accounts after sucsessful new account creation\n if (isLoggedInNew) {\n String username = na.getUsername();\n String fileExt = \"_data.txt\";\n String workingDirectory = System.getProperty(\"user.dir\");\n String filePath = workingDirectory + \"\\\\\" + username + fileExt;\n File file = new File(filePath);\n try {\n try (FileWriter fw = new FileWriter(file);\n BufferedWriter bw = new BufferedWriter(fw)) {\n for (int i = 0; i < remindersTable.getRowCount(); i++) { // rows\n for (int j = 0; j < remindersTable.getColumnCount(); j++) { // cols\n bw.write(remindersTable.getValueAt(i, j).toString() + \"\\t\");\n }\n bw.newLine();\n }\n }\n } catch (IOException ex) {\n Logger.getLogger(MoneyMinderDesktopMainGui.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n // path for existing accounts after sucsessful login\n if (isLoggedIn) {\n String username = uL.getUsername();\n String fileExt = \"_data.txt\";\n String workingDirectory = System.getProperty(\"user.dir\");\n String filePath = workingDirectory + \"\\\\\" + username + fileExt;\n File file = new File(filePath);\n try {\n try (FileWriter fw = new FileWriter(file);\n BufferedWriter bw = new BufferedWriter(fw)) {\n for (int i = 0; i < remindersTable.getRowCount(); i++) { // rows\n for (int j = 0; j < remindersTable.getColumnCount(); j++) { // cols\n bw.write(remindersTable.getValueAt(i, j).toString() + \"\\t\");\n }\n bw.newLine();\n }\n }\n } catch (IOException ex) {\n Logger.getLogger(MoneyMinderDesktopMainGui.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }", "public void saveContenttoFile(ArrayList<String> content, String pathResult){\n\t\ttry{\n\t\t\t//File file = new File(path+\"/\"+gene+\".csv\");\n\t\t\tFile file = new File(pathResult);\n\t\t\tif(!file.exists()){\n\t\t\t\tfile.createNewFile(); \n\t\t\t}\n\t\t\tFileWriter fw = new FileWriter(file,true);\n\t\t\tBufferedWriter bw = new BufferedWriter(fw, 1000000);\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tbw.write(content.get(0));\n\t\t\tcontent.remove(0); \n\t\t\tfor(String str: content) {\n\t\t\t\tif(str!=null ){\n\t\t\t\t\tbw.append(\",\" +\"\\\"\"+str+\"\\\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tbw.newLine();\n\t\t\t//\tbw.write(bw.toString());\n\t\t\tbw.close();\n\t\t\tfw.close();\n\t\t}catch(IOException ioe){\n\t\t\tSystem.out.println(\"IOException occurred: not possible to find\" + pathResult);\n\t\t\tioe.printStackTrace();\n\t\t}\n\t\treturn;\n\t}" ]
[ "0.7181262", "0.7050137", "0.69961375", "0.6818228", "0.6776605", "0.67747635", "0.6604401", "0.6568123", "0.6558987", "0.65571797", "0.64800805", "0.6446476", "0.64277107", "0.64005977", "0.63605964", "0.6310907", "0.6309018", "0.6305874", "0.62842655", "0.6259172", "0.6245156", "0.62048507", "0.62009966", "0.6172908", "0.61628425", "0.61476696", "0.61396044", "0.61342734", "0.6129227", "0.61171377", "0.61135995", "0.6105321", "0.6089149", "0.6068157", "0.6064692", "0.6048645", "0.6026131", "0.6024588", "0.60057753", "0.6004065", "0.5997427", "0.59904015", "0.598552", "0.59801584", "0.59525925", "0.5936697", "0.59331936", "0.59116995", "0.59104455", "0.5887818", "0.5886819", "0.58516854", "0.5837281", "0.5819521", "0.5808422", "0.5805754", "0.57951784", "0.5794724", "0.5793728", "0.5782271", "0.5774665", "0.5772185", "0.57642376", "0.5759418", "0.5748662", "0.57302684", "0.5727758", "0.57168394", "0.57161397", "0.570724", "0.5699973", "0.56960094", "0.56931597", "0.5685308", "0.5684193", "0.5677735", "0.5677415", "0.5671804", "0.56712794", "0.56534445", "0.5646251", "0.56452674", "0.5628146", "0.56203264", "0.5617279", "0.5613426", "0.5602762", "0.56000155", "0.55953026", "0.55885005", "0.5580325", "0.5580155", "0.55778545", "0.5575555", "0.55579376", "0.55391866", "0.55366814", "0.553648", "0.5535149", "0.5529315" ]
0.56971025
71
loads data from a csv file should be called from constructor only
public void loadFromCsv(String filePath) throws Exception { BufferedReader br=new BufferedReader(new FileReader(filePath)); String line=""; int i=0; line=br.readLine(); this.gen=Integer.parseInt(line); while((line=br.readLine()) != null) { this.setBna(i,line); i++; } br.close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void openPlayerDataFromCSV() throws FileNotFoundException {\n csvReader = new BufferedReader(new FileReader(PATH_TO_CSV));\n }", "public LoadCSV(String file_position){\r\n this.file_position = file_position;\r\n }", "@Override\n public void importCSV(File file) {\n System.out.println(\"oi\");\n System.out.println(file.isFile()+\" \"+file.getAbsolutePath());\n if(file.isFile() && file.getPath().toLowerCase().contains(\".csv\")){\n System.out.println(\"Entro\");\n try {\n final Reader reader = new FileReader(file);\n final BufferedReader bufferReader = new BufferedReader(reader);\n String[] cabecalho = bufferReader.readLine().split(\",\");\n int tipo;\n if(cabecalho.length == 3){\n if(cabecalho[2].equalsIgnoreCase(\"SIGLA\")){\n tipo = 1;\n System.out.println(\"TIPO PAIS\");\n }\n else {\n tipo = 2;\n System.out.println(\"TIPO CIDADE\");\n }\n }else {\n tipo = 3;\n System.out.println(\"TIPO ESTADO\");\n }\n \n while(true){\n String linha = bufferReader.readLine();\n if(linha == null){\n break;\n }\n String[] row = linha.split(\",\");\n switch (tipo) {\n case 1:\n Pais pais = new Pais();\n pais.setId(Long.parseLong(row[0]));\n pais.setNome(row[1]);\n pais.setSigla(row[2]);\n new PaisDaoImpl().insert(pais);\n break;\n case 2:\n Cidade cidade = new Cidade();\n cidade.setId(Long.parseLong(row[0]));\n cidade.setNome(row[1]);\n cidade.setEstado(Long.parseLong(row[2]));\n new CidadeDaoImpl().insert(cidade);\n break;\n default:\n Estado estado = new Estado();\n estado.setId(Long.parseLong(row[0]));\n estado.setNome(row[1]);\n estado.setUf(row[2]);\n estado.setPais(Long.parseLong(row[3]));\n new EstadoDaoImpl().insert(estado);\n break;\n }\n }\n \n } catch (FileNotFoundException ex) {\n Logger.getLogger(SQLUtilsImpl.class.getName()).log(Level.SEVERE, null, ex);\n } catch (IOException ex) {\n Logger.getLogger(SQLUtilsImpl.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }", "public void loadListFromCsv() {\n List<Publication> list = new ArrayList<>();\n String line;\n try(BufferedReader bufferedReader = new BufferedReader(new FileReader(\"saves/data.csv\"))){\n while ((line = bufferedReader.readLine()) != null){\n String[] attributes = line.split(\",(?=([^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\n String[] formattedAttributes = formatAttributes(attributes);\n Publication book = createPublicationFromAttributes(formattedAttributes);\n list.add(book);\n }\n } catch (IOException e){\n System.out.println(\"IOException occurred: \" + e.getMessage());\n }\n\n this.library = list;\n }", "public void loadCSVData() throws IOException, SQLException {\r\n //SQL statement to load csv information into data table\r\n String insertvaluesSQL = \"INSERT INTO data\"\r\n + \"(InvoiceNo, StockCode, Description, Quantity, InvoiceDate, UnitPrice, CustomerID, Country)\"\r\n + \" VALUES (?,?,?,?,?,?,?,?);\";\r\n\r\n //code to read csv file taken from W03 practical\r\n BufferedReader br = new BufferedReader(new FileReader(filePath));\r\n String line = br.readLine();\r\n String[] informationArray;\r\n while (line != null) {\r\n informationArray = line.split(\",\");\r\n PreparedStatement preparedStatement = connection.prepareStatement(insertvaluesSQL);\r\n //the first '?' corresponds to the 0th term in the information array\r\n //the second '?' corresponds to the 1st term in the information array\r\n for (int i = 1; i < 9; i++) {\r\n preparedStatement.setString(i, informationArray[i - 1]);\r\n }\r\n preparedStatement.executeUpdate();\r\n line = br.readLine();\r\n }\r\n Statement statement = connection.createStatement();\r\n statement.executeUpdate(\"DELETE FROM data WHERE InvoiceNo = 'InvoiceNo';\");\r\n statement.close();\r\n }", "private static void readInputDataFromCSV(String pathToCSVfile) throws IOException {\n\n // open the file\n BufferedReader reader = new BufferedReader(new FileReader(pathToCSVfile));\n // read line by line\n String line = null;\n Scanner scanner = null;\n int index = 0;\n inputPlayersList = new ArrayList<>();\n\n while ((line = reader.readLine()) != null) {\n Player pl = new Player();\n scanner = new Scanner(line);\n scanner.useDelimiter(\",\");\n while (scanner.hasNext()) {\n String data = scanner.next();\n if (index == 0)\n pl.setLastName(data);\n else if (index == 1)\n pl.setFirstName(data);\n else if (index == 2)\n pl.setCountry(data);\n else if (index == 3)\n pl.setTicketNumber(data);\n else\n System.out.println(\"Incorrect data: \" + data);\n index++;\n }\n index = 0;\n inputPlayersList.add(pl);\n\n }\n //close reader\n reader.close();\n }", "public void readCsvFile(String path) {\n\n // make sure the ArrayList is empty before you start recording the data\n if (!Records.isEmpty()) {\n Records.clear();\n }\n try {\n // read data from the .csv file\n System.out.println(\"Reading array list....\");\n BufferedReader br = new BufferedReader(new FileReader(path));\n // Skip the first line\n String line = br.readLine();\n while ((line = br.readLine()) != null) {\n\n String[] fields = line.split(\",\");\n Record record = new Record( // the fields in .csv are jumbled\n Integer.parseInt(fields[2]), // skierID\n Integer.parseInt(fields[3]), // liftID\n Integer.parseInt(fields[1]), // dayNum\n Integer.parseInt(fields[4])); // time\n Records.add(record);\n }\n\n br.close();\n System.out.println(\"!!Reading completed!!\");\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public static void loadcars() {\n Cars xx = new Cars();\n System.out.println(\"Load cars\");\n listcars.clear();\n try {\n File fileload = new File(\"cars.csv\");\n BufferedReader in = new BufferedReader(new FileReader(fileload));\n String st;\n while((st = in.readLine()) != null) {\n String[] strs = st.split(\"[,//;]\");\n addcar(strs[0], strs[1], strs[2],Integer.parseInt(strs[3]));\n }\n in.close();\n System.out.println(\"cars data restored from cars.csv\");\n } catch (IOException i) {\n i.printStackTrace();\n }\n\n\n }", "public void LoadFromCSV(){\n InputStream inputStream = getResources().openRawResource(R.raw.movielist);\n CSVinput csVinput = new CSVinput(inputStream);\n final List<String[]> movList = csVinput.read();\n\n for(String[] data : movList) {\n itemArrAdapt.add(data);\n }\n }", "public void read()\r\n\t{\r\n\t\tScanner input = null;\r\n\t\ttry\r\n\t\t{\r\n\t\t\tint i = 0;\r\n\r\n\t\t\tinput = new Scanner(new File(\"netflix.csv\")).useDelimiter(\"[,\\r\\n]\");\r\n\r\n\t\t\twhile (input.hasNext())\r\n\t\t\t{\r\n\t\t\t\tinput.nextLine();\r\n\t\t\t\tString title = input.next();\r\n\r\n\t\t\t\tString rating = input.next();\r\n\r\n\t\t\t\tint year = Integer.parseInt(input.next());\r\n\r\n\t\t\t\tint score = Integer.parseInt(input.next());\r\n\t\t\t\tMovie a = new Movie(title, rating, year, score);\r\n\t\t\t\tdata[i] = a;\r\n\t\t\t\ti++;\r\n\t\t\t\tactualSize++;\r\n\r\n\t\t\t}\r\n\t\t\tinput.close();\r\n\r\n\t\t}\r\n\t\tcatch (FileNotFoundException e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"File not found\");\r\n\r\n\t\t}\r\n\r\n\t}", "public Set<Airport> loadFile(final String csvFile) throws CoreException;", "@Override\n public void csvImport(String filename) {\n try {\n FileReader r = new FileReader(filename);\n Scanner in = new Scanner(r);\n\n while (in.hasNext()) {\n String firstInput = in.next().trim();\n String firstName = firstInput.substring(0, firstInput.length() - 1).trim();\n String lastInput = in.next().trim();\n String lastName = lastInput.substring(0, lastInput.length() - 1).trim();\n String ID = in.next().substring(0, 5);\n int pID = Integer.parseInt(ID);\n String grade = in.next();\n\n Student s = new Student(firstName, lastName, pID);\n Grade g = new Grade(grade);\n\n map.put(s, g);\n }\n checker = true;\n } catch (FileNotFoundException ex) {\n System.out.println(\"File was not found\");\n checker = false;\n }\n }", "public Set<Airport> loadFile(final File csvFile) throws CoreException;", "private Agent loadFromFile(String _login)\n {\n Agent agent = new Agent();\n File file = new File(_login + \".csv\");\n FileReader fr;\n BufferedReader br;\n String line;\n try {\n fr = new FileReader(file);\n br = new BufferedReader(fr);\n\n line = br.readLine();\n\n int numCients;\n { // to restrain the scope of csvData\n String[] csvData = line.split(\",\");\n agent.setID(Integer.parseInt(csvData[0]));\n agent.setName(csvData[1]);\n agent.setSalary(Double.parseDouble(csvData[2]));\n agent.setSalesBalance(Double.parseDouble(csvData[3]));\n\n numCients = Integer.parseInt(csvData[4]);\n }\n\n for(int i = 0; i<numCients; i++) {\n line = br.readLine();\n\n Client client = new Client();\n int numProp;\n\n {\n String[] csvData = line.split(\",\");\n client.setID(Integer.parseInt(csvData[0]));\n client.setName(csvData[1]);\n client.setIncome(Double.parseDouble(csvData[2]));\n\n numProp = Integer.parseInt(csvData[3]);\n }\n\n for(int j=0; j<numProp; j++)\n {\n line = br.readLine();\n\n String[] csvData = line.split(\",\");\n\n if(csvData[0].equals(\"house\")) {\n House property = new House();\n\n property.setAddress(csvData[1]);\n property.setNumRoom(Integer.parseInt(csvData[2]));\n property.setPrice(Double.parseDouble(csvData[3]));\n property.setSize(Double.parseDouble(csvData[4]));\n property.setHasGarage(Boolean.parseBoolean(csvData[5]));\n\n property.setHasGarden(Boolean.parseBoolean(csvData[6]));\n property.setHasPool(Boolean.parseBoolean(csvData[7]));\n\n client.addProperty(property);\n }\n else if(csvData[0].equals(\"apt\"))\n {\n Apartment property = new Apartment();\n\n property.setAddress(csvData[1]);\n property.setNumRoom(Integer.parseInt(csvData[2]));\n property.setPrice(Double.parseDouble(csvData[3]));\n property.setSize(Double.parseDouble(csvData[4]));\n property.setHasGarage(Boolean.parseBoolean(csvData[5]));\n\n property.setHasTerrace(Boolean.parseBoolean(csvData[6]));\n property.setHasElevator(Boolean.parseBoolean(csvData[7]));\n property.setFloor(Integer.parseInt(csvData[8]));\n property.setNumber(Integer.parseInt(csvData[9]));\n\n client.addProperty(property);\n }\n }\n\n agent.addClient(client);\n }\n fr.close();\n br.close();\n return agent;\n }\n catch (NumberFormatException nfEx) {\n JOptionPane.showMessageDialog(null, \"There was a problem when retrieving \" +\n \"the agent's data.\\n Please try again\");\n return null;\n }\n catch (IOException ioEx) {\n JOptionPane.showMessageDialog(null, \"This user doesn't exist....\");\n return null;\n }\n }", "public InputReader(String csv){\n inputStream = new Scanner(csv);\n instantiate();\n assert(invariant());\n }", "@Override\n\tpublic void parseCSV(String csv) {\n\t\t\n\t}", "public Instances openCSV(String path)\n\t{\n\t\ttry\n\t\t{\n\t\t\tCSVLoader loader = new CSVLoader();\n\t\t\tloader.setSource(new File(path));\n\t\t\tdataset = loader.getDataSet();\n\t\t\t\n\t\t\t//VERIFICA QUE HAYA UNA CLASE, SI NO LO HAY LO ESTABLECE\n\t\t\tif (dataset.classIndex() == -1)\n\t\t\t\tdataset.setClassIndex(dataset.numAttributes() - 1);\n\t\t}\n\t\tcatch(IOException ex)\n\t\t{\n\t\t\tSystem.out.println(ex);\n\t\t}\n\t\t\n\t\treturn this.dataset;\n\t}", "public DataProcessor(String filename) throws FileNotFoundException{\n\tlst = new ArrayList();\n\tScanner input = new Scanner(new FileReader(filename));\n //skip the first line of the csv file\n\tString escapedLine = input.nextLine();\n \twhile(input.hasNextLine()){\n\t recordCount++;\n\t String line = input.nextLine();\n\t //CORRECTION BLOC to skip quoted commas\n\t if (line.contains(\"\\\"\")){\n\t\tint first= line.indexOf(\"\\\"\");\n\t\twhile(first >0 ){\n\t\t String problem = line.substring(first,line.indexOf(\"\\\"\",first+1)+1);\n\t\t \tint second = line.indexOf(\"\\\"\",first+1);\n\t\t\t//look for comma between quoted\n\t\t\tif(problem.contains(\",\")){\n\t\t\t //replace comma by space not to change string indices\n\t\t\t problem=problem.replace(\",\",\" \");\n\t\t\t line=line.replace(line.substring(first,line.indexOf(\"\\\"\",first+1)+1),problem);\n\t\t\t}\n\t\t\t//look for another quote symbol\n\t\t\tfirst = line.indexOf(\"\\\"\",second+1);\n\t\t}\n\t }\n\t String[] fields = line.split(\",\");\n\t //create Person object to store the suspect's data\n\t Person suspect = new Person(fields[SEX].charAt(0),fields[RACE].charAt(0),Integer.parseInt(fields[DOB]),Integer.parseInt(fields[HEIGHTFT]),fields[EYECOLOR],fields[BUILD].charAt(0));\n\t lst.add(suspect);\n\t}\n\t//close scanner\n\tinput.close();\n }", "public void fillBoardFromCSV(String pathToCSV){\r\n \r\n BufferedReader br = null;\r\n String line = \" \";\r\n int index = 0;\r\n \r\n \r\n try{\r\n br = new BufferedReader(new FileReader(pathToCSV));\r\n while ((line = br.readLine()) != null) {\r\n String[] lines = line.split(\",\");\r\n System.out.println(lines.length);\r\n for(int i = 0; i < 11; i++){\r\n if(lines[i].equals(\"f\")){\r\n board[index][i] = new Flat(index,i);\r\n }\r\n if(lines[i].equals(\"s\")){\r\n board[index][i] = new Slot(index,i);\r\n }\r\n }\r\n index++; \r\n }\r\n } catch (FileNotFoundException e) {\r\n e.printStackTrace();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n } finally {\r\n if (br != null) {\r\n try {\r\n br.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n }\r\n \r\n \r\n }", "@Override\n public ToDoList readCSV(String csvPath) throws InvalidArgumentException {\n this.csvPath = csvPath;\n this.toDoList = new ToDoList();\n\n BufferedReader inputFile = null;\n try {\n inputFile = new BufferedReader(new FileReader(this.csvPath));\n\n String line = inputFile.readLine();\n if (line == null) {\n inputFile.close();\n return this.toDoList;\n } // Empty CSV file, no need for processing.\n this.processHeader(line);\n while ((line = inputFile.readLine()) != null) {\n this.processToDoItem(line);\n }\n inputFile.close();\n return this.toDoList;\n } catch (FileNotFoundException fnfe) {\n throw new InvalidArgumentException(\"OOPS! File not found!\");\n } catch (IOException ioe) {\n throw new InvalidArgumentException(\"There is somthing wrong!\");\n }\n }", "public void readEntityCSV(String line) {\n List<String> items = Arrays.asList(line.split(\",\"));\n this.setId(Long.valueOf(items.get(0)));\n this.noOfRounds = Integer.parseInt(items.get(1));\n this.caliber = Float.parseFloat(items.get(2));\n this.manufacturer = items.get(3);\n this.price = Float.parseFloat(items.get(4));\n }", "public void Read_Csv() {\n\t\t\n\t\tFile file = new File(\"Faucets.csv\");\n\t\tif(file.exists() == false) {\n\t\t\ttry {\n\t\t\t\t if (file.createNewFile()) {\n\t\t\t\t System.out.println(\"File created: \" + file.getName());\n\t\t\t\t } else {\n\t\t\t\t System.out.println(\"File already exists... Error\");\n\t\t\t\t }\n\t\t\t\t \n\t\t\t\tFileWriter myWriter = new FileWriter(\"Faucets.csv\");\n\t\t\t\tmyWriter.write(\"Freebitco.in,3600,228,\");\n\t\t\t\tmyWriter.close();\n\t\t\t\t\n\t\t\t\t\n\t\t\t}catch (IOException e) {\n\t\t\t\tSystem.out.println(\"Error\");\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t//Reading the file\n\t\tString line = null;\n\t\ttry {\n\t\t\tFileReader fileReader = new FileReader(\"Faucets.csv\");\n\t\t\tBufferedReader bufferedReader = new BufferedReader(fileReader);\n\t\t\t\n\t\t\tint x = 0;\n\t\t\tint commacounter = 0;\n\t\t\tint commaposition[] = new int[3];\n\t\t\twhile((line = bufferedReader.readLine()) != null) {\n\t\t\t\t\n\t\t\t\twhile(x < line.length()) {\n\t\t\t\t\t\n\t\t\t\t\tif(line.charAt(x) == ',') {\n\t\t\t\t\t\tcommaposition[commacounter] = x;\n\t\t\t\t\t\tcommacounter +=1;\n\t\t\t\t\t}\n\t\t\t\t\tif(commacounter == 3) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tFaucets.site[amount_counter] = line.substring(0, commaposition[0]);\n\t\t\t\t\t\tFaucets.time[amount_counter] = Integer.parseInt(line.substring(commaposition[0]+1, commaposition[1]));\n\t\t\t\t\t\tFaucets.amount[amount_counter] = Integer.parseInt(line.substring(commaposition[1]+1, commaposition[2]));\n\t\t\t\t\t\tamount_counter += 1;\n\t\t\t\t\t\tcommacounter=0;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tx+=1;\n\t\t\t\t}\n\t\t\t\tx=0;\n\t\t\t}\n\t\t\tbufferedReader.close();\n\t\t\t\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException ex) {\n\t\t\tex.printStackTrace();\n\t\t}\n\t\t\n\t\n\t\t\t\n\t}", "private void loadAllCountData(){\n // load from csv\n try{\n FileReader file = new FileReader(\"/home/ubuntu/user_counts_small.csv\");\n //FileReader file = new FileReader(\"/Users/YHWH/Desktop/cloud computing/team project/user_counts.csv\");\n BufferedReader buff = new BufferedReader(file);\n String line = \"\";\n boolean eof = false;\n\n while(!eof){\n line = buff.readLine();\n if(line == null){\n eof = true;\n }\n else{\n String[] data = line.split(\"\\t\"); //0->id, 1->selfCount, 2->prevCount\n wholeCountData.put(data[0], Integer.parseInt(data[2]));\n }\n }\n buff.close();\n }\n catch(IOException e){\n e.printStackTrace();\n }\n }", "public CSVLoader(Connection connection, String filePath) throws IOException, SQLException {\r\n this.connection = connection;\r\n this.filePath = filePath;\r\n }", "@Override\r\n public void init() throws HarvesterException {\r\n JsonSimple options = new JsonSimple(getJsonConfig().getObject(\"harvester\", \"csv\"));\r\n \r\n String filePath = options.getString(null, \"fileLocation\");\r\n if (filePath == null) {\r\n throw new HarvesterException(\"No data file provided!\");\r\n }\r\n File csvDataFile = new File(filePath);\r\n if (csvDataFile == null || !csvDataFile.exists()) {\r\n throw new HarvesterException(\"Could not find CSV file '\" + filePath + \"'\");\r\n }\r\n filename = csvDataFile.getName();\r\n \r\n idPrefix = options.getString(\"\", \"recordIDPrefix\");\r\n maxRows = options.getInteger(-1, \"maxRows\");\r\n ignoredFields = getStringList(options, \"ignoreFields\");\r\n includedFields = getStringList(options, \"includedFields\");\r\n payloadId = options.getString(DEFAULT_PAYLOAD_ID, \"payloadId\");\r\n batchSize = options.getInteger(DEFAULT_BATCH_SIZE, \"batchSize\");\r\n hasMore = true;\r\n \r\n try {\r\n // open the CSV file for reading\r\n Reader fileReader = new InputStreamReader(new FileInputStream(csvDataFile), \"UTF-8\");\r\n char delimiter = options.getString(String.valueOf(DEFAULT_DELIMITER), \"delimiter\").charAt(0);\r\n csvReader = new CSVReader(fileReader, delimiter);\r\n \r\n // configure the data fields\r\n if (options.getBoolean(true, \"headerRow\")) {\r\n dataFields = Arrays.asList(csvReader.readNext());\r\n } else {\r\n dataFields = getStringList(options, \"headerList\");\r\n }\r\n \r\n // check that the specified id column is valid\r\n idColumn = options.getString(null, \"idColumn\");\r\n if (idColumn != null && !dataFields.contains(idColumn)) {\r\n throw new HarvesterException(\"'\" + idColumn + \"' is invalid!\");\r\n }\r\n } catch (IOException ioe) {\r\n throw new HarvesterException(ioe);\r\n }\r\n }", "public CSVReader(String filename) {\r\n try {\r\n File inFile = new File(filename);\r\n Scanner scanner = new Scanner(inFile);\r\n boolean hasNumberOfCountries = false;\r\n boolean hasYearLabels = false;\r\n while (scanner.hasNextLine()) {\r\n String nextLine = scanner.nextLine();\r\n if (nextLine.startsWith(\"Number of countries\")) {\r\n int numberOfCountries = Integer.parseInt(nextLine.split(\",\")[1]);\r\n countryNames = new String[numberOfCountries];\r\n cellularDataTable = new double[numberOfCountries][];\r\n countryIndex = 0;\r\n hasNumberOfCountries = true;\r\n continue;\r\n }\r\n if (nextLine.startsWith(\"Country Name\")) {\r\n parseYearLabels(nextLine);\r\n hasYearLabels = true;\r\n continue;\r\n }\r\n if (hasNumberOfCountries && hasYearLabels) {\r\n // if both number of countries and year labels are found, proceed to parse data\r\n if (!nextLine.isEmpty()) {\r\n parseCountryData(nextLine);\r\n }\r\n }\r\n }\r\n if (!hasNumberOfCountries || !hasYearLabels) {\r\n System.out.println(\"Invalid file: missing Number of countries or Year labels, exiting program\");\r\n System.exit(0);\r\n }\r\n scanner.close();\r\n } catch (FileNotFoundException e) {\r\n System.out.println(\"File \" + filename + \" not found, exiting program\");\r\n System.exit(0);\r\n }\r\n }", "@SuppressWarnings(\"resource\")\r\n\tpublic static ArrayList<UserInfo> getUserDataFromCsvFile()\r\n\t{\r\n\t\t\r\n\t\tArrayList<UserInfo> unfList=null;\r\n\t\ttry{\r\n\t\t\tFile myObj= new File(\"E:\\\\Selenium Setup\\\\datadriven.csv\");\r\n\t\t\tunfList = new ArrayList<UserInfo>();\r\n\t\t\tScanner myReader= new Scanner(myObj);\r\n\t\t\tint count=0;\r\n\t\t\twhile (myReader.hasNextLine()) \r\n\t\t\t{\r\n\t\t\t\tString data= myReader.nextLine();\r\n\t\t\t\tif (count !=0)\r\n\t\t\t\t{\r\n\t\t\t\t\tString[] info =data.split(\"\\\\,\");\r\n\t\t\t\t\tunfList.add(new UserInfo(info[0],info[1]));\r\n\t\t\t\t\t//unfList.add(new UserInfo(info[0], info[1]));\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t++count;\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}catch (Exception e)\r\n\t\t\t{\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t\t// TODO: handle exception\r\n\t\t\t}\r\n\t\t\treturn unfList;\r\n\t}", "public csvFile(File f) throws FileNotFoundException{\n Scanner s;\n try {\n s = new Scanner(f); // Create scanner (reason for the try).\n headers = s.nextLine().split(\",\"); // Get column headers.\n int size = (getSize(f) - 1); // Determine number of lines (rows) in the file.\n data = new String[size][]; // Appropriately size the data array based on number of rows.\n for ( int i = 0; i < size; i++) { // Load rows from file.\n data[i] = s.nextLine().split(\",\");\n }\n s.close();\n } catch(Exception e) {\n throw new FileNotFoundException();\n }\n }", "private static ArrayList<Glootie> loadAliensFromFile(String pathToCSV) throws Exception{\r\n\t\tArrayList<Glootie> alienArray = new ArrayList<>();\r\n\t\tBufferedReader csvReader = new BufferedReader(new FileReader(pathToCSV));\r\n\t\t//Read and ignore header row:\r\n\t\tString row = csvReader.readLine();\r\n\t\t//Read remain data from CSV file\r\n\t\twhile ((row = csvReader.readLine()) != null) {\r\n\t\t\tString[] data = row.split(\",\");\r\n\t\t\t// Add new Glootie to array\r\n\t\t\talienArray.add(new Glootie(data));\r\n\t\t}\r\n\t\tcsvReader.close();\r\n\r\n\t\treturn alienArray;\r\n\t}", "static public void readCSVData(String csvFile, String imagePath)\n\t{\t\n String line = \"\";\n String cvsSplitBy = \"\\t\";\n\n try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(csvFile), \"UTF8\"))) {\n\n while ((line = br.readLine()) != null) {\n String[] dataMovie = line.split(cvsSplitBy);\n //System.out.println(\"Nom: \" + dataMovie[0] + \"\\nDate de sortie: \" + dataMovie[1] + \"\\nRealisateur: \" + dataMovie[2] + \"\\nDescription: \" + dataMovie[3] + \"\\nLien de la BA: \" + dataMovie[4] + \"\\nLiens sceances: \" + dataMovie[5] + \"\\nNom fichier image: \" + dataMovie[6] + \"\\n\");\n\t\t\t\tmoviesDataTab.add(dataMovie[0] + \"\\t\" + dataMovie[1] + \"\\t\" + dataMovie[2] + \"\\t\" + dataMovie[3] + \"\\t\" + dataMovie[4] + \"\\t\" + dataMovie[5]);\n\t\t\t\timageTab.add(imagePath +\"/images/\" +dataMovie[6]);\n\t\t\t}\n } catch (IOException e) {\n e.printStackTrace();\n }\t\n\t}", "private void processCSVFile( BufferedReader csvFile ) throws IOException {\r\n\t\t\r\n\t\tboolean headerRowRead = false;\r\n\t\tString[] headerArray = null;\r\n\t\t\r\n\t\t//loop through all rows and create contacts\r\n\t\tString row = csvFile.readLine();\r\n\t\t\r\n\t\twhile (row != null) {\r\n\t\t\t\r\n\t\t\tif (row.length()==0 || row.startsWith(\"#\") || row.startsWith(\";\") ) {\t\t\r\n\t\t\t\t\r\n\t\t\t\t//empty or comment row: skip\r\n\t\t\t\t\r\n\t\t\t} else if (!headerRowRead) {\r\n\t\t\t\t\r\n\t\t\t\t//header row is the first non-blank, not-comment row in the CSV file\r\n\t\t\t\t//the required header row contains the attribute names\r\n\t\t\t\t\r\n\t\t\t\theaderRowRead = true;\r\n\t\t\t\t\r\n\t\t\t\t//read header\r\n\t\t\t\theaderArray = parseCSVLine( row, true); \t\t\r\n\t\t\t\tLogger.debug(\"header: \" + row);\r\n\t\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\r\n\t\t\t\tHashMap<String,String> contactObject = ContactsImport.getRowValues(headerArray, row);\r\n\t\t\t\tcreateContact(contactObject);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\trow = csvFile.readLine(); //read next line form csv file\r\n\t\t}\r\n\t\t\r\n\t\tLogger.debug(\"finished\");\r\n\r\n\t}", "private void testDataReader() {\n File csv = new File(pathTest);\n try (FileReader fr = new FileReader(csv); BufferedReader bfr = new BufferedReader(fr)) {\n Logger.printInfo(\"Reading test data\");\n for (String line; (line = bfr.readLine()) != null; ) {\n String[] split = line.split(\",\");\n String data = textCleaner(split[indexData].toLowerCase());\n int label = Integer.parseInt(split[indexLabel].toLowerCase());\n\n linesTest.add(data);\n labelsTest.add(label);\n Logger.print(\"Reading size: \" + linesTest.size());\n }\n for (String l : linesTest) {\n matrixTest.add(wordVectorizer(l));\n }\n } catch (IOException ex) {\n Logger.printError(\"!! Test Data Not Reading !!\");\n System.exit(0);\n }\n }", "public CSVFile(String path)\n\t{\n\t\tthis.filePath = path;\n\t\t File fl = new File(path);\n\t\t FileInputStream fin;\n\t\t\ttry {\n\t\t\t\t\t\tfin = new FileInputStream(fl);\n\t\t\t\t\t BufferedReader reader = new BufferedReader(new InputStreamReader(fin));\n\t\t\t\t \n\t\t\t\t\t String line = null;\n\t\t\t\t\t while ((line = reader.readLine()) != null) \n\t\t\t\t\t {\n\t\t\t\t\t \tif(line.contains(\";\"))\n\t\t\t\t\t \t{\n\t\t\t\t\t\t\t CSVItem item = new CSVItem(line);\n\t\t\t\t\t\t\t itemList.add(item);\n\t\t\t\t\t \t}\n\t\t\t\t\t }\n\t\t\t\t\t reader.close();\n\t\t\t\t\t \n\t\t\t\t\t }\n\t\t\t\t\tcatch (Exception e) \n\t\t\t\t\t {\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t }\n\t\t\n\t}", "public int loadData(Reader csv, KeywordFactory kwf) \n throws InterruptedException, IOException\n {\n return loadData(csv, kwf, false);\n }", "public void loadData()\n\t{\n\t\tString fileName = \"YouthTobaccoUse.csv\"; //file to be read and loaded in\n\t\tScanner input = FileUtils.openToRead(fileName).useDelimiter(\",\");\n\t\tint count = 0;\n\t\tboolean isNewState = false;\n\t\tString state = \"\", measure = \"\", stateAbbr = \"\";\n\t\tdouble percent = 0.0;\n\t\tint stateDate = 0;\n\t\twhile(input.hasNext())\n\t\t{\n\t\t\tString line = input.nextLine();\n\t\t\tint tokenCount = 0;\n\t\t\ttokens[tokenCount] = \"\";\n\t\t\t//each line tokenized\n\t\t\tfor(int i = 0; i < line.length(); i++)\n\t\t\t{\n\t\t\t\tif(line.charAt(i) == ',')\n\t\t\t\t{\n\t\t\t\t\ttokenCount++;\n\t\t\t\t\ttokens[tokenCount] = \"\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\ttokens[tokenCount] += line.charAt(i);\n\t\t\t}\n\t\t\t//loads values into variables, converts String into integers and doubles\n\t\t\tString abbr = tokens[1];\n\t\t\tString name = tokens[2];\n\t\t\tString measureDesc = tokens[5];\n\t\t\tint date = convertInteger(tokens[0]);\n\t\t\tdouble percentage = 0.0;\n\t\t\tif(tokens[10].equals(\"\") == false)\n\t\t\t\tpercentage = convertDouble();\n\t\t\tif(abbr.equals(stateAbbr))\n\t\t\t{\n\t\t\t\tif(measureDesc.equals(\"Smoking Status\") \n\t\t\t\t\t\t\t\t\t|| measureDesc.equals(\"User Status\"))\n\t\t\t\t\tpercent += percentage;\n\t\t\t}\n\t\t\telse\n\t\t\t\tisNewState = true;\n\t\t\tif(isNewState)\n\t\t\t{\n\t\t\t\t//calculates the average values for each state, then adds to \n\t\t\t\t//array list, stored as fields\n\t\t\t\tpercent = (double)(percent/count);\n\t\t\t\tif(state.equals(\"Arizona\") && stateDate == 2017)\n\t\t\t\t\ttobacco.add(new StateTobacco(state, stateAbbr, 3.75, 2017));\n\t\t\t\telse if(state.equals(\"Guam\") == false && count != 0 && count != 1\n\t\t\t\t&& stateAbbr.equals(\"US\") == false)\n\t\t\t\t\ttobacco.add(new StateTobacco(state, stateAbbr, percent, stateDate));\n\t\t\t\tstate = name;\n\t\t\t\tstateAbbr = abbr; \n\t\t\t\tstateDate = date;\n\t\t\t\tisNewState = false;\n\t\t\t\tpercent = 0.0;\n\t\t\t\tcount = 0;\n\t\t\t}\n\t\t\tcount++;\n\t\t}\n\t}", "@Test\n\tpublic void testReadCsvFile() throws FileNotFoundException {\n\t\tFileParser fp = new FileParser();\n\t\tArrayList<String> parsedLines = fp.readCsvFile(\"movies.csv\");\n\t\tassertEquals(\"toy story\", parsedLines.get(0));\n\t}", "public List<Country> readCountriesFromCSV(String fileName){\n try {\n Scanner scanner = new Scanner(new File(fileName));\n scanner.useDelimiter(\",\");\n scanner.nextLine();\n while(scanner.hasNextLine()){\n lsta.add(createCountry(scanner.nextLine().split(\",\")));\n// System.out.println(pyr.get_pharaoh()+\"|\"+pyr.get_modern_name()+\"|\"+pyr.get_site()+\"|\"+pyr.get_height()+\"|\");\n }\n scanner.close();\n } catch (FileNotFoundException ex) {\n Logger.getLogger(CityCSVDAO.class.getName()).log(Level.SEVERE, null, ex);\n }\n return lsta;\n }", "@PostConstruct\n public void loaddata() throws IOException {\n File file = ResourceUtils.getFile(configProvider.getFilePath());\n Reader in = new FileReader(file.getPath());\n Iterable<CSVRecord> records = CSVFormat.RFC4180.withHeader(\n \"locationid\", \"Applicant\", \"FacilityType\", \"cnn\", \"LocationDescription\", \"Address\", \"blocklot\", \"block\", \"lot\",\n \"permit\", \"Status\", \"FoodItems\", \"X\", \"Y\", \"Latitude\", \"Longitude\", \"Schedule\",\n \"dayshours\", \"NOISent\", \"Approved\", \"Received\", \"PriorPermit\", \"ExpirationDate\",\n \"Location\", \"Fire Prevention Districts\", \"Police Districts\",\n \"Supervisor Districts\", \"Zip Codes\", \"Neighborhoods (old)\"\n ).parse(in);\n\n Iterator<CSVRecord> iterator = records.iterator();\n iterator.next();\n // use our own ids because of how atomic integers work, we can't have a 0 for an id, so can't rely on outside sources.\n int i = 0;\n while (iterator.hasNext()) {\n CSVRecord record = iterator.next();\n FoodTruck truck = new FoodTruck(Float.parseFloat(record.get(\"Latitude\")), Float.parseFloat(record.get(\"Longitude\")),\n record.get(\"Address\"), record.get(\"FoodItems\"), ++i);\n //add food truck to datastore\n truckDataStore.addTruck(truck.getId(), truck);\n\n final Rectangle rect = new Rectangle(truck.getLat(), truck.getLon(),\n truck.getLat(), truck.getLon());\n //add food truck location + id to location data store.\n locationDataStore.getSpatialIndex().add(rect, truck.getId());\n }\n }", "@PostConstruct\n\tpublic void init() {\n\t\tBufferedReader fileReader = null;\n\t\ttry {\n\t\t\tResource resource = resourceLoader.getResource(\"classpath:JetBlue_Airports.csv\");\n\t\t\tfileReader = new BufferedReader(new FileReader(resource.getFile()));\n\t\t\tairportList = CsvReaderUtil.formAirportList(fileReader);\n\t\t\tLOG.info(\"Loaded data from csv file on startup, total airports: {}\", airportList.size());\n\t\t} catch (Exception e) {\n\t\t\tLOG.error(\"Exception: \", e);\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tfileReader.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tLOG.error(\"Exception while closing csv file, exception: \", e);\n\t\t\t}\n\t\t}\n\t}", "public static void readCSV() 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\tsetCSVorder(line);\n\t\t}\n\t\t\n\t\twhile((line = br.readLine()) != null) {\n\t\t\tFlightState fs = getStateFromCSV(line);\n\t\t\tsendToKafka(fs);\n\t\t}\n\t\t\n\t\tbr.close();\n\t}", "@Override\r\n\tpublic void loadAircraftData(Path p) throws DataLoadingException {\t\r\n\t\ttry {\r\n\t\t\t//open the file\r\n\t\t\tBufferedReader reader = Files.newBufferedReader(p);\r\n\t\t\t\r\n\t\t\t//read the file line by line\r\n\t\t\tString line = \"\";\r\n\t\t\t\r\n\t\t\t//skip the first line of the file - headers\r\n\t\t\treader.readLine();\r\n\t\t\t\r\n\t\t\twhile( (line = reader.readLine()) != null) {\r\n\t\t\t\t//each line has fields separated by commas, split into an array of fields\r\n\t\t\t\tString[] fields = line.split(\",\");\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t//Creating an Aircraft object\r\n\t\t\t\tAircraft loadingIn = new Aircraft();\r\n\t\t\t\t\r\n\t\t\t\t//put some of the fields into variables: check which fields are where atop the CSV file itself\r\n\t\t\t\tloadingIn.setTailCode(fields[0]);\r\n\t\t\t\tloadingIn.setTypeCode(fields[1]);\r\n\t\t\t\t//Checking the manufacturer and setting it\r\n\t\t\t\tManufacturer manufacturer = null;\r\n\t\t\t\tString mString = fields[2];\r\n\t\t\t\tif(mString.equals(\"Boeing\"))\r\n\t\t\t\t\tmanufacturer = Manufacturer.BOEING;\r\n\t\t\t\telse if(mString.equals(\"Airbus\"))\r\n\t\t\t\t\tmanufacturer = Manufacturer.AIRBUS;\r\n\t\t\t\telse if(mString.equals(\"Bombardier\"))\r\n\t\t\t\t\tmanufacturer = Manufacturer.BOMBARDIER;\r\n\t\t\t\telse if(mString.equals(\"Embraer\"))\r\n\t\t\t\t\tmanufacturer = Manufacturer.EMBRAER;\r\n\t\t\t\telse if(mString.equals(\"Fokker\"))\r\n\t\t\t\t\tmanufacturer = Manufacturer.FOKKER;\r\n\t\t\t\telse\r\n\t\t\t\t\tmanufacturer = Manufacturer.ATR;\r\n loadingIn.setManufacturer(manufacturer);\r\n\t\t\t\tloadingIn.setModel(fields[3]);\r\n\t\t\t\tloadingIn.setSeats(Integer.parseInt(fields[4]));\r\n\t\t\t\tloadingIn.setCabinCrewRequired(Integer.parseInt(fields[5]));\r\n\t\t\t\tloadingIn.setStartingPosition(fields[6]);\r\n\t\t\t\tairCrafts.add(loadingIn);\r\n\t\t\t\t\r\n\t\t\t\t//print a line explaining what we've found\r\n\t\t\t\t/*System.out.println(\"Tail Code: \" + loadingIn.getTailCode() + \" TypeCode: \" + loadingIn.getTailCode() +\r\n\t\t\t\t\t\t\" Manufacturer: \" + loadingIn.getManufacturer() + \" Model: \" + loadingIn.getModel() +\r\n\t\t\t\t\t\t\" Seats and CabinCrew : \" + loadingIn.getSeats() + \" \" + loadingIn.getCabinCrewRequired()\r\n\t\t\t\t\t\t+ \" Starting Pos. \" + loadingIn.getStartingPosition());*/\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tcatch (IOException ioe) {\r\n\t\t\t//There was a problem reading the file\r\n\t\t\tthrow new DataLoadingException(ioe);\r\n\t\t}\r\n\t\tcatch (NumberFormatException e)\r\n\t\t{\r\n\t\t\tSystem.err.println(\"Error loading aircraft data\");\r\n\t\t\tDataLoadingException dle = new DataLoadingException();\r\n\t\t\tthrow dle;\r\n\t\t}\r\n\r\n\t}", "private void init() throws FileNotFoundException, TransformerConfigurationException {\n try (Scanner filesscanner = new Scanner(new File(csvlocation))) {\n while (filesscanner.hasNext()) {\n filecontent.add(filesscanner.next());\n }\n if (!filecontent.isEmpty()) {\n this.header = filecontent.get(0);\n filecontent.remove(0);\n }\n setMailtemplate();\n } catch (FileNotFoundException | TransformerConfigurationException e) {\n LOGGER.error(\"Exception occured while reading the file\", e);\n throw e;\n }\n }", "public CSVImporter(String filename, int sourceUnits) throws FileNotFoundException {\n csvReader = new CSVReader(new FileReader(filename));\n yields = new HashMap<Integer, ArrayList<Object>>();\n this.sourceUnits = sourceUnits;\n db = new DatabaseClient();\n }", "void loadCrimeList(InputStream inputStream) {\n // Define a scanner\n try (Scanner scanner = new Scanner(inputStream)) {\n\n // While the scanner has another line to read\n while (scanner.hasNextLine()) {\n\n // Get the next link and split it into parts\n String line = scanner.nextLine();\n String parts[] = line.split(\",\");\n\n //Assign each part to a local var\n String id = parts[0];\n String title = parts[1];\n String dateString = parts[2];\n String solvedString = parts[3];\n\n UUID uuid = UUID.fromString(id);\n Date date = new SimpleDateFormat(\n \"yyyy-MM-dd\",\n Locale.getDefault()\n ).parse(dateString);\n boolean isSolved = (solvedString.equals(\"1\"));\n\n // Add the Crime to the Crime list\n mCrimes.add(\n new Crime(\n uuid,\n title,\n date,\n isSolved\n )\n );\n }\n\n // Date read in, so set the dataLoadedOnce flag to true.\n mDataLoadedOnce = true;\n\n } catch (Exception e) {\n Log.e(\"Read CSV\", e.toString());\n }\n }", "public void read(String csvFilepath) {\n\t\t String line = \"\";\n\t\t\tString cvsSplitBy = \",\";\n\t\t\t\n\t\t\tMyGIS_layer layer = new MyGIS_layer();\n\t\t\ttry (BufferedReader br = new BufferedReader(new FileReader(csvFilepath))) \n\t\t\t{\n\t\t\t\t\n\t\t\t\t br.readLine();\n\t\t\t\tString[] headline = br.readLine().split(cvsSplitBy);\n\t\t\t\twhile ((line = br.readLine()) != null) \n\t\t\t\t{\n\t\t\t\t\tString[] data = line.split(cvsSplitBy);\n\t\t\t\t\tMyGIS_element elemnt = new MyGIS_element(headline,data);\n\t\t\t\t\tlayer.add(elemnt);\n\t\t\t\t}\n\t\t\t\t\n\n\t\t\t} \n\t\t\tcatch (IOException e) \n\t\t\t{\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t\n\t\t\tproject.add(layer);\n\t\t}", "@Override\n\tpublic void importData(String filePath) {\n\t\tString[] allLines = readFile(filePath);\n\n\t\t//Obtains the date to give to all sales from the cell in the first line and first column of the csv\n\t\t//And formats it into the expected format.\n\t\tString[] firstLine = allLines[0].split(\",(?=([^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\", -1);\n\t\tString[] title = firstLine[0].split(\"\\\\(\");\n\t\tSimpleDateFormat oldFormat = new SimpleDateFormat(\"MMMMM, yyyy\");\n\t\tSimpleDateFormat newFormat = new SimpleDateFormat(\"MMM yyyy\");\n\t\tDate date = null;\n\t\ttry {\n\t\t\tdate = oldFormat.parse(title[1].replaceAll(\"[()]\", \"\"));\n\t\t} catch (ParseException e) {\n\t\t\tSystem.out.println(\"There was parsing the date in the first cell of the first line of the csv.\\n\" \n\t\t\t\t\t+ \" A date of the format 'October, 2017' was expected.\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\tthis.monthAndYear = newFormat.format(date);\n\n\t\t//Parses data for each currency and places it in class variable listForex by calling importForex() on each currency line of csv\n\t\t//Considers that the first line of currencies is the fourth line of csv.\n\t\t//Stops if counter reaches the total number of lines of csv, or if the line is shorter than 15 characters,\n\t\t//so that it doesn't try to parse the summary lines below the last currency line.\n\t\tint counter = 3;\n\t\twhile (counter< allLines.length && allLines[counter].length() > 15) {\n\t\t\timportForex(allLines[counter]);\n\t\t\tcounter++;\n\t\t}\n\n\t\tChannel apple = obtainChannel(\"Apple\", new AppleFileFormat(), false);\n\n\t\t//Places the imported data in the app,\n\t\t//making sure not to replace the existing list of FX rates for this month and year if there is one.\n\t\t//It does however update the FX rate value for currencies that are already in the data for this month.\n\t\tif (apple.getHistoricalForex().containsKey(monthAndYear)) {\n\t\t\tHashMap<String, Double> existingList = apple.getHistoricalForex().get(monthAndYear);\n\t\t\tfor (String s : existingList.keySet()) {\n\t\t\t\tlistForex.put(s, existingList.get(s));\n\t\t\t}\t\n\t\t}\n\t\tapple.addHistoricalForex(monthAndYear, listForex);\n\t}", "public void loadPlayer(HashMap<Integer, Player> Player_HASH){\r\n \r\n try {\r\n Scanner scanner = new Scanner(new File(file_position+\"Player.csv\"));\r\n Scanner dataScanner = null;\r\n int index = 0;\r\n \r\n while (scanner.hasNextLine()) {\r\n dataScanner = new Scanner(scanner.nextLine());\r\n \r\n if(Player_HASH.size() == 0){\r\n dataScanner = new Scanner(scanner.nextLine());\r\n }\r\n \r\n dataScanner.useDelimiter(\",\");\r\n Player player = new Player(-1, \"\", Color.BLACK, -1, -1);\r\n \r\n while (dataScanner.hasNext()) {\r\n String data = dataScanner.next();\r\n if (index == 0) {\r\n player.setID(Integer.parseInt(data));\r\n } else if (index == 1) {\r\n player.setName(data);\r\n } else if (index == 2) {\r\n player.setColor(Color.valueOf(data));\r\n } else if (index == 3) {\r\n player.setOrder(Integer.parseInt(data));\r\n } else {\r\n System.out.println(\"invalid data::\" + data);\r\n }\r\n index++;\r\n }\r\n \r\n Player_HASH.put(player.getID(), player);\r\n index = 0;\r\n }\r\n \r\n scanner.close();\r\n \r\n } catch (FileNotFoundException ex) {\r\n System.out.println(\"Error: FileNotFound - loadPlayer\");\r\n }\r\n }", "@Override\r\n\tpublic ArrayList<String> importCsv(File file) {\r\n\t\t\tFileReader monFichier = null;\r\n\t\t\tBufferedReader tampon = null;\r\n\t\t\tArrayList<String> aLImport = new ArrayList<String>();\r\n\t\t\tString[] tabString ;\r\n\t\t\tint sizeLine;\r\n\t\t\r\n\t\t\ttry {\r\n\t\t\t\t// file path\r\n\t\t\t\tmonFichier = new FileReader(file.getAbsolutePath());\r\n\t\t\t\ttampon = new BufferedReader(monFichier);\r\n\r\n\t\t\t\t// read the first line of the file .csv\r\n\t\t\t\tString ligneTemp = tampon.readLine();\r\n\t\t\t\ttabString = ligneTemp.split(\";\");\r\n\t\t\t\tthis.setNbColumnsRead(tabString.length);\r\n\t\t\t\t\r\n\t\t\t\t//Start of the actual content (first line only acting as a header)\r\n\t\t\t\tligneTemp = tampon.readLine();\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\t// faire la gestion des erreurs \r\n\t\t\t\t\t\t/*JOptionPane.showMessageDialog(this, \"Le fichier .csv n'est pas valide\", \"Erreur !\",\r\n\t\t\t\t\t\t\t\t\tJOptionPane.ERROR_MESSAGE);*/\r\n\t\t\t\t\r\n\t\t\t\t// read all the lines one by one and split them to keep the\r\n\t\t\t\t// structure's name\r\n\t\t\t\twhile (ligneTemp != null) {\t\t\t\t\t\r\n\t\t\t\t\ttabString = ligneTemp.split(\";\");\r\n\t\t\t\t\t\r\n\t\t\t\t\tsizeLine = tabString.length;\r\n\t\t\t\t\t//This for start at 1 in order to skip the first cell, assuming it is always \"Start\" and is therefore not required in the ArrayList\r\n\t\t\t\t\tfor (int i = 1; i < sizeLine; i+=2) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(!tabString[i].contains(\"End\")){\r\n\t\t\t\t\t\t\taLImport.add(tabString[i]);\r\n\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\tligneTemp = tampon.readLine();\r\n\t\t\t\t}\r\n\r\n\t\t\t} catch (IOException exception) {\r\n\t\t\t\texception.printStackTrace();\r\n\t\t\t\treturn null;\r\n\t\t\t} finally {\r\n\t\t\t\ttry {\r\n\t\t\t\tif (tampon != null)\r\n\t\t\t\t{\r\n\t\t\t\t\ttampon.close();\r\n\t\t\t\t}\r\n\t\t\t\tif (monFichier != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmonFichier.close();\r\n\t\t\t\t\t}\r\n\t\t\t\t} catch (IOException exception1) {\r\n\t\t\t\t\texception1.printStackTrace();\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\treturn aLImport;\t\r\n\t}", "private ArrayList<CSVRecord> processCsvData(String csvFile) {\n ArrayList<CSVRecord> records = new ArrayList<>();\n\n File csvData = new File(\"src/main/resources/csv/\" + csvFile + \".csv\");\n\n try {\n CSVParser parser = CSVParser.parse(csvData, Charset.defaultCharset(), CSVFormat.EXCEL);\n records.addAll(parser.getRecords());\n } catch (IOException exception) {\n logger.error(\"Unable to parse CSV file: \" + exception.getMessage());\n }\n\n return records;\n }", "public static StockSetData getStockSetDataFromCSV(String filePath) {\r\n int TOP_HEADER_ROW_INDEX = 4;\r\n // Create our BuyOptionObject\r\n StockSetData stockSetData = new StockSetData();\r\n // Get all the data as records\r\n List<List<String>> records = getCSV2(filePath);\r\n // Label the columns\r\n List<String> topHeader = records.get(TOP_HEADER_ROW_INDEX);\r\n List<String> nameHeader = records.get(TOP_HEADER_ROW_INDEX + 1);\r\n\r\n // loop horizontally through the elements in the top header\r\n for (int i = 0; i < topHeader.size(); i++) {\r\n // decide the type of column\r\n\r\n if (topHeader.get(i).equals(\"l\")) {\r\n ArrayList<String> loaderArray = new ArrayList<>();\r\n for (int j = TOP_HEADER_ROW_INDEX + 2; j < records.size(); j++) {\r\n loaderArray.add(records.get(j).get(i));\r\n }\r\n ColumnAndName columnAndName = new ColumnAndName(loaderArray ,nameHeader.get(i));\r\n stockSetData.getLabelValues().add(columnAndName);\r\n }\r\n if (topHeader.get(i).equals(\"s\")) {\r\n ArrayList<String> loaderArray = new ArrayList<>();\r\n for (int j = TOP_HEADER_ROW_INDEX + 2; j < records.size(); j++) {\r\n loaderArray.add(records.get(j).get(i));\r\n }\r\n ColumnAndName columnAndName = new ColumnAndName(loaderArray ,nameHeader.get(i));\r\n stockSetData.getSortingValues().add(columnAndName);\r\n }\r\n if (topHeader.get(i).equals(\"f\")) {\r\n ArrayList<String> loaderArray = new ArrayList<>();\r\n for (int j = TOP_HEADER_ROW_INDEX + 2; j < records.size(); j++) {\r\n loaderArray.add(records.get(j).get(i));\r\n }\r\n ColumnAndName columnAndName = new ColumnAndName(loaderArray ,nameHeader.get(i));\r\n stockSetData.getFitnessValues().add(columnAndName);\r\n }\r\n\r\n\r\n }\r\n\r\n return stockSetData;\r\n }", "@Override\n\tpublic void configuration(String csv) {\n\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}", "protected void loadFile(String resourcePath) {\n // Locate the resource in the classpath\n //URL fileUrl = this.getClass().getResource(resourcePath);\n //File f = new File(fileUrl.getFile());\n List<String[]> data = new LinkedList<>();\n String readLine;\n String[] splitLine;\n\n InputStream in = this.getClass().getResourceAsStream(resourcePath);\n BufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\n /*\n Attempt to read the data from the csv file, provided the input stream was\n actually opened and store the String[] by splitting.\n */\n try {\n log.info(\"Reading data from {}\", resourcePath);\n while((readLine = reader.readLine()) != null) {\n splitLine = readLine.split(DELIMITER);\n\n if (this.validateData(splitLine))\n data.add(splitLine);\n else\n log.error(\"Skipping {}\", readLine);\n }\n }\n catch(IOException e) {\n log.debug(e.getLocalizedMessage());\n }\n finally {\n IOUtils.closeQuietly(reader);\n IOUtils.closeQuietly(in);\n }\n\n //Using toMap collector to provide a keyMapper function that serves as a test for duplicates based on the passenger ID.\n //https://stackoverflow.com/questions/52148400/remove-duplicates-from-a-list-of-string-array\n //This will use the first element as a key and the currently selected element as the value for mapping\n this.lines = new LinkedList<>(\n data.stream().collect(Collectors.toMap(arr -> arr[0], Function.identity(),\n (a, b) -> a)).values());\n\n log.info(\"File {} with {} lines has been loaded\", resourcePath, lines.size());\n }", "protected static ArrayList<String> load() throws Exception {\r\n\t\tArrayList<String> list;\r\n\t\tFileReader fileRead = new FileReader(csv);\r\n\t\tBufferedReader buff = Files.newBufferedReader(Paths.get(\"story.csv\"));\r\n\t\tlist = buff.lines().map(line -> line.split(\",\")).flatMap(Arrays::stream)\r\n\t\t\t\t.collect(Collectors.toCollection(ArrayList::new));\r\n\t\tbuff.close();\r\n\t\tfileRead.close();\r\n\r\n\t\treturn list;\r\n\t}", "public int loadData(Reader csv, KeywordFactory kwf, boolean quiet) \n throws InterruptedException, IOException\n {\n if (! tablecreated) \n System.err.println(\"Warning: table not created yet?\");\n\n DbLoadCSV ldr = new DbLoadCSV(tbl, kwf, csv);\n ldr.addHMSCol(\"RA\");\n ldr.addDMSCol(\"Dec\");\n ldr.addDMSCol(\"Decl\");\n\n Process proc = startDbClient();\n Writer w = new OutputStreamWriter(proc.getOutputStream());\n ldr.sendData(w);\n\n w.close();\n proc.waitFor();\n if (!quiet) {\n if (proc.exitValue() > 0) {\n for (String line : emsgs) \n System.err.println(line);\n }\n else \n System.err.println(\"Table data loaded\");\n }\n\n return proc.exitValue();\n }", "public void load() throws CityException{\r\n \r\n allRanks = new ArrayList<Rank>();\r\n File file = new File(RANK_DATA_DIRECTORY);\r\n Scanner rankDataReader = null;\r\n Scanner lineReader = null;\r\n\r\n try {\r\n\r\n rankDataReader = new Scanner(file);\r\n\r\n ArrayList<String> rankDataArray = new ArrayList<String>();\r\n int count = 0;\r\n\r\n while (rankDataReader.hasNext()) {\r\n\r\n String rankDataLine = rankDataReader.nextLine();\r\n\r\n if (count > 0) {\r\n\r\n String[] rankData = rankDataLine.split(\",\");\r\n\r\n String rankName = rankData[0];\r\n int xp = Integer.parseInt(rankData[1]);\r\n int plotAvailable = Integer.parseInt(rankData[2]);\r\n\r\n allRanks.add(new Rank(rankName, xp, plotAvailable));\r\n }\r\n\r\n count++;\r\n }\r\n\r\n } catch (FileNotFoundException e) {\r\n throw new CityException(\"InvalidFile\");\r\n } finally {\r\n rankDataReader.close();\r\n }\r\n }", "public void loadBuildingPiece(HashMap<Integer, BuildingPiece> BuildingPiece_HASH){\r\n \r\n try {\r\n Scanner scanner = new Scanner(new File(file_position+\"BuildingPiece.csv\"));\r\n Scanner dataScanner = null;\r\n int index = 0;\r\n \r\n while (scanner.hasNextLine()) {\r\n dataScanner = new Scanner(scanner.nextLine());\r\n \r\n if(BuildingPiece_HASH.size() == 0){\r\n dataScanner = new Scanner(scanner.nextLine());\r\n }\r\n \r\n dataScanner.useDelimiter(\",\");\r\n BuildingPiece buildingPiece = new BuildingPiece(-1, -1, -1, Color.BLACK);\r\n \r\n while (dataScanner.hasNext()) {\r\n String data = dataScanner.next();\r\n if (index == 0) {\r\n buildingPiece.setId(Integer.parseInt(data));\r\n } else if (index == 1) {\r\n buildingPiece.setAreaNumber(Integer.parseInt(data));\r\n } else if (index == 2) {\r\n buildingPiece.setColor(Color.valueOf(data));\r\n } else if (index == 3) {\r\n buildingPiece.setPlayerID(Integer.parseInt(data));\r\n } else {\r\n System.out.println(\"invalid data::\" + data);\r\n }\r\n index++;\r\n }\r\n \r\n BuildingPiece_HASH.put(buildingPiece.getId(), buildingPiece);\r\n index = 0;\r\n }\r\n \r\n scanner.close();\r\n \r\n } catch (FileNotFoundException ex) {\r\n System.out.println(\"Error: FileNotFound - loadBuildingPiece\");\r\n }\r\n \r\n }", "private void loadData() {\n try {\n URL source = new URL(CSV_URL);\n URLConnection connect = source.openConnection();\n BufferedReader f = new BufferedReader(new InputStreamReader(connect.getInputStream()));\n\n header = f.readLine().split(\",\");\n // Replace third header with Difficulty Rating\n header[3] = \"Difficulty\";\n\n String line;\n while((line = f.readLine()) != null) {\n String[] row = line.split(\",\");\n // Section: 0, 1, 2, 3 for now, 3 will be WCC\n\n int problemNumber = Integer.parseInt(row[0]);\n int section;\n int year;\n String exam = row[1];\n String answer = row[2];\n\n if(row.length > 3) {\n answer += \"~\" + row[3];\n }\n\n if(exam.matches(\"USNCO .*\")) {\n exam = exam.substring(6);\n year = Integer.parseInt(exam.substring(1, 5));\n if(exam.charAt(0) == 'N') {\n section = 1;\n }\n else {\n section = 0;\n }\n }\n else {\n year = Integer.parseInt(exam.substring(4, 8));\n section = 3;\n }\n\n int id = year*240 + problemNumber*4 + section;\n data.put(id, answer);\n }\n }\n catch (Exception e) {\n // Solution given by StackOverflow: https://stackoverflow.com/questions/1149703/\n StringWriter sw = new StringWriter();\n PrintWriter pw = new PrintWriter(sw);\n e.printStackTrace(pw);\n String sStackTrace = sw.toString().substring(0, 800); // stack trace as a string\n\n // Send error messages to me\n instance.retrieveUserById(CREATOR).queue(\n user -> user.openPrivateChannel().queue(\n channel -> channel.sendMessage(sStackTrace).queue()));\n\n }\n }", "@Test\r\n public void readCsvFile() throws FileNotFoundException, IOException { \r\n CsvReader csvr = new CsvReader(CSV_FILE);\r\n \r\n List<NetworkElement> nes = csvr.getNetworkElements();\r\n assertEquals(55,nes.size()); \r\n }", "@Test\r\n\tpublic void readCsvTest() throws IOException {\r\n\t\t\tfail(\"Not yet implemented\");\r\n\t}", "public void loadCoin(HashMap<Integer, Coin> Coin_HASH){\r\n \r\n try {\r\n Scanner scanner = new Scanner(new File(file_position+\"Coin.csv\"));\r\n Scanner dataScanner = null;\r\n int index = 0;\r\n \r\n while (scanner.hasNextLine()) {\r\n dataScanner = new Scanner(scanner.nextLine());\r\n \r\n if(Coin_HASH.size() == 0){\r\n dataScanner = new Scanner(scanner.nextLine());\r\n }\r\n \r\n dataScanner.useDelimiter(\",\");\r\n Coin coin = new Coin();\r\n \r\n while (dataScanner.hasNext()) {\r\n String data = dataScanner.next();\r\n if (index == 0) {\r\n coin.setId(Integer.parseInt(data));\r\n } else if (index == 1) {\r\n coin.setPlayerID(Integer.parseInt(data));\r\n } else {\r\n System.out.println(\"invalid data::\" + data);\r\n }\r\n index++;\r\n }\r\n \r\n Coin_HASH.put(coin.getId(), coin);\r\n index = 0;\r\n }\r\n \r\n scanner.close();\r\n \r\n } catch (FileNotFoundException ex) {\r\n System.out.println(\"Error: FileNotFound - loadCoin\");\r\n }\r\n }", "protected void readCSVToMap(String filename) throws Exception{ // IMPORTANT FUNCTION\n db = new HashMap<String, List<String>>();\n keys = new ArrayList<String>();\n InputStream is = getAssets().open(\"ABBREV_2.txt\");\n //File f = new File(path.toURI());\n //File f = new File(path.getFile());\n BufferedReader in = new BufferedReader(new InputStreamReader(is));//new BufferedReader(new FileReader(\"ABBREV_2.txt\"));\n String line = \"\";\n while ((line = in.readLine()) != null) {\n String parts[] = line.split(\"\\t\");\n List<String> nutrition = new ArrayList();\n for (int i = 1; i < parts.length; i++){\n nutrition.add(parts[i]);\n }\n db.put(parts[0], nutrition);\n keys.add(parts[0]);\n }\n in.close();\n\n }", "public static double[][] loadData() {\n double[][] data = null;;\n \n try {\n // create a path to the file\n File file = new File(\"data.csv\");\n \n // create a scanner to read the file\n Scanner inputFile = new Scanner(file);\n \n // count the number of entries in the file so we know how big\n // data needs to be.\n int index = 0;\n \n // count the rows in the file\n while(inputFile.hasNext()) {\n inputFile.nextLine();\n index++;\n }\n \n // declare the array.\n // first row is X, second row is Y\n data = new double[2][index];\n \n // create a new scanner so we can go back to the beginning of the file\n inputFile = new Scanner(file);\n \n // reset index to zero so we can assign array values properly\n index = 0;\n \n // a String to hold the lines as they are read from the file.\n String input = \"\";\n \n // the file should consist of a list of ordered pairs x,y\n // one ordered pair per line. assign these to the appropriate\n // places in the array\n while (inputFile.hasNext()) {\n // read the line\n input = inputFile.nextLine();\n \n // store the x value in the first array\n data[0][index] = Double.parseDouble(input.split(\",\")[0]);\n \n // store the y value in the second array\n data[1][index] = Double.parseDouble(input.split(\",\")[1]);\n \n // increment\n index++;\n }\n \n // done working with the file\n inputFile.close();\n } catch (FileNotFoundException ex) {\n System.out.println(\"File not found: \" + ex);\n } \n \n return data; \n }", "@PostConstruct\r\n\tpublic void init()\r\n\t{\r\n\t\tResource resource = resourceLoader.getResource(\"classpath:\"+\"assets/csv/corpus.csv\");\r\n\t\ttry {\r\n\t\t\tcsvArray = CsvUtil.loadCSVFile(resource.getInputStream());\t\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void fromCsv(String line, String separator, NumberFormat numberFormat) throws ParseException {\r\n\t\t\tString[] values = line.split(separator);\r\n\t\t\t\r\n\t\t\tid = values[0];\r\n\t\t\tdate = ZonedDateTime.parse(values[1]);\r\n\t\t\tresolution = values[2];\r\n\t\t\thypothesis = values[3];\r\n\t\t\tquality = (values[4].length() == 0 ? Integer.MIN_VALUE : Integer.parseInt(values[4]));\r\n\t\t\tvalue = numberFormat.parse(values[5]).doubleValue();\r\n\t\t\tunit = values[6];\r\n\t\t}", "public CSVFileReader(String fileName, BufferedReader br, char sep)\n {\n super(sep);\n this.fileName = fileName;\n in = br;\n }", "@Test\n public void doImport_doesNotModifyOriginalCsv() {\n ExternalDataReader externalDataReader = new ExternalDataReaderImpl(null);\n externalDataReader.doImport(formDefToCsvMedia);\n\n assertThat(dbFile.exists(), is(true));\n assertThat(csvFile.exists(), is(true));\n }", "public void read_file(String filename ,int storage_level){\n input=sqlContext.read()\r\n .format(\"com.databricks.spark.csv\")\r\n .option(\"header\",\"true\")\r\n .option(\"inferSchema\",\"true\")\r\n .load(filename);\r\n\r\n input.saveAsTable(\"crimeData\");\r\n cache_data(storage_level);\r\n }", "@Override\n public List<TimetableUpload> parseCsvFile(MultipartFile file) {\n try (Reader reader = new BufferedReader(new InputStreamReader(file.getInputStream()))) {\n // create csv bean reader\n CsvToBean<TimetableUpload> csvToBean = new CsvToBeanBuilder(reader)\n .withType(TimetableUpload.class)\n .withIgnoreLeadingWhiteSpace(true)\n .build();\n return csvToBean.parse();\n } catch (IOException e) {\n System.err.println(\"Something went wrong while parsing the csv file\");\n return null;\n }\n }", "private void loadData(){\n try (BufferedReader br = new BufferedReader(new FileReader(this.fileName))) {\n String line;\n while((line=br.readLine())!=null){\n E e = createEntity(line);\n super.save(e);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void readFile() {\r\n\t\tcsvEntrys = new ArrayList<>();\r\n\t\tString line = \"\";\r\n\t\ttry (BufferedReader br = new BufferedReader(new FileReader(new File(filepath)))) {\r\n\t\t\twhile ((line = br.readLine()) != null) {\r\n\t\t\t\tif (!line.contains(\"id\")) {\r\n\t\t\t\t\tcsvEntrys.add(line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public CsvReader(String filename, String seperator) {\n\t\tthis.seperator = seperator;\n\t\treadFile(filename, true);\n\t}", "public static void main(String[] args) throws FileNotFoundException, IOException {\r\n \r\n Directory d = new Directory();\r\n \r\n if (args.length != 1) {\r\n System.out.println(\"Usage: java CSVReaderTest <filename>\");\r\n }\r\n else {\r\n FileReader fr = new FileReader(args[0]);\r\n BufferedReader c = new BufferedReader(fr);\r\n\r\n int lineNum = 0;\r\n boolean eof = false;\r\n \r\n while (!eof) {\r\n String line = c.readLine();\r\n \r\n if (line == null) {\r\n eof = true;\r\n }\r\n else{\r\n // Allocate an array of the necessary size to return the strings\r\n String[] values = new String[4];\r\n // Start beginIndex at the beginning of the String, position 0\r\n int beginIndex = 0;\r\n\r\n for (int i = 0; i < 3; i++) {\r\n int endIndex;\r\n endIndex = line.indexOf(',', beginIndex);\r\n\r\n // if the argument begins and ends with quotes, remove them\r\n if (line.charAt(beginIndex) == '\"' && line.charAt(endIndex - 1) == '\"') {\r\n values[i] = line.substring(beginIndex + 1, endIndex - 1);\r\n\r\n } else {\r\n values[i] = line.substring(beginIndex, endIndex);\r\n }\r\n\r\n beginIndex = endIndex + 1;\r\n }\r\n\r\n if (line.charAt(beginIndex) == '\"' && line.charAt(line.length() - 1) == '\"') {\r\n values[3] = line.substring(beginIndex + 1, line.length() - 1);\r\n } else {\r\n values[3] = line.substring(beginIndex, line.length());\r\n }\r\n \r\n if (lineNum > 1) {\r\n lineNum = lineNum + 1;\r\n Student s = new Student(values[0]);\r\n s.setFirstName(values[1]);\r\n s.setLastName(values[2]);\r\n s.setPhoneNumber(values[3]);\r\n d.addStudent(s);\r\n System.out.println(s);\r\n }\r\n\r\n }\r\n }\r\n c.close();\r\n }\r\n \r\n Student c = new Student(\"mengl1\");\r\n c.setFirstName(\"Meng\");\r\n c.setLastName(\"Li\");\r\n c.setPhoneNumber(\"412-807-0153\");\r\n \r\n Student a = new Student(\"mengl2\");\r\n a.setFirstName(\"Mengl\");\r\n a.setLastName(\"Li\");\r\n a.setPhoneNumber(\"412-807-0154\");\r\n \r\n Student b = new Student(\"terryhong\");\r\n b.setFirstName(\"terry\");\r\n b.setLastName(\"hong\");\r\n b.setPhoneNumber(\"412-464-475\");\r\n\r\n d.addStudent(c);\r\n d.addStudent(a);\r\n d.addStudent(b);\r\n \r\n //System.out.println(d.searchByAndrewId(\"mengl2\"));\r\n //d.deleteStudent(\"terryhong\");\r\n System.out.println(d.size());\r\n // System.out.println(d.searchByLastName(\"Li\"));\r\n\r\n }", "public Reader(File file) {\r\n\t\tdata = new ArrayList<Measure>();\r\n\r\n\t\ttry {\r\n\t\t\treader = new CSVReader(new InputStreamReader(new FileInputStream(\r\n\t\t\t\t\tfile)), ';', '\\'');\r\n\r\n\t\t\t// skip the header\r\n\t\t\treader.readNext();\r\n\r\n\t\t\tString[] line;\r\n\t\t\twhile ((line = reader.readNext()) != null) {\r\n\t\t\t\tgetData().add(new Measure(line));\r\n\t\t\t}\r\n\t\t} catch (UnsupportedEncodingException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public List<Lender> readCSVFile(String path){\r\n\r\n List<Lender> inputList = new ArrayList<>();\r\n try{\r\n File inputF = new File(path);\r\n InputStream inputFS = new FileInputStream(inputF);\r\n BufferedReader br = new BufferedReader(new InputStreamReader(inputFS));\r\n // skip the header of the csv\r\n inputList = br.lines().skip(1).map(mapToItem).collect(Collectors.toList());\r\n br.close();\r\n } catch (IOException e) {\r\n throw new QuoteException(\"Error reading the csv file\", e);\r\n }\r\n\r\n return inputList ;\r\n }", "private void parseCSVToBean(String url) throws Exception {\r\n\r\n\t\t// later we have to implement to check created time of the CSV file\r\n\r\n\t\tColumnPositionMappingStrategy<DealerDetails> strat = new ColumnPositionMappingStrategy<>();\r\n\t\tstrat.setType(DealerDetails.class);\r\n\t\tString[] columns = new String[] { \"firstName\", \"lastName\", \"username\",\r\n\t\t\t\t\"contactNumber\", \"panNumber\", \"vatNumber\", \"bankName\",\r\n\t\t\t\t\"bankAccountNumber\", \"websiteUrl\", \"address\",\r\n\t\t\t\t\"branchTelNumber\", \"country\", \"state\", \"city\", \"zipcode\" };\r\n\t\tstrat.setColumnMapping(columns);\r\n\r\n\t\tCsvToBean<DealerDetails> csvToBean = new CsvToBean<DealerDetails>();\r\n\r\n\t\t// URL fileURL = new URL(url);\r\n\t\t// BufferedReader br = new BufferedReader(new InputStreamReader(\r\n\t\t// fileURL.openStream()));\r\n\r\n\t\tURL csvFileURL = new URL(url);\r\n\t\tBufferedReader bufferedReader = new BufferedReader(\r\n\t\t\t\tnew InputStreamReader(csvFileURL.openStream()));\r\n\r\n\t\tCSVReader reader = new CSVReader(bufferedReader);\r\n\r\n\t\tList<DealerDetails> dealers = csvToBean.parse(strat, reader);\r\n\r\n\t\tfor (DealerDetails dealerDetails : dealers) {\r\n\t\t\t// create user\r\n\t\t\tcreateUser(dealerDetails);\r\n\t\t}\r\n\r\n\t}", "public void loadDemonPiece(HashMap<Integer, DemonPiece> DemonPiece_HASH){\r\n \r\n try {\r\n Scanner scanner = new Scanner(new File(file_position+\"DemonPiece.csv\"));\r\n Scanner dataScanner = null;\r\n int index = 0;\r\n \r\n while (scanner.hasNextLine()) {\r\n dataScanner = new Scanner(scanner.nextLine());\r\n \r\n if(DemonPiece_HASH.size() == 0){\r\n dataScanner = new Scanner(scanner.nextLine());\r\n }\r\n \r\n dataScanner.useDelimiter(\",\");\r\n DemonPiece demonPiece = new DemonPiece(-1, -1);\r\n \r\n while (dataScanner.hasNext()) {\r\n String data = dataScanner.next();\r\n if (index == 0) {\r\n demonPiece.setId(Integer.parseInt(data));\r\n } else if (index == 1) {\r\n demonPiece.setAreaNumber(Integer.parseInt(data));\r\n } else {\r\n System.out.println(\"invalid data::\" + data);\r\n }\r\n index++;\r\n }\r\n \r\n DemonPiece_HASH.put(demonPiece.getId(), demonPiece);\r\n index = 0;\r\n }\r\n \r\n scanner.close();\r\n \r\n } catch (FileNotFoundException ex) {\r\n System.out.println(\"Error: FileNotFound - loadDemonPiece\");\r\n }\r\n \r\n }", "public void loadBooks(){\n\t\tSystem.out.println(\"\\n\\tLoading books from CSV file\");\n\t\ttry{\n\t\t\tint iD=0, x;\n\t\t\tString current = null;\n\t\t\tRandom r = new Random();\n\t\t\tBufferedReader br = new BufferedReader(new FileReader(\"../bin/books.csv\"));\n\t\t\twhile((current = br.readLine()) != null){\n\t\t\t\tString[] data = current.split(\",\");\n\t\t\t\tx = r.nextInt(6) + 15;\n\t\t\t\tfor(int i =0;i<x;i++){\n\t\t\t\t\tBook b= new Book(Integer.toHexString(iD), data[0], data[1], data[2], data[3]);\n\t\t\t\t\tif(bookMap.containsKey(data[0]) != true){\n\t\t\t\t\t\tbookMap.put(data[0], new ArrayList<Book>());\n\t\t\t\t\t}\t\n\t\t\t\t\t\t\n\t\t\t\t\tbookMap.get(data[0]).add(b);\n\t\t\t\t\tiD += 1;\n\t\t\t\t}\t\n\t\t\t}\t\t\t\n\t\t\tbr.close();\n\t\t\tSystem.out.println(\"\\tBooks Added!\");\n\t\t}catch(FileNotFoundException e){\n\t\t\tSystem.out.println(\"\\tFile not found\");\n\t\t}catch(IOException e){\n System.out.println(e.toString());\n }\n\t}", "public void loadTrollPiece(HashMap<Integer, TrollPiece> TrollPiece_HASH){\r\n \r\n try {\r\n Scanner scanner = new Scanner(new File(file_position+\"TrollPiece.csv\"));\r\n Scanner dataScanner = null;\r\n int index = 0;\r\n \r\n while (scanner.hasNextLine()) {\r\n dataScanner = new Scanner(scanner.nextLine());\r\n \r\n if(TrollPiece_HASH.size() == 0){\r\n dataScanner = new Scanner(scanner.nextLine());\r\n }\r\n \r\n dataScanner.useDelimiter(\",\");\r\n TrollPiece trollPiece = new TrollPiece(-1, -1);\r\n \r\n while (dataScanner.hasNext()) {\r\n String data = dataScanner.next();\r\n if (index == 0) {\r\n trollPiece.setId(Integer.parseInt(data));\r\n } else if (index == 1) {\r\n trollPiece.setAreaNumber(Integer.parseInt(data));\r\n } else {\r\n System.out.println(\"invalid data::\" + data);\r\n }\r\n index++;\r\n }\r\n \r\n TrollPiece_HASH.put(trollPiece.getId(), trollPiece);\r\n index = 0;\r\n }\r\n \r\n scanner.close();\r\n \r\n } catch (FileNotFoundException ex) {\r\n System.out.println(\"Error: FileNotFound - loadTrollPiece\");\r\n }\r\n \r\n }", "public InputReader(String csvlocation, String templatelocation) throws FileNotFoundException, TransformerConfigurationException {\n this.csvlocation = csvlocation;\n this.templatelocation = templatelocation;\n init();\n }", "public void insertdata(String file) {\n\r\n\r\n final String csvFile = file;\r\n\r\n try (BufferedReader br = new BufferedReader(new FileReader(csvFile))) {\r\n\r\n\r\n while ((line = br.readLine()) != null) {\r\n\r\n\r\n // use comma as separator\r\n String[] country = line.split(\",\");\r\n\r\n if (country.length == 12) {\r\n model_lacakMobil = new Model_LacakMobil();\r\n realmHelper = new RealmHelper(realm);\r\n\r\n model_lacakMobil.setNama_mobil(country[1]);\r\n model_lacakMobil.setNo_plat(country[2]);\r\n model_lacakMobil.setNamaunit(country[3]);\r\n model_lacakMobil.setFinance(country[4]);\r\n model_lacakMobil.setOvd(country[5]);\r\n model_lacakMobil.setSaldo(country[6]);\r\n model_lacakMobil.setCabang(country[7]);\r\n model_lacakMobil.setNoka(country[8]);\r\n model_lacakMobil.setNosin(country[9]);\r\n model_lacakMobil.setTahun(country[10]);\r\n model_lacakMobil.setWarna(country[11]);\r\n realmHelper.save(model_lacakMobil);\r\n\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n } finally {\r\n// fixing_data();\r\n\r\n }\r\n }", "static public List<Product> productReader() throws IOException {\n BufferedReader csvReader = new BufferedReader(new FileReader(PRODUCTS_REFERENCE_FILE));\n String row;\n List<Product> dataList = new ArrayList<>();\n\n row = csvReader.readLine();\n while ((row = csvReader.readLine()) != null){\n\n Product data = new Product();\n //I separate the row data by a separator, a coma in this case and add all the data in the class\n String[] datas = row.split(SEPARATOR_COLON);\n\n data.setProduct_id(Integer.parseInt(datas[0]));\n data.setName(datas[1]);\n data.setDescription(datas[2]);\n data.setCategory_id(Integer.parseInt(datas[3]));\n\n DateTimeFormatter formatter = DateTimeFormatter.ofPattern(\"MM/dd/yyyy\");\n\n //Since some dates had just one number for the month, I had to use this to add a 0\n //to make all the dates the same length after getting rid of the 0:01 that was not necessary\n String[] creationDate = datas[4].split(\" \");\n if(creationDate[0].length() == 9){\n creationDate[0] = \"0\"+ creationDate[0];\n }\n data.setCreation_date(LocalDate.parse(creationDate[0], formatter));\n\n creationDate = datas[5].split(\" \");\n if(creationDate[0].length() == 9){\n creationDate[0] = \"0\"+ creationDate[0];\n }\n data.setUpdate_date(LocalDate.parse(creationDate[0], formatter));\n\n creationDate = datas[6].split(\" \");\n if(creationDate[0].length() == 9){\n creationDate[0] = \"0\"+ creationDate[0];\n }\n data.setLast_purchased_date(LocalDate.parse(creationDate[0], formatter));\n\n dataList.add(data);\n\n }\n return dataList;\n\n }", "public void loadItems(String filename) throws IOException, CSVException {\n\t\tinventory = new Stock();\n\n\t\tString[] itemProperties = Utilities.readCSV(filename, 5, 6);\n\t\tfor (String line : itemProperties) {\n\t\t\tString[] properties = line.split(\",\");\n\t\t\tItem item;\n\t\t\tif (properties.length == 5) {\n\t\t\t\titem = new Item(properties[0], Double.parseDouble(properties[1]), Double.parseDouble(properties[2]),\n\t\t\t\t\t\tInteger.parseInt(properties[3]), Integer.parseInt(properties[4]));\n\t\t\t} else {\n\t\t\t\titem = new ColdItem(properties[0], Double.parseDouble(properties[1]), Double.parseDouble(properties[2]),\n\t\t\t\t\t\tInteger.parseInt(properties[3]), Integer.parseInt(properties[4]),\n\t\t\t\t\t\tDouble.parseDouble(properties[5]));\n\t\t\t}\n\n\t\t\tinventory.add(item);\n\t\t}\n\n\t}", "public CSVLoader(String directory, String name) {\n this.setDirectory(directory);\n this.setName(name);\n this.setConnection(null);\n this.setStatement(null);\n this.setResults(null);\n this.loadDriver();\n }", "private void loadDataMap() throws IOException {\n\t\tDaySleepDurationMap.getInstance().clear();\n\n\t\t// List of entries\n\t\tList<SleepEntry> entries = new ArrayList<SleepEntry>();\n\t\t\n\t\t// Get CSV file\n\t\tBufferedReader br = new BufferedReader(new FileReader(new File(DATA_LOCATION)));\n\t\tString line = \"\";\n\n\t\t// Ignore the first line (CSV header)\n\t\tbr.readLine();\n\n\t\twhile (((line = br.readLine()) != null)){\n\t\t\t// Convert the line from CSV to a SleepEntry\n\t\t\tSleepEntry se = SleepEntry.parseFromCSV(line);\n\t\t\t// Add it to the entry list\n\t\t\tentries.add(se);\n\t\t}\n\t\t\n\t\tfor (SleepEntry se : entries){\n\t\t\t// Add data from list to the map\n\t\t\tDaySleepDurationMap.getInstance().addToDay(se.getEffectiveDate(), se.getDuration());\n\t\t}\n\t\t\n\n\t\tbr.close();\n\t\t\n\t}", "@Override\n public void loadDataFromFile(File file) {\n Gson gson = new Gson();\n try {\n Scanner scanner = new Scanner(file);\n while (scanner.hasNextLine()){\n IndividualCustomer customer =\n gson.fromJson(scanner.nextLine(),IndividualCustomer.class);\n customerList.add(customer);\n }\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n\n }", "public static void readFromCSVIntoTable() {\n try {\n for (String tn : ORDERED_TABLE_NAMES) {\n handle.execute(buildInsertIntoFromCSV(tn));\n }\n } catch (Throwable e) {\n itsLogger.error(e.getMessage(), e);\n }\n\n }", "public CSVReader(double percentage, String fileLocation) {\n this.percentage = percentage;\n this.fileLocation = fileLocation;\n\n instances.clear();\n readCSVFile();\n targetsize = (int) Math.round(instances.size() * percentage);\n }", "protected abstract void loadData();", "private void initFromFile(Configuration config) throws FileNotFoundException {\n String file = config.getString(OrderFile_Type_Property_Name);\n List<List<String>> contents = FileUtils.readCsv(file);\n int index;\n for (List<String> rowContent : contents) {\n index = 0;\n String accountId = rowContent.get(index++);\n String orderId = rowContent.get(index++);\n String exchange = rowContent.get(index++);\n String stockId = rowContent.get(index++);\n String tradingDay = rowContent.get(index++);\n\n\n if (this.date == 0) {\n // 2019-11-13 00:00:00\n this.date = TimeUtils.formatTradeDate(tradingDay);\n } else if (TimeUtils.formatTradeDate(tradingDay) != date) {\n throw new InitializationException(MessageFormat.format(\"Two different trading days are sent to system, {0} and {1}.\", String.valueOf(this.date), String.valueOf(TimeUtils.formatTradeDate(tradingDay))));\n }\n\n String side = rowContent.get(index++);\n String type = rowContent.get(index++);\n double price = Double.valueOf(rowContent.get(index++));\n String algo = rowContent.get(index++);\n String startTime = rowContent.get(index++);\n String endTime = rowContent.get(index++);\n int qty = Integer.valueOf(rowContent.get(index++));\n double pov = Double.valueOf(rowContent.get(index));\n\n Order order = new Order(orderId, accountId, stockId, startTime, endTime, algo, type, price, pov, side, qty, exchange);\n this.cache.put(orderId, order);\n }\n }", "public void load() {\n\t\n\t\tdataTable = new HashMap();\n\t\t\n\t\tArrayList musicArrayList = null;\n\t\tStringTokenizer st = null;\n\n\t\tMusicRecording myRecording;\n\t\tString line = \"\";\n\n\t\tString artist, title;\n\t\tString category, imageName;\n\t\tint numberOfTracks;\n\t\tint basePrice;\n\t\tdouble price;\n\n\t\tTrack[] trackList;\n\t\t\n\t\ttry\n\t\t{\n\t\t\tlog(\"Loading File: \" + FILE_NAME + \"...\");\n\t\t\tBufferedReader inputFromFile = new BufferedReader(new FileReader(FILE_NAME));\n\t\t\t\n\t\t\t// read until end-of-file\n\t\t\twhile ( (line = inputFromFile.readLine()) != null ) {\t\t\t\n\t\t\t\n\t\t\t\t// create a tokenizer for a comma delimited line\n\t\t\t\tst = new StringTokenizer(line, \",\");\n\t\t\n\t\t\t\t// Parse the info line to read following items formatted as\n\t\t\t\t// - the artist, title, category, imageName, number of tracks\n\t\t\t\t//\n\t\t\t\tartist = st.nextToken().trim();\n\t\t\t\ttitle = st.nextToken().trim();\n\t\t\t\tcategory = st.nextToken().trim();\n\t\t\t\timageName = st.nextToken().trim();\n\t\t\t\tnumberOfTracks = Integer.parseInt(st.nextToken().trim());\n\t\t\t\t\t\t\n\t\t\t\t// read all of the tracks in\n\t\t\t\ttrackList = readTracks(inputFromFile, numberOfTracks);\n\n\t\t\t\t// select a random price between 9.99 and 15.99\n\t\t\t\tbasePrice = 9 + (int) (Math.random() * 7);\n\t\t\t\tprice = basePrice + .99;\n\n\t\t\t\t// create the music recording\n\t\t\t\tmyRecording = new MusicRecording(artist, trackList, title, \n\t\t\t\t\t\t\t\t\t\t\t\t price, category, imageName);\n\n\t\t\t\t// check to see if we have information on this category\n\t\t\t\tif (dataTable.containsKey(category)) {\n\t\t\t\t\n\t\t\t\t\t// get the list of recordings for this category\n\t\t\t\t\tmusicArrayList = (ArrayList) dataTable.get(category); \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\t// this is a new category. simply add the category\n\t\t\t\t\t// to our dataTable\n\t\t\t\t\tmusicArrayList = new ArrayList();\n\t\t\t\t\tdataTable.put(category, musicArrayList);\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// add the recording\n\t\t\t\tmusicArrayList.add(myRecording);\n\t\t\t\t\n\t\t\t\t// move ahead and consume the line separator\n\t\t\t\tline = inputFromFile.readLine();\n\t\t\t}\n\n\t\t\tinputFromFile.close();\n\t\t\tlog(\"File loaded successfully!\");\n\t\t\tlog(\"READY!\\n\");\n\n\t\t}\n\t\tcatch (FileNotFoundException exc) {\n\t\t\tlog(\"Could not find the file \\\"\" + FILE_NAME + \"\\\".\");\n\t\t\tlog(\"Make sure it is in the current directory.\");\n\t\t\tlog(\"========>>> PLEASE CONTACT THE INSTRUCTOR.\\n\\n\\n\");\n\t\t\tlog(exc);\n\t\t\t\n\t\t}\n\t\tcatch (IOException exc) {\n\t\t\tlog(\"IO error occurred while reading file: \" + FILE_NAME);\n\t\t\tlog(\"========>>> PLEASE CONTACT THE INSTRUCTOR.\\n\\n\\n\");\n\t\t\tlog(exc);\n\n\t\t}\n\t\n\t}", "public static void load() {\r\n\t\ttransList = new ArrayList<Transaction>();\r\n\t\ttry {\r\n\t\t\tSystem.out.println(\"loading all trans...\");\r\n\t\t\tBufferedReader reader = new BufferedReader(new FileReader(\"src/transaction.csv\"));\r\n\t\t\treader.readLine();\r\n\t\t\tString line = null;\r\n\t\t\twhile ((line = reader.readLine()) != null) {\r\n\t\t\t\tString item[] = line.split(\",\");\r\n\t\t\t\tString type = item[0];\r\n\t\t\t\tint acc = Integer.parseInt(item[1]);\r\n\t\t\t\tdouble amount = Double.parseDouble(item[2]);\r\n\t\t\t\tint year = Integer.parseInt(item[3]);\r\n\t\t\t\tint month = Integer.parseInt(item[4]);\r\n\t\t\t\tint date = Integer.parseInt(item[5]);\r\n\t\t\t\tCalendar cal = Calendar.getInstance();\r\n\t\t\t\tcal.set(year, month - 1, date);\r\n\t\t\t\tif (type.charAt(0) == 'w') {\r\n\t\t\t\t\tWithdrawal trans = new Withdrawal(acc, amount, cal);\r\n\t\t\t\t\ttransList.add(trans);\r\n\t\t\t\t\tSystem.out.println(trans.toFile());\r\n\t\t\t\t} else if (type.charAt(0) == 'd') {\r\n\t\t\t\t\tboolean cleared = Boolean.parseBoolean(item[6]);\r\n\t\t\t\t\tDeposit trans = new Deposit(acc, amount, cal, cleared);\r\n\t\t\t\t\ttransList.add(trans);\r\n\t\t\t\t\tSystem.out.println(trans.toFile());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treader.close();\r\n\t\t\tSystem.out.println(\"loading finished\");\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void stockLoad() {\n try {\n File file = new File(stockPath);\n Scanner scanner = new Scanner(file);\n while (scanner.hasNextLine()) {\n String data = scanner.nextLine();\n String[] userData = data.split(separator);\n Stock stock = new Stock();\n stock.setProductName(userData[0]);\n int stockCountToInt = Integer.parseInt(userData[1]);\n stock.setStockCount(stockCountToInt);\n float priceToFloat = Float.parseFloat(userData[2]);\n stock.setPrice(priceToFloat);\n stock.setBarcode(userData[3]);\n\n stocks.add(stock);\n }\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }", "protected void loadDriver() {\n try {\n Class.forName(\"org.relique.jdbc.csv.CsvDriver\");\n this.setConnection(DriverManager.getConnection(\"jdbc:relique:csv:\" + this.getDirectory()));\n this.setStatement(this.getConnection().createStatement());\n } catch (ClassNotFoundException ex) {\n ex.printStackTrace(System.out);\n System.exit(1);\n } catch (SQLException ex) {\n ex.printStackTrace(System.out);\n System.exit(1);\n }\n }", "public RegistroCsv(String rutaArchivo) throws IOException {\n super(rutaArchivo);\n }", "public static HashMap<String, Investor> readInvestorInfoFile(String fileName)\n\t\t\tthrows InvalidFileFormatException, IOException {\n\t\tFile csvFile = new File(fileName);\n\t\t// read the file only if it exists\n\t\tif (csvFile.isFile()) {\n\t\t\t// the row in the csv file\n\t\t\tString row = null;\n\t\t\tint indexRow = 0;\n\t\t\t// create BufferedReader and read data from csv\n\t\t\tBufferedReader csvReader = new BufferedReader(new FileReader(fileName));\n\t\t\ttry {\n\t\t\t\t// read the rest of the lines\n\t\t\t\tHashMap<String, Investor> tableInvestorInfo = new HashMap<String, Investor>();\n\t\t\t\twhile ((row = csvReader.readLine()) != null) {\n\t\t\t\t\tString[] data = row.split(\",\");\n\n\t\t\t\t\t// check the header at the first line (header)\n\t\t\t\t\tif (indexRow == 0) {\n\t\t\t\t\t\t// check if the column names\n\t\t\t\t\t\tif (!(data[0].equals(\"name\") && data[1].equals(\"targetRatio\"))) {\n\t\t\t\t\t\t\tthrow new InvalidFileFormatException(\n\t\t\t\t\t\t\t\t\t\"The column names of the file is invalid.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tindexRow++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// for the rest of the rows\n\t\t\t\t\t// - create the transaction node for each row\n\t\t\t\t\tString name = data[0];\n\t\t\t\t\tdouble targetRatio = Double.valueOf(data[1]);\n\n\t\t\t\t\t// add the row data to the hash table\n\t\t\t\t\tInvestor investorInfo = new Investor(name, targetRatio);\n\t\t\t\t\ttableInvestorInfo.put(name, investorInfo);\n\t\t\t\t\tindexRow++;\n\t\t\t\t}\n\t\t\t\t// return the table\n\t\t\t\treturn tableInvestorInfo;\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\tthrow new IOException(\"IO Exception occured while reading the file at line \"\n\t\t\t\t\t\t+ String.valueOf(indexRow) + \" in: \" + fileName);\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t\tthrow new InvalidFileFormatException(\n\t\t\t\t\t\t\"The format of the file at line \" + String.valueOf(indexRow)\n\t\t\t\t\t\t\t\t+ \" is invalid,i.e.,\" + row + \" in: \" + fileName);\n\t\t\t} finally {\n\t\t\t\t// close the reader\n\t\t\t\tcsvReader.close();\n\t\t\t}\n\t\t} else\n\n\t\t{\n\t\t\tthrow new FileNotFoundException(\n\t\t\t\t\t\"The file you attempted to read does not exist or is not a valid file: \"\n\t\t\t\t\t\t\t+ fileName);\n\t\t}\n\t}", "public void readToCsv() {\r\n\r\n String seperator = \";\";\r\n\r\n try (BufferedReader reader = new BufferedReader(\r\n new FileReader(\"Products.csv\"))){\r\n\r\n String line = null;\r\n for(int i=1; (line = reader.readLine()) != null; i++) {\r\n String[] fields = line.split(seperator, -1);\r\n\r\n // For nutrients objects to read\r\n if(fields.length ==5){\r\n Nutrient object= new Nutrient();\r\n object.name = fields[0];\r\n object.price = Double.parseDouble(fields[1]);\r\n object.tag=fields[2];\r\n object.content = fields[3];\r\n object.numOfProduct = Integer.parseInt(fields[4]);\r\n //object.addFeatures(object.name,object.price,object.size,object.gender,object.tag,object.content,object.numOfProduct);\r\n NutrientList.add(object);\r\n allProducts.add(object);\r\n }\r\n // For Cosmetics objects to read\r\n if (fields.length==6){\r\n Cosmetics object2=new Cosmetics();\r\n object2.name = fields[0];\r\n object2.price = Double.parseDouble(fields[1]);\r\n object2.gender = fields[2];\r\n object2.tag=fields[3];\r\n object2.content = fields[4];\r\n object2.numOfProduct = Integer.parseInt(fields[5]);\r\n //object2.addFeatures(object2.name,object2.price,object2.size,object2.gender,object2.tag,object2.content,object2.numOfProduct);\r\n CosmeticsList.add(object2);\r\n allProducts.add(object2);\r\n }\r\n // For clothes objects to read\r\n if(fields.length ==7){\r\n\r\n Clothes object3=new Clothes();\r\n object3.name = fields[0];\r\n object3.price = Double.parseDouble(fields[1]);\r\n object3.size= fields[2];\r\n object3.tag=fields[4];\r\n object3.content = fields[5];\r\n object3.numOfProduct = Integer.parseInt(fields[6]);\r\n object3.addFeatures(object3.name,object3.price,object3.size,\"E\",object3.tag,object3.content,object3.numOfProduct);\r\n ClothesList.add(object3);\r\n allProducts.add(object3);\r\n }\r\n\r\n }}\r\n catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }", "public void loadActivitiesFromCsv(UserTrees tree, LocalDateTime timePeriodBegin, LocalDateTime timePeriodEnd) {\n\t\t\n\t\tActivity atividade;\n\t\tNode<Object> userNode, timeNode, pcNode;\n\t\tString csvLine = getNextLine();\n\t\t/*Verifies if the line is a header. ignores it if that's the case*/\n\t\tPattern p = Pattern.compile(\"/id|date|user|pc|activity/i\");\n\t\tMatcher m = p.matcher( csvLine );\n\t\tif(!m.find()) {\n\t\t\tatividade = (Activity) stringsToClass( parseCsvLine( csvLine ) );\n\t\t\t\n\t\t\tuserNode = tree.getUserNode( atividade.getUserIdentifier() );\n\t\t\ttimeNode = userNode.getChild(0);\n\t\t\tpcNode = loadPcIntoTime(timeNode, atividade.getPc());\n\t\t\tloadActivityIntoPc(pcNode, atividade);\t\n\t\t\tif(atividade.getDate().isAfter(timePeriodBegin) && atividade.getDate().isBefore(timePeriodEnd))\n\t\t\t{\n\t\t\t\ttimeNode = userNode.getChild(1);\n\t\t\t\tpcNode = loadPcIntoTime(timeNode, atividade.getPc());\n\t\t\t\tloadActivityIntoPc(pcNode, atividade);\n\t\t\t}\n\t\t}\n\t\tcsvLine = getNextLine();\n\t\twhile(csvLine != null)\n\t\t{\n\t\t\tatividade = (Activity) stringsToClass( parseCsvLine( csvLine ) );\n\t\t\tif(atividade==null)\n\t\t\t{\n\t\t\t\tcsvLine = getNextLine();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tuserNode = tree.getUserNode( atividade.getUserIdentifier() );\n\t\t\tif(userNode == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttimeNode = userNode.getChild(0);\n\t\t\tpcNode = loadPcIntoTime(timeNode, atividade.getPc());\n\t\t\tloadActivityIntoPc(pcNode, atividade);\t\n\t\t\tif(timePeriodBegin == null || timePeriodEnd == null) \n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(atividade.getDate().isAfter(timePeriodBegin) && atividade.getDate().isBefore(timePeriodEnd))\n\t\t\t{\n\t\t\t\ttimeNode = userNode.getChild(1);\n\t\t\t\tpcNode = loadPcIntoTime(timeNode, atividade.getPc());\n\t\t\t\tloadActivityIntoPc(pcNode, atividade);\n\t\t\t}\n\t\t\tcsvLine = getNextLine();\n\t\t}\n\t\t\n\t}", "public void readFile() \n\t{\n\t\tArrayList<String> tempStations = new ArrayList<>();\n\t\t//create arraylist local variable tempStations which will hold the list of stations temporarily for a specific line to be added to the stations hashmap \n\n\t\tString mtrSystemFile = \"MTRsystem_partial.csv\";\n\t\t//store the csv file name in a string\n\t\tFile file = new File(mtrSystemFile);\n\t\t//create a file object for the MTRSystems csv file\n\n\t\ttry \n\t\t{\n\t\t\tScanner inputStream = new Scanner(file);\n\t\t\t//pass the file through to new scanner object to be scanned\n\n\t\t\twhile (inputStream.hasNext())\n\t\t\t//so long as the scanner object has another token to read from the csv file\n\t\t\t{\n\t\t\t\tString line = inputStream.nextLine();\n\t\t\t\t//store the next line in the string variable\n\t\t\t\tcells = line.split(\",\");\n\t\t\t\t//split each line into cells separated by a comma\n\t\t\t\tint celli = 1;\n\t\t\t\t//assign int index to 1, so that only stations are read excluding line name stored at position 0\n\n\t\t\t\twhile (celli <= cells.length - 1)\n\t\t\t\t//whilst the index is less than or equal the last position of the array\n\t\t\t\t{\n\t\t\t\t\tif (celli == 1 || celli == cells.length - 1)\n\t\t\t\t\t//if the index is at the second position in the array or at the last\n\t\t\t\t\t{\n\t\t\t\t\t\tallTermini.add((cells[celli]));\n\t\t\t\t\t\t//add termini to the ArrayList\n\t\t\t\t\t}\n\t\t\t\t\ttempStations.add(cells[celli]);\n\t\t\t\t\t//add station to the ArrayList\n\t\t\t\t\tcelli++;\n\t\t\t\t}\n\n\t\t\t\taddToStations(cells[0], tempStations);\n\t\t\t\t//add the line name and the list of stations for that line to the hashmap\n\t\t\t\ttempStations.clear();\n\t\t\t\t//Clear the temporary list for the next line\n\n\t\t\t\tcells = null;\n\t\t\t}\n\t\t\tinputStream.close();\n\t\t} catch (FileNotFoundException e) \n\t\t{\n\t\t\tSystem.out.println(\"file not found\");\n\t\t}\n\t}", "public HashMap<Node, int[]> importCsv(String name) throws Exception {\n\t\t\n\t\tString path = \"./\" + name + \".csv\";\n\t\tCsvReader reader = new CsvReader(path, ';');\n\t\t\n\t\tboolean end = false;\n\t\tString[] headers;\n\t\tGraph graph = null;\n\t\tHashMap<Node, int[]> nodeDraws = new HashMap<Node, int[]>();\n\t\twhile(!end) {\n\t\t\treader.readHeaders();\n\t\t\theaders = reader.getHeaders();\n\t\t\tif(headers[0].equals(\"Graph\")) {\n\t\t\t\treader.readRecord();\n\t\t\t\tgraph = new Graph(reader.get(\"Graph\"));\n\t\t\t\tManagerMatlab.getInstance().createGraph(reader.get(\"Graph\"));\n\t\t\t\treader.skipRecord();\n\t\t\t} else if(headers[0].equals(\"Nodes\")) {\n\t\t\t\treader.readHeaders();\n\t\t\t\twhile(reader.readRecord() && reader.getColumnCount() > 1 && !reader.get(\"ID\").equals(\"\")) {\n\t\t\t\t\t//Possible problem with the encoding, so we replace  if we find it\n\t\t\t\t\tString nom = reader.get(\"Name\").replace(\"Â\", \"\");\n\t\t\t\t\tNode node = new Node(Integer.valueOf(reader.get(\"ID\")),nom);\n\t\t\t\t\tgraph.addNode(node);\n\t\t\t\t\tnodeDraws.put(node, new int[]{Integer.valueOf(reader.get(\"X\")),Integer.valueOf(reader.get(\"Y\"))});\n\t\t\t\t}\n\t\t\t }else if(headers[0].equals(\"Arcs\")) {\n\t\t\t\treader.readHeaders();\n\t\t\t\twhile(reader.readRecord() && reader.getColumnCount() > 1) {\n\t\t\t\t\tArc arc = new Arc(Integer.valueOf(reader.get(\"ID\")),\n\t\t\t\t\t\t\tgraph.getNode(Integer.valueOf(reader.get(\"headId\"))),graph.getNode(Integer.valueOf(reader.get(\"tailId\"))),\n\t\t\t\t\t\t\tBoolean.valueOf(reader.get(\"directed\")),Integer.valueOf(reader.get(\"color\")));\n\t\t\t\t\tgraph.addArc(arc);\n\t\t\t\t}\n\t\t\t\tif (reader.readRecord() == false) {\n\t\t\t\t\tend = true;\n\t\t\t\t} else {\n\t\t\t\t\treader.readHeaders();\n\t\t\t\t\twhile(reader.readRecord() && reader.getColumnCount() > 1) {\n\t\t\t\t\t\tint ID = Integer.valueOf(reader.get(\"ID\"));\n\t\t\t\t\t\tColor color = new Color(Integer.valueOf(reader.get(\"red\")),\n\t\t\t\t\t\t\t\tInteger.valueOf(reader.get(\"green\")), \n\t\t\t\t\t\t\t\tInteger.valueOf(reader.get(\"blue\")));\n\t\t\t\t\t\tManagerGraph.getInstance().addColor(ID, color);\n\t\t\t\t\t}\n\t\t\t\t\tend = true;\n\t\t\t\t}\n\t\t\t }\n\t\t}\n\t\tManagerGraph.getInstance().setGraph(graph);\n\t\treturn nodeDraws;\n\t}" ]
[ "0.75656193", "0.73600054", "0.7358029", "0.7214138", "0.72002316", "0.69744414", "0.6970772", "0.69518507", "0.69271344", "0.6889002", "0.6872591", "0.6841827", "0.68295765", "0.68084216", "0.6805594", "0.68037176", "0.67529887", "0.67489254", "0.67480445", "0.67173105", "0.67116266", "0.6682464", "0.66706264", "0.6636672", "0.66265273", "0.6592924", "0.65910375", "0.6579187", "0.65579575", "0.65186495", "0.6513315", "0.64812005", "0.64631784", "0.64446783", "0.64427125", "0.6415448", "0.63814116", "0.6377899", "0.63715655", "0.6348049", "0.6345498", "0.634046", "0.6339205", "0.63376015", "0.63341284", "0.63325155", "0.63249385", "0.6311529", "0.6304903", "0.630337", "0.62987244", "0.62923616", "0.6288883", "0.6280158", "0.6278605", "0.6232551", "0.62127894", "0.62091637", "0.6204731", "0.6203543", "0.6172504", "0.6169764", "0.61679685", "0.6161764", "0.61432445", "0.6143241", "0.6110774", "0.60980624", "0.60889715", "0.6065078", "0.6064915", "0.6064639", "0.60644084", "0.60629475", "0.6057322", "0.6052642", "0.6049417", "0.6036517", "0.60350376", "0.603221", "0.60274994", "0.6019352", "0.60145855", "0.60108715", "0.6010059", "0.5996968", "0.5992118", "0.5972", "0.5963875", "0.5951744", "0.5947374", "0.5945283", "0.59423894", "0.5937598", "0.59324306", "0.59219533", "0.59126246", "0.59094405", "0.5899885", "0.58981067" ]
0.73251027
3
checks whether a node should be registered in this module
abstract protected boolean shouldRegister(NodeDescriptor node) throws NodeException;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean hasHasNodeID();", "boolean hasNode();", "boolean hasNode();", "boolean hasHasNodeSettings();", "boolean hasNodeId();", "@java.lang.Override\n public boolean hasNode() {\n return node_ != null;\n }", "@java.lang.Override\n public boolean hasNode() {\n return node_ != null;\n }", "boolean hasIsNodeOf();", "public boolean hasNode(Node p_node) {\n\t\treturn nodes.contains(p_node);\n\t}", "public boolean isNode() {\n return (kids != null);\n }", "public boolean hasNode() {\n return nodeBuilder_ != null || node_ != null;\n }", "public boolean hasNode() {\n return nodeBuilder_ != null || node_ != null;\n }", "boolean hasRegistry();", "boolean hasNode()\n/* */ {\n/* 473 */ if ((this.bn == null) && (this.mn == null)) return false;\n/* 474 */ if (this.jt == null) return false;\n/* 475 */ 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 canRegister() {\n return true;\n }", "public boolean isApplicableForNode(AbstractNode node);", "public boolean check(XsdNode node) {\n\t\treturn true;\n\t}", "boolean hasNodeCharacteristicId();", "boolean hasNodeCharacteristicId();", "protected boolean hasNode(int ID) {\n\t\treturn nodes.containsKey(ID);\n\t}", "public abstract boolean isUsing(Long graphNode);", "public Boolean node_exists (NodeWS node) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tQuery i = null;\r\n\t\t\t\t\t\r\n\t\t\t\t\tiniciaOperacion();\r\n\t\t\t\t\ti = sesion.createQuery(\"SELECT u.id_node FROM Node u WHERE u.node_name = :seu\"); \r\n\t\t\t\t i.setString(\"seu\", node.getNode_name());\r\n\t\t\t\t \r\n\t\t\t\t return (i.uniqueResult() != null);\r\n\t\t\t\t}", "public boolean hasRegistry() {\n return registryBuilder_ != null || registry_ != null;\n }", "public boolean hasRegistry() {\n return registry_ != null;\n }", "@Override\n\t\tpublic boolean addCheckNodeObject(Node node, IRdfModel rdfModelObject) {\n\t\t\treturn false;\n\t\t}", "private boolean nodeRequiresInput() {\n boolean requiresInput = false;\n \n return requiresInput;\n }", "boolean hasIsCentralNode();", "boolean hasRegistrationRequest();", "public static boolean register() {\n try {\n buildSocket();\n ClientService.sendMessageToServer(connectionToServer, ClientService.requestRegistration());\n ClientService.receiveMessageFromServer(connectionToServer);\n closeSocket();\n } catch (Exception e) {\n e.printStackTrace();\n }\n return !ClientService.getLastMessageFromServer().contains(XML_Manager.XML_NODES.Error.toString());\n }", "public boolean containsContextNodes();", "public boolean registerNode(Node node, OutputStream out, boolean isRequestedRegistration) throws IOException;", "public boolean addNode(NodeType node) {\n\t\treturn false;\n\t}", "public boolean isRealNode();", "public boolean isRealNode();", "public boolean isRegistrationRequiredForCalling()\n {\n return true;\n }", "void can_register_valid_racer() {\n }", "@Override\n\tpublic boolean containsNode(Object node)\n\t{\n\t\t// This is presumably faster than searching through nodeList\n\t\treturn nodeEdgeMap.containsKey(node);\n\t}", "boolean usedByNode(Long id);", "interface ExternalModuleChecker {\n\t/**\n\t * To check is external-module registered well\n\t *\n\t * @param module module to check\n\t * @return true if registered well\n\t */\n\tboolean isValidModule(ExternalModule module);\n}", "public void isNodePresent(Class clazz) {\n if (getNode(clazz) == null) {\n throw new ServiceIsNotInObjectGraphException();\n }\n }", "@Override\n public boolean isMissingNode() { return false; }", "@Override\n public boolean containsNodeFor(E item) {\n if(item == null){\n throw new NullPointerException(\"Received null as value.\");\n }\n return graphNodes.containsKey(item);\n }", "public void checkNodes() {\n // Don't do anything when you check the nodes. This nodes is built by\n // when the setTarget method is called.\n }", "boolean hasResource();", "public boolean registered(String place) {\n return hotels != null && hotels.size() > 0;\n }", "boolean hasHost();", "boolean hasHost();", "public boolean canRun(NodeType type) {\n return childNodeTypes.contains(type);\n }", "private boolean isWanted(Node n) {\n if (use_All) {\n return true;\n }\n String name = n.getNodeName();\n for (int ix = 0; ix < remove_tags.length; ix++) {\n if (name.compareTo(remove_tags[ix]) == 0) {\n return false;\n }\n }\n for (int ix = 0; ix < add_tags.length; ix++) {\n if (name.compareTo(add_tags[ix]) == 0) {\n return true;\n }\n }\n return false;\n }", "public boolean isThereFreeRegenAt(TranslucentCircuit circuit, Node nodeX){\n\t\tint numberRegeneratorsRequired = nodeX.getRegenerators().getAmountOfRequiredRegenerators(circuit);\n\t\t\n\t\tif(nodeX.getRegenerators().canRegenerate(numberRegeneratorsRequired)){ // Check if you can regenerate\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "boolean hasInstance();", "@java.lang.Override\n public boolean hasRegistrationRequest() {\n return registrationRequest_ != null;\n }", "@Override\r\n\tpublic boolean nodeExists(String absPath) throws RepositoryException {\n\t\treturn false;\r\n\t}", "@Override\r\n\tpublic boolean isNodeValid() {\n\t\treturn (SKILLS.HITPOINTS.getActualLevel() >= 25\r\n\t\t\t\t&& SKILLS.THIEVING.getActualLevel() >= 28\r\n\t\t\t\t&& Inventory.getCount(\"Coins\") >= 30 && (Location.karamjaFirstStepCheck.atLocation(Player.getPosition()) ||Location.karamjaBoatLandTile.equals(Player.getPosition()) ));\r\n\t}", "@objid (\"808c0830-1dec-11e2-8cad-001ec947c8cc\")\n @SuppressWarnings (\"static-method\")\n public boolean canContain(Class<? extends GmNodeModel> nodeClass) {\n return true;\n }", "public abstract boolean isNetbeansKenaiRegistered();", "boolean isBlacklisted(DependencyNodeFunction function);", "public boolean hasNodeCharacteristicId() {\n return nodeCharacteristicId_ != null;\n }", "public boolean hasNodeCharacteristicId() {\n return nodeCharacteristicId_ != null;\n }", "public boolean hasTopLevelNode(IAstTopLevelNode node);", "public IStatus canAddModule(IModule module);", "boolean hasResourceType();", "public boolean isContainNode(ServentInfo a){\n\t\tfor(int i = 0;i<serventList.size();i++){\n\t\t\tServentInfo b = serventList.get(i);\n\t\t\tif(b.IP.equals(a.IP) && b.port == a.port){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "@Override\n public boolean containsNode(Node testedNode) {\n for (int i = 0; i < this.nodes.size(); i++) {\n if (nodes.get(i).getName().equals(testedNode.getName())) {\n return true;\n }\n }\n\n return false;\n }", "public boolean hasRegistrationRequest() {\n return registrationRequestBuilder_ != null || registrationRequest_ != null;\n }", "public boolean registerNode(Node node, String remoteHost, String remoteAddress, OutputStream out, boolean isRequestedRegistration) throws IOException;", "boolean hasUsage();", "private boolean validDevice(AcceleratorNode nodeDev) {\n// for (Class<?> typeValidDev : this.arrValidDevTypes) {\n// if (nodeDev.getClass() == typeValidDev)\n// return true;\n// }\n// \n// return false;\n \n return true;\n }", "boolean hasProvider();", "public boolean containsNode(Node n);", "public boolean hasNodeCharacteristicId() {\n return nodeCharacteristicIdBuilder_ != null || nodeCharacteristicId_ != null;\n }", "public boolean hasNodeCharacteristicId() {\n return nodeCharacteristicIdBuilder_ != null || nodeCharacteristicId_ != null;\n }", "boolean hasEndpoint();", "boolean hasDevice();", "public static boolean isValidNode(Node node) {\r\n\t\tif (node == null ||\r\n\t\t\t\tnode.getCreatedByPrincipalId() == null ||\r\n\t\t\t\tnode.getCreatedOn() == null ||\r\n\t\t\t\tnode.getETag() == null ||\r\n\t\t\t\tnode.getId() == null ||\r\n\t\t\t\tnode.getModifiedByPrincipalId() == null ||\r\n\t\t\t\tnode.getModifiedOn() == null ||\r\n\t\t\t\tnode.getName() == null ||\r\n\t\t\t\tnode.getNodeType() == null) \r\n\t\t\treturn false;\r\n\t\treturn true;\r\n\t}", "private static void checkNode(Node node){\n if(node != null){\n if(node.getSnames() == null || node.getSnames().isEmpty()){\n if(node.getName() != null){\n node.addSearchName(node.getName());\n }\n }\n }\n }", "public boolean isNodePresent(int nd) {\n if ((nd >= (int) nodeVector.size() || (nodeVector.get(nd).getIndex() == invalid_node_index))) {\n return false;\n } else {\n return true;\n }\n }", "static synchronized boolean isRegistered(Tool tool) {\n\t\treturn getTool(tool.getItem()) != null;\n\t}", "public static boolean hasModule() {\n\t\ttry {\n\t\t\tPackageManager packageManager = AppMain.getContext().getPackageManager();\n\t\t\tIntent intent = new Intent(\"android.settings.USAGE_ACCESS_SETTINGS\");\n\t\t\tList<ResolveInfo> list = packageManager.queryIntentActivities(intent,\n\t\t\t\tPackageManager.MATCH_DEFAULT_ONLY);\n\t\t\treturn list.size() > 0;\n\t\t} catch (RuntimeException e) {\n\t\t\t// 在某个三星的设备上出现过安全异常\n\t\t\t// 在某个ZTE的设备上出现过RuntimeException\n\t\t\treturn false;\n\t\t}\n\t}", "public Boolean isRootNode();", "void ensureNode(int nodeId);", "public boolean visit(SchemaBase node) {\n return true;\n }", "private boolean checkAction() {\n if (nodes == null || nodes.length > 1) {\r\n return false;\r\n }\r\n // Emptry node name\r\n if (jtfChildName.getText().isEmpty()) {\r\n JOptionPane.showMessageDialog(JZVNode.this,\r\n bundle.getString(\"dlg.error.addWithoutName\"),\r\n bundle.getString(\"dlg.error.title\"),\r\n JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n // No parent\r\n if (nodes == null || nodes.length != 1) {\r\n JOptionPane.showMessageDialog(JZVNode.this,\r\n bundle.getString(\"dlg.error.addWithoutParent\"),\r\n bundle.getString(\"dlg.error.title\"),\r\n JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n return true;\r\n }", "public boolean provideGraphInfo() { return node_size == NodeSize.GRAPHINFO; }", "public static boolean isThisClassRegistered(String classname){\n dbgLog.fine(\"********** within isThisClassRegistered **********\");\n dbgLog.fine(\"classname to be checked=\"+classname);\n Object singleton = map.get(classname);\n if (singleton != null){\n return true;\n } else {\n return false;\n }\n }", "protected boolean isExtendedNode(Node node) {\r\n\r\n String nodeName = node.getNodeName();\r\n\r\n if (nodeName.equalsIgnoreCase(ExtendedXmlParser.INSERT_AFTER_OP)\r\n || nodeName.equalsIgnoreCase(ExtendedXmlParser.INSERT_BEFORE_OP)\r\n || nodeName.equalsIgnoreCase(ExtendedXmlParser.REMOVE_OP)\r\n || nodeName.equalsIgnoreCase(ExtendedXmlParser.REPLACE_OP)\r\n || nodeName.equalsIgnoreCase(ExtendedXmlParser.MODIFY_FORM)\r\n || nodeName.equalsIgnoreCase(ExtendedXmlParser.MODIFY_ATTRIBUTE)\r\n || nodeName.equalsIgnoreCase(ExtendedXmlParser.ADD_REMOTE_REFERENCE)\r\n || nodeName.equalsIgnoreCase(ExtendedXmlParser.REMOVE_REMOTE_REFERENCE)\r\n || nodeName.equalsIgnoreCase(ExtendedXmlParser.MODIFY_REMOTE_REFERENCE)) {\r\n return true;\r\n }\r\n return false;\r\n }", "public boolean isTaskNode()\n\t{\n\t\treturn isTaskNode;\n\t}", "@Override\r\n\tpublic boolean hasChildren() {\n\t\tif (taskNodeList != null)\r\n\t\t\treturn true;\r\n\t\telse\r\n\t\t\treturn false;\r\n\t}", "boolean hasSer();", "protected boolean checkNodeWithoutAttributes(Node node) {\r\n String nodeName = node.getNodeName();\r\n\r\n if (nodeName.equalsIgnoreCase(ExtendedXmlParser.MODIFY_FORM)\r\n || nodeName.equalsIgnoreCase(ExtendedXmlParser.ADD_REMOTE_REFERENCE)) {\r\n return true;\r\n }\r\n return false;\r\n }", "public boolean addNode(DAGNode node) {\r\n\t\treturn true;\r\n\t}", "public boolean processMegaNode(MegaNode node) {\n if (listener != null)\n return listener.processMegaNode(megaApi, node);\n return false;\n }", "public boolean hasCustom();", "boolean isUsed();", "boolean isUsed();", "public boolean hasTreeNodeId() {\n return treeNodeId_ != null;\n }", "boolean hasUses();", "boolean hasChildren();", "private boolean shardExistsInNode(final NodeGatewayStartedShards response) {\n return response.storeException() != null || response.allocationId() != null;\n }" ]
[ "0.7150315", "0.7088101", "0.7088101", "0.69257534", "0.6880956", "0.6832998", "0.6832998", "0.679004", "0.6457533", "0.6445277", "0.6444557", "0.6444557", "0.6362658", "0.624399", "0.6230782", "0.6218303", "0.6207814", "0.6168666", "0.61473656", "0.61473656", "0.611968", "0.61088765", "0.60984755", "0.60945594", "0.6093482", "0.6093233", "0.6065359", "0.6004993", "0.5991232", "0.597426", "0.59642774", "0.5961013", "0.5953386", "0.5948463", "0.5948463", "0.59323466", "0.5870023", "0.58650994", "0.5853382", "0.5851593", "0.5843579", "0.5824762", "0.5811428", "0.580773", "0.5805193", "0.5802808", "0.578691", "0.578691", "0.57832056", "0.5771747", "0.57681763", "0.57658625", "0.5765571", "0.57528555", "0.57461727", "0.5742536", "0.57220644", "0.5707917", "0.57042396", "0.57042396", "0.5704083", "0.5701324", "0.5670342", "0.56634825", "0.5661354", "0.5655801", "0.5649361", "0.5645822", "0.5644918", "0.5643264", "0.56359476", "0.56322825", "0.56322825", "0.56315696", "0.5625021", "0.5614862", "0.5611743", "0.5599075", "0.5593377", "0.55914795", "0.55834836", "0.5560929", "0.5556963", "0.5556942", "0.55443096", "0.553289", "0.552814", "0.5521911", "0.551973", "0.5512932", "0.5506547", "0.55050206", "0.55024534", "0.5500401", "0.5492956", "0.5492956", "0.54926986", "0.54848343", "0.54845387", "0.5472895" ]
0.799644
0
Create a module node from a NodeDescriptor. Nodes that should be registered are registered using the ModuleNodeDescriptor returned by this method
abstract protected T createModuleNode(NodeDescriptor node);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected T registerNode(NodeDescriptor node) {\n\t\tT moduleNode = createModuleNode(node);\n \tsynchronized (nodes) {\n \t\tnodes.add(moduleNode);\n \t\tnodesMap.put(node, moduleNode);\n \t}\n\t\treturn moduleNode;\n\t}", "Module createModule();", "private static Module createEditedModule(Module moduleToEdit,\n EditModuleCommand.EditModuleDescriptor editModuleDescriptor) {\n assert moduleToEdit != null;\n\n ModuleName updatedName = editModuleDescriptor.getModuleName();\n\n UniqueStudentList studentList = moduleToEdit.getUniqueStudentList();\n UniqueTaskList taskList = moduleToEdit.getTaskList();\n\n return new Module(updatedName, studentList, taskList);\n }", "ModuleDefinition createModuleDefinition();", "public static ModuleDef createSyntheticModule(TreeLogger logger,\n String moduleName, String[] inherits, boolean refresh)\n throws UnableToCompleteException {\n ModuleDef moduleDef = tryGetLoadedModule(logger, moduleName, refresh);\n if (moduleDef != null) {\n return moduleDef;\n }\n ModuleDefLoader loader = new ModuleDefLoader(inherits);\n ModuleDef module = loader.doLoadModule(logger, moduleName);\n /*\n * Must reset name override on synthetic modules. Otherwise they'll be\n * incorrectly affected by the last inherits tag, because they have no XML\n * which would reset the name at the end of parse.\n */\n module.setNameOverride(null);\n return module;\n }", "public Module createModule(String bundleName, String moduleTypeName) {\n Bundle bundle = getBundle(bundleName);\n if (bundle == null) {\n return null;\n }\n //System.err.println(\"creating \"+bundleName+\":\"+moduleTypeName);\n CModule newModule = createCModule(bundleName, moduleTypeName);\n //System.err.println(\"done\");\n return newModule;\n }", "public ModuleDescriptor createModuleDescriptor() { This is a blatant hack: we use an organisation that is highly\n // unlikely to conflict with the project's dependencies. The\n // truth is, the dependency manager doesn't really care what the\n // organisation is. See:\n //\n // http://jira.codehaus.org/browse/GRAILS-6270\n //\n DefaultModuleDescriptor moduleDescriptor =\n DefaultModuleDescriptor.newDefaultInstance(ModuleRevisionId.newInstance(\"org.grails.internal\", applicationName, applicationVersion));\n\n // TODO: make configurations extensible\n moduleDescriptor.addConfiguration(BUILD_CONFIGURATION);\n moduleDescriptor.addConfiguration(COMPILE_CONFIGURATION);\n moduleDescriptor.addConfiguration(RUNTIME_CONFIGURATION);\n moduleDescriptor.addConfiguration(TEST_CONFIGURATION);\n moduleDescriptor.addConfiguration(PROVIDED_CONFIGURATION);\n moduleDescriptor.addConfiguration(DOCS_CONFIGURATION);\n return moduleDescriptor;\n }", "TNode createTNode();", "public Project(ModuleDescriptor descriptor) {\n this.descriptor = descriptor;\n }", "public ProgramModule createRootModule(String treeName) throws DuplicateNameException;", "private Module createModule() throws Exception\n {\n Map headerMap = m_archive.getCurrentRevision().getManifestHeader();\n\n // Create the module instance.\n ModuleImpl module = new ModuleImpl(\n getFramework().getLogger(),\n getFramework().getConfig(),\n getFramework().getResolver(),\n this,\n Long.toString(getBundleId())\n + \".\" + m_archive.getCurrentRevisionNumber().toString(),\n headerMap,\n m_archive.getCurrentRevision().getContent(),\n getFramework().getBundleStreamHandler(),\n getFramework().getBootPackages(),\n getFramework().getBootPackageWildcards());\n\n // Verify that the bundle symbolic name + version is unique.\n if (module.getManifestVersion().equals(\"2\"))\n {\n Version bundleVersion = module.getVersion();\n bundleVersion = (bundleVersion == null) ? Version.emptyVersion : bundleVersion;\n String symName = module.getSymbolicName();\n\n Bundle[] bundles = getFramework().getBundles();\n for (int i = 0; (bundles != null) && (i < bundles.length); i++)\n {\n long id = ((BundleImpl) bundles[i]).getBundleId();\n if (id != getBundleId())\n {\n String sym = bundles[i].getSymbolicName();\n Version ver = ((ModuleImpl)\n ((BundleImpl) bundles[i]).getCurrentModule()).getVersion();\n if ((symName != null) && (sym != null) && symName.equals(sym) && bundleVersion.equals(ver))\n {\n throw new BundleException(\n \"Bundle symbolic name and version are not unique: \"\n + sym + ':' + ver, BundleException.DUPLICATE_BUNDLE_ERROR);\n }\n }\n }\n }\n\n return module;\n }", "OFPortMod createPortMod(DatapathId dpid, OFPort port, OFPortConfig config, boolean enable) throws PortModException;", "public Node(Node cloneNode) {\n\t\tthis.name = cloneNode.getName();\n\t\tthis.type = cloneNode.getType();\n\t\tthis.setX(cloneNode.getX());\n\t\tthis.setY(cloneNode.getY());\n\t\tthis.position = new Vector2(cloneNode.getPosition());\n\t}", "public static void decodeNodeDescriptor(ChannelBuffer buffer, BgpLsNodeDescriptor nd) {\n\n\t\twhile(buffer.readable()) {\n\t\t\tint subType = buffer.readUnsignedShort();\n\t\t\tint valueLength = buffer.readUnsignedShort();\n\t\t\t\n\t\t\tChannelBuffer valueBuffer = ChannelBuffers.buffer(valueLength);\n\t\t\tbuffer.readBytes(valueBuffer);\n\t\t\t\n\t\t\tswitch(BgpLsType.fromCode(subType)) {\n\t\t\tcase AutonomousSystem:\n\t\t\t\tdecodeAutonomousSystem(valueBuffer, nd);\n\t\t\t\tbreak;\n\t\t\tcase BGPLSIdentifier:\n\t\t\t\tdecodeBgpLsIdentifier(valueBuffer, nd);\n\t\t\t\tbreak;\n\t\t\tcase AreaID:\n\t\t\t\tdecodeOspfAreaId(valueBuffer, nd);\n\t\t\t\tbreak;\n\t\t\tcase IGPRouterID:\n\t\t\t\tdecodeIgpRouterId(valueBuffer, nd);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tlog.error(\"Unsupported descriptor type \" + subType);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "ModulePackage createModulePackage();", "ModularizationElement createModularizationElement();", "Builder(String name) {\n var synthetic = Set.of(ModuleDescriptor.Modifier.SYNTHETIC);\n this.descriptor = ModuleDescriptor.newModule(name, synthetic);\n }", "void createNode(String path);", "public void create(NetworkNode networkNode);", "ModuleDefine createModuleDefine();", "public Node createNode(String p_name) {\n\t\tNode n = new Node(p_name, this);\n\t\taddNode(n);\n\t\treturn n;\n\t}", "protected SceneGraphObject createNode( String className ) {\n\tSceneGraphObject ret;\n\n\ttry {\n Class state = Class.forName( className, true, control.getClassLoader() );\n\n\t ret = createNode( state );\n\n\t //System.err.println(\"Created J3D node for \"+className );\n\t} catch(ClassNotFoundException e) {\n if (control.useSuperClassIfNoChildClass())\n ret = createNodeFromSuper( className );\n else\n throw new SGIORuntimeException( \"No Such Class \"+\n\t\t\t\t\t\tclassName );\n\t}\n\n\treturn ret;\n }", "private Module createModule(String moduleId, String ownerId, String copyId) throws NoFactoryForModuleException{\n\t\tIModuleFactory factory = factories.get(moduleId);\n\t\tif (factory==null){\n\t\t\tthrow new NoFactoryForModuleException(moduleId);\n\t\t}\n\t\treturn factory.createModule(ownerId, copyId);\n\t}", "void createNode(NodeKey key);", "private MockTopologyNode createMockNode(MockTopologyNode parent, String nodeName, String typeHint, long freq,\n long timestamp, Boolean isId, Boolean isReplace){\n final MockTopologyNode result = (MockTopologyNode) parent.createNode(nodeName);\n result.setTypeHint(typeHint);\n result.setReplace(isReplace);\n result.setIsIdentity(isId);\n result.setNodeFrequency(freq);\n result.setNodeTimestamp(timestamp);\n\n return result;\n}", "Future<OFPortMod> createPortModAsync(DatapathId dpid, OFPort port, OFPortConfig config, boolean enable);", "private BTNode createNode() {\n BTNode btNode;\n btNode = new <DataPair>BTNode ();\n btNode.mIsLeaf = true;\n btNode.mCurrentKeyNum = 0;\n return btNode;\n }", "OFPortMod createPortMod(DatapathId dpid, OFPort port, Map<OFPortConfig, Boolean> configs) throws PortModException;", "public static Node node(String primaryLabel, String... additionalLabels) {\n\n\t\treturn Node.create(primaryLabel, additionalLabels);\n\t}", "public RubyModule getOrCreateModule(String name) {\n IRubyObject module = objectClass.getConstantAt(name);\n if (module == null) {\n module = defineModule(name);\n } else if (getSafeLevel() >= 4) {\n throw newSecurityError(\"Extending module prohibited.\");\n } else if (!module.isModule()) {\n throw newTypeError(name + \" is not a Module\");\n }\n \n return (RubyModule) module;\n }", "ModuleRule createModuleRule();", "public Node<E> createNode(E e) {\n Node<E> nodeFromCache = getNodeFromCache();\n if (nodeFromCache == null) {\n return super.createNode(e);\n }\n nodeFromCache.setValue(e);\n return nodeFromCache;\n }", "IFMLModule createIFMLModule();", "public RubyModule defineModuleUnder(String name, RubyModule parent) {\n IRubyObject moduleObj = parent.getConstantAt(name);\n \n boolean parentIsObject = parent == objectClass;\n \n if (moduleObj != null ) {\n if (moduleObj.isModule()) return (RubyModule)moduleObj;\n \n if (parentIsObject) {\n throw newTypeError(moduleObj.getMetaClass().getName() + \" is not a module\");\n } else {\n throw newTypeError(parent.getName() + \"::\" + moduleObj.getMetaClass().getName() + \" is not a module\");\n }\n }\n \n return RubyModule.newModule(this, name, parent, !parentIsObject);\n }", "private void editPipelineDefChangeNodeModule(PipelineDefinition pipelineDef) {\n pipelineDef.getRootNodes()\n .get(0)\n .setPipelineModuleDefinition(expectedModuleDef3);\n }", "private Node createNode(EventPair ep, Color c, Node parent) {\n Node node = new Node();\n node.ID = ep.ID;\n node.count = ep.count;\n node.color = c;\n node.left = createNullLeaf(node);\n node.right = createNullLeaf(node);\n node.parent = parent;\n return node;\n }", "public PDGNode getPDGNode(Object cfgNode);", "void nodeCreate( long id );", "NodeReader addNode(VNFTypeReader type, String hostName) throws AllocationException, ServiceException;", "NodeLayout createNodeLayout();", "RegistrationModule createRegistrationModule();", "public static GraphNode createGraphNodeForSubsystem() {\n GraphNode nameNode = new GraphNode();\n\n for (int i = 0; i < 3; i++) {\n GraphNode childNode = new GraphNode();\n\n childNode.setPosition(AccuracyTestHelper.createPoint(0, 12 * i));\n childNode.setSize(AccuracyTestHelper.createDimension(100, 22));\n\n nameNode.addContained(childNode);\n }\n\n nameNode.setPosition(AccuracyTestHelper.createPoint(20, 20));\n nameNode.setSize(AccuracyTestHelper.createDimension(100, 100));\n\n GraphNode graphNode = new GraphNode();\n graphNode.addContained(nameNode);\n graphNode.addContained(new GraphNode());\n\n graphNode.setPosition(AccuracyTestHelper.createPoint(20, 20));\n graphNode.setSize(AccuracyTestHelper.createDimension(1000, 1000));\n\n // create a subsystem\n Subsystem subsystem = new SubsystemImpl();\n\n // set namespace\n Namespace namespace = new MockNamespaceImplAcucracy();\n subsystem.setNamespace(namespace);\n\n // create a semantic model\n Uml1SemanticModelBridge semanticModel = new Uml1SemanticModelBridge();\n semanticModel.setElement(subsystem);\n\n graphNode.setSemanticModel(semanticModel);\n\n return graphNode;\n }", "public Node makeNode(Document xmlDoc) {\r\n Element out = xmlDoc.createElement(this.parent.getHeader());\r\n this.parent.updateSave();\r\n if (this.nodeText != null) {\r\n out.setTextContent(nodeText);\r\n }\r\n this.makeAtributes(out);\r\n for (int i = 0; i < this.children.size(); i++) {\r\n out.appendChild(this.children.get(i).makeNode(xmlDoc));\r\n }\r\n return out;\r\n}", "public void createNodeUsingExistingClasses() {\n final PLayer layer = getCanvas().getLayer();\n layer.addChild(PPath.createEllipse(0, 0, 100, 100));\n layer.addChild(PPath.createRectangle(0, 100, 100, 100));\n layer.addChild(new PText(\"Hello World\"));\n\n // Here we create an image node that displays a thumbnail\n // image of the root node. Note that you can easily get a thumbnail\n // of any node by using PNode.toImage().\n final PImage image = new PImage(layer.toImage(300, 300, null));\n layer.addChild(image);\n }", "public ProgramModule getModule(String treeName, String name);", "public abstract GraphNode<N, E> createNode(N value);", "public RubyModule defineOrGetModuleUnder(String name) {\n // This method is intended only for defining new modules in Ruby code\n Ruby runtime = getRuntime();\n IRubyObject moduleObj = getConstantAt(name);\n RubyModule module;\n if (moduleObj != null) {\n if (!moduleObj.isModule()) throw runtime.newTypeError(name + \" is not a module\");\n if (runtime.getSafeLevel() >= 4) throw runtime.newSecurityError(\"extending module prohibited\");\n module = (RubyModule)moduleObj;\n } else if (classProviders != null && (module = searchProvidersForModule(name)) != null) {\n // reopen a java module\n } else {\n module = RubyModule.newModule(runtime, name, this, true); \n }\n return module;\n }", "private final void createAndAddNode(String name) {\n\t}", "public NetworkNode(Node treeNode) {\n height = treeNode.getHeight();\n label = treeNode.getID();\n metaDataString = treeNode.metaDataString;\n for (String metaDataKey: treeNode.getMetaDataNames()) {\n Object metaDataValue = treeNode.getMetaData(metaDataKey);\n metaData.put(metaDataKey, metaDataValue);\n }\n }", "abstract AbstractRuntimeServiceNode<T> newRuntimeNode();", "private Node addNode(String nodeName)\r\n\t{\r\n\t final Node n = new Node(nodeName, attributes, numNodes());\r\n\t if (nodeMap.put(nodeName, n) != null)\r\n\t\tthrow new RuntimeException(\"Node <\"+n+\"> already exists!\");\r\n\t return n;\r\n\t}", "protected ProjectCreationDescriptor() {\n\t}", "public Node registerPullOnlyNode(String externalId, String nodeGroupId, String databaseType, String databaseVersion) throws IOException;", "public INode addOrGetNode(String label);", "public RecordObject createNode(String token, Object record) throws RestResponseException;", "private void editPipelineDefAddNextNode(PipelineDefinition pipelineDef) {\n PipelineDefinitionNode newPipelineNode = new PipelineDefinitionNode(\n expectedModuleDef3.getName());\n pipelineDef.getRootNodes()\n .get(0)\n .getNextNodes()\n .get(0)\n .getNextNodes()\n .add(newPipelineNode);\n newPipelineNode.setUnitOfWork(new ClassWrapper<UnitOfWorkTaskGenerator>(\n new TestUowTaskGenerator()));\n newPipelineNode.setStartNewUow(false);\n }", "NamedLinkDescriptor createNamedLinkDescriptor();", "Node(Path workDir) {\n vaultManager = new VaultManager(new PersistentVaultService(workDir.resolve(\"vault\")));\n\n clusterService = createClusterService(addr);\n\n raftManager = new Loza(clusterService, workDir);\n\n List<RootKey<?, ?>> rootKeys = List.of(NodeConfiguration.KEY);\n\n List<ConfigurationStorage> localStorage = List.of(new LocalConfigurationStorage(vaultManager));\n\n cfgManager = new ConfigurationManager(rootKeys, localStorage);\n\n metaStorageManager = new MetaStorageManager(\n vaultManager,\n cfgManager,\n clusterService,\n raftManager\n );\n\n cfgStorage = new DistributedConfigurationStorage(metaStorageManager, vaultManager);\n }", "public HNode createHead(String name) throws InvalidTreeException;", "public RubyModule defineModule(String name) {\n return defineModuleUnder(name, objectClass);\n }", "private Node createTrackingNode(Session session, RequestData requestData, String userId) throws RepositoryException {\n Calendar today = Calendar.getInstance();\n String path = String.format(\"%s/%s/%s/%s\",\n ConversionJob.JOB_DATA_LOCATION,\n requestData.getType().name().toLowerCase(),\n new SimpleDateFormat(\"yyyy/MM/dd\").format(today.getTime()),\n JcrUtil.createValidName(requestData.getName(), JcrUtil.HYPHEN_LABEL_CHAR_MAPPING, \"-\"));\n Node node = JcrUtils.getOrCreateByPath(path, true, JcrConstants.NT_UNSTRUCTURED, JcrConstants.NT_UNSTRUCTURED, session, false);\n node.setProperty(PN_TITLE, requestData.getName());\n node.setProperty(PN_TEMPLATE_RULES, requestData.getTemplateRules());\n node.setProperty(PN_COMPONENT_RULES, requestData.getComponentRules());\n node.setProperty(PN_POLICY_RULES, requestData.getPolicyRules());\n node.setProperty(PN_TYPE, requestData.getType().toString());\n node.setProperty(PN_CONF_PATH, requestData.getConfPath());\n node.setProperty(PN_SOURCE_ROOT, requestData.getSourceRoot());\n node.setProperty(PN_TARGET_ROOT, requestData.getTargetRoot());\n node.setProperty(PN_PAGE_HANDLING, requestData.getPageHandling().name());\n node.setProperty(PN_OVERWRITE, requestData.isOverwrite());\n node.setProperty(PN_INITIATOR, userId);\n node.setProperty(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY, ConversionJob.RESOURCE_TYPE);\n return node;\n }", "public INodeDepot createNodeDepot(int deliverGoodRequest, int pickupGoodSupply, String depotId) {\n\n ILoad deliverGoodLoad = new SimpleLoad(\"DeliverGood\", deliverGoodRequest, true, true);\n\n ILoad pickupGoodLoad = new SimpleLoad(\"PickupGood\", pickupGoodSupply, false, true);\n\n INodeDepot customerNodeDepot = new SimpleNodeDepot(depotId);\n customerNodeDepot.add(deliverGoodLoad);\n customerNodeDepot.add(pickupGoodLoad);\n\n return customerNodeDepot;\n }", "public Node(String name) {\n this.name = name;\n }", "public NetworkNode(String id, String title, String label, String name, String type) {\n super();\n this.id = id;\n this.title = title;\n this.label = label;\n this.name = name;\n this.group = type;\n this.type = type;\n }", "public ModuleType(String name, String description) {\r\n super(name, description);\r\n }", "public Node(){}", "public void setDescriptor(Descriptor inDescriptor);", "@Override\n\tpublic String createNode(String type,String name,String time,String loca,String phone, String desc,String axisId ) {\n\t\tNode node = new Node(type, name, time, loca, phone, desc, axisId);\n\t\thibernatedao.insert(null, node);\n\t\treturn node.getId();\n\t}", "public static LabelToNode createScopeByDocumentHash(UUID seed)\n { return new LabelToNode(new FixedScopePolicy(), nodeAllocatorHash(seed)); }", "private LECCModule (ModuleName moduleName, ClassLoader foreignClassLoader, GeneratedCodeInfo generatedCodeInfo) {\r\n super (moduleName, foreignClassLoader, generatedCodeInfo);\r\n }", "Object getDefaultNodeFactory();", "protected Node newNode() {\n\t\treturn new RCPOMDocument();\n\t}", "public Node clone(int bno, String course){\r\n Node node = new Node();\r\n node.bkpNode(bno, course, node.operation.INSERT);\r\n return node;\r\n }", "DataSourceIngestModule createDataSourceIngestModule(IngestModuleIngestJobSettings settings);", "public static void createNode (PsiDirectory parentDirectory, VNode vNode) throws IOException {\r\n\t\tString name = mungeNamespace(vNode.getName());\r\n\t\tPsiDirectory contentDirectory = parentDirectory.createSubdirectory(name);\r\n\t\tPsiFile contentFile = contentDirectory.createFile(\".content.xml\");\r\n\t\twriteNodeContent(contentFile, vNode);\r\n\t}", "public NodeMap<CDMNode, DapNode> create() throws DapException {\n // Netcdf Dataset will already have a root group\n Group cdmroot = ncfile.getRootGroup();\n this.nodemap.put(cdmroot, this.dmr);\n fillGroup(cdmroot, this.dmr, ncfile);\n return this.nodemap;\n }", "private Node hubInsertNode(HubNode hubNode, Pane canvas , ContextMenu contextMenu) {\n\n\t\tImage image = new Image(\"root/Images/Hub.png\");\n\t\tImagePattern imagePattern = new ImagePattern(image);\n\n\t\tRectangle node = new Rectangle(NODE_LENGTH, NODE_WIDTH);\n\t\tnode.setFill(imagePattern);\n\n\t\tLabel lnodeName = new Label(\"HUB: \" + hubNode.getName()+ \"\\n\" + \"IP: \" + hubNode.getSubnet() + \"\\n\" + \"NetMask: \" + hubNode.getNetmask());\n\n\t\t//lnodeName.setOpacity(0.5);\n\t\tlnodeName.setStyle(\"-fx-background-color: rgba(255,255,255,0.6); -fx-font-size: 8; \");\n\n\n\t\tStackPane nodeContainer = new StackPane();\n\t\tnodeContainer.getChildren().addAll(node, lnodeName);\n\t\tnodeContainer.relocate(hubNode.getPosx(), hubNode.getPosy());\n\t\thubNode.setCanvasNode(nodeContainer); //for removing\n\n\t\tnodeContainer.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {\n\t\t\t@Override\n\t\t\tpublic void handle(MouseEvent event) {\n\t\t\t\tNodeController nodeController = NodeController.getNodeController();\n\t\t\t\tif (event.getButton() == MouseButton.SECONDARY) {\n\t\t\t\t\tcontextMenu.getItems().get(2).setDisable(false);//allows deletion option of the stack pane object 'nodeContainer'\n\t\t\t\t\tcontextMenu.getItems().get(2).setOnAction(new EventHandler<ActionEvent>() {\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void handle(ActionEvent e) {\n\t\t\t\t\t\t\tString hubName = hubNode.getName();\n\t\t\t\t\t\t\tnodeController.removeHubNode(hubName);\n\t\t\t\t\t\t\trefreshAll();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tcontextMenu.setOnHidden(new EventHandler<WindowEvent>() {\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void handle(WindowEvent e) {\n\t\t\t\t\t\t\tcontextMenu.getItems().get(2).setDisable(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\n\t\treturn nodeContainer;\n\t}", "Node(TNode i, Node n){\t\t\t//A function to create a Node\n\t\telement = i;\t\t\t\t\n\t\tnext = n;\n\t}", "public NetworkNode(String id, String title, String label, String name, String type, String participant) {\n super();\n this.id = id;\n this.title = title;\n this.label = label;\n this.name = name;\n this.group = type;\n this.type = type;\n this.participant = participant;\n }", "public Node createNode(int value) {\r\n\t\treturn new Node(value, null, null);\r\n\t}", "protected SceneGraphObject createNode( Class state ) {\n\tSceneGraphObject ret;\n\n\ttry {\n\t ret = (SceneGraphObject)state.newInstance();\n\n\t //System.err.println(\"Created J3D node for \"+className );\n\t} catch( IllegalAccessException exce ) {\n\t throw new SGIORuntimeException( \"Broken State class for \"+\n\t\t\t\t\t\tstate.getClass().getName()+\" - IllegalAccess\" );\n\t} catch( InstantiationException excep ) {\n\t throw new SGIORuntimeException( \"Broken State class for \"+\n\t\t\t\t\t\tstate.getClass().getName() );\n\t}\n\n\treturn ret;\n }", "public NodeKey createNodeKey();", "private SceneGraphObject createNode( String className, Class[] parameterTypes, Object[] parameters ) {\n SceneGraphObject ret;\n Constructor constructor;\n\n try {\n Class state = Class.forName( className );\n constructor = state.getConstructor( parameterTypes );\n ret = (SceneGraphObject)constructor.newInstance( parameters );\n\t} catch(ClassNotFoundException e1) {\n if (control.useSuperClassIfNoChildClass())\n ret = createNodeFromSuper( className, parameterTypes, parameters );\n else\n throw new SGIORuntimeException( \"No State class for \"+\n\t\t\t\t\t\tclassName );\n\t} catch( IllegalAccessException e2 ) {\n\t throw new SGIORuntimeException( \"Broken State class for \"+\n\t\t\t\t\t\tclassName+\" - IllegalAccess\" );\n\t} catch( InstantiationException e3 ) {\n\t throw new SGIORuntimeException( \"Broken State class for \"+\n\t\t\t\t\t\tclassName );\n } catch( java.lang.reflect.InvocationTargetException e4 ) {\n\t throw new SGIORuntimeException( \"InvocationTargetException for \"+\n\t\t\t\t\t\tclassName );\n } catch( NoSuchMethodException e5 ) {\n for(int i=0; i<parameterTypes.length; i++)\n System.err.println( parameterTypes[i].getName() );\n System.err.println(\"------\");\n\t throw new SGIORuntimeException( \"Invalid constructor for \"+\n\t\t\t\t\t\tclassName );\n }\n\n return ret;\n }", "boolean addNode(long idNum, String label);", "public Node() {}", "public Node() {}", "public Node() {}", "public Node() {}", "ModuleAssembly module( String name );", "NodeConnection createNodeConnection();", "LECCModule (ModuleName moduleName, ClassLoader foreignClassLoader, ProgramResourceRepository resourceRepository) {\r\n super (moduleName, foreignClassLoader);\r\n this.resourceRepository = resourceRepository;\r\n }", "public static LabelToNode createScopeByGraph() {\n return new LabelToNode(new GraphScopePolicy(), nodeAllocatorByGraph());\n }", "public Node(){\n\n\t\t}", "public MessagingNode(String registryHost, int registryPort) {\n\t\trand = new Random();\n\t\t// Connect to the Registry\n\t\ttry {\n\t\t\tSocket registrySocket = new Socket(registryHost, registryPort);\n\t\t\tthis.registry = new TCPConnection(registrySocket, this);\n\t\t} catch (UnknownHostException e) {\n\t\t\tSystem.out.println(e.getMessage()\n\t\t\t\t\t+ \" Trouble opening socket to Registry.\");\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(e.getMessage()\n\t\t\t\t\t+ \" Trouble opening socket to Registry.\");\n\t\t}\n\t\t// Prepare the routing table\n\t\tnodesToSendTo = new TCPConnectionsCache();\n\t}", "public NodeKey createNodeKey( String sourceName,\n String identifier );", "POperand createPOperand();", "public static LevelNodeBase loadNode(LevelNodeBase parent, LevelController level, Element tag) {\n\t\ttry {\n\n\t\t\tClass<? extends LevelNodeBase> cls = nodes.get(tag.getName().toLowerCase());\n\t\t\tConstructor<? extends LevelNodeBase> constructor = cls.getDeclaredConstructor(LevelNodeBase.class, LevelController.class);\n\t\t\tLevelNodeBase node = constructor.newInstance(parent, level);\n\t\t\tnode.loadFromXml(tag);\n\t\t\treturn node;\n\n\t\t} catch (Exception e) {\n\t\t\tLog.e(\"Could not instantiate algorithm node '\" + tag.getName() + \"' - not found in registry.\");\n\t\t\treturn null;\n\t\t}\n\t}", "TestNode createTestNode();", "public Node<E> createNode(E e, Position<E> parent){\n Node<E> p = (Node<E>) parent;\n return new Node<>(e, p);\n }", "public MockTopologyNode createManualTree() throws ServiceFactory.ServiceNotAvailableException {\n // get a new submitter to create a new tree\n final TopologyDataSubmissionService3.TopologySubmitter3 mysubmitter = mServiceFactory.getService\n (TopologyDataSubmissionService3.class).getTopologySubmitter();\n\n TopologyNode topnode = mysubmitter.createTopLevelNode(\"__top_of_tree__\", 0);\n MockTopologyNode node = (MockTopologyNode) topnode;\n\n MockTopologyNode node1 = createMockNode(node, \"HostDiscoveryData\", null, 0, 0, false, false);\n MockTopologyValue value1 = (MockTopologyValue) node1.createValue(\"name\");\n value1.setSampleValue(\"HostDiscoveryData\");\n value1.setIsIdentity(true);\n value1.setNodeFrequency(0);\n\n MockTopologyNode node2 = createMockNode(node1, \"host\", \"Host\", 0, 0, false, false);\n MockTopologyValue value2 = (MockTopologyValue) node2.createValue(\"name\");\n value2.setSampleValue(\"198.51.100.0\");\n value2.setIsIdentity(true);\n value2.setNodeFrequency(0);\n\n return node;\n}" ]
[ "0.61416924", "0.5991921", "0.5914338", "0.57971007", "0.5593313", "0.55147016", "0.5492092", "0.5374335", "0.52044755", "0.5197978", "0.51661766", "0.51606447", "0.51451963", "0.508031", "0.50751716", "0.5071665", "0.5045083", "0.50324124", "0.4999279", "0.4974123", "0.49655575", "0.49388975", "0.49298292", "0.49246284", "0.48964775", "0.48873258", "0.48856276", "0.48825297", "0.48803332", "0.4862707", "0.48533067", "0.48524934", "0.48242807", "0.48094818", "0.47780043", "0.47605267", "0.47207645", "0.4716327", "0.4700869", "0.46873695", "0.46781272", "0.46589434", "0.46558213", "0.46364233", "0.46225718", "0.461785", "0.46169156", "0.46158677", "0.46041936", "0.45863992", "0.45616412", "0.4535545", "0.4515025", "0.45136622", "0.45124966", "0.45073494", "0.4493995", "0.44783112", "0.44755954", "0.44728577", "0.44708353", "0.4465733", "0.44635344", "0.4438271", "0.44382554", "0.44297", "0.44285074", "0.4426653", "0.4425289", "0.44193152", "0.44144723", "0.4412939", "0.44034156", "0.44007722", "0.4374644", "0.43643525", "0.43641055", "0.43570995", "0.43541566", "0.43456453", "0.4343139", "0.4341335", "0.4339697", "0.43364403", "0.43356302", "0.43356302", "0.43356302", "0.43356302", "0.4333468", "0.43324476", "0.43176195", "0.43160132", "0.4299028", "0.42879164", "0.4287603", "0.42860377", "0.42832783", "0.4282847", "0.42805368", "0.42755902" ]
0.80209297
0
whenever the cluster notifies a node, and the node belongs to this module, the module will call notifyModuleNode
abstract protected void notifyModuleNode(T node);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void notify(Node node);", "private void notifyReplicaNodes(Identifier pid, boolean notifyAuthNode) {\n\n logger.info(buildStandardLogMessage(null, \" Entering notifyReplicaNodes...\"));\n SystemMetadata cnSystemMetadata = hzSystemMetaMap.get(pid);\n if (cnSystemMetadata != null) {\n List<Replica> prevReplicaList = cnSystemMetadata.getReplicaList();\n\n for (Replica replica : prevReplicaList) {\n NodeReference replicaNodeId = replica.getReplicaMemberNode();\n try {\n if (notifyAuthNode) {\n // notify all nodes\n notifyReplicaNode(cnSystemMetadata, replicaNodeId);\n } else {\n // only notify MNs that are not the AuthMN\n if (!replicaNodeId.getValue().equals(task.getNodeId())) {\n notifyReplicaNode(cnSystemMetadata, replicaNodeId);\n }\n }\n } catch (InvalidToken | NotAuthorized | NotImplemented |\n ServiceFailure | NotFound | InvalidRequest be) {\n // failed notifications shouldn't result in a sync failure\n // nor a retry, so we will log the exception and keep going\n logger.error(buildStandardLogMessage(be, \"Failed to notify replica member node \" +\n replicaNodeId.getValue()), be);\n }\n }\n } else {\n logger.error(buildStandardLogMessage(null,\"null returned from Hazelcast \"\n + hzSystemMetaMapString + \" Map\"));\n }\n }", "private void notifyReplicaNode(SystemMetadata cnSystemMetadata, NodeReference nodeId)\n throws InvalidToken, NotAuthorized, NotImplemented, ServiceFailure, NotFound, InvalidRequest {\n\n // Characterize the replica MemberNode\n Node replicaNode = nodeCommunications.getNodeRegistryService().getNode(nodeId);\n if (!replicaNode.getType().equals(NodeType.MN)) \n return; //quietly\n \n \n boolean isV1Tier3 = false;\n boolean isV2Tier3 = false;\n boolean hasTier3 = false;\n // Find out if a tier 3 node, if not then do not callback since it is not implemented\n for (Service service : replicaNode.getServices().getServiceList()) {\n if (service.getName() != null && service.getName().equals(\"MNStorage\") && service.getAvailable()) {\n if (service.getVersion().equalsIgnoreCase(\"V1\")) {\n isV1Tier3 = true;\n hasTier3 = true;\n } else if (service.getVersion().equalsIgnoreCase(\"V2\")) {\n isV2Tier3 = true;\n hasTier3 = true;\n }\n }\n }\n if (!hasTier3)\n return; //quietly\n \n // If this far, notify the replicaNode\n \n // removed the sanity checks on notification - there isn't a clear reason for them, \n // and more likely to fail for trivial reasons (NPEs, IOExceptions) and cause some trouble. \n // (was added 11/11/2011, part of #1979, today is 10/22/2015)\n // (the code used to retrieve the systemMetadata from the replica node\n // and make sure the modified time was different)\n \n \n NodeComm nodeComm = null;\n try {\n // get a nodeComm to occupy one of the communication slots in the pool\n // but it's going to be simpler logic to ignore existing MnRead from\n // the NodeComm, and get an MNode from a D1Client instead\n // TODO: this should be refactored to allow use of mock objects for\n // unit testing (we shouldn't be going outside of the NodeComm bundle)\n nodeComm = NodeCommSyncObjectFactory.getInstance().getNodeComm(nodeId);\n \n if (isV2Tier3) {\n org.dataone.client.v2.itk.D1Client.getMN(replicaNode.getBaseURL())\n .systemMetadataChanged(session, \n cnSystemMetadata.getIdentifier(),\n cnSystemMetadata.getSerialVersion().longValue(), \n cnSystemMetadata.getDateSysMetadataModified());\n logger.info(buildStandardLogMessage(null,\" Notified (v2) \" + nodeId.getValue()));\n } \n else if (isV1Tier3) {\n org.dataone.client.v1.itk.D1Client.getMN(replicaNode.getBaseURL())\n .systemMetadataChanged(session, \n cnSystemMetadata.getIdentifier(),\n cnSystemMetadata.getSerialVersion().longValue(), \n cnSystemMetadata.getDateSysMetadataModified());\n logger.info(buildStandardLogMessage(null,\" Notified (v1) \" + nodeId.getValue()));\n }\n } catch (NodeCommUnavailable e) {\n throw new ServiceFailure(\"0000\", \"In notifyReplicaNode: \" + e.getMessage());\n } finally {\n if (nodeComm != null)\n nodeComm.setState(NodeCommState.AVAILABLE);\n }\n }", "public void sendUpdateNodeMessage (Node node) {\n this.clientCommunicationManager.sendUpdateNodeMessage(node);\n }", "public void serviceUpdated(BNode n) {\n }", "public abstract ModuleMonitoring monitoring();", "public void markNodeAsRegistered(String nodeId);", "public void handleNewNode(INode node) {\n\n\t\tsynchronized (services) {\n\t\t\tfor (String name : getInstalledClusterServiceNames()) {\n\t\n\t\t\t\tClusterServiceHandler csWrapper = services.get(name);\n\t\t\t\t\n\t\t\t\tif (node.getStatus() == NodeStatus.CONNECTED) {\n\t\t\t\t\tMessage msg = new Message(ClusterNodeClientProtocol.CMD_GET_SERVICE_STATUS, name);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tResponse resp = node.sendMessage(msg);\n\t\t\t\t\t\tif (resp.isSuccess()) {\n\t\t\t\t\t\t\tClusterServiceStatus status = ClusterServiceStatus.valueOf(resp.getReason());\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tIRemoteService rs = new RemoteService(node, name, status);\n\t\t\t\t\t\t\tcsWrapper.getRemoteServices().add(rs);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (status == ClusterServiceStatus.ACTIVE_MASTER) {\n\t\t\t\t\t\t\t\t// the remote service is currently a master\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tIClusterService clusterService = csWrapper.getClusterService();\n\t\t\t\t\t\t\t\tif (clusterService.isMaster()) { // only try if we are already a master. If we are a slave, another node exists with a higher prio \n\t\t\t\t\t\t\t\t\tif (node.getMasterPriority() < cluster.getConfig().getMasterPriority()) {\n\t\t\t\t\t\t\t\t\t\t// this node has a higher master priority. This means that we have to take over the master role\n\t\t\t\t\t\t\t\t\t\t// from the remote node.\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tobtainMasterRole(name, clusterService, node);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t// the other node has a higher priority -> let's surrender!\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tSerializable data = clusterService.surrenderMasterRole();\n\t\t\t\t\t\t\t\t\t\tMessage msgSur = new Message(ClusterNodeClientProtocol.CMD_SURRENDER_SERVICE, name, data);\n\t\t\t\t\t\t\t\t\t\tnode.sendMessage(msgSur);\n\t\t\t\t\t\t\t\t\t\tcsWrapper.setMasterService(rs);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} else if (status == ClusterServiceStatus.ACTIVE_SLAVE) {\n\t\t\t\t\t\t\t\t// the remote service is currently a slave. This means that it knows a node\n\t\t\t\t\t\t\t\t// with a higher priority. We do not have to do anything in that case.\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\tlog.warn(\"Can not retrieve remote service status : \" + resp.getReason());\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (CommunicationException ce) {\n\t\t\t\t\t\tlog.warn(\"Error retrieving service status from node \" + node, ce);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t}", "public void notifyAll(Node node, String course){\r\n for(Node nodes : listeners){\r\n nodes.update(node, course);\r\n }\r\n }", "protected abstract Object pollNode(MBeanServerConnection connection, String nodeName, int nodeIdx) throws Exception;", "@Override\n\t\t\tpublic void notify(Notification n) {\n\t\t\t\tif (isActive()) handleModelChanged();\n\t\t\t\trefreshAdapters();\n\t\t\t}", "void nodeUpdated(Node n) throws RepositoryException;", "@Override\n\tpublic void onModuleAdditionalStateChanged(final byte[] additionalState) {\n\t\tpeerDiscoveryService.updateSelfAdditionalState(additionalState);\n\t}", "@Override\n public void notify(Object event){\n }", "@Override\r\n public void nodeActivity() {\n }", "public void sendModuleNameToServer() {\n try {\n System.out.println(\"writing module name:\" + getModuleName());\n ostream.writeObject(getModuleName());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "void onModuleAdded(final ModularConfigurationModule<T> module) {\n for (ModularConfigurationEntry<T> newEntry : module.getAll()) {\n ModularConfigurationEntry<T> existing = entries.getIfExists(newEntry.getName());\n if (existing == null) {\n existing = removedEntries.remove(newEntry.getName());\n }\n\n // Directly store the module's entry. No change notification as there's\n // no listeners registered yet.\n if (existing == null) {\n this.entries.set(newEntry.getName(), newEntry);\n continue;\n }\n\n // Check whether the existing entry's module overrides the module that\n // we are adding to this store. If so, the entry isn't loaded.\n // Instead it's added to the \"shadow modules\" - a list modules are taken\n // from when the entry is removed from higher-priority modules.\n if (!existing.isRemoved() && !isModuleOverriding(module, existing.getModule())) {\n int index = 0;\n while (index < existing.shadowModules.size() &&\n isModuleOverriding(module, existing.shadowModules.get(index)))\n {\n index++;\n }\n existing.shadowModules.add(index, module);\n continue;\n }\n\n // Swap the entry for the existing one\n existing.loadFromModule(module);\n }\n }", "void onHisNotify();", "@Override\n\tpublic ModuleInfo setModule(ModuleInfo moduleInfo) throws HFModuleException {\n\t\tLog.d(\"HFModuleManager\", \"setModule\");\n//\t\tif (!this.isCloudChannelLive()) {\n//\t\t\tthrow new HFModuleException(HFModuleException.ERR_USER_OFFLINE,\n//\t\t\t\t\t\"User is not online\");\n//\t\t}\n\t\tif (moduleInfo == null) {\n\t\t\tthrow new IllegalArgumentException(\"moduleinfo is Null\");\n//\t\t\tthrow new HFModuleException(HFModuleException.ERR_SET_MODULE,\n//\t\t\t\t\t\"your moduleinfo is null\");\n\t\t}\n\n\t\tmoduleInfo.setAccessKey(HFConfigration.accessKey);\n\t\tModuleSetRequest request = new ModuleSetRequest(moduleInfo);\n\t\t\n\t\ttry {\n\t\t\tModuleInfoResponse response = cloudModuleManager.setModule(request);\n\t\t\n\t\t\tModuleInfo responseModuleInfo = response.getPayload();\n\t\t\tresponseModuleInfo.setLocalIp(moduleInfo.getLocalIp());\n\t\t\tgetHFModuleHelper().addRemoteModuleInfo(responseModuleInfo);\n\t\t\t\n\t\t\treturn responseModuleInfo;\n\t\t} catch (CloudException e1) {\n\t\t\te1.printStackTrace();\n\t\t\tthrow new HFModuleException(e1.getErrorCode(), e1.getMessage());\n\t\t}\n\t\t\n//\t\ttry {\n//\t\t\tJSONObject joReq = new JSONObject();\n//\t\t\tJSONObject pl = new JSONObject(moduleInfo.toJson());\n//\t\t\tjoReq.put(\"PL\", pl);\n//\t\t\tjoReq.put(\"CID\", 30011);\n//\t\t\tjoReq.put(\"SID\", this.getsid());\n//\n//\t\t\tString req = joReq.toString();\n//\t\t\tString rsp = null;\n//\t\t\trsp = HttpProxy.reqByHttpPost(req);\n//\t\t\tJSONObject jo = new JSONObject(rsp);\n//\n//\t\t\tif (jo.isNull(\"RC\")) {\n//\t\t\t\tthrow new HFModuleException(HFModuleException.ERR_SET_MODULE,\n//\t\t\t\t\t\t\"can not set module\");\n//\t\t\t}\n//\n//\t\t\tif (jo.getInt(\"RC\") == 1) {\n//\t\t\t\tJSONObject rspPL = jo.getJSONObject(\"PL\");\n//\t\t\t\tModuleInfo rspInfo = new ModuleInfo();\n//\t\t\t\trspInfo.fromJson(pl);\n//\n//\t\t\t\trspInfo.setLocalIp(moduleInfo.getLocalIp());\n//\t\t\t\tgetHFModuleHelper().addRemoteModuleInfo(rspInfo);\n//\n//\t\t\t\treturn rspInfo;\n//\t\t\t} else {\n//\t\t\t\tthrow new HFModuleException(HFModuleException.ERR_SET_MODULE,\n//\t\t\t\t\t\t\"can not set module\");\n//\t\t\t}\n//\t\t} catch (JSONException e) {\n//\t\t\tthrow new HFModuleException(HFModuleException.ERR_SET_MODULE,\n//\t\t\t\t\t\"can not set module\");\n//\t\t}\n\t}", "private void notifyNeighbors() {\n final World world = getCasing().getCasingWorld();\n\n scheduledNeighborUpdate = false;\n final Block blockType = world.getBlockState(getCasing().getPosition()).getBlock();\n world.updateNeighborsAlways(getCasing().getPosition(), blockType);\n }", "public void notify(ObserveSession observeSession) {\n Lwm2mNotifyResponse response = new Lwm2mNotifyResponse(observeSession.node);\n observeSession.lastNotifyTime = System.currentTimeMillis();\n observeSession.coapResource.changed(response);\n LOG.debug(\"Sent notify on node {} to server {}\", observeSession.coapResource.getName(), observeSession.getServerUri());\n }", "void nodeStarted();", "public synchronized void informModuleStartLoading(Module module) {\n\t\tModuleStat stat = getModuleStat(module);\n\t\tstat.waitLoading = true;\n\t}", "@Override\n public void stateChange(PciContext pciContext) {\n log.debug(\"inside statechange of sdnr notif state\");\n String notification = pciContext.getSdnrNotification();\n Notification notificationObject;\n try {\n\n ObjectMapper mapper = new ObjectMapper();\n notificationObject = mapper.readValue(notification, Notification.class);\n log.debug(\"notificationObject{}\", notificationObject);\n\n List<FapServiceList> serviceList = notificationObject.getPayload().getRadioAccess().getFapServiceList();\n for (FapServiceList fapService : serviceList) {\n String cellId = fapService.getCellConfig().getLte().getRan().getCellIdentity();\n log.debug(\"cellId:{}\", cellId);\n log.debug(\"inside for loop\");\n\n List<ClusterDetails> clusterDetails = getAllClusters();\n\n ClusterDetails clusterDetail = getClusterForNotification(fapService, clusterDetails);\n\n if (clusterDetail == null) {\n // form the cluster\n Graph cluster = createCluster(fapService);\n // save to db\n UUID clusterId = UUID.randomUUID();\n cluster.setGraphId(clusterId);\n // create the child thread\n log.debug(\"creating new child\");\n BlockingQueue<FapServiceList> queue = new LinkedBlockingQueue<>();\n ThreadId threadId = new ThreadId();\n threadId.setChildThreadId(0);\n ChildThread child = new ChildThread(pciContext.getChildStatusUpdate(), cluster, queue, threadId);\n queue.put(fapService);\n MainThreadComponent mainThreadComponent = BeanUtil.getBean(MainThreadComponent.class);\n mainThreadComponent.getPool().execute(child);\n\n waitForThreadId(threadId);\n\n saveCluster(cluster, clusterId, threadId.getChildThreadId());\n addChildThreadMap(threadId.getChildThreadId(), child);\n pciContext.addChildStatus(threadId.getChildThreadId(), \"processingNotifications\");\n\n }\n\n else {\n if (isOofTriggeredForCluster(pciContext, clusterDetail)) {\n pciContext.setNotifToBeProcessed(false);\n bufferNotification(fapService, clusterDetail.getClusterId());\n } else {\n pciContext.setNotifToBeProcessed(true);\n log.debug(\"childThreadId:{}\", clusterDetail.getChildThreadId());\n childThreadMap.get(clusterDetail.getChildThreadId()).putInQueue(fapService);\n }\n }\n }\n } catch (Exception e) {\n log.error(\"caught in sdnr notif handling state{}\", e);\n }\n\n WaitState waitState = WaitState.getInstance();\n pciContext.setPciState(waitState);\n pciContext.stateChange(pciContext);\n }", "void notifyRestart();", "public void memberLeft(ClusterEvent e) {}", "void nodeOnline();", "protected void notify(Employee e) {\n\t}", "protected void notifyUser()\n {\n }", "@Override\n public void onEvent(EMNotifierEvent event) {\n\n }", "public void update(Observable o, Object arg) {\n\n if (!(arg instanceof NodeChange)) {\n logger.severe(\"received unknown notification, ignore...\");\n return;\n }\n\n NodeChange nodeChange = (NodeChange) arg;\n if ((nodeChange.getCause() != NodeChange.MEMBER_JOINED) &&\n (nodeChange.getCause() != NodeChange.MEMBER_LEFT)) {\n // Ignore.\n return;\n }\n\n synchronized(cmmNotifications) {\n cmmNotifications.add(nodeChange);\n }\n }", "public void onAlivenessChange(long nodehash, boolean b) { synchronized (this.nodedb) {\n\t\tNodeDB.NodeInfo n = this.nodedb.get(nodehash);\n\t\tif (n == null) return;\n\t\tif (n.alive == b) return;\n\t\tif ((n.isLocal) && !b) throw new RuntimeException(\"Local liveness change!!\");\n\n\t\tn.timestamp = System.currentTimeMillis();\n\t\tn.alive = b;\n\t\t\n\t\tGossipThread.getInstance().replicateNodeInfo(n);\n\t}}", "@Override\n public synchronized void Notify(WatchedEvent e) {\n\n switch (e.getType()) {\n case NodeDeleted:\n if (e.getPath().equals(buildPath(ROOT, watchedLeader))) {\n LOG.info(\"[Notify] The leader before me has died I must find a new Leader!\");\n // the leader before us has died, start an election\n runLeaderElection(zkService);\n }\n break;\n }\n }", "public void serverRestarting() {\n notifyServerRestart();\n }", "private void invokeStockMarketModule(String resourceName)\r\n {\r\n\r\n debug(\"invokeStockMarketModule(\" + resourceName + \") - preparing to change\");\r\n debug(\"invokeStockMarketModule() - shudown thread timers\");\r\n shutdownWatchListTimers();\r\n\r\n debug(\"invokeStockMarketModule() - get a handle to the main application\");\r\n StockMarketApp mainApp = getMainApp();\r\n\r\n if (mainApp != null)\r\n {\r\n debug(\"invokeStockMarketModule() - Sending message to change applications\");\r\n mainApp.notifyChangeModules(resourceName);\r\n }\r\n else\r\n {\r\n System.out.println(\"invokeStockMarketModule() - module [\" + resourceName + \"] cannot be invoked!\");\r\n System.out.println(\" - This function only works when... \");\r\n System.out.println(\" - The Full Application is running.\");\r\n }\r\n\r\n debug(\"invokeStockMarketModule() - Processing completed\");\r\n }", "protected void notifyListeners() {\n // TODO could these be done earlier (or just once?)\n JMeterContext threadContext = getThreadContext();\n JMeterVariables threadVars = threadContext.getVariables();\n SamplePackage pack = (SamplePackage) threadVars.getObject(JMeterThread.PACKAGE_OBJECT);\n if (pack == null) {\n // If child of TransactionController is a ThroughputController and TPC does\n // not sample its children, then we will have this\n // TODO Should this be at warn level ?\n log.warn(\"Could not fetch SamplePackage\");\n } else {\n SampleEvent event = new SampleEvent(res, threadContext.getThreadGroup().getName(),threadVars, true);\n // We must set res to null now, before sending the event for the transaction,\n // so that we can ignore that event in our sampleOccured method\n res = null;\n- // bug 50032 \n- if (!getThreadContext().isReinitializingSubControllers()) {\n- lnf.notifyListeners(event, pack.getSampleListeners());\n- }\n+ lnf.notifyListeners(event, pack.getSampleListeners());\n }\n }", "interface NotifyClient extends Remote {\n\n\t/**\n\t * An identity has been assigned to this node.\n\t * \n\t * @param id\n\t * the identity\n\t * @param oldNode\n\t * the last node the identity was assigned to, or {@code null} if\n\t * this is a new node assignment\n\t * @throws IOException\n\t * if there is a communication problem\n\t */\n\tvoid added(Identity id, Node oldNode) throws IOException;\n\n\t/**\n\t * \n\t * An identity has been removed from this node.\n\t * \n\t * @param id\n\t * the identity\n\t * @param newNode\n\t * the new node the identity is assigned to, or {@code null} if\n\t * the identity is being removed from the map\n\t * @throws IOException\n\t * if there is a communication problem\n\t */\n\tvoid removed(Identity id, Node newNode) throws IOException;\n\n\t/**\n\t * An identity has been selected for relocation from this node.\n\t * \n\t * @param id\n\t * the identity\n\t * @param newNodeId\n\t * the ID of the new node the identity will be relocated to\n\t * @throws IOException\n\t * if there is a communication problem\n\t */\n\tvoid prepareRelocate(Identity id, long newNodeId) throws IOException;\n}", "protected void notifyChildRemoval(FONode node) {\n //nop\n }", "void refreshNode(ChartNode node);", "@Override\n\tprotected void inspectModule(String label, ModuleAction action, Module module) {\n\t\tfinal Instant mark = timeService.now();\n\t\tfinal String modulePK = module.primaryKey();\n\t\tif (Stream.of(ignoredModules).anyMatch(ignorance -> !StringUtils.isEmpty(ignorance) && modulePK.startsWith(ignorance))) {\n\t\t\tlog.debug(\"Module '{}' is ignored for inspection.\", modulePK);\n\t\t\treturn;\n\t\t}\n\t\tlog.info(\"Scan module '{}'\", modulePK);\n\t\t// get health state of module\n\t\tmodule.getMetricsContainer().health().heartBeat(action, module);\n\t\t// collect and save all metrics of module\n\t\tAtomicInteger counter = new AtomicInteger(1);\n\t\tmodule.metrics().stream()\n\t\t\t\t.peek(metric -> log.debug(\"{}. metric '{}' processing\", counter.getAndIncrement(), metric.getName()))\n\t\t\t\t.filter(metric -> this.isWorking())\n\t\t\t\t.forEach(this::storeMetric);\n\n\t\t// save metric about module health check duration\n\t\tgetMetricsContainer().duration().simple(label, action, timeService.now(), modulePK, timeService.duration(mark));\n\t}", "private void processCMMNotif(NodeChange arg)\n throws AlertException {\n\n CMMObservable observable = new CMMObservable();\n synchronized(AlertCorrelationEngine.class) {\n Iterator it = observers.values().iterator();\n while (it.hasNext()) {\n AlertObserver obs = (AlertObserver) it.next();\n if (obs.isRegisteredCMM()) {\n observable.addObserver(obs.getObserver());\n }\n }\n }\n observable.notifyAllObservers(arg);\n synchronized(AlertCorrelationEngine.class) {\n if (arg.getCause() == NodeChange.MEMBER_LEFT) {\n int index = getIndexFromNodeId(arg.nodeId());\n if (index != -1) {\n // Removes all properties for this node.\n deleteNodeProperties(index);\n // Free memory for subtree\n AlertTreeNode node = root.getChild(index);\n node.setChild(null);\n if (logger.isLoggable(Level.FINE)) {\n logger.fine(\"CMM notification node \" +\n arg.nodeId() + \n \"left the cluster\");\n }\n } \n } else {\n if (logger.isLoggable(Level.FINE)) {\n logger.fine(\"CMM notification node \" + arg.nodeId() + \n \"joins the cluster\");\n }\n }\n }\n }", "protected void checkHealth(MonitoredService module) {\n if (!isActive()) {\n return;\n }\n final ModuleOutputDevice moduleLog = ModuleOutputDeviceFarm.getDevice(this, ModuleLoggerMessage.LOG_OUTPUT_TYPE);\n moduleLog.associate(\"Processing heart-beat for '\" + module + \"' module\");\n moduleLog.actionBegin();\n // service is active for the moment, process module's heart-beat\n try {\n moduleLog.out(\"Saving heart-beat of module \", module.toString());\n storage.saveHeartBeat(module);\n moduleLog.out(\"Getting config updates for module \", module.toString());\n final Map<String, ConfiguredVariableItem> updated\n = configurationService.getUpdatedVariables(module, module.getConfiguration());\n if (!updated.isEmpty()) {\n moduleLog.out(\"Updating module configuration.\");\n module.configurationChanged(updated);\n }\n moduleLog.actionEnd();\n } catch (Throwable t) {\n LOG.error(\"Can't process heartbeat for module '{}'\", module, t);\n moduleLog.actionFail();\n }\n }", "@Override\r\n\tpublic void Update() {\n\t\tSystem.out.println(name+\",¹Ø±ÕNBA£¬¼ÌÐø¹¤×÷£¡\"+abstractNotify.getAction());\r\n\t}", "@Override\n public synchronized void memberRemoved(MembershipEvent membershipEvent) {\n membershipEvent.getMember().getUuid();\n System.out.println(String.format(\"Member Removed: %s - %s \",\n membershipEvent.getMember().getUuid(), membershipEvent.getMember().toString()));\n\n super.memberRemoved(membershipEvent);\n String masterId = manager.getNodeID(); // master node\n List<String> nodeIdList = manager.getNodes();\n if (nodeIdList.get(0).equals(masterId)) {\n manager.getAsyncMap(KeyDefine.CLUSTER_MAP_NAME, ar -> {\n if (ar.succeeded()) {\n String downNodeId = membershipEvent.getMember().getUuid();\n ar.result().get(downNodeId, obj -> {\n JsonObject json = (JsonObject) obj.result();\n if (json != null) {\n System.out.printf(\"# yes I am manager, and the node %s offline!\\n\",\n membershipEvent.getMember().toString());\n System.out.println(\"## offline node info: \" + obj.result().toString());\n Boolean restartFlag = Boolean.parseBoolean(json.getString(\"restart\", \"false\"));\n if (restartFlag == null || restartFlag == false) return;\n vertx.executeBlocking(h -> {\n restart(ar.result(), nodeIdList, json);\n }, r -> {\n logger.info(\"restart node: {} ok\", json.getString(\"nodeInfo\"));\n });\n }\n });\n }\n });\n }\n }", "@Override\r\n public void notify(Object arg) {\n }", "public synchronized void start() throws IOException, ClassNotFoundException, RemoteReadException, InstantiationException, IllegalAccessException, InterruptedException\n\t{\n\t\t// Start up the peer. 06/14/2017, Bing Li\n\t\tif (!this.peer.isStarted())\n\t\t{\n\t\t\tthis.peer.start();\n\t\t}\n\n\t\t// Retrieve all of the registered IP addresses of the distributed nodes in the cluster from the registry server. 07/05/2017, Bing Li\n\t\tClusterIPResponse ipResponse = (ClusterIPResponse)this.peer.read(RegistryConfig.PEER_REGISTRY_ADDRESS, RegistryConfig.PEER_REGISTRY_PORT, new ClusterIPRequest());\n\t\tif (ipResponse.getIPs() != null)\n\t\t{\n\t\t\t// Add the IP addresses to the client pool. 07/05/2017, Bing Li\n\t\t\tfor (IPAddress ip : ipResponse.getIPs().values())\n\t\t\t{\n\t\t\t\tthis.peer.getClientPool().addIP(ip.getIP(), ip.getPort());\n\t\t\t}\n\n\t\t\t// Initialize the cluster root IP address broadcast notifier. 07/05/2017, Bing Li\n\t\t\tthis.rootIPBroadcastNotifier = new ClusterRootBroadcastNotifier<IPAddress, OldRootIPAddressBroadcastNotification, RootIPAddressBroadcastNotificationCreator>(this.peer.getClientPool(), MulticastConfig.MULTICASTOR_POOL_SIZE, MulticastConfig.RESOURCE_WAIT_TIME, new RootIPAddressBroadcastNotificationCreator());\n\t\t\t// Broadcast the root IP address to each child in the cluster. 07/05/2017, Bing Li\n\t\t\tthis.rootIPBroadcastNotifier.notifiy(new IPAddress(this.peer.getPeerID(), this.peer.getPeerIP(), this.peer.getPort()), MulticastConfig.ROOT_BRANCH_COUNT, MulticastConfig.SUB_BRANCH_COUNT);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Initialize the cluster root IP address broadcast notifier. 07/05/2017, Bing Li\n\t\t\tthis.rootIPBroadcastNotifier = new ClusterRootBroadcastNotifier<IPAddress, OldRootIPAddressBroadcastNotification, RootIPAddressBroadcastNotificationCreator>(this.peer.getClientPool(), MulticastConfig.MULTICASTOR_POOL_SIZE, MulticastConfig.RESOURCE_WAIT_TIME, new RootIPAddressBroadcastNotificationCreator());\n\t\t}\n\t}", "@Override\n\tpublic void peerStateChange(final ModuleHandleInternal module, final ModuleLifecycleState newState, final ModuleLifecycleState lastState) {\n\t\tsynchronized (lockPeerChange) {\n\t\t\tlockPeerChange.notifyAll();\n\t\t}\n\n\t\teventDispatcher.onPeerStateChange(module, newState, lastState);\n\t}", "void handleDisconnectedNode(INode remoteNode) {\n\t\t\n\t\tint myMasterPrio = cluster.getConfig().getMasterPriority();\n\t\tsynchronized (services) {\n\t\t\tfor (String name : getInstalledClusterServiceNames()) {\n\t\n\t\t\t\tClusterServiceHandler csWrapper = services.get(name);\n\t\t\t\tIRemoteService rsMaster = csWrapper.getMasterService();\n\t\t\t\tif (rsMaster != null) {\n\t\t\t\t\tif (rsMaster.getNode().sameNode(remoteNode)) {\n\t\t\t\t\t\t// the node that went down was hosting the master service.\n\t\t\t\t\t\t// We need to check if we are the logical next master and if so, become master. If a different, active node\n\t\t\t\t\t\t// is the next master, change to the new master\n\t\t\t\t\t\t\n\t\t\t\t\t\tIRemoteService nextMaster = null;\n\t\t\t\t\t\tfor (IRemoteService rs : csWrapper.getRemoteServices()) {\n\t\t\t\t\t\t\tif (rs.getServiceStatus() != ClusterServiceStatus.NO_SUCH_SERVICE &&\n\t\t\t\t\t\t\t\trs.getNode().getStatus() == NodeStatus.CONNECTED) {\n\t\t\t\t\t\t\t\t// the node is active\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (rs.getNode().getMasterPriority() > myMasterPrio && (nextMaster == null || rs.getNode().getMasterPriority() > nextMaster.getNode().getMasterPriority())) {\n\t\t\t\t\t\t\t\t\tnextMaster = rs;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (nextMaster == null) {\n\t\t\t\t\t\t\t// either no other node exists or we have the highest master priority of all remaining active tasks\n\t\t\t\t\t\t\tcsWrapper.getClusterService().obtainMasterRole(null);\n\t\t\t\t\t\t\tcsWrapper.setMasterService(null);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// simply point to the newly identified master node. We assume that the other node\n\t\t\t\t\t\t\t// also experienced the connection loss to the old master, so the new master node will\n\t\t\t\t\t\t\t// obtain the master role by itself.\n\t\t\t\t\t\t\t((RemoteService)nextMaster).setServiceStatus(ClusterServiceStatus.ACTIVE_MASTER);\n\t\t\t\t\t\t\tcsWrapper.setMasterService(nextMaster);\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\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public void notifyConfigChange() {\n }", "public abstract void toggleNode(final NodeDevice node, NodeCallback callback);", "public void notifyRespawn()\n {\n playerObserver.onRespawn();\n }", "private void updateReadyNodeLivenessEvents() {\n try (Mutex lock = nodeRepository().nodes().lockUnallocated()) {\n for (Node node : nodeRepository().nodes().list(Node.State.ready)) {\n Optional<Instant> lastLocalRequest = hostLivenessTracker.lastRequestFrom(node.hostname());\n if (lastLocalRequest.isEmpty()) continue;\n\n if (!node.history().hasEventAfter(History.Event.Type.requested, lastLocalRequest.get())) {\n History updatedHistory = node.history()\n .with(new History.Event(History.Event.Type.requested, Agent.NodeHealthTracker, lastLocalRequest.get()));\n nodeRepository().nodes().write(node.with(updatedHistory), lock);\n }\n }\n }\n }", "private void registerModule(Module module) {\n \t\tif (module.register()) {\n \t\t\t_availableModules.add(module);\n \t\t}\n \t}", "void onNodeNeighbourChange(World world, BlockPos pos, BlockPos neighbourPos);", "public void update(NetworkNode networkNode);", "public void setNodeService(NodeService nodeService)\n {\n this.nodeService = nodeService;\n }", "abstract protected T createModuleNode(NodeDescriptor node);", "@Override\n\tpublic void notifyParallelRoad(int arg0) {\n\n\t}", "@Override\n\t\t\t\tpublic void notifyParallelRoad(int arg0) {\n\t\t\t\t\t\n\t\t\t\t}", "public void reOpenRegistration(String nodeId);", "public void nodeJoined(final ClusterEvent event) {\n }", "void notify(Message m);", "public void memberJoined(ClusterEvent e) {}", "private void signalAndCreateCoordinator(Cluster pCluster)\n \t{\n \t\tRandom tRandom = new Random(System.currentTimeMillis());\n \t\tHRMController tHRMController = pCluster.getHRMController();\n \t\tNode tNode = tHRMController.getPhysicalNode();\n \t\tint tToken = tRandom.nextInt();\n \t\t\n \t\tpCluster.setToken(tToken);\n \t\tLogging.log(this, \"INIT COORDINATOR functions for cluster \" + pCluster);\n \n \t\tif(pCluster.getHRMController().getIdentity() == null) {\n \t\t\tString tName = tNode.getName();\n \t\t\tHRMIdentity tIdentity= new HRMIdentity(tName);\n \t\t\tpCluster.getHRMController().setIdentity(tIdentity);\n \t\t}\n \t\t\n \n \t\t/**\n \t\t * Create signature of cluster\n \t\t */\n \t\tHRMSignature tSignature = null;\n \t\ttry {\n \t\t\ttSignature = tHRMController.getIdentity().createSignature(tNode.toString(), null, pCluster.getHierarchyLevel());\n \t\t} catch (AuthenticationException tExc) {\n \t\t\tpCluster.getHRMController().getLogger().err(this, \"Unable to create signature for coordinator\", tExc);\n \t\t}\n \t\t\n \t\t/**\n \t\t * Send BULLY ANNOUNCE in order to signal that we are the coordinator\n \t\t */\n \t\tBullyAnnounce tAnnounce = new BullyAnnounce(tNode.getCentralFN().getName(), pCluster.getBullyPriority(), tSignature, pCluster.getToken());\n \t\tfor(CoordinatorCEPChannel tCEP : pCluster.getParticipatingCEPs()) {\n \t\t\ttAnnounce.addCoveredNode(tCEP.getPeerName());\n \t\t}\n \t\tif(tAnnounce.getCoveredNodes() == null || (tAnnounce.getCoveredNodes() != null && tAnnounce.getCoveredNodes().isEmpty())) {\n \t\t\tpCluster.getHRMController().getLogger().log(this, \"Sending announce that does not cover anyhting\");\n \t\t}\n \t\tpCluster.sendClusterBroadcast(tAnnounce, null);\n \t\tName tAddress = tNode.getRoutingService().getNameFor(tNode.getCentralFN());; \n \t\tpCluster.setCoordinatorCEP(null, tSignature, tNode.getCentralFN().getName(), (L2Address)tAddress);\n \t\tLinkedList<HRMSignature> tSignatures = tHRMController.getApprovedSignatures();\n \t\ttSignatures.add(tSignature);\n \t\tif(getHierarchLevel().isHigherLevel()) {\n \t\t\tpCluster.getHRMController().getLogger().log(pCluster, \"has the coordinator and will now announce itself\");\n \t\t\tfor(ICluster tToAnnounce : pCluster.getNeighbors()) {\n //\t\t\t\t\tList<VirtualNode> tNodesBetween = pCluster.getCoordinator().getClusterMap().getIntermediateNodes(pCluster, tToAnnounce);\n \t\t\t\t/*\n \t\t\t\t * OK: Because of the formerly sent \n \t\t\t\t */\n \t\t\t\tif(tToAnnounce instanceof NeighborCluster) {\n \t\t\t\t\tBullyAnnounce tBullyAnnounce = new BullyAnnounce(tNode.getCentralFN().getName(), pCluster.getBullyPriority(), tSignature, pCluster.getToken());\n \t\t\t\t\tfor(CoordinatorCEPChannel tCEP: pCluster.getParticipatingCEPs()) {\n \t\t\t\t\t\ttBullyAnnounce.addCoveredNode(tCEP.getPeerName());\n \t\t\t\t\t}\n \t\t\t\t\tfor(CoordinatorCEPChannel tCEP : ((NeighborCluster)tToAnnounce).getAnnouncedCEPs()) {\n \t\t\t\t\t\ttCEP.sendPacket(tBullyAnnounce);\n \t\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(!mPleaseInterrupt) {\n \t\t\t/*\n \t\t\t * synchronized(mPleaseInterrupt) {\n \t\t\t *\n \t\t\t\ttry {\n \t\t\t\t\tmPleaseInterrupt.wait(WAIT_BEFORE_ADDRESS_DISTRIBUTION);\n \t\t\t\t} catch (InterruptedException tExc) {\n \t\t\t\t\tLogging.trace(this, \"interrupted before address distribution\");\n \t\t\t\t}\n \t\t\t}\n \t\t\t */\n \t\t\t\n \t\t\t\n \t\t\tCoordinator tElectedCoordinator = new Coordinator(pCluster, pCluster.getHierarchyLevel(), pCluster.getHrmID());\n \t\t\tint tClusterHierLvl = pCluster.getHierarchyLevel().getValue() + 1;\n \t\t\t\n \t\t\tpCluster.setCoordinator(tElectedCoordinator);\n \t\t\tpCluster.getHRMController().setSourceIntermediateCluster(tElectedCoordinator, pCluster);\n \t\t\ttElectedCoordinator.setPriority(pCluster.getBullyPriority());\n \t\t\tpCluster.getHRMController().addCluster(tElectedCoordinator);\n \t\t\tif(tClusterHierLvl != HRMConfig.Hierarchy.HEIGHT) {\n \t\t\t\t// stepwise hierarchy creation\n \t\t\t\tLogging.log(this, \"Will now wait because hierarchy build up is done stepwise\");\n \t\t\t\tmWillInitiateManager = true;\n \t\t\t\tLogging.log(this, \"Reevaluating whether other processes settled\");\n \t\t\t\tElectionManager.getElectionManager().reevaluate(pCluster.getHierarchyLevel().getValue());\n \t\t\t\tsynchronized(this) {\n \t\t\t\t\ttry {\n \t\t\t\t\t\twait();\n \t\t\t\t\t} catch (InterruptedException tExc) {\n \t\t\t\t\t\tLogging.err(this, \"Unable to fulfill stepwise hierarchy preparation\", tExc);\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\ttElectedCoordinator.prepareAboveCluster(tClusterHierLvl);\n \t\t\t} else {\n \t\t\t\tLogging.log(this, \"Beginning address distribution\");\n \t\t\t\ttry {\n \t\t\t\t\ttElectedCoordinator.setHRMID(new HRMID(0));\n \t\t\t\t\tsynchronized(mPleaseInterrupt) {\n \t\t\t\t\t\tLogging.log(this, \"ACTIVE WAITING (init) - \" + WAIT_BEFORE_ADDRESS_DISTRIBUTION);\n \t\t\t\t\t\tmPleaseInterrupt.wait(WAIT_BEFORE_ADDRESS_DISTRIBUTION);\n \t\t\t\t\t}\n \t\t\t\t\ttElectedCoordinator.distributeAddresses();\n \t\t\t\t} catch (RemoteException tExc) {\n \t\t\t\t\tLogging.err(this, \"Remoe problem - error when trying to distribute addresses\", tExc);\n \t\t\t\t} catch (RoutingException tExc) {\n \t\t\t\t\tLogging.err(this, \"Routing problem - error when trying to distribute addresses\", tExc);\n \t\t\t\t} catch (RequirementsException tExc) {\n \t\t\t\t\tLogging.err(this, \"Requirements problem - error when trying to distribute addresses\", tExc);\n \t\t\t\t} catch (InterruptedException tExc) {\n \t\t\t\t\tLogging.err(this, \"interrupt problem - error when trying to distribute addresses\", tExc);\n \t\t\t\t}\n \t\t\t}\n \t\t}\t\n \t}", "void scanModulesHealth() {\n\t\t// activate main module action\n\t\tactivateMainModuleAction();\n\n\t\tlog.debug(\"Scanning modules.\");\n\t\tactionsFactory.executeAtomicModuleAction(this, \"metrics-check\", () -> iterateRegisteredModules(ACTIVITY_LABEL), false);\n\n\t\tif (!isWorking() || Objects.isNull(runnerFuture)) {\n\t\t\tlog.debug(\"Scanning is stopped.\");\n\t\t\treturn;\n\t\t}\n\t\tlog.debug(\"Rescheduling service for {} millis\", delay);\n\t\trunnerFuture = activityRunner.schedule(this::scanModulesHealth, delay, TimeUnit.MILLISECONDS);\n\t}", "private void fireNodeChangedNow( EventListenerList list, ChangeEvent e )\n {\n Object[] listeners = list.getListenerList();\n\n // Process the listeners last to first,\n // notifying those that are interested in this event\n for( int i = listeners.length - 2; i >= 0; i -= 2 )\n {\n if( listeners[i] == ChangeListener.class )\n {\n ((ChangeListener)listeners[i + 1]).stateChanged( e );\n }\n }\n }", "private void sendNotification() {\n }", "@Override\n public void onNodeTouched(int NodeId) {\n }", "void changed(DiscoveryEvent e);", "@Override\n public void setNodeStatesForUpdate(int iNode) {\n }", "protected T registerNode(NodeDescriptor node) {\n\t\tT moduleNode = createModuleNode(node);\n \tsynchronized (nodes) {\n \t\tnodes.add(moduleNode);\n \t\tnodesMap.put(node, moduleNode);\n \t}\n\t\treturn moduleNode;\n\t}", "public void entryUpdated(MapEvent mapEvent) {\n String domain = mapEvent.getKey().toString();\n for (Map.Entry<NodeID, Set<String>[]> entry : nodeSessions.entrySet()) {\n // Get components hosted in this node\n Set<String> nodeComponents = entry.getValue()[COMPONENT_CACHE_IDX];\n nodeComponents.remove(domain);\n }\n // Trace nodes hosting the component\n entryInserted(mapEvent);\n }", "private void fireNodeUpdatedEvent(Node node)\n {\n Iterator iterator = clients.keySet().iterator();\n while (iterator.hasNext())\n {\n String key = (String) iterator.next();\n\n ScriptSession asession = clients.get(key);\n Util utilAll = new Util(asession);\n logger.info(\"Setting value on :\" + node.getId() + \" to #\" + node.getNumberOfMessagesHandled().toString());\n utilAll.setValue(node.getId(), node.getNumberOfMessagesHandled().toString());\n Effect effect = new Effect(asession); //, duration: 15\n effect.highlight(node.getId(), \"{ duration: 2, queue: {position: 'end', scope: '\" + node.getId() + \"', limit:1}}\"); //\"{startcolor:'e6e6fa', queue: {position: 'end', scope: 'price', limit:1}}\");\n // highlight a row\n // effect.highlight(\"row_\" + node.getId(), \"{ duration: 1, queue: {position: 'end', scope: 'row_\" + node.getId() + \"', limit:1}}\"); //\"{startcolor:'e6e6fa', queue: {position: 'end', scope: 'price', limit:1}}\");\n }\n }", "void notifyMessage(Task task);", "public StatusChecker(Node node){\n this.node=node;\n start();\n }", "default void updateNode(\n com.google.cloud.tpu.v2alpha1.UpdateNodeRequest request,\n io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {\n io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUpdateNodeMethod(), responseObserver);\n }", "public void doNotify(){\n\t\tsynchronized(m){\n\t\t\tm.notifyAll();\n\t\t}\n\t}", "@Transactional\n public abstract void updateNode(OnmsNode node);", "public void nodeAdded(GraphEvent e);", "@Override\n public void run() {\n ShellResponse response =\n getNodeManager().nodeCommand(NodeManager.NodeCommandType.Configure, taskParams());\n processShellResponse(response);\n\n if (taskParams().type == UpgradeUniverse.UpgradeTaskType.Everything\n && !taskParams().updateMasterAddrsOnly) {\n // Check cronjob status if installing software.\n response = getNodeManager().nodeCommand(NodeManager.NodeCommandType.CronCheck, taskParams());\n\n // Create an alert if the cronjobs failed to be created on this node.\n if (response.code != 0) {\n Universe universe = Universe.getOrBadRequest(taskParams().universeUUID);\n Customer cust = Customer.get(universe.customerId);\n String alertErrCode = \"CRON_CREATION_FAILURE\";\n String nodeName = taskParams().nodeName;\n String alertMsg =\n \"Universe %s was successfully created but failed to \"\n + \"create cronjobs on some nodes (%s)\";\n\n // Persist node cronjob status into the DB.\n UniverseUpdater updater =\n new UniverseUpdater() {\n @Override\n public void run(Universe universe) {\n UniverseDefinitionTaskParams universeDetails = universe.getUniverseDetails();\n NodeDetails node = universe.getNode(nodeName);\n node.cronsActive = false;\n LOG.info(\n \"Updated \"\n + nodeName\n + \" cronjob status to inactive from universe \"\n + taskParams().universeUUID);\n }\n };\n saveUniverseDetails(updater);\n\n // Create new alert or update existing alert with current node name if alert already exists.\n if (Alert.exists(alertErrCode, universe.universeUUID)) {\n Alert cronAlert = Alert.list(cust.uuid, alertErrCode, universe.universeUUID).get(0);\n List<String> failedNodesList =\n universe\n .getNodes()\n .stream()\n .map(nodeDetail -> nodeDetail.nodeName)\n .collect(Collectors.toList());\n String failedNodesString = String.join(\", \", failedNodesList);\n cronAlert.update(String.format(alertMsg, universe.name, failedNodesString));\n } else {\n Alert.create(\n cust.uuid,\n universe.universeUUID,\n Alert.TargetType.UniverseType,\n alertErrCode,\n \"Warning\",\n String.format(alertMsg, universe.name, nodeName));\n }\n }\n\n // We set the node state to SoftwareInstalled when configuration type is Everything.\n // TODO: Why is upgrade task type used to map to node state update?\n setNodeState(NodeDetails.NodeState.SoftwareInstalled);\n }\n }", "private ClusterMonitor sendDummyMessage() {\n\t\tClusterMonitor.Builder cm = ClusterMonitor.newBuilder();\n\t\t//your cluster ID\n\t\tcm.setClusterId(0);\n\t\n\t\tcm.setTick(i++);\n\n\t\t\n\t\t//No of nodes in your cluster\n\t\tcm.setNumNodes(5);\n\t\t\n\t\t//Node Id = Process Id\n\t//\tcm.addProcessId(50);\n\t\t//cm.addProcessId(51);\n\t\t//cm.addProcessId(53);\n\t\t//cm.addProcessId(54);\n\t\t//cm.addProcessId(52);\n\t\t\n//\t\t/cm.set\n\t\t\n\t\t//Set processId,No of EnquedTask for that processId\n\t\t\n\t//\tcm.addEnqueued(19);\n\t\t\n\t//\tcm.addEnqueued(5);\n\t\t//Set processId,No of ProcessedTask for that processId\n\t//\tcm.addProcessed(3);\n\t\t//cm.addProcessed(3);\n\t\t//Set processId,No of StolenTask for that processId\n\t\t//cm.addStolen(2);\n\t\tcm.addStolen(2);\n\t\t\n\t\t//Increment tick every time you send the message, or else it would be ignored\n\t\t// Tick starts from 0\n\t\n\t\t\n\t\treturn cm.build();\n\t}", "void onModuleRemoved(ModularConfigurationModule<T> module) {\n for (String name : module.getNames()) {\n ModularConfigurationEntry<T> e = getIfExists(name);\n if (e != null) {\n e.onModuleRemoved(module);\n }\n }\n }", "public void setCorrespondingNode(MinesNode node) {\r\n\t\tcorrespondingNode = node;\r\n\t}", "public MonModuleInfo init(MNode Node, String param) {\n logger.log(Level.INFO, \"Timer Task Scheduled \");\n this.Node = Node;\n return info;\n }", "void refreshNodeHostCount(int nodeHostCount);", "private void sendHeartbeats() {\n\t\tHashSet<InetAddress> addresses = new HashSet<>(nodes.keySet());\n\t\t\n for (InetAddress addr : addresses) {\n\t\t\t// Take the mutex to ensure that no modifications are made to nodes\n\t\t\t// or channels while checking this node\n\t\t\tmutexLock.lock();\n\n // Check if the last heartbeat was responded to\n if (!nodes.containsKey(addr)) {\n mutexLock.unlock();\n continue;\n }\n\n NodeStatus node = nodes.get(addr);\n if (!(node.getLastResponse() == heartbeat.get())) {\n\n if (node.isAvailable()) {\n node.setAvailable(false);\n System.out.println(\"[\" + System.currentTimeMillis() + \" :: Node at \" + addr + \" is not available\");\n }\n }\n\n // Send the new heartbeat\n if (!channels.containsKey(addr)) {\n mutexLock.unlock();\n continue;\n }\n\n HeartbeatRequestMessage hrm = new HeartbeatRequestMessage(heartbeat.get()+1);\n SocketChannel channel = channels.get(addr);\n byte[] message = hrm.serialize();\n\n try {\n channel.write(ByteBuffer.wrap(message));\n } catch (ClosedChannelException cce) {\n channels.remove(addr);\n } catch (IOException e) {\n // Do something?\n }\n\n\t\t\t// Release the mutex\n\t\t\tmutexLock.unlock();\n }\n\n heartbeat.getAndIncrement();\n lastHeartbeatTime = System.currentTimeMillis();\n }", "public abstract Object notify(NotifyDescriptor descriptor);", "public synchronized void informModuleEndLoading(Module module) {\n\t\tModuleStat stat = getModuleStat(module);\n\t\tstat.waitLoading = false;\n\t}", "public void actionPerformed(ActionEvent e) {\n\t\tif (node != null) {\n\t\t\tnode.setExternal(!node.isExternal());\n\t\t\tChangeElementVisibilityAction changeVisibilityAction = new ChangeElementVisibilityAction(\n\t\t\t\t\t(GraphElement) node.getGraphNode().getContaineds().get(\n\t\t\t\t\t\t\tOPERATION_INDEX), !node.isExternal());\n\t\t\tmainFrame.handleActionEvent(changeVisibilityAction, node,\n\t\t\t\t\t\"Change graph element's visibility\");\n\n\t\t\tchangeVisibilityAction = new ChangeElementVisibilityAction(\n\t\t\t\t\t(GraphElement) node.getGraphNode().getContaineds().get(\n\t\t\t\t\t\t\tATTRIBUTE_INDEX), !node.isExternal());\n\t\t\tmainFrame.handleActionEvent(changeVisibilityAction, node,\n\t\t\t\t\t\"Change graph element's visibility\");\n\n\t\t\tUpdateNodeContainerAction updateNodeContainerAction = new UpdateNodeContainerAction(node, \"external properties of node is changed\");\n\t updateNodeContainerAction.setEventManager(mainFrame.getEventManager());\n\t try {\n\t\t\t\tupdateNodeContainerAction.execute();\n\t\t\t} catch (ActionExecutionException e1) {\n\t\t\t\t// ignore\n\t\t\t}\n\n\t\t}\n\t}", "@Override\r\n\tpublic void setNode(Node node) {\n\t\tthis.node = (MessagingNode) node;\r\n\t}", "public void addNotify() {\n super.addNotify();\n \n // Enter key in the tree\n /*\n ExplorerManager newManager = ExplorerManager.find(this);\n System.out.println(\"newManager=\"+newManager);\n if (newManager != manager) {\n if (manager != null) {\n manager.removeVetoableChangeListener(wlvc);\n manager.removePropertyChangeListener(wlpc);\n }\n \n manager = newManager;\n \n manager.addVetoableChangeListener(wlvc = WeakListeners.vetoableChange(nodeListener, manager));\n manager.addPropertyChangeListener(wlpc = WeakListeners.propertyChange(nodeListener, manager));\n //manager.addPropertyChangeListener(nodeListener);\n \n }\n */\n }", "public void setModuleListener(ModuleListener listener);", "public void notifyEvent(GrillEvent event) throws GrillException;", "@Override\n\tpublic void publishTopic(Node node) {\n\t\t\n\t}", "protected void preProcessModuleConfiguration(ConfigurationNode moduleConfig) {\n }", "public void setNodeService(final NodeService nodeService)\n {\n this.nodeService = nodeService;\n }", "void notifyStart();", "void notify(HorseFeverEvent e);", "public void setNodeService(NodeService nodeService) {\n\t\tthis.nodeService = nodeService;\n\t}", "private void totalCPUCores_EntityChanged(Object sender, EventArgs args) {\n removeCPUListeners();\n\n behavior.totalCpuCoresChanged();\n\n // start listening again\n addCPUListeners();\n }" ]
[ "0.7192632", "0.64979476", "0.64353746", "0.6124208", "0.60908324", "0.5912609", "0.56676173", "0.56607974", "0.56599694", "0.5598001", "0.55363196", "0.5534199", "0.5527813", "0.552418", "0.5506839", "0.55032617", "0.54942656", "0.5491038", "0.5485", "0.5465797", "0.54605925", "0.5454342", "0.5441237", "0.543379", "0.5411542", "0.54028416", "0.5393392", "0.5386953", "0.537213", "0.53650737", "0.5355016", "0.5345299", "0.5343283", "0.53244483", "0.5321294", "0.5320416", "0.5320225", "0.53123176", "0.5306886", "0.5299246", "0.52896756", "0.5275198", "0.52653044", "0.52516365", "0.5228615", "0.52206707", "0.521591", "0.5184484", "0.518413", "0.5172901", "0.5168841", "0.5161538", "0.51554495", "0.5142009", "0.5140232", "0.5133917", "0.5133632", "0.51317185", "0.51271003", "0.51123554", "0.51115835", "0.5111475", "0.5106006", "0.51032335", "0.5100626", "0.50884897", "0.5088437", "0.50882417", "0.5073364", "0.5071699", "0.50692844", "0.5062208", "0.5049844", "0.5045549", "0.50415343", "0.503977", "0.5034854", "0.50272536", "0.502143", "0.5015892", "0.5004329", "0.5004198", "0.49911678", "0.49903032", "0.49835643", "0.49811596", "0.49803653", "0.49742842", "0.49719736", "0.49712828", "0.49689522", "0.49662736", "0.49549836", "0.49526033", "0.4951008", "0.49502197", "0.49448997", "0.49415982", "0.49385002", "0.4935919" ]
0.85372984
0
registers a node, creating a module node for this node
protected T registerNode(NodeDescriptor node) { T moduleNode = createModuleNode(node); synchronized (nodes) { nodes.add(moduleNode); nodesMap.put(node, moduleNode); } return moduleNode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected T createModuleNode(NodeDescriptor node);", "public boolean registerNode(Node node, OutputStream out, boolean isRequestedRegistration) throws IOException;", "RegistrationModule createRegistrationModule();", "public boolean registerNode(Node node, String remoteHost, String remoteAddress, OutputStream out, boolean isRequestedRegistration) throws IOException;", "@SuppressWarnings(\"unchecked\")\n public void register()\n {\n this.phpProcessor.registerProcessorExtension(this);\n \n // Register the node type if specified\n if (this.nodeType != null)\n {\n try\n {\n QName type = QName.createQName(this.nodeType);\n Class clazz = Class.forName(this.extensionClass); \n this.nodeFactory.addNodeType(type, clazz);\n }\n catch (ClassNotFoundException exception)\n {\n throw new PHPProcessorException(\"Unable to load node type (\" + this.extensionClass + \")\", exception);\n }\n }\n }", "private void registerModule(Module module) {\n \t\tif (module.register()) {\n \t\t\t_availableModules.add(module);\n \t\t}\n \t}", "public NodeInformation registerNode(NodeName nodeName) throws IOTException {\n if (nodeCatalog.hasNode(nodeName)) {\n handleError(\"Cannot register node.. node already exists: \" + nodeName);\n return null;\n }\n \n NodeInformation nodeInformation = new NodeInformation(nodeName);\n nodeCatalog.addNode(nodeInformation);\n \n return nodeInformation;\n }", "public void addModule(IPModule module);", "public static SxpNode register(final SxpNode node) {\n NODES.put(NodeIdConv.toString(Preconditions.checkNotNull(node).getNodeId()), node);\n return node;\n }", "Module createModule();", "void register();", "public abstract void register();", "ModuleDefine createModuleDefine();", "public void register(){\n }", "private void register() {\n\t\tInetAddress iNA;\n\t\ttry {\n\t\t\tiNA = InetAddress.getLocalHost();\n\t\t\tmyIPAddress = iNA.getAddress();\n\t\t\tOverlayNodeSendsRegistration register = new OverlayNodeSendsRegistration(\n\t\t\t\t\tmyIPAddress, myServerThreadPortNum);\n\t\t\tthis.registry.getSender().sendData(register.getBytes());\n\t\t} catch (UnknownHostException e1) {\n\t\t\tSystem.out.println(e1.getMessage()\n\t\t\t\t\t+ \" Trouble sending registration event.\");\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(e.getMessage()\n\t\t\t\t\t+ \" Trouble sending registration event.\");\n\t\t}\n\t}", "static void register() {\n }", "public void markNodeAsRegistered(String nodeId);", "public Node registerPullOnlyNode(String externalId, String nodeGroupId, String databaseType, String databaseVersion) throws IOException;", "abstract protected void notifyModuleNode(T node);", "void addNode(int node);", "abstract protected boolean shouldRegister(NodeDescriptor node) throws NodeException;", "void nodeCreate( long id );", "public void AddNode(StubNode node) {\n\n }", "private final void createAndAddNode(String name) {\n\t}", "public void register(RegistrationData d) {}", "public void register(T t);", "ModuleDefinition createModuleDefinition();", "public void c2pAddModule(IPModule module);", "private void registerUiNode() {\n }", "void addNode(String node);", "public void addNode(NodeImpl node) {\n supervisedNodes.add(node);\n \n colorNodes();\n shortenNodeLabels();\n colorNodeLabels();\n colorNodeLabelBorders();\n }", "public void addModule(Module module, String name) {\n module.parentMobile = this;\n modules.put(name, module);\n if(module instanceof LightSource)\n Scene.addLightSource((LightSource) module);\n }", "void addNode(Node n) {\n nodes.put(n.id, n);\n }", "protected void __register()\n {\n }", "protected void __register()\n {\n }", "public void addNode(byte b, Node node) {\n nodes.put(b, node);\n }", "public void register(T o);", "void createNode(NodeKey key);", "private void AddMetaRegistrationInformation(Registration reg) {\n }", "public static int register() {\n\t\treturn 0;\n\t}", "public Register() {\n\t\tsuper();\n\t}", "private static void registerBlock(Block b)\n\t{\n\t}", "public NodeToJexl(TypeRegistry<String> registry) {\n this.registry = registry;\n }", "public void addNode(ConfigurationNode node)\n {\n if (node == null || node.getName() == null)\n {\n throw new IllegalArgumentException(\n \"Node to add must have a defined name!\");\n }\n node.setParentNode(null); // reset, will later be set\n\n if (nodes == null)\n {\n nodes = new ArrayList<ConfigurationNode>();\n namedNodes = new HashMap<String, List<ConfigurationNode>>();\n }\n\n nodes.add(node);\n List<ConfigurationNode> lst = namedNodes.get(node.getName());\n if (lst == null)\n {\n lst = new LinkedList<ConfigurationNode>();\n namedNodes.put(node.getName(), lst);\n }\n lst.add(node);\n }", "boolean addNode(long idNum, String label);", "private Node addNode(String nodeName)\r\n\t{\r\n\t final Node n = new Node(nodeName, attributes, numNodes());\r\n\t if (nodeMap.put(nodeName, n) != null)\r\n\t\tthrow new RuntimeException(\"Node <\"+n+\"> already exists!\");\r\n\t return n;\r\n\t}", "@Override\n public ModularConfigurationEntry<T> add(\n final String name,\n final ConfigurationNode config)\n {\n ModularConfigurationEntry<T> entry = get(name);\n try {\n if (entry.isReadOnly()) {\n return getDefaultModule().add(name, config);\n } else {\n entry.setConfig(config);\n return entry;\n }\n } catch (ReadOnlyModuleException ex) {\n throw new IllegalStateException(\"Unexpected read-only module exception\", ex);\n }\n }", "@Override\r\n\tpublic void register() {\n\t\t\r\n\t}", "public void reOpenRegistration(String nodeId);", "public void beginRegister() {}", "public void registerWithServer();", "public void testAddModule() {\n\t System.out.println(\"addModule\");\n\t Module module = module1;\n\t Student instance = student1;\n\t instance.addModule(module);\n\t }", "public static void register () {\n channel = NetworkRegistry.newSimpleChannel(CHANNEL_NAME, ()->PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals);\n\n cprCartSchedule.register();\n cprStationOrders.register();\n }", "public void register(Node node, Database db){\n\t\tdatabases.add(db);\n\t\tdbByName.put(db.getName(), db);\n\t\tdbToNode.put(db, node);\n\t\tnodeToDbs.get(node).add(db);\n\t}", "public static void registerNode(Socket registrySocket, int portNum, String hostname)\n\t{\n\t\ttry \n\t\t{\n\t\t\tTCPSender registerMe = new TCPSender(registrySocket); // send registry socket to be used to send data to the Registry.\n\t\t\tRegistrationRequestMessage registerMsg = new RegistrationRequestMessage();\n\t\t\tbyte[] msgBytes = registerMsg.getRegistrationBytes(portNum, registrySocket); // get the marshalled registration msg.\n\t\t\tregisterMe.sendData(msgBytes); // send this registration msg to the registry.\n\t\t\t\n\t\t} catch (IOException e) {\n\t\t\tSystem.err.println(\"registerNode got error \" + e.getMessage());\n\t\t} \n\t}", "public RubyModule defineModule(String name) {\n return defineModuleUnder(name, objectClass);\n }", "private void addNodeToGyroPlaceManager(ARNode node)\n {\n ARGyroPlaceManager gyroPlaceManager = ARGyroPlaceManager.getInstance();\n gyroPlaceManager.initialise();\n gyroPlaceManager.getWorld().addChild(node);\n }", "public void addNode() {\r\n \r\n Nod nod = new Nod(capacitate_noduri);\r\n numar_noduri++;\r\n noduri.add(nod);\r\n }", "public void registerObject(NetObject object);", "@Override\n public void register() {\n }", "public void addNode (NodeState node) throws RepositoryException, IOException\n\t{\n\t}", "public RubyModule defineModuleUnder(String name) {\n return getRuntime().defineModuleUnder(name, this);\n }", "NodeReader addNode(VNFTypeReader type, String hostName) throws AllocationException, ServiceException;", "public String openRegistration(String nodeGroupId, String externalId);", "void newNode(int nodeId) {\n window.newNode(nodeId);\n }", "void addNode()\n {\n Node newNode = new Node(this.numNodes);\n this.nodeList.add(newNode);\n this.numNodes = this.numNodes + 1;\n }", "protected void registerSubNode(String msisdn, RBTNode node) {\n\t\tsynchronized (_monitorNodeMap) {\n\t\t\tif (!_monitorNodeMap.containsKey(msisdn)) {\n\t\t\t\tnode.setNodeStartTime(new Date());\n\t\t\t\t_monitorNodeMap.put(msisdn, node);\n\t\t\t}\n\t\t}\n\t}", "public void addModule(Module m) {\n feed.getModules().add(m);\n }", "protected void addNode( String workspaceName,\n NodeKey key,\n Path path,\n Name primaryType,\n Set<Name> mixinTypes,\n Properties properties ) {\n }", "public static void register() {\n Registry.register(Registry.BLOCK, new Identifier(\"cultivation\", \"sieve_block\"), SIEVE_BLOCK);\n Registry.register(Registry.ITEM, new Identifier(\"cultivation\", \"sieve_block\"), new BlockItem(SIEVE_BLOCK, new Item.Settings().group(Cultivation.GROUP)));\n Registry.register(Registry.BLOCK, new Identifier(\"cultivation\", \"pod_shell\"), POD_SHELL);\n }", "private void addNode(NeuralNode node) {\r\n\t\tinnerNodes.add(node);\r\n\t}", "void register(Opcode opcode);", "public RubyModule defineOrGetModuleUnder(String name) {\n // This method is intended only for defining new modules in Ruby code\n Ruby runtime = getRuntime();\n IRubyObject moduleObj = getConstantAt(name);\n RubyModule module;\n if (moduleObj != null) {\n if (!moduleObj.isModule()) throw runtime.newTypeError(name + \" is not a module\");\n if (runtime.getSafeLevel() >= 4) throw runtime.newSecurityError(\"extending module prohibited\");\n module = (RubyModule)moduleObj;\n } else if (classProviders != null && (module = searchProvidersForModule(name)) != null) {\n // reopen a java module\n } else {\n module = RubyModule.newModule(runtime, name, this, true); \n }\n return module;\n }", "void createNode(String path);", "private void add_node(Node node) {\n if (this.nodes.get(node.name) != null) {\n throw new RuntimeException(\"Node \" + node.name + \" already exists!\");\n }\n this.nodes.put(node.name, node);\n this.bars.put(node.name, new TreeMap<String, Bar>());\n }", "void register(RegisterData data) throws Exception;", "void registerProvidesModule(Node n, String file, String namespace) {\n FileModule module;\n if (fileToModule.containsKey(file)) {\n if (fileToModule.get(file).isGoogModule) {\n compiler.report(\n JSError.make(\n n,\n GentsErrorManager.GENTS_MODULE_PASS_ERROR,\n String.format(\"goog.provide cannot be used in the same file as goog.module.\")));\n return;\n }\n module = fileToModule.get(file);\n } else {\n module = new FileModule(file, false);\n }\n module.jsNamespaces.add(namespace);\n module.registerNamespaceToGlobalScope(namespace);\n }", "private MockTopologyNode createMockNode(MockTopologyNode parent, String nodeName, String typeHint, long freq,\n long timestamp, Boolean isId, Boolean isReplace){\n final MockTopologyNode result = (MockTopologyNode) parent.createNode(nodeName);\n result.setTypeHint(typeHint);\n result.setReplace(isReplace);\n result.setIsIdentity(isId);\n result.setNodeFrequency(freq);\n result.setNodeTimestamp(timestamp);\n\n return result;\n}", "TNode createTNode();", "public NonceHelperImpl(Node node) {\n\t\tthis.node = node;\n\t}", "private static RegistryKey<World> register(String name){\n return RegistryKey.of(Registry.WORLD_KEY, new Identifier(Shurlin.MODID, name));\n }", "void addHasNodeID(Integer newHasNodeID);", "private void register()\n {\n ScControlRegistry r = getRegistry();\n\n _key = r.getNextKey();\n r.register(this);\n }", "@Override\n\tpublic String createNode(String type,String name,String time,String loca,String phone, String desc,String axisId ) {\n\t\tNode node = new Node(type, name, time, loca, phone, desc, axisId);\n\t\thibernatedao.insert(null, node);\n\t\treturn node.getId();\n\t}", "public void add(DefaultGraphCell node) {\n nodes.add(node);\n groupObject.add(node);\n fragmentName.append(((NodeData)node.getUserObject()).getName() + \" \");\n \n }", "protected void addNode(INode node) {\n\n if (node != null) {\n\n this.ids.add(node.getID());\n this.nodeMap.put(node.getID(), node);\n }\n }", "protected void submitNewNode(NNode node) {\n\t\tNNode newnode = new NNode(node);\n\t\tnodes.put(newnode.ID, newnode);\n\t}", "public ProgramModule createRootModule(String treeName) throws DuplicateNameException;", "public RubyModule defineModuleUnder(String name, RubyModule parent) {\n IRubyObject moduleObj = parent.getConstantAt(name);\n \n boolean parentIsObject = parent == objectClass;\n \n if (moduleObj != null ) {\n if (moduleObj.isModule()) return (RubyModule)moduleObj;\n \n if (parentIsObject) {\n throw newTypeError(moduleObj.getMetaClass().getName() + \" is not a module\");\n } else {\n throw newTypeError(parent.getName() + \"::\" + moduleObj.getMetaClass().getName() + \" is not a module\");\n }\n }\n \n return RubyModule.newModule(this, name, parent, !parentIsObject);\n }", "int register(String clazz, String method, String branch);", "public void addNode(Node node) {\n\t\tnodes.add(node);\n\t}", "void addNodeMetadata(int node, String key, String value);", "public void addNode(Node p_node) {\n\t\tnodes.add(p_node);\n\t}", "void add(Member node, long now);", "private void register() throws IOException {\n while( true ) {\n try {\n dnRegistration = namenode.register( dnRegistration );\n break;\n } catch( SocketTimeoutException e ) { // namenode is busy\n LOG.info(\"Problem connecting to server: \" + getNameNodeAddr());\n try {\n Thread.sleep(1000);\n } catch (InterruptedException ie) {}\n }\n }\n if( storage.getStorageID().equals(\"\") ) {\n storage.setStorageID( dnRegistration.getStorageID());\n storage.writeAll();\n }\n }", "public Object register(HttpServletRequest req);", "public void addNode(INode node) {\r\n\t\tnodeList.add(node);\r\n\t}", "public void registerState(Model model, Node node)\n {\n statesModel.registerState(model, node);\n }", "POperand createPOperand();", "public Node addNode(String node) {\n return nodeRepository.save(new Node(node));\n }" ]
[ "0.74404836", "0.66176593", "0.6616358", "0.6523498", "0.64989066", "0.63919574", "0.6339021", "0.62284577", "0.61027473", "0.5969868", "0.5952841", "0.59224224", "0.58458656", "0.5794461", "0.57608", "0.5758625", "0.57301116", "0.56823486", "0.56602603", "0.56600475", "0.5600366", "0.5588913", "0.5584808", "0.55800813", "0.5547086", "0.5508001", "0.5487977", "0.54831415", "0.54792035", "0.5466824", "0.54512113", "0.544989", "0.5413564", "0.5408618", "0.5408618", "0.5385961", "0.53817946", "0.53749716", "0.53668994", "0.5365843", "0.5351011", "0.53318584", "0.5327956", "0.5326322", "0.53103447", "0.5300466", "0.52919817", "0.52871346", "0.52759135", "0.5274848", "0.5249371", "0.5249345", "0.52387464", "0.5225623", "0.5224808", "0.5211592", "0.52104646", "0.5200094", "0.51964086", "0.51936656", "0.5184889", "0.5179534", "0.51764727", "0.51761127", "0.51754194", "0.51737803", "0.5161641", "0.5145614", "0.51369107", "0.5135001", "0.51328605", "0.5121631", "0.51170915", "0.5117004", "0.51167583", "0.51135355", "0.51131785", "0.5112935", "0.5112618", "0.51103926", "0.5110096", "0.5099222", "0.50967914", "0.50829464", "0.5081701", "0.5075941", "0.50758064", "0.50756913", "0.5075379", "0.5074025", "0.50636625", "0.5063555", "0.50578094", "0.5056926", "0.5051472", "0.5051369", "0.5050899", "0.5039454", "0.503628", "0.5035481" ]
0.8009086
0
Contains static methods to parse commands. Created by sautin1 on 9/30/14.
public interface CommandParser { String[] splitStringIntoCommands(String string); String[] splitCommandIntoParams(String string); String convertArrayToString(String... stringArray); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Command parse() throws ParseException {\n next();\n expect(Token.COMMAND);\n cmd = new Command(text);\n next();\n while (!((token == Token.WHERE) || (token == Token.RETURN) || (token == Token.EOL))) {\n param();\n }\n if (token == Token.WHERE) {\n where();\n }\n if (token == Token.RETURN) {\n returns();\n }\n expect(Token.EOL);\n return cmd;\n }", "public static Command parseCommand(String response) {\n String[] command = response.split(\" \", 10);\n switch (command[0]) {\n case \"list\":\n return new ListCommand(command);\n case \"done\":\n case \"undo\":\n return new DoneUndoCommand(command);\n case \"remove\":\n return new RemoveCommand(command);\n case \"add\":\n return new AddCommand(command, response);\n case \"bye\":\n return new ByeCommand();\n case \"help\":\n return new HelpCommand();\n case \"find\":\n return new FindCommand(command, response);\n case \"update\":\n return new UpdateCommand(command);\n default:\n System.out.println(\"Im sorry i did not catch that maybe these instructions below will help\"\n + System.lineSeparator() + Interface.lineBreak);\n return new HelpCommand();\n }\n }", "private Command parseCommand(String input) {\r\n\r\n String[] splittedInput = input.toUpperCase().split(\" \");\r\n String command = splittedInput[0];\r\n\r\n switch (command) {\r\n case \"PLACE\":\r\n return new PlaceCommand(input);\r\n case \"MOVE\":\r\n return new MoveCommand();\r\n case \"LEFT\":\r\n return new RotateLeftCommand();\r\n case \"RIGHT\":\r\n return new RotateRightCommand();\r\n case \"REPORT\":\r\n return new ReportCommand();\r\n default:\r\n return new IgnoreCommand();\r\n }\r\n }", "@Override\n public Command parseCommand(String commandText, ViewController viewController, Cli cli) throws InvalidCommandException {\n\n String prefix = \"\";\n String suffix = \"\";\n\n for (int i = 0;i<commandText.length();i++){\n if (commandText.charAt(i) != ' '){\n prefix = prefix + commandText.charAt(i);\n } else {\n for (i++;i<commandText.length();i++)\n suffix = suffix + commandText.charAt(i);\n }\n }\n\n\n if (prefix.equals(\"\"))\n throw new InvalidCommandException();\n\n switch(prefix){\n case \"exit\" : {\n return new ExitCommand();\n }\n case \"help\" : {\n return new HelpCommand();\n }\n case \"showGameboard\" : {\n return new ShowGameBoardCommand(cli);\n }\n case \"showMarket\" : {\n return new ShowMarketCommand(cli);\n }\n case \"showPlayer\" : {\n\n int n = 0;\n int temp;\n boolean found = false;\n\n for (int i = 0; i < suffix.length() && !found; i++) {\n if ( suffix.charAt(i) != ' '){\n temp = suffix.charAt(i) -'0';\n if (temp < 0 || temp > 9)\n throw new InvalidCommandException();\n n = temp;\n found = true;\n }\n\n }\n if (n < 1 || n > 4)\n throw new InvalidCommandException();\n return new ShowPlayerCommand(n, viewController);\n\n }\n case \"showProductionDecks\" : {\n return new ShowProductionDeckCommand(cli);\n }\n case \"showReserve\" : {\n return new ShowReserveCommand(cli);\n }\n default: {\n throw new InvalidCommandException();\n }\n }\n\n }", "public CommandType parseCommand() {\n try {\n extractCommand();\n extractParameters();\n parameterData = new ParameterParser(commandType, parameters).processParameters();\n executeCommand();\n } catch (IllegalCommandException e) {\n commandUi.printInvalidCommand();\n } catch (IndexOutOfBoundsException e) {\n commandUi.printInvalidParameters();\n } catch (MissingTaskLiteralException e) {\n commandUi.printMissingLiteral(e.getMessage());\n } catch (NumberFormatException e) {\n commandUi.printTaskDoneNotInteger();\n } catch (DateTimeFormatException e) {\n commandUi.printDateTimeFormatIncorrect();\n }\n\n return commandType;\n }", "private static void parse(String[] command, Player player) {\n\t\t\n\t\t\n\t}", "public Command parseCommand(String userInput) throws ParseException {\n final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim());\n if (!matcher.matches()) {\n throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE));\n }\n\n final String commandWord = matcher.group(\"commandWord\");\n final String arguments = matcher.group(\"arguments\");\n switch (commandWord) {\n\n // ========================== Easy Travel Commands =========================\n case HelpCommand.COMMAND_WORD:\n return new HelpCommand();\n\n case ExitCommand.COMMAND_WORD:\n return new ExitCommand();\n\n // ========================== Trip Commands =========================\n case SetTripCommand.COMMAND_WORD:\n return new SetTripCommandParser().parse(arguments);\n\n case DeleteTripCommand.COMMAND_WORD:\n return new DeleteTripCommand();\n\n case CheckStatusCommand.COMMAND_WORD:\n return new CheckStatusCommand();\n\n case EditBudgetCommand.COMMAND_WORD:\n return new EditBudgetCommandParser().parse(arguments);\n\n case RenameCommand.COMMAND_WORD:\n return new RenameCommandParser().parse(arguments);\n // ========================== Schedule Commands =========================\n case ScheduleCommand.COMMAND_WORD:\n return new ScheduleCommandParser().parse(arguments);\n\n case UnscheduleCommand.COMMAND_WORD:\n return new UnscheduleCommandParser().parse(arguments);\n\n case ListScheduleCommand.COMMAND_WORD:\n return new ListScheduleCommand();\n\n // ========================== Fixed Expense Commands =========================\n case AddFixedExpenseCommand.COMMAND_WORD:\n return new AddFixedExpenseCommandParser().parse(arguments);\n\n case ClearFixedExpenseCommand.COMMAND_WORD:\n return new ClearFixedExpenseCommand();\n\n case DeleteFixedExpenseCommand.COMMAND_WORD:\n return new DeleteFixedExpenseCommandParser().parse(arguments);\n\n case EditFixedExpenseCommand.COMMAND_WORD:\n return new EditFixedExpenseCommandParser().parse(arguments);\n\n case CheckBudgetStatus.COMMAND_WORD:\n return new CheckBudgetStatus();\n\n case SortFixedExpenseCommand.COMMAND_WORD:\n return new SortFixedExpenseCommandParser().parse(arguments);\n\n case ListFixedExpenseCommand.COMMAND_WORD:\n return new ListFixedExpenseCommand();\n\n // ========================== Transport Booking Commands =========================\n case AddTransportBookingCommand.COMMAND_WORD:\n return new AddTransportBookingCommandParser().parse(arguments);\n\n case EditTransportBookingCommand.COMMAND_WORD:\n return new EditTransportBookingCommandParser().parse(arguments);\n\n case DeleteTransportBookingCommand.COMMAND_WORD:\n return new DeleteTransportBookingCommandParser().parse(arguments);\n\n case ClearTransportBookingCommand.COMMAND_WORD:\n return new ClearTransportBookingCommand();\n\n case SortTransportBookingCommand.COMMAND_WORD:\n return new SortTransportBookingCommandParser().parse(arguments);\n\n case ListTransportBookingCommand.COMMAND_WORD:\n return new ListTransportBookingCommand();\n\n // ========================== Packing List Commands =========================\n case AddItemCommand.COMMAND_WORD:\n return new AddItemCommandParser().parse(arguments);\n\n case AddPresetCommand.COMMAND_WORD:\n return new AddPresetCommandParser().parse(arguments);\n\n case CheckItemCommand.COMMAND_WORD:\n return new CheckItemCommandParser().parse(arguments);\n\n case ClearItemCommand.COMMAND_WORD:\n return new ClearItemCommand();\n\n case DeleteItemCommand.COMMAND_WORD:\n return new DeleteItemCommandParser().parse(arguments);\n\n case EditItemCommand.COMMAND_WORD:\n return new EditItemCommandParser().parse(arguments);\n\n case FindItemCommand.COMMAND_WORD:\n return new FindItemCommandParser().parse(arguments);\n\n case FindItemCategoryCommand.COMMAND_WORD:\n return new FindItemCategoryCommandParser().parse(arguments);\n\n case UncheckItemCommand.COMMAND_WORD:\n return new UncheckItemCommandParser().parse(arguments);\n\n case ListItemCommand.COMMAND_WORD:\n return new ListItemCommand();\n\n case ListPresetCommand.COMMAND_WORD:\n return new ListPresetCommand();\n\n case SortItemCommand.COMMAND_WORD:\n return new SortItemCommandParser().parse(arguments);\n\n\n // ========================== Activity Commands =========================\n case AddActivityCommand.COMMAND_WORD:\n return new AddActivityCommandParser().parse(arguments);\n\n case DeleteActivityCommand.COMMAND_WORD:\n return new DeleteActivityCommandParser().parse(arguments);\n\n case ClearActivityCommand.COMMAND_WORD:\n return new ClearActivityCommand();\n\n case EditActivityCommand.COMMAND_WORD:\n return new EditActivityCommandParser().parse(arguments);\n\n case FindActivityCommand.COMMAND_WORD:\n return new FindActivityCommandParser().parse(arguments);\n\n case FindActivityTagCommand.COMMAND_WORD:\n return new FindActivityTagCommandParser().parse(arguments);\n\n case ListActivityCommand.COMMAND_WORD:\n return new ListActivityCommand();\n\n case SortActivityCommand.COMMAND_WORD:\n return new SortActivityCommandParser().parse(arguments);\n\n // ========================== Accommodation Commands =========================\n case AddAccommodationBookingCommand.COMMAND_WORD:\n return new AddAccommodationBookingCommandParser().parse(arguments);\n\n case ClearAccommodationBookingCommand.COMMAND_WORD:\n return new ClearAccommodationBookingCommand();\n\n case DeleteAccommodationBookingCommand.COMMAND_WORD:\n return new DeleteAccommodationBookingCommandParser().parse(arguments);\n\n case EditAccommodationBookingCommand.COMMAND_WORD:\n return new EditAccommodationBookingCommandParser().parse(arguments);\n\n case SortAccommodationBookingCommand.COMMAND_WORD:\n return new SortAccommodationBookingParser().parse(arguments);\n\n case ListAccommodationBookingCommand.COMMAND_WORD:\n return new ListAccommodationBookingCommand();\n\n // ========================== Invalid Commands =========================\n default:\n throw new ParseException(MESSAGE_UNKNOWN_COMMAND);\n }\n }", "private Command parseCommand(String s) {\n\t\tif (constantMatch.matcher(s).matches()) {\n\t\t\treturn new Constant(Double.parseDouble(s));\n\t\t}\n\t\tif (variableMatch.matcher(s).matches()) {\n\t\t\treturn myDictionary.getVariable(s);\n\t\t}\n\t\tif (s.equals(START_LIST)) {\n\t\t\treturn createListCommand();\n\t\t}\n\t\tif(s.equals(START_GROUP)) {\n\t\t\tCommand c = getCommandOrFunction(codeReader.next());\n\t\t\tif(c.howManyArguments() <= 0) {\n\t\t\t\tthrow new SLogoException(\"Attempting to group command that takes no arguments\");\n\t\t\t}\n\t\t\tcreateGroupCommand(c); \n\t\t\treturn c;\n\t\t}\n\t\treturn findTrueCommand(s);\n\t}", "@Test\n\tpublic void parseCommandTest() {\n\t\tassertFalse(myManager.parseCommand(\"quit\"));\n\t\tassertFalse(myManager.parseCommand(\"Quit\"));\n\t\tassertFalse(myManager.parseCommand(\"q uit\"));\n\t\t\n\t\tassertTrue(myManager.parseCommand(\"new job\"));\n\t\tassertTrue(myManager.parseCommand(\"NEW job\"));\n\t\tassertTrue(myManager.parseCommand(\"new\"));\n\t\tassertFalse(myManager.parseCommand(\"new jobzo\"));\n\t}", "@Override\n public Command parseCommand(String commandText, ViewController viewController, Cli cli) throws InvalidCommandException {\n\n System.out.println(this+\": \"+commandText);\n String word = \"\";\n Resource resource;\n String prefix = \"\";\n String suffix = \"\";\n boolean found = false;\n ArrayList<Resource> resources = new ArrayList<>();\n\n if (commandText.length() == 0)\n throw new InvalidCommandException();\n\n commandText = Command.deleteInitSpaces(commandText);\n\n for (int i = 0;i<commandText.length();i++){\n if (commandText.charAt(i) != ' '){\n prefix = prefix + commandText.charAt(i);\n } else {\n for (i++;i<commandText.length();i++)\n suffix = suffix + commandText.charAt(i);\n }\n }\n\n if (prefix.equals(\"coin\") || prefix.equals(\"rock\") || prefix.equals(\"shield\") || prefix.equals(\"servant\")){\n\n resource = Command.fromStringToResource(prefix);\n resources.add(resource);\n\n for (int i = 0;i<suffix.length();i++){\n if (suffix.charAt(i) != ' '){\n word = word + suffix.charAt(i);\n } else {\n resource = Command.fromStringToResource(word);\n if(resource != null )\n for(Resource r : possibleResources)\n if (r == resource)\n resources.add(resource);\n word = \"\";\n }\n }\n resource = Command.fromStringToResource(word);\n if(resource != null )\n for(Resource r : possibleResources)\n if (r == resource)\n resources.add(resource);\n\n if (resources.size() != numberOfWhiteMarbles){\n throw new InvalidCommandException();\n }\n return new WhiteMarbleCommand(resources,cli);\n } else {\n switch (prefix) {\n case \"exit\": {\n return new ExitCommand();\n }\n case \"help\": {\n return new HelpCommand();\n }\n case \"showGameboard\": {\n return new ShowGameBoardCommand(cli);\n }\n case \"showMarket\": {\n return new ShowMarketCommand(cli);\n }\n case \"showPlayer\": {\n\n int n = 0;\n int temp;\n found = false;\n\n for (int i = 0; i < suffix.length() && !found; i++) {\n if (suffix.charAt(i) != ' ') {\n temp = suffix.charAt(i) - '0';\n if (temp < 0 || temp > 9)\n throw new InvalidCommandException();\n n = temp;\n found = true;\n }\n\n }\n if (n < 1 || n > 4)\n throw new InvalidCommandException();\n return new ShowPlayerCommand(n, viewController);\n\n }\n case \"showProductionDecks\": {\n return new ShowProductionDeckCommand(cli);\n }\n case \"showReserve\": {\n return new ShowReserveCommand(cli);\n }\n default: {\n throw new InvalidCommandException();\n }\n }\n }\n }", "public Command parse(String inputCommand) {\n Matcher matcher = BASIC_COMMAND_FORMAT.matcher(inputCommand.trim());\n if (!matcher.matches()) {\n return new IncorrectCommand(\"This is a incorrect format, \"\n + \" you may type the list to see all the commands.\"\n + \" the command should not contain the separator '|'\");\n }\n\n String commandWord = matcher.group(\"commandWord\");\n String arguments = matcher.group(\"arguments\");\n\n switch (commandWord) {\n case AddCommand.COMMAND_WORD:\n return prepareAdd(arguments);\n case ListCommand.COMMAND_WORD:\n return prepareList(arguments);\n\n case DoneCommand.COMMAND_WORD:\n return prepareDone(arguments);\n case DueCommand.COMMAND_WORD:\n return prepareDue(arguments);\n case DeleteCommand.COMMAND_WORD:\n return prepareDelete(arguments);\n\n case SetCommand.COMMAND_WORD:\n return prepareSet(arguments);\n\n case ExitCommand.COMMAND_WORD:\n return new ExitCommand();\n\n case ProjModeCommand.COMMAND_WORD:\n return new ProjModeCommand();\n\n // case HelpCommand.COMMAND_WORD:\n // default:\n // return new HelpCommand();\n\n default:\n return new IncorrectCommand(\"IncorrectCommand\");\n }\n\n }", "public CommandParser(){\n setLanguage(\"ENGLISH\");\n commandTranslations = getPatterns(new String[] {TRANSLATION});\n commands = new ArrayList<>();\n addErrors();\n }", "public static Command parse(String fullCommand) throws DukeException {\n String[] arr = fullCommand.split(\"\\\\s+\", 2);\n String command = arr[0];\n if (command.equals(\"todo\")) {\n if (arr.length == 1) {\n throw new DukeException(\"OOPS!!! The description of a todo cannot be empty.\");\n } else {\n Task task = new Todo(arr[1]);\n return new AddCommand(task);\n }\n } else if (command.equals(\"deadline\")) {\n if (arr.length == 1) {\n throw new DukeException(\"OOPS!!! The description of a deadline cannot be empty.\");\n } else {\n String[] deadlineArr = arr[1].split(\" /by \", 2);\n if (deadlineArr.length == 1) {\n throw new DukeException(\"OOPS!!! You forgot to specify a date/time for the deadline.\");\n } else {\n Task task = new Deadline(deadlineArr[0], deadlineArr[1]);\n return new AddCommand(task);\n }\n }\n } else if (command.equals(\"event\")) {\n if (arr.length == 1) {\n throw new DukeException(\"OOPS!!! The description of an event cannot be empty.\");\n } else {\n String[] eventArr = arr[1].split(\" /at \", 2);\n if (eventArr.length == 1) {\n throw new DukeException(\"OOPS!!! You forgot to specify a date/time for the event.\");\n } else {\n Task task = new Event(eventArr[0], eventArr[1]);\n return new AddCommand(task);\n }\n }\n } else if (command.equals(\"done\")) {\n String[] array = arr[1].split(\"\\\\s+\");\n int[] options = new int[array.length];\n for (int i = 0; i < options.length; i++) {\n options[i] = Integer.parseInt(array[i]);\n }\n return new DoneCommand(options);\n } else if (command.equals(\"delete\")) {\n String[] array = arr[1].split(\"\\\\s+\");\n int[] options = new int[array.length];\n for (int i = 0; i < options.length; i++) {\n options[i] = Integer.parseInt(array[i]);\n }\n return new DeleteCommand(options);\n } else if (command.equals(\"list\")) {\n return new ListCommand();\n } else if (command.equals(\"find\")) {\n return new FindCommand(arr[1]);\n } else if (command.equals(\"bye\")) {\n return new ExitCommand();\n } else {\n throw new DukeException(\"OOPS!!! I'm sorry, but I don't know what that means :-(\");\n }\n }", "final public void basicCommand() throws ParseException {\n if (jj_2_75(4)) {\n if (jj_2_55(4)) {\n jj_consume_token(MOVE);\n numero();\n } else if (jj_2_56(4)) {\n jj_consume_token(RIGHT);\n numero();\n } else if (jj_2_57(4)) {\n jj_consume_token(LEFT);\n numero();\n } else if (jj_2_58(4)) {\n jj_consume_token(ROTATE);\n numero();\n } else if (jj_2_59(4)) {\n jj_consume_token(DROP);\n numero();\n } else if (jj_2_60(4)) {\n jj_consume_token(FREE);\n numero();\n } else if (jj_2_61(4)) {\n jj_consume_token(PICK);\n numero();\n } else if (jj_2_62(4)) {\n jj_consume_token(POP);\n numero();\n } else if (jj_2_63(4)) {\n jj_consume_token(BLOCKEDP);\n } else if (jj_2_64(4)) {\n jj_consume_token(NOP);\n } else if (jj_2_65(4)) {\n jj_consume_token(LOOK);\n if (jj_2_49(4)) {\n jj_consume_token(N);\n } else if (jj_2_50(4)) {\n jj_consume_token(E);\n } else if (jj_2_51(4)) {\n jj_consume_token(W);\n } else if (jj_2_52(4)) {\n jj_consume_token(S);\n } else {\n jj_consume_token(-1);\n throw new ParseException();\n }\n } else if (jj_2_66(4)) {\n jj_consume_token(CHECK);\n if (jj_2_53(4)) {\n jj_consume_token(C);\n } else if (jj_2_54(4)) {\n jj_consume_token(B);\n } else {\n jj_consume_token(-1);\n throw new ParseException();\n }\n numero();\n } else if (jj_2_67(4)) {\n block();\n } else if (jj_2_68(4)) {\n repeat();\n } else if (jj_2_69(4)) {\n conditional();\n } else if (jj_2_70(4)) {\n define();\n } else if (jj_2_71(4)) {\n function();\n } else if (jj_2_72(4)) {\n funcall();\n } else if (jj_2_73(4)) {\n varcall();\n } else {\n jj_consume_token(-1);\n throw new ParseException();\n }\n } else {\n label_13:\n while (true) {\n if (jj_2_74(4)) {\n ;\n } else {\n break label_13;\n }\n jj_consume_token(34);\n }\n }\n }", "public static Command parse(String input) throws DukeException {\r\n String[] inputArr = input.split(\" \", 2);\r\n String command = inputArr[0];\r\n\r\n switch (command) {\r\n case \"bye\":\r\n return new ExitCommand();\r\n case \"list\":\r\n return new ListCommand();\r\n case \"done\":\r\n try {\r\n return new DoneCommand(inputArr[1]);\r\n } catch (ArrayIndexOutOfBoundsException e) {\r\n throw new DukeException(\"Please specify the task number you wish to\\n mark as done!\");\r\n }\r\n case \"delete\":\r\n try {\r\n return new DeleteCommand(inputArr[1]);\r\n } catch (ArrayIndexOutOfBoundsException e) {\r\n throw new DukeException(\"Please specify the task number you wish to\\n delete!\");\r\n }\r\n case \"todo\":\r\n try {\r\n return new AddCommand(new Todo(inputArr[1]));\r\n } catch (ArrayIndexOutOfBoundsException e) {\r\n throw new DukeException(\"The description of a todo cannot be empty.\");\r\n }\r\n case \"deadline\":\r\n try {\r\n String[] detailsArr = inputArr[1].split(\" /by \");\r\n return new AddCommand(new Deadline(detailsArr[0], detailsArr[1]));\r\n } catch (ArrayIndexOutOfBoundsException e) {\r\n throw new DukeException(\r\n \"Please follow the format:\\n deadline <description> /by <DD/MM/YYYY HHMM>\");\r\n }\r\n case \"event\":\r\n try {\r\n String[] detailsArr = inputArr[1].split(\" /at \");\r\n return new AddCommand(new Event(detailsArr[0], detailsArr[1]));\r\n } catch (ArrayIndexOutOfBoundsException e) {\r\n throw new DukeException(\r\n \"Please follow the format:\\n event <description> /at <DD/MM/YYYY HHMM>\");\r\n }\r\n case \"find\":\r\n try {\r\n return new FindCommand(inputArr[1]);\r\n } catch (ArrayIndexOutOfBoundsException e) {\r\n throw new DukeException(\"Please specify what you are searching for!\");\r\n }\r\n default:\r\n throw new DukeException(\"I'm sorry, but I don't know what that means!\");\r\n }\r\n }", "public Command parse(String command) throws DukeException {\n String[] commandSplit = command.split(\"\\\\s+\", 2);\n String commandWord = commandSplit[0].toLowerCase();\n String desc = \"\";\n if (commandSplit.length == 2) {\n desc = commandSplit[1];\n }\n\n switch (commandWord) {\n case DoneCommand.COMMAND_WORD:\n return doneParse(desc);\n\n case ListCommand.COMMAND_WORD:\n return new ListCommand();\n\n case ToDoCommand.COMMAND_WORD:\n return toDoParse(desc);\n\n case DeadlineCommand.COMMAND_WORD:\n return deadlineParse(desc);\n\n case EventCommand.COMMAND_WORD:\n return eventParse(desc);\n\n case DeleteCommand.COMMAND_WORD:\n return deleteParse(desc);\n\n case FindCommand.COMMAND_WORD:\n return new FindCommand(desc);\n case UpdateCommand.COMMAND_WORD:\n return new UpdateParser(desc).parse();\n case ByeCommand.COMMAND_WORD:\n return new ByeCommand();\n default:\n throw new DukeException(INVALID_COMMAND_MESSAGE);\n }\n }", "static Command parse(String text) throws ParseException {\n Parser parser = new Parser(text);\n return parser.parse();\n }", "public static Command parseCommand(String command) throws DukeException {\n try {\n String[] args = getArgs(command.trim());\n String commandWord = args[0];\n boolean isOneWord = isOneWord(command.trim());\n\n if (isOneWord) {\n switch (commandWord.toLowerCase()) {\n case \"list\":\n return new ListCommand();\n case \"bye\":\n return new ExitCommand();\n case \"listtag\":\n return new ListTagCommand();\n default:\n throw new DukeException(MESSAGE_INVALID_INPUT);\n }\n\n } else {\n switch (commandWord.toLowerCase()) {\n case \"todo\":\n return new AddTodo(args[1]);\n case \"deadline\":\n return new AddDeadline(args[1]);\n case \"event\":\n return new AddEvent(args[1]);\n case \"done\":\n return new DoneCommand(args[1]);\n case \"delete\":\n return new DeleteCommand(args[1]);\n case \"find\":\n return new FindCommand(args[1]);\n case \"findtag\":\n return new FindTagCommand(args[1]);\n case \"addtag\":\n return new AddTagCommand(args[1]);\n case \"deltag\":\n return new DeleteTagCommand(args[1]);\n default:\n throw new DukeException(MESSAGE_INVALID_INPUT);\n }\n }\n\n } catch (ArrayIndexOutOfBoundsException e) {\n throw new DukeException(MESSAGE_INVALID_INPUT);\n }\n }", "public Command parse(String fullCommand) throws InvalidInputException, UnknownException {\n checkDelimiters(fullCommand);\n String[] tokens = fullCommand.split(\"\\\\s+\");\n\n // If tokenized command returns an empty array (entered a string with only white spaces),\n // raise an exception\n if (tokens.length == 0) {\n throw new InvalidInputException(InvalidInputException.Type.EMPTY_STRING);\n }\n // If first token (command) is empty, there are empty spaces typed in at the front - so we remove it\n if (tokens[0].isEmpty()) {\n tokens = Arrays.copyOfRange(tokens, 1, tokens.length);\n // Check again to make sure it is not empty after removing first element\n if (tokens.length == 0) {\n throw new InvalidInputException(InvalidInputException.Type.EMPTY_STRING);\n }\n }\n\n HashMap<String, String> arguments = new HashMap<>();\n // Conver input command to lowercase to make it case insensitive\n String command = tokens[0].toLowerCase();\n arguments.put(\"command\", command);\n\n // Default key is \"payload\"\n String key = \"payload\";\n ArrayList<String> values = new ArrayList<>();\n for (int i = 1; i < tokens.length; ++i) {\n String token = tokens[i];\n // Check whether this token is a new key\n if (!token.isEmpty() && token.charAt(0) == '/') {\n // If it is, save current value into the map and start a new k-v pair\n arguments.put(key, String.join(DELIMITER, values));\n key = token.substring(1);\n values.clear();\n } else {\n // If not, append this token to the end of the value\n values.add(token);\n }\n }\n\n // Store the last k-v pair\n // Store even when `values` is empty, as that indicates an empty string\n arguments.put(key, String.join(DELIMITER, values));\n\n // Initialize a respective class from the command (by capitalize first character)\n String className = command + \"Command\";\n className = className.substring(0, 1).toUpperCase() + className.substring(1);\n className = Constants.COMMAND_CLASS_PREFIX + className;\n try {\n Class<?> cls = Class.forName(className);\n Constructor<?> constructor = cls.getDeclaredConstructor(Ui.class, Data.class, HashMap.class);\n Object obj = constructor.newInstance(ui, data, arguments);\n return (Command) obj;\n } catch (ClassNotFoundException classNotFoundException) {\n // *Command class cannot be found!\n throw new InvalidInputException(InvalidInputException.Type.UNKNOWN_COMMAND, classNotFoundException);\n } catch (Exception exception) {\n // Some other weird error occurred here (e.g. dev bugs)\n // We should NEVER reach this block, if we do, log under the highest level\n throw new UnknownException(exception);\n }\n }", "private void extractCommand() throws IllegalCommandException {\n if (userInput.contentEquals(COMMAND_WORD_BYE)) {\n commandType = CommandType.BYE;\n } else if (userInput.startsWith(COMMAND_WORD_LIST)) {\n commandType = CommandType.LIST;\n } else if (userInput.startsWith(COMMAND_WORD_DONE)) {\n commandType = CommandType.DONE;\n } else if (userInput.startsWith(COMMAND_WORD_TODO)) {\n commandType = CommandType.TODO;\n } else if (userInput.startsWith(COMMAND_WORD_DEADLINE)) {\n commandType = CommandType.DEADLINE;\n } else if (userInput.startsWith(COMMAND_WORD_EVENT)) {\n commandType = CommandType.EVENT;\n } else if (userInput.startsWith(COMMAND_WORD_DELETE)) {\n commandType = CommandType.DELETE;\n } else if (userInput.startsWith(COMMAND_WORD_FIND)) {\n commandType = CommandType.FIND;\n } else if (userInput.contentEquals(COMMAND_WORD_HELP)) {\n commandType = CommandType.HELP;\n } else {\n throw new IllegalCommandException();\n }\n }", "public ArrayList<Command> parseCommand(String command) throws InvalidCommandException {\n\n\n\t\tArrayList<Command> cmds = new ArrayList<Command>();\n\t\tString cmd;\n\t\tString[] text;\n\n\t\tArrayList<Parameter> parameters = new ArrayList<Parameter>();\n\n\t\tint indexOfFirstSpace = 0;\n\t\tint indexOfFirstInvertedSlash = 0;\n\t\tboolean passFirstSpace = false;\n\n\t\t// check and find the first space and slash.\n\t\tfor (int i = 0; i < command.length(); i++) {\n\t\t\tif (command.charAt(i) == ' ' && !passFirstSpace) {\n\t\t\t\tindexOfFirstSpace = i;\n\t\t\t\tpassFirstSpace = true;\n\t\t\t} else if (command.charAt(i) == INVERTED_SLASH) {\n\t\t\t\tindexOfFirstInvertedSlash = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tindexOfFirstSpace = getEquivalentIndexForCommandWithoutParameter(command, indexOfFirstSpace);\n\n\t\tif (indexOfFirstSpace == 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tcmd = command.substring(0, indexOfFirstSpace);\n\t\tint cmdType = mapCommandType(cmd);\n\n\t\tif (cmdType == ERROR_COMMAND_TYPE) {\n\t\t\tthrow new InvalidCommandException(command);\n\t\t}\n\n\t\tif (!command.contains(VERTICAL_DASH)) {\n\t\t\tperformSmartParsing(command, parameters);\n\t\t}\n\n\t\ttext = extractTextAndPerformParameterParsing(command, parameters, indexOfFirstSpace, indexOfFirstInvertedSlash);\n\t\tif (text != null) {\n\t\t\tfor (String textEntry : text) {\n\t\t\t\tcmds.add(new Command(cmdType, trimOffDateIfAny(textEntry), parameters));\n\n\t\t\t}\n\t\t} else {\n\t\t\tcmds.add(new Command(cmdType, \"\", parameters));\n\t\t}\n\n\t\treturn cmds;\n\t}", "public static String parseCommand(String command) {\n String keyWord = \"\";\n if (command.startsWith(\"list\")) {\n keyWord = \"list\";\n } else if (command.startsWith(\"notes\")) {\n keyWord = \"notes\";\n } else if (command.startsWith(\"done\")) {\n keyWord = \"done\";\n } else if (command.startsWith(\"delete note\")) {\n keyWord = \"delete note\";\n } else if (command.startsWith(\"delete\")) {\n keyWord = \"delete\";\n } else if (command.startsWith(\"todo\")) {\n keyWord = \"todo\";\n } else if (command.startsWith(\"deadline\")) {\n keyWord = \"deadline\";\n } else if (command.startsWith(\"event\")) {\n keyWord = \"event\";\n } else if (command.startsWith(\"today\")) {\n keyWord = \"today\";\n } else if (command.startsWith(\"find\")) {\n keyWord = \"find\";\n } else if (command.startsWith(\"bye\")) {\n keyWord = \"bye\";\n } else if (command.startsWith(\"note\")) {\n keyWord = \"note\";\n }\n return keyWord;\n }", "public static Command parse(String fullCommand) throws DukeException {\n\n String firstWord = null;\n if(fullCommand.contains(\" \")) {\n firstWord = fullCommand.substring(0, fullCommand.indexOf(\" \"));\n }\n\n if (fullCommand.equals(\"bye\")) {\n return new ExitCommand();\n } else if (fullCommand.equals(\"list\")) {\n return new ListCommand();\n } else if (firstWord.equals(\"todo\")) {\n return new AddCommand(Command.Type.TODO,fullCommand);\n } else if (firstWord.equals(\"deadline\")) {\n return new AddCommand(Command.Type.DEADLINE,fullCommand);\n } else if (firstWord.equals(\"event\")) {\n return new AddCommand(Command.Type.EVENT,fullCommand);\n } else if (firstWord.equals(\"done\")) {\n return new DoneCommand(fullCommand);\n } else if (firstWord.equals(\"find\")) {\n return new FindCommand(fullCommand);\n } else if (firstWord.equals(\"delete\")) {\n return new DeleteCommand(fullCommand);\n } else {\n throw new DukeException(\" ☹ OOPS!! I'm sorry, but I don't know what that means :-(\");\n }\n }", "public static Command parse(String command) throws DukeException {\n // remove trailing/leading whitespace and split by whitespace(s)\n command = command.strip();\n String[] commands = command.split(\"[ ]+\");\n String[] args = Arrays.copyOfRange(commands, 1, commands.length);\n\n assert args.length == commands.length - 1 : \"Incorrect array copy\";\n\n switch (commands[0]) {\n case \"todo\":\n return parseTodoCommand(args);\n case \"event\":\n return parseEventCommand(args);\n case \"deadline\":\n return parseDeadlineCommand(args);\n case \"find\":\n return parseFindCommand(args);\n case \"done\":\n return parseDoneCommand(args);\n case \"delete\":\n return parseDeleteCommand(args);\n case \"list\":\n return parseListCommand(args);\n case \"remindme\":\n return parseRemindCommand(args);\n case \"bye\":\n return parseBye(args);\n default:\n throw new DukeMissingDescriptionException(\"Hmm... I'm sorry, but I don't know what that means...\");\n }\n }", "java.lang.String getCommand();", "void parseCommand(String command){\n\t\tif(command!=null && command.length()>0){\n\t\t\tif(!subMenuFlag){\n\t\t\t\tmainMenuCommand(command);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tsubMenuCommand(command);\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(\"Please enter a valid command.\");\n\t\t}\n\t}", "public String[] readCommand();", "@Override\n\tpublic Command parse(String[] s) {\n\t\tif (s.length==1 && s[0].equalsIgnoreCase(\"HELP\"))\n\t\t\treturn new Help(); \n\t\telse return null;\n\t}", "public Command parse(String userInput, TaskList taskList) throws CommandException {\n String fullInput = parseShortcutCommandAndDetails(userInput);\n String[] commandAndDetails = fullInput.split(COMMAND_WORD_DELIMITER, 2);\n String commandType = commandAndDetails[0];\n String taskInfo = \"\";\n if (commandAndDetails.length > 1) {\n taskInfo = commandAndDetails[1];\n }\n int namePos = taskInfo.indexOf(NAME_DELIMITER);\n int timePos = taskInfo.indexOf(TIME_DELIMITER);\n int durationPos = taskInfo.indexOf(DURATION_DELIMITER);\n int deadlinePos = taskInfo.indexOf(DEADLINE_DELIMITER);\n int recurrencePos = taskInfo.indexOf(RECURRENCE_DELIMITER);\n int importancePos = taskInfo.indexOf(IMPORTANCE_DELIMITER);\n int addNotesPos = taskInfo.indexOf(ADDITIONAL_NOTES_DELIMITER);\n int forecastPos = taskInfo.indexOf(FORECAST_DELIMITER);\n switch (commandType) {\n case \"add\": {\n return parseAddCommand(taskInfo, namePos, timePos, durationPos, deadlinePos,\n recurrencePos, importancePos, addNotesPos);\n }\n case \"edit\": {\n return parseEditCommand(taskInfo, namePos, timePos, durationPos, deadlinePos,\n recurrencePos, importancePos, addNotesPos, taskList);\n }\n case \"list\": {\n return parseListCommand(taskInfo, importancePos, forecastPos);\n }\n case \"done\": {\n return parseDoneCommand(taskInfo);\n }\n case \"delete\": {\n return parseDeleteCommand(taskInfo);\n }\n case \"view\": {\n return parseViewCommand(taskInfo);\n }\n case \"help\": {\n return new HelpCommand();\n }\n case \"exit\": {\n return new ExitCommand();\n }\n default: {\n throw new InvalidCommandException();\n }\n }\n }", "public interface CommandInterface {\n\n\tpublic static class Commands\n\t{\n\t\tpublic static final String ABORT = \"ABOR\";\n\t\tpublic static final String ACCOUNT_INFO = \"ACCT\";\n\t\tpublic static final String AUTHENTICATION_DATA = \"ADAT\";\n\t\tpublic static final String ALLOCATE_DISK_SPACE = \"ALLO\";\n\t\tpublic static final String APPEND = \"APPE\";\n\t\tpublic static final String AUTHENTICATION_MECHANISM = \"AUTH\";\n\t\tpublic static final String GET_AVAILABLE_SPACE = \"AVBL\";\n\t\tpublic static final String CLEAR_COMMAND_CHANNEL = \"CCC\";\n\t\tpublic static final String CHANGE_TO_PARENT_DIRECTORY = \"CDUP\";\n\t\tpublic static final String CONFIDENTIALITY_PROTECTION_COMMAND = \"CONF\";\n\t\tpublic static final String SERVER_IDENTIFICATION = \"CSID\";\n\t\tpublic static final String CHANGE_WORKING_DIRECTORY = \"CWD\";\n\t\tpublic static final String DELETE_FILE = \"DELE\";\n\t\tpublic static final String GET_DIRECTORY_SIZE = \"DSIZ\";\n\t\tpublic static final String PRIVACY_PROTECTED = \"ENC\";\n\t\tpublic static final String SPECIFY_ADDRESS_AND_PORT = \"EPRT\";\n\t\tpublic static final String ENTER_EXTENDED_PASSIVE_MODE = \"EPSV\";\n\t\tpublic static final String GET_FEATURE_LIST = \"FEAT\";\n\t\tpublic static final String HELP = \"HELP\";\n\t\tpublic static final String GET_HOST_BY_NAME = \"HOST\";\n\t\tpublic static final String LANGUAGE_NEGOTIATION = \"LANG\";\n\t\tpublic static final String GET_FILES_LIST = \"LIST\";\n\t\tpublic static final String SPECIFY_LONGADDRESS_AND_PORT = \"LPRT\";\n\t\tpublic static final String ENTER_LONG_PASSIVE_MODE = \"LPSV\";\n\t\tpublic static final String GET_LAST_MODIFICATION_TIME = \"MDTM\";\n\t\tpublic static final String MODIFY_CREATION_TIME = \"MFCT\";\n\t\tpublic static final String MODIFY_FACT = \"MFF\";\n\t\tpublic static final String MODIFY_MODYFICATION_TIME = \"MFMT\";\n\t\tpublic static final String INTEGRITY_PROTECTION = \"MIC\";\n\t\tpublic static final String MAKE_DIRECTORY = \"MKD\";\n\t\tpublic static final String LIST_A_CONTENT = \"MLSD\";\n\t\tpublic static final String PROVIDES_DATA = \"MLST\";\n\t\tpublic static final String SET_TRANSFER_MODE = \"MODE\";\n\t\tpublic static final String LIST_OF_FILE_NAMES = \"NLST\";\n\t\tpublic static final String NO_OPERATION = \"NOOP\";\n\t\tpublic static final String SELECT_OPTIONS = \"OPTS\";\n\t\tpublic static final String AUTHENTICATION_PASSWORD = \"PASS\";\n\t\tpublic static final String ENTER_PASSIVE_MODE = \"PASV\";\n\t\tpublic static final String PROTECTION_BUFFER_SIZE = \"PBSZ\";\n\t\tpublic static final String SPECIFY_PORT = \"PORT\";\n\t\tpublic static final String DATA_CHANNEL_PROTECTION_LEVEL = \"PROT\";\n\t\tpublic static final String PRINT_WORKING_DIRECTORY = \"PWD\";\n\t\tpublic static final String DISCONNECT = \"QUIT\";\n\t\tpublic static final String REINITIALIZE = \"REIN\";\n\t\tpublic static final String RESTART = \"REST\";\n\t\tpublic static final String RETRIEVE_A_COPY = \"RETR\";\n\t\tpublic static final String REMOVE_DIRECTORY = \"RMD\";\n\t\tpublic static final String REMOVE_DIRECTORY_TREE = \"RMDA\";\n\t\tpublic static final String RENAME_FROM = \"RNFR\";\n\t\tpublic static final String RENAME_TO = \"RNTO\";\n\t\tpublic static final String SITE_SPECIFFIC_COMMAND = \"SITE\";\n\t\tpublic static final String SIZE_OF_FILE = \"SIZE\";\n\t\tpublic static final String MOUNT_FILE_STRUCTURE = \"SMNT\";\n\t\tpublic static final String USE_SINGLE_PORT_PASSIVE_MODE = \"SPSV\";\n\t\tpublic static final String GET_STATUS = \"STAT\";\n\t\tpublic static final String ACCEPT_AND_STORE = \"STOR\";\n\t\tpublic static final String STORE_FILE_UNIQUELY = \"STOU\";\n\t\tpublic static final String SET_FILE_TRANSFER_STRUCT = \"STRU\";\n\t\tpublic static final String GET_SYSTEM_TYPE = \"SYST\";\n\t\tpublic static final String GET_THUMBNAIL = \"THMB\";\n\t\tpublic static final String SET_TRANSFER_TYPE = \"TYPE\";\n\t\tpublic static final String AUTHENTICATION_USERNAME = \"USER\";\n\t}\n\t\n\t/**\n\t * Types of transmission.\n\t * @author P.Gajewski\n\t *\n\t */\n\tpublic static class TransmissionTypes\n\t{\n\t\tpublic static final String BINARY = \"I\";\n\t\tpublic static final String ASCII = \"A\";\n\t}\n\n\t/**\n\t * Inner class for responses from server.\n\t * @author P.Gajewski\n\t *\n\t */\n\tpublic static class ServerResonses\n\t{\n\t\t/**\n\t\t * 1xx replay codes.\n\t\t * @author P.Gajewski\n\t\t *\n\t\t */\n\t\tpublic static class PossitivePreliminaryReply\n\t\t{\n\t\t\tpublic static final String GENERAL = \"100\";\n\t\t\tpublic static final String RESTART_REPLY = \"110\";\n\t\t\tpublic static final String SERVICE_READY = \"120\";\t\n\t\t\tpublic static final String DATA_CONNECTION_ALREADY_OPENED = \"125\";\n\t\t\tpublic static final String FILE_STATUS_OKAY = \"150\";\n\t\t}\n\t\t\n\t\t/**\n\t\t * 2xx replay codes.\n\t\t * @author P.Gajewski\n\t\t *\n\t\t */\n\t\tpublic static class PossitiveCompletionReply\n\t\t{\n\t\t\tpublic static final String GENERAL = \"200\";\n\t\t\tpublic static final String SYSTEM_STATUS = \"211\";\n\t\t\tpublic static final String DIRECTORY_STATUS = \"212\";\n\t\t\tpublic static final String FILE_STATUS = \"213\";\n\t\t\tpublic static final String HELP_MESSAGE = \"214\";\n\t\t\tpublic static final String NAME_SYSTEM_TYPE = \"215\";\n\t\t\tpublic static final String READY_FOR_NEW_USER = \"220\";\n\t\t\tpublic static final String SERVICE_CLOSING_CONTROL_CONNECTION = \"221\";\n\t\t\tpublic static final String OPEN_DATA_CONNECTION = \"225\";\t\t\t\n\t\t\tpublic static final String CLOSING_DATA_CONNECTION = \"226\";\n\t\t\tpublic static final String PASSIVE_MODE = \"227\";\n\t\t\tpublic static final String LONG_PASSIVE_MODE = \"228\";\n\t\t\tpublic static final String EXTENDED_PASSIVE_MODE = \"229\";\n\t\t\tpublic static final String USER_LOG_IN = \"230\";\n\t\t\tpublic static final String USER_LOG_OUT = \"231\";\n\t\t\tpublic static final String LOGOUT_NOTED = \"232\";\n\t\t\tpublic static final String REQUESTED_OK = \"250\";\n\t\t\tpublic static final String PATHNAME_CREATED = \"257\";\t\t\t\n\t\t}\n\t\t\n\t\t/**\n\t\t * 3xx replay codes.\n\t\t * @author P.Gajewski\n\t\t *\n\t\t */\n\t\tpublic static class PositiveIntermediateReply\n\t\t{\n\t\t\tpublic static final String GENERAL = \"300\";\n\t\t\tpublic static final String USERNAME_OK_PASSWORD_NEEDED = \"331\";\n\t\t\tpublic static final String NEED_ACCOUNT_FOR_LOGIN = \"332\";\n\t\t\tpublic static final String REQUESTED_FILE_ACTION = \"350\";\n\t\t}\n\t\t\n\t\t/**\n\t\t * 4xx replay codes.\n\t\t * @author P.Gajewski\n\t\t *\n\t\t */\n\t\tpublic static class TransientNegativeCompletionReply\n\t\t{\n\t\t\tpublic static final String GENERAL = \"400\";\n\t\t\tpublic static final String SERVICE_NOT_AVAILABLE = \"421\";\n\t\t\tpublic static final String CANT_OPEN_DATA_CONNECTION = \"425\";\n\t\t\tpublic static final String CONNECTION_CLOSED = \"426\";\n\t\t\tpublic static final String INVALID_USERNAME_OR_PASSWORD = \"430\";\n\t\t\tpublic static final String REQUESTED_HOST_UNAVAILABLE = \"434\";\n\t\t\tpublic static final String REQUESTED_FILE_ACTION_NOT_TAKEN = \"450\";\n\t\t\tpublic static final String LOCAL_ERROR = \"451\";\n\t\t\tpublic static final String FILE_BUSY = \"452\";\t\n\t\t}\n\t\t\n\t\t/**\n\t\t * 5xx replay codes.\n\t\t * @author P.Gajewski\n\t\t *\n\t\t */\n\t\tpublic static class PermamentNegativeCompletionReply\n\t\t{\n\t\t\tpublic static final String GENERAL = \"500\";\n\t\t\tpublic static final String SYNTAX_ERROR = \"501\";\n\t\t\tpublic static final String COMMAND_NOT_IMPLEMENTED = \"502\";\n\t\t\tpublic static final String BAD_SEQUENCE_OF_COMMANDS = \"503\";\n\t\t\tpublic static final String COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER = \"504\";\n\t\t\tpublic static final String NOT_LOGGED_IN = \"530\";\n\t\t\tpublic static final String NEED_ACCOUNT_FOR_STORING_FILES = \"532\";\n\t\t\tpublic static final String POLICY_REQUIRES_SSL = \"534\";\n\t\t\tpublic static final String FILE_NOT_FOUND = \"550\";\n\t\t\tpublic static final String PAGE_TYPE_UNKNOWN = \"551\";\t\t\t\n\t\t\tpublic static final String EXCEEDED_STORAGE_ALLOCATION = \"552\";\n\t\t\tpublic static final String FILE_NAME_NOT_ALLOWED = \"553\";\t\t\n\t\t}\n\t\t\n\t\t/**\n\t\t * 6xx replay codes.\n\t\t * @author P.Gajewski\n\t\t *\n\t\t */\n\t\tpublic static class ProtectedReply\n\t\t{\n\t\t\tpublic static final String GENERAL = \"600\";\n\t\t\tpublic static final String INTEGRITY_PROTECTED_REPLY = \"631\";\n\t\t\tpublic static final String CONFIDENTIALITY_AND_INTEGRITY_PROTECTED_REPLY = \"632\";\t\t\t\n\t\t\tpublic static final String CONFIDENTIALITY_PROTECTED_REPLY = \"633\";\t\t\t\n\t\t}\n\t}\n\t\n\t/**\n\t * Language controller.\n\t */\n\tpublic final static LanguageController lc = LanguageController.getInstance();\n\t\n\tpublic void execute(FTPLexer lexer);\n}", "public static Commands parse(String fullCommand) throws InvalidCommandException {\n String[] inputs = fullCommand.split(\"\\\\s+\", 2);\n String commandType = inputs[0].trim().toUpperCase();\n checkCommands(commandType);\n return Commands.valueOf(commandType);\n }", "public String[] nextCommand() {\r\n String[] result = null;\r\n if (sc.hasNextLine()) {\r\n String temp = sc.next();\r\n if (temp.equals(\"insert\")) {\r\n result = new String[3];\r\n result[0] = \"insert\";\r\n temp = sc.nextLine().trim();\r\n result[1] = temp.split(\"<SEP>\")[0];\r\n result[2] = temp.split(\"<SEP>\")[1];\r\n }\r\n else if (temp.equals(\"remove\")) {\r\n result = new String[3];\r\n result[0] = \"remove\";\r\n result[1] = sc.next();\r\n result[2] = sc.nextLine().trim();\r\n }\r\n else if (temp.equals(\"print\")) {\r\n result = new String[2];\r\n result[0] = \"print\";\r\n result[1] = sc.nextLine().trim();\r\n }\r\n else {\r\n sc.nextLine();\r\n }\r\n return result;\r\n }\r\n return null;\r\n }", "public static String parse(String command) throws IOException {\n assert tasks.size() >= 0;\n\n if (command.equals(\"bye\")) {\n return executeExit();\n } else if (command.equals(\"list\")) {\n return executeList();\n } else if (command.equals(\"yes\") || command.equals(\"no\")) {\n return executeDuplicateHandling(command);\n } else if (command.startsWith(\"done\")) {\n return executeDone(command);\n } else if (command.startsWith(\"delete\")) {\n return executeDelete(command);\n } else if (command.startsWith(\"find\")) {\n return executeFind(command);\n } else {\n return executeTask(command);\n }\n }", "public static JaccsCommandHandler parseCommands(String str, JaccsCommandHandler command)throws JaccsCommandException \r\n\t{\r\n\t\tif (!(str != null))return null;\r\n\t\t\t\r\n\t\t\r\n\t\tString[] args = str.split(\" \");\r\n\t\tfor (int i = 0; i < args.length; i++) {\r\n\t\t\tif (args[i].startsWith(prefix)) \r\n\t\t\t{\r\n\t\t\t\tString tempString = args[i].substring(prefix.length());\r\n\r\n\t\t\t\tswitch (tempString) \r\n\t\t\t\t{\r\n\t\t\t\tcase \"noconjunctions\":\r\n\t\t\t\t\tcommand.setNoConjunctions(true);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"conjunctions\":\r\n\t\t\t\t\tcommand.setNoConjunctions(false);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"noreasons\":\r\n\t\t\t\t\tcommand.setNoReasons(true);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"reasons\":\r\n\t\t\t\t\tcommand.setNoReasons(false);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"counter\":\r\n\t\t\t\t\ti++;\r\n\t\t\t\t\tcommand.addCounterNames(args[i]);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"card\":\r\n\t\t\t\tcase \"arch\":\r\n\t\t\t\tcase \"name\":\r\n\t\t\t\t\ti += command.addName(args, i);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"quickspell\":\r\n\t\t\t\t\tcommand.setQuickSpells(true);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"fastspell\":\r\n\t\t\t\t\tcommand.setFastSpells(true);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"addword\":\r\n\t\t\t\t\tcommand.addWord(tempString.toLowerCase());\r\n\t\t\t\t}\r\n\t\t\t} \r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\tString ans = \"\";\r\n\t\t\t\tfor (int j = i; j < args.length; j++) \r\n\t\t\t\t{\r\n\t\t\t\t\tans = ans + args[j] + \" \";\r\n\t\t\t\t}\r\n\t\t\t\tcommand.text = ans;\r\n\t\t\t\treturn command;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\r\n\t}", "private void createCommands()\n{\n exitCommand = new Command(\"Exit\", Command.EXIT, 0);\n helpCommand=new Command(\"Help\",Command.HELP, 1);\n backCommand = new Command(\"Back\",Command.BACK, 1);\n}", "public void testParseCommands_Accuracy1() throws Exception {\r\n InputStream input = new FileInputStream(\"test_files/scripts/test/test_parse.txt\");\r\n DistributionScript script = new DistributionScript();\r\n target = new DistributionScriptParserImpl();\r\n target.parseCommands(input, script, null);\r\n\r\n assertEquals(\"The number of parsed commands shoule be equal.\", 10, script.getCommands().size());\r\n\r\n // verify the parsed commands, to simplify, pick up 2 items to check\r\n List<DistributionScriptCommand> cmds = script.getCommands();\r\n assertTrue(\"The command type should be right.\", cmds.get(0) instanceof DefineVariableCommand);\r\n DefineVariableCommand define = (DefineVariableCommand) cmds.get(0);\r\n assertEquals(\"The value should match.\", \"tests_dir\", getPrivateField(DefineVariableCommand.class, define, \"name\"));\r\n assertEquals(\"The value should match.\", \"%{comp_dir}/src/java/tests/%{package/name}\", getPrivateField(DefineVariableCommand.class, define, \"value\"));\r\n\r\n assertTrue(\"The command type should be right.\", cmds.get(2) instanceof UndefineVariableCommand);\r\n UndefineVariableCommand undefine = (UndefineVariableCommand) cmds.get(2);\r\n assertEquals(\"The value should match.\", \"varToUndefine\", getPrivateField(UndefineVariableCommand.class, undefine, \"name\"));\r\n }", "public Command parseCommand(String userInput, boolean isAllJobScreen) throws ParseException {\n final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim());\n if (!matcher.matches()) {\n throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE));\n }\n\n final String commandWord = matcher.group(\"commandWord\");\n final String arguments = matcher.group(\"arguments\");\n switch (commandWord) {\n\n case AddCommand.COMMAND_WORD:\n if (!isAllJobScreen) {\n throw new ParseException(MESSAGE_COMMAND_CANNOT_USE);\n }\n return new AddCommandParser().parse(arguments);\n\n case AddCommand.COMMAND_ALIAS:\n if (!isAllJobScreen) {\n throw new ParseException(MESSAGE_COMMAND_CANNOT_USE);\n }\n return new AddCommandParser().parse(arguments);\n\n case ImportResumesCommand.COMMAND_WORD:\n if (!isAllJobScreen) {\n throw new ParseException(MESSAGE_COMMAND_CANNOT_USE);\n }\n return new ImportResumesCommandParser().parse(arguments);\n\n case ImportResumesCommand.COMMAND_ALIAS:\n if (!isAllJobScreen) {\n throw new ParseException(MESSAGE_COMMAND_CANNOT_USE);\n }\n return new ImportResumesCommandParser().parse(arguments);\n\n case CreateJobCommand.COMMAND_WORD:\n return new CreateJobCommandParser().parse(arguments);\n\n case CreateJobCommand.COMMAND_ALIAS:\n return new CreateJobCommandParser().parse(arguments);\n\n case EditCommand.COMMAND_WORD:\n if (!isAllJobScreen) {\n throw new ParseException(MESSAGE_COMMAND_CANNOT_USE);\n }\n return new EditCommandParser().parse(arguments);\n\n case EditCommand.COMMAND_ALIAS:\n if (!isAllJobScreen) {\n throw new ParseException(MESSAGE_COMMAND_CANNOT_USE);\n }\n return new EditCommandParser().parse(arguments);\n\n case DeleteFilterCommand.COMMAND_WORD:\n return new DeleteFilterCommandParser().parse(arguments);\n\n case DeleteFilterCommand.COMMAND_ALIAS:\n return new DeleteFilterCommandParser().parse(arguments);\n\n case ClearFilterCommand.COMMAND_WORD:\n return new ClearFilterCommandParser().parse(arguments);\n\n case ClearFilterCommand.COMMAND_ALIAS:\n return new ClearFilterCommandParser().parse(arguments);\n\n case DeleteCommand.COMMAND_WORD:\n if (!isAllJobScreen) {\n throw new ParseException(MESSAGE_COMMAND_CANNOT_USE);\n }\n return new DeleteCommandParser().parse(arguments);\n\n case DeleteCommand.COMMAND_ALIAS:\n if (!isAllJobScreen) {\n throw new ParseException(MESSAGE_COMMAND_CANNOT_USE);\n }\n return new DeleteCommandParser().parse(arguments);\n\n case ClearCommand.COMMAND_WORD:\n if (!isAllJobScreen) {\n throw new ParseException(MESSAGE_COMMAND_CANNOT_USE);\n }\n return new ClearCommand();\n\n case ClearCommand.COMMAND_ALIAS:\n if (!isAllJobScreen) {\n throw new ParseException(MESSAGE_COMMAND_CANNOT_USE);\n }\n return new ClearCommand();\n\n case FilterCommand.COMMAND_WORD:\n return new FilterCommandParser().parse(arguments);\n\n case FilterCommand.COMMAND_ALIAS:\n return new FilterCommandParser().parse(arguments);\n\n case ListCommand.COMMAND_WORD:\n return new ListCommand();\n\n case ListCommand.COMMAND_ALIAS:\n return new ListCommand();\n\n case HistoryCommand.COMMAND_WORD:\n return new HistoryCommand();\n\n case HistoryCommand.COMMAND_ALIAS:\n return new HistoryCommand();\n\n case ExitCommand.COMMAND_WORD:\n return new ExitCommand();\n\n case ExitCommand.COMMAND_ALIAS:\n return new ExitCommand();\n\n case HelpCommand.COMMAND_WORD:\n return new HelpCommand();\n\n case HelpCommand.COMMAND_ALIAS:\n return new HelpCommand();\n\n case UndoCommand.COMMAND_WORD:\n return new UndoCommand();\n\n case UndoCommand.COMMAND_ALIAS:\n return new UndoCommand();\n\n case RedoCommand.COMMAND_WORD:\n return new RedoCommand();\n\n case RedoCommand.COMMAND_ALIAS:\n return new RedoCommand();\n\n case GenerateInterviewsCommand.COMMAND_WORD:\n return new GenerateInterviewsCommand();\n\n case ShowInterviewsCommand.COMMAND_WORD:\n return new ShowInterviewsCommand();\n\n case SetMaxInterviewsADayCommand.COMMAND_WORD:\n return new SetMaxInterviewsADayCommandParser().parse(arguments);\n\n case ClearInterviewsCommand.COMMAND_WORD:\n return new ClearInterviewsCommand();\n\n case GenerateAnalyticsCommand.COMMAND_WORD:\n return new AnalyticsCommandParser().parse(arguments);\n\n case SetBlockOutDatesCommand.COMMAND_WORD:\n return new SetBlockOutDatesCommandParser().parse(arguments);\n\n case DisplayJobCommand.COMMAND_WORD:\n return new DisplayJobCommandParser().parse(arguments);\n\n case DisplayJobCommand.COMMAND_ALIAS:\n return new DisplayJobCommandParser().parse(arguments);\n\n case MovePeopleCommand.COMMAND_WORD:\n return new MovePeopleCommandParser().parse(arguments);\n\n case MovePeopleCommand.COMMAND_ALIAS:\n return new MovePeopleCommandParser().parse(arguments);\n\n case DeleteJobCommand.COMMAND_WORD:\n return new DeleteJobCommandParser().parse(arguments);\n\n case DeleteJobCommand.COMMAND_ALIAS:\n return new DeleteJobCommandParser().parse(arguments);\n\n case AddListToJobCommand.COMMAND_WORD:\n return new AddListToJobCommandParser().parse(arguments);\n\n case AddListToJobCommand.COMMAND_ALIAS:\n return new AddListToJobCommandParser().parse(arguments);\n\n case RemoveFromListCommand.COMMAND_WORD:\n return new RemoveFromListCommandParser().parse(arguments);\n\n case RemoveFromListCommand.COMMAND_ALIAS:\n return new RemoveFromListCommandParser().parse(arguments);\n\n default:\n throw new ParseException(MESSAGE_UNKNOWN_COMMAND);\n }\n }", "String getCommand();", "public static void parseUserCommand (String userCommand) {\n ArrayList<String> commandTokens = new ArrayList<String>(Arrays.asList(userCommand.split(\" \")));\n \n\n /*\n * This switch handles a very small list of hard coded commands of known syntax.\n * You will want to rewrite this method to interpret more complex commands. \n */\n switch (commandTokens.get(0)) {\n \tcase \"show\":\n \t\tdisplay(userCommand);\n \t\tbreak;\n case \"select\":\n parseQueryString(userCommand);\n break;\n case \"drop\":\n System.out.println(\"STUB: Calling your method to drop items\");\n dropTable(userCommand);\n break;\n case \"create\":\n parseCreateString(userCommand);\n break;\n case \"insert\":\n parseInsertString(userCommand);\n break;\n case \"delete\":\n parseDeleteString(userCommand); \n break;\n case \"help\":\n help();\n break;\n case \"version\":\n displayVersion();\n break;\n case \"exit\":\n isExit = true;\n break;\n case \"quit\":\n isExit = true;\n break;\n default:\n System.out.println(\"Unknown command: \\\"\" + userCommand + \"\\\"\");\n break;\n }\n }", "private void parseCommand(String consoleLine){\r\n if(consoleLine.trim().equals(\"\")) {\r\n System.err.println(\"Blank line\");\r\n } else {\r\n ArrayList<String> cmdSplit = new ArrayList<>();\r\n\r\n //Split the line by spaces except between quotes and add to the cmdSplit ArrayList\r\n Matcher matcher = Pattern.compile(\"([^\\\"]\\\\S*|\\\".+?\\\")\\\\s*\").matcher(consoleLine);\r\n while(matcher.find()) cmdSplit.add(matcher.group(1).replace(\"\\\"\", \"\"));\r\n\r\n //Store the first element in a String command and the second element in a String name\r\n String command = cmdSplit.get(0);\r\n String name = \"\";\r\n consoleAppend(\"Command: \" + command);\r\n if(cmdSplit.size() > 1) {\r\n name = cmdSplit.get(1);\r\n consoleAppend(\"Name: \" + name);\r\n }\r\n /* COMMANDS BELOW\r\n * printnames: Prints the current list of clients\r\n *\r\n * search name: Searches for the client in the Vector and prints a String\r\n *\r\n * enable name: If the player is in the Vector, sends a ControlToken telling\r\n * them to enable their button.\r\n *\r\n * disable name: If the player is in the Vector, sends a ControlToken telling\r\n * them to disable their button.\r\n *\r\n * kick name: Close the socket for this player.\r\n *\r\n * move name <int> <obo>: Move the player a number of spaces. Include obo if you want the\r\n * player to move one tile at a time.\r\n */\r\n\r\n switch(command){\r\n //Prints the current list of clients\r\n case \"printnames\":\r\n if(clientThreads.size() == 0){\r\n consoleAppend(\"No clients are connected.\");\r\n }\r\n StringBuilder sbClientList = new StringBuilder();\r\n for(ClientHandler ch:clientThreads){\r\n sbClientList.append(String.format(\"Index: %-3d | Name: \\\"%s\\\"\\n\", clientThreads.indexOf(ch), ch.getName()));\r\n }\r\n consoleAppend(sbClientList.toString());\r\n break;\r\n\r\n //Gets an updated board\r\n case \"getboard\":\r\n requestBoard();\r\n break;\r\n\r\n// //Displays the updated board in a new window\r\n// case \"showboard\":\r\n// if(updatedGL != null) {\r\n// JFrame jfBoard = new JFrame();\r\n// jfBoard.setTitle(\"Current Board\");\r\n// jfBoard.add(updatedGL, BorderLayout.CENTER);\r\n// jfBoard.pack();\r\n// jfBoard.setVisible(true);\r\n// jfBoard.setDefaultCloseOperation(EXIT_ON_CLOSE);\r\n// } else {\r\n// consoleAppend(\"Board doesn't exist.\");\r\n// }\r\n// break;\r\n\r\n //Searches for a client in the Vector\r\n case \"search\":\r\n consoleAppend(searchClients(name));\r\n break;\r\n\r\n //Starts the game\r\n case \"startgame\":\r\n if(clientThreads.size() == 0){\r\n consoleAppend(\"Can't start the game, no players are connected.\");\r\n } else {\r\n consoleAppend(\"Starting game..\");\r\n TurnHandler th = new TurnHandler();\r\n th.start();\r\n }\r\n break;\r\n\r\n //Enables roll for a player\r\n case \"enable\":\r\n if(getIndex(name) != -1){\r\n consoleAppend(String.format(\"Attempting to enable %s's button...\\n\", name));\r\n clientThreads.get(getIndex(name)).enableClient();\r\n } else {\r\n consoleAppend(String.format(\"Could not enable button, client %s not found.\\n\", name));\r\n }\r\n break;\r\n\r\n //Disables roll for a player\r\n case \"disable\":\r\n if(getIndex(name) != -1){\r\n consoleAppend(String.format(\"Attempting to disable %s's button...\\n\", name));\r\n clientThreads.get(getIndex(name)).disableClient();\r\n } else {\r\n consoleAppend(String.format(\"Could not disable button, client %s not found.\\n\", name));\r\n }\r\n break;\r\n //Kick a player.\r\n case \"kick\":\r\n if(getIndex(name) != -1){\r\n consoleAppend(String.format(\"Attempting to kick %s...\\n\", name));\r\n try{\r\n clientThreads.get(getIndex(name)).mySocket.close();\r\n } catch(IOException ioe) {\r\n consoleAppend(\"Error: couldn't kick \" + name);\r\n ioe.printStackTrace();\r\n }\r\n } else {\r\n consoleAppend(String.format(\"Could not kick client %s, client %s not connected.\\n\", name, name));\r\n }\r\n break;\r\n\r\n //Move a player a number of tiles on all boards\r\n case \"move\":\r\n if (getIndex(name) != -1) {\r\n try {\r\n int tilesToMove = Integer.parseInt(cmdSplit.get(2));\r\n boolean oBo = false;\r\n if (cmdSplit.size() >= 4) {\r\n String oneByOne = cmdSplit.get(3);\r\n if (oneByOne.equals(\"obo\")) {\r\n oBo = true;\r\n }\r\n }\r\n sendCTToAll(new ControlToken(\r\n ControlToken.MOVECODE, name, tilesToMove, oBo));\r\n } catch (NumberFormatException nfe) {\r\n System.err.println(\"Invalid number of moves, please enter an integer.\");\r\n }\r\n } else {\r\n System.err.printf(\"Could not move client %s, client %s not connected.\\n\", name, name);\r\n }\r\n break;\r\n\r\n default:\r\n consoleAppend(\"Command not recognized.\");\r\n break;\r\n\r\n }\r\n }\r\n }", "static ParsedCommand parseCommand(String cmdline) {\n ParsedCommand res = new ParsedCommand();\n cmdline = cmdline.trim();\n String[] split = cmdline.split(\"\\\\/([-]?[a-zA-Z]*)\");\n List<String> args = new ArrayList<>();\n for (int i = 0; i < split.length; i++) {\n String[] tmp = split[i].split(\" \");\n for (int j = 0; j < tmp.length; j++) {\n if (tmp[j].length() > 0) {\n args.add(tmp[j]);\n }\n }\n }\n if (args.size() == 0) return null;\n res.argv.addAll(args);\n Pattern p = Pattern.compile(\"\\\\/([-]?[a-zA-Z]*)\");\n Matcher m = p.matcher(cmdline);\n while (m.find()) {\n String cur = m.group(1);\n if (cur.startsWith(\"-\")) {\n for (int i = 1; i < cur.length(); i++) {\n res.switches.remove(String.valueOf(cur.charAt(i)).toUpperCase());\n }\n } else {\n for (int i = 0; i < cur.length(); i++) {\n res.switches.add(String.valueOf(cur.charAt(i)).toUpperCase());\n }\n }\n }\n\n return res;\n }", "Commands createCommands();", "List<String> getCommands();", "public void parseCommand(byte command) throws Exception {\r\n\r\n\t switch(command){\r\n\t case Constants.ROTATE_LEFT:\r\n\t rotateLeft();\r\n\t break;\r\n\t case Constants.ROTATE_RIGHT:\r\n\t rotateRight();\r\n\t break;\r\n\t case Constants.MOVE:\r\n\t move();\r\n\t break;\r\n\t default:\r\n\t throw new Exception(\"Invalid signal\");\r\n\t }\r\n\t }", "public static Command parser(String input) {\r\n\t\tCommand command;\r\n\t\tif (input.equals(\"\")) {\r\n\t\t\treturn new CommandInvalid(\"User input cannot be empty\");\r\n\t\t}\r\n\r\n\t\tif ((command = parserAdd(input)) != null) {\r\n\t\t\tcurrent_status = NATURAL_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserEdit(input)) != null) {\r\n\t\t\tcurrent_status = NATURAL_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserShow(input)) != null) {\r\n\t\t\tcurrent_status = SHOW_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserExit(input)) != null) {\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserDelete(input)) != null) {\r\n\t\t\tcurrent_status = NATURAL_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserSave(input)) != null) {\r\n\t\t\tcurrent_status = NATURAL_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserClear(input)) != null) {\r\n\t\t\tcurrent_status = NATURAL_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserUndo(input)) != null) {\r\n\t\t\tcurrent_status = NATURAL_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserOpen(input)) != null) {\r\n\t\t\tcurrent_status = NATURAL_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserCheck(input)) != null) {\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserSearch(input)) != null) {\r\n\t\t\tcurrent_status = SEARCH_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserRedo(input)) != null) {\r\n\t\t\tcurrent_status = NATURAL_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserHelp(input)) != null) {\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserDisplayAll(input)) != null) {\r\n\t\t\tcurrent_status = NATURAL_STATE;\r\n\t\t\treturn command;\r\n\t\t} else if ((command = parserSort(input)) != null) {\r\n\t\t\tcurrent_status = SORT_STATE;\r\n\t\t\treturn command;\r\n\t\t}\r\n\t\treturn new CommandInvalid(\"Invalid Command. Please check 'Help' for proper input.\");\r\n\t}", "Commands getCommandes();", "protected Command parseCommandString(String commandString) {\n DslParser parser = new DslParser(new DslLexer(new StringReader(commandString)));\n\n Object parseResult = null;\n\n try {\n parseResult = parser.parse().value;\n } catch (Exception e) {\n //environment.error(String.format(\"Invalid command: \\\"%s\\\"\", command_string));\n }\n\n if (parseResult instanceof Command) {\n return (Command)parseResult;\n } else {\n //environment.error(String.format(\"Expected command object but got \\\"%s\\\"\",\n // parseResult));\n return new NullCommand();\n }\n }", "public void parse() {\n if (commandSeparate.length == 1) {\n parseTaskType();\n } else if (commandSeparate.length == 2) {\n parseTaskType();\n index = commandSeparate[1];\n taskName = commandSeparate[1];\n } else {\n parseTaskType();\n parseTaskName();\n parseTaskDate();\n }\n }", "public Command getCommand() {\n String userInput = in.nextLine();\n String[] words = userInput.split(\" \", 2);\n try {\n return new Command(words[0].toLowerCase(), words[1]);\n } catch (ArrayIndexOutOfBoundsException e) {\n return new Command(words[0].toLowerCase(), Command.BLANK_DESCRIPTION);\n }\n }", "private void parseCommand(String spokenString) {\n\t\tRuleParse parse = null;\n\t\ttry {\n\t\t\tparse = rules.parse(spokenString, null);\n\t\t} catch (GrammarException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tString[] result = parse.getTags();\n\n\t\tfor(String r:result){\n\t\t\tSystem.out.println(r);\n\t\t}\n\t}", "@Override\n\tpublic Command parse(String[] commandWords) {\n\t\tCommand comando = null;\n\t\tif(commandWords[0].equalsIgnoreCase(\"exit\") || commandWords[0].equalsIgnoreCase(\"e\"))\n\t\t\tcomando = new ExitCommand();\n\t\treturn comando;\n\t}", "private void registerCommands() {\n }", "private ConsoleCommand[] registerCommands(){\r\n\t\tHelpCommand help = new HelpCommand(this.application, \"Help\", \"?\");\r\n\t\t\r\n\t\tConsoleCommand[] commands = {\r\n\t\t\t\tnew WebServicesCommand(this.application, \"WebService\"),\r\n\t\t\t\tnew ScannerCommand(this.application, \"Scanner\"),\r\n\t\t\t\tnew ShowConfigCommand(this.application, \"System.Config\", \"Config\"),\r\n\t\t\t\tnew ShowStatsCommand(this.application, \"System.Stats\", \"Stats\"),\r\n\t\t\t\tnew ShutdownCommand(this.application, \"System.Shutdown\", \"Exit\", \"Shutdown\"),\r\n\t\t\t\tnew DisableUserCommand(this.application, \"User.Disable\"),\r\n\t\t\t\tnew EnableUserCommand(this.application, \"User.Enable\"),\r\n\t\t\t\tnew ListUsersCommand(this.application, \"User.List\"),\r\n\t\t\t\tnew SetPasswordCommand(this.application, \"User.SetPassword\"),\r\n\t\t\t\tnew UnlockUserCommand(this.application, \"User.Unlock\"),\r\n\t\t\t\tnew AddUserCommand(this.application, \"User.Add\"),\r\n\t\t\t\tnew ShowEventsCommand(this.application, \"ShowEvents\"),\r\n\t\t\t\tnew TaskListCommand(this.application, \"Task.List\"),\r\n\t\t\t\tnew TaskStopCommand(this.application, \"Task.Stop\"),\r\n\t\t\t\tnew EventLogLastCommand(this.application, \"EventLog.Last\"),\r\n\t\t\t\tnew EventLogViewCommand(this.application, \"EventLog.View\"),\r\n\t\t\t\thelp\r\n\t\t};\r\n\t\t\r\n\t\t\r\n\t\tdefaultCommand = help;\r\n\t\thelp.setCommands(commands);\r\n\t\t\r\n\t\treturn commands;\r\n\t}", "private ConsoleCommand mapConsoleCommand( String[] parsedString ){\r\n\t\t\r\n\t\tFileSystemService fileSysSrv = new FileSystemService();\r\n\t\tStringBuilder errorSB = new StringBuilder();\r\n\t\tConsoleCommand consoleCommand = new ConsoleCommand();\r\n\t\t\r\n\t\tconsoleCommand.setCommand( parsedString[ AppConstanst.COMMAND_IDX ] );\r\n\t\t\t\t\r\n\t\tif ( parsedString.length < AppConstanst.MIN_SCAN_PARAM ){\r\n\t\t\terrorSB.append( AppConstanst.NOT_ALL_REQ_COMMAND_SET ) ;\r\n\t\t} else {\r\n\t\t\t// VALIDATE INPUTDIR COMMAND\r\n\t\t\tconsoleCommand.setInputDir( parsedString[ AppConstanst.INPUT_DIR_IDX ] );\r\n\t\t\tif ( !AppConstanst.SCAN_INPUT_DIR.equals( consoleCommand.getInputDir() ) ){\r\n\t\t\t\terrorSB.append( AppConstanst.WRONG_REQ_COMMAND+\" \"+consoleCommand.getInputDir()+AppConstanst.MUST_BE+AppConstanst.SCAN_INPUT_DIR+\"\\n\" );\r\n\t\t\t}\r\n\t\t\tconsoleCommand.setInputDirValue( parsedString[ AppConstanst.INPUT_DIR_VALUE_IDX ] );\r\n\t\t\tif ( ! consoleCommand.getInputDirValue().matches( AppConstanst.ABS_PATH) ){\r\n\t\t\t\terrorSB.append( AppConstanst.ILLEGAL_INPUT_PATH + consoleCommand.getInputDirValue()+\"\\n\");\r\n\t\t\t}\r\n\t\t\t//CHECK IS INPUT DIR EXIST, IF NOT TRY CREATE IT\r\n\t\t if ( !fileSysSrv.isDirectoryExist( consoleCommand.getInputDirValue() ) ){\r\n\t\t \tif ( !fileSysSrv.makeDirectory( consoleCommand.getInputDirValue() ) ){\r\n\t\t \t\terrorSB.append( AppConstanst.INPUT_DIR_NOT_EXISTS + consoleCommand.getInputDirValue()+\"\\n\");\r\n\t\t \t};\r\n\t\t }\r\n\t\t\t// VALIDATE OUTPUTDIR COMMAND\r\n\t\t\tconsoleCommand.setOutPutDir( parsedString[ AppConstanst.OUTPUT_DIR_IDX ] );\r\n\t\t\tif ( !AppConstanst.SCAN_OUTPUT_DIR.equals( consoleCommand.getOutPutDir() ) ){\r\n\t\t\t\terrorSB.append( AppConstanst.WRONG_REQ_COMMAND+\" \"+consoleCommand.getOutPutDir()+AppConstanst.MUST_BE+AppConstanst.SCAN_OUTPUT_DIR+\"\\n\" );\r\n\t\t\t}\r\n\t\t\tconsoleCommand.setOutPutDirValue( parsedString[ AppConstanst.OUTPUT_DIR_VALUE_IDX ] );\r\n\t\t\tif ( ! consoleCommand.getOutPutDirValue().matches( AppConstanst.ABS_PATH) ){\r\n\t\t\t\terrorSB.append( AppConstanst.ILLEGAL_OUTPUT_PATH + consoleCommand.getOutPutDirValue()+\"\\n\" );\r\n\t\t\t}\r\n\t\t\t//CHECK IS OUTPUT DIR EXIST, IF NOT TRY CREATE IT\r\n\t\t if ( !fileSysSrv.isDirectoryExist( consoleCommand.getOutPutDirValue() ) ){\r\n\t\t \tif ( !fileSysSrv.makeDirectory( consoleCommand.getOutPutDirValue() ) ){\r\n\t\t \t\terrorSB.append( AppConstanst.OUTPUT_DIR_NOT_EXISTS + consoleCommand.getOutPutDirValue()+\"\\n\");\r\n\t\t \t};\r\n\t\t }\r\n\t\t\t// VALIDATE MASK COMMAND\r\n\t\t\tconsoleCommand.setMask( parsedString[ AppConstanst.MASK_IDX ] );\r\n\t\t\tif ( !AppConstanst.SCAN_MASK.equals( consoleCommand.getMask() ) ){\r\n\t\t\t\terrorSB.append( AppConstanst.WRONG_REQ_COMMAND+\" \"+consoleCommand.getMask()+AppConstanst.MUST_BE+AppConstanst.SCAN_MASK+\"\\n\" );\r\n\t\t\t}\r\n\t\t\tconsoleCommand.setMaskValue( parsedString[ AppConstanst.MASK_VALUE_IDX ]);\r\n\t\t\tif ( ! AppUtils.isMaskCorrect( consoleCommand.getMaskValue() ) ){\r\n\t\t\t\terrorSB.append( AppConstanst.ILLEGAL_MASK + consoleCommand.getMaskValue()+\"\\n\" );\r\n\t\t\t}\r\n\t\t\t// VALIDATE WAIT INTERVAL COMMAND\r\n\t\t\tconsoleCommand.setWaitInterval( parsedString[ AppConstanst.WAIT_INTERVAL_IDX ] );\r\n\t\t\tif ( !AppConstanst.SCAN_WAIT_INTERVAL.equals( consoleCommand.getWaitInterval() ) ){\r\n\t\t\t\terrorSB.append( AppConstanst.WRONG_REQ_COMMAND+\" \"+consoleCommand.getWaitInterval()+AppConstanst.MUST_BE+AppConstanst.SCAN_WAIT_INTERVAL+\"\\n\" );\r\n\t\t\t}\r\n\t\t\tLong interval= null;\r\n\t\t\ttry{\r\n\t\t\t\tinterval = Long.parseLong( parsedString[ AppConstanst.WAIT_INTERVAL_VALUE_IDX ] );\r\n\t\t\t} catch (NumberFormatException e) {} \r\n\t\t\tconsoleCommand.setWaitIntervalValue( interval );\r\n\t\t\tif ( interval == null || interval < 0){\r\n\t\t\t\terrorSB.append( AppConstanst.INCORECT_WAIT_INTERVAL + parsedString[ AppConstanst.WAIT_INTERVAL_VALUE_IDX ]+AppConstanst.POSITIVE_INT+\"\\n\" );\r\n\t\t\t}\r\n\t\t\t// VALIDATE NOT REQUIRED COMMAND\r\n\t\t\t\r\n\t\t\t\tfor (int idx = AppConstanst.MIN_SCAN_PARAM+1; idx < parsedString.length; idx += 2){\r\n\t\t\t\t\tif ( AppConstanst.SCAN_INCLUDE_SUB.equals( parsedString[ idx ] ) ){\r\n\t\t\t\t\t\tconsoleCommand.setIncludeSubs( parsedString[ idx ] );\r\n\t\t\t\t\t\tconsoleCommand.setIncludeSubsValue( parsedString[ idx+1 ] );\r\n\t\t\t\t\t\tif ( !AppConstanst.TRUE.equals( parsedString[ idx+1 ]) && !AppConstanst.FALSE.equals( parsedString[ idx+1 ] ) ){\r\n\t\t\t\t\t\t\terrorSB.append( AppConstanst.INCORECT_INCLUDE_SUBFOLDERS+\" \"+parsedString[ idx+1 ]+AppConstanst.TRUE_OR_FALSE+\"\\n\" );\r\n\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\tif ( AppConstanst.SCAN_AUTO_DELETE.equals( parsedString[ idx ] ) ){\r\n\t\t\t\t\t\tconsoleCommand.setAutoDelete( parsedString[ idx ] );\r\n\t\t\t\t\t\tconsoleCommand.setAutoDeleteValue( parsedString[ idx+1 ] );\r\n\t\t\t\t\t\tif ( !AppConstanst.TRUE.equals( parsedString[ idx+1 ]) && !AppConstanst.FALSE.equals( parsedString[ idx+1 ] ) ){\r\n\t\t\t\t\t\t\terrorSB.append( AppConstanst.INCORECT_AUTODELETE+\" \"+parsedString[ idx+1 ]+AppConstanst.TRUE_OR_FALSE+\"\\n\" );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t}\r\n\t\tif ( errorSB.length() > 0 ){\r\n\t\t\tSystem.out.println(AppConstanst.ERROR_IN_SCAN_COMMAND+ errorSB.toString());\r\n\t\t\tconsoleCommand.setCommand( AppConstanst.UNKNOWN);\r\n\t\t} \r\n\t\treturn consoleCommand;\r\n\t}", "@SuppressWarnings(\"unchecked\")\r\n public void testParseCommands_Accuracy2() throws Exception {\r\n InputStream input = new FileInputStream(\"test_files/scripts/test/dotnet.txt\");\r\n DistributionScript script = new DistributionScript();\r\n target = new DistributionScriptParserImpl();\r\n target.parseCommands(input, script, LOG);\r\n\r\n // Test the dotnet command was parsed correctly as we are not able to test the execution\r\n // of this command.\r\n assertEquals(\"The number of parsed commands shoule be equal.\", 2, script.getCommands().size());\r\n assertTrue(\"The command should be a ExecuteProcessCommand.\",\r\n script.getCommands().get(0) instanceof ExecuteProcessCommand);\r\n\r\n ExecuteProcessCommand con = (ExecuteProcessCommand) script.getCommands().get(0);\r\n String cmd = (String) getPrivateField(ExecuteProcessCommand.class, con, \"command\");\r\n String workingPath = (String) getPrivateField(ExecuteProcessCommand.class, con, \"workingPath\");\r\n assertEquals(\"The value should match.\", \"MSBuild \\\"Component Sources.csproj\\\" /t:DesignDist\", cmd);\r\n assertEquals(\"The value should match.\", \"%{comp_dir}\", workingPath);\r\n\r\n // the parsed command should have two conditions\r\n DefineVariableCommand con1 = (DefineVariableCommand) script.getCommands().get(1);\r\n List<CommandExecutionCondition> conditions = (List<CommandExecutionCondition>) getPrivateField(\r\n BaseDistributionScriptCommand.class, con1, \"conditions\");\r\n assertEquals(\"The DefineVariableCommand should have two conditions.\", 2, conditions.size());\r\n assertTrue(\"The first should VariableDefinedCondition.\",\r\n conditions.get(0) instanceof VariableDefinedCondition);\r\n assertTrue(\"The first should VariableNotDefinedCondition.\",\r\n conditions.get(1) instanceof VariableNotDefinedCondition);\r\n }", "public static Command parse(String str) throws DukeException {\n\n String[] arr = str.split(\" \", 2);\n if (arr.length < 1) {\n throw new DukeException(\"No command was given.\");\n }\n String firstWord = arr[0];\n if (str.equalsIgnoreCase(\"bye\")) {\n return new ExitCommand();\n } else if (str.equalsIgnoreCase(\"list\")) {\n return new ListCommand();\n } else {\n Action action = parseFirstWord(firstWord.toLowerCase());\n\n if (arr.length < 2 && (action == Action.Done || action == Action.Delete)) {\n throw new DukeException(\"duke.task.Task number for \" + firstWord + \" is not given.\");\n } else if (arr.length < 2 || arr[1].isBlank()) {\n throw new DukeException(\"The description of \" + firstWord + \" cannot be empty\");\n } else {\n return actionToCommand(action, arr[1]);\n }\n }\n }", "private void parseCommand(String line) throws IllegalArgumentException {\n\t\tString[] tokens = line.split(\"\\\\s+\");\n\t\tString commandString;\n\t\tif(tokens.length == 4) {\n\t\t\tcommandString = tokens[2] + \" \" + tokens[3];\n\t\t}\n\t\telse if(tokens.length == 3) {\n\t\t\tcommandString = tokens[2];\n\t\t}\n\t\telse {\n\t\t\tthrow new IllegalArgumentException(\"Invalid command argument\");\n\t\t}\n\t\tthis.registerCommand(tokens[1].charAt(0), commandString);\n\t}", "protected abstract void parse(final ArrayList<Command> cmds) throws QueryException;", "public abstract String getCommand();", "public static Action parseCommand(String sentence) throws DukeException {\n if (sentence.isEmpty()) {\n throw new EmptyInputException(\"Empty input! Try again (o|o)\");\n } else if (sentence.equals(\"bye\")) {\n return Action.BYE;\n } else if (sentence.equals(\"list\")) {\n return Action.LIST;\n } else if (sentence.startsWith(\"done\")) {\n return Action.MARK_AS_DONE;\n } else if (sentence.startsWith(\"todo\")) {\n return Action.CREATE_TODO;\n } else if (sentence.startsWith(\"deadline\")) {\n return Action.CREATE_DEADLINE;\n } else if (sentence.startsWith(\"event\")) {\n return Action.CREATE_EVENT;\n } else if (sentence.startsWith(\"delete\")) {\n return Action.DELETE;\n } else if (sentence.startsWith(\"clear\")) {\n return Action.CLEAR;\n } else if (sentence.startsWith(\"find\")) {\n return Action.FIND;\n } else {\n throw new IllegalInputException(\"☹ OOPS!!! I'm sorry, but I don't know what that means :-( \\nPlease try again!\");\n }\n }", "private static Command<?> getCommand(@NonNull String inputStr) {\n int seperatorIndex = inputStr.indexOf(' ');\n String commandStr = seperatorIndex == -1 ? inputStr : inputStr.substring(0, seperatorIndex);\n String paramStr = seperatorIndex == -1 ? \"\" : inputStr.substring(seperatorIndex + 1).trim();\n\n if (\"Tag\".equalsIgnoreCase(commandStr)) {\n List<String> tagList = Splitter.on(\",\")\n .trimResults()\n .omitEmptyStrings()//可以 选择是否对 空字符串 做处理\n .splitToList(paramStr.replace(',', ','));\n return new TagCommand(tagList.toArray(new String[]{}));\n } else if (\"Name\".equalsIgnoreCase(commandStr)) {\n if (isBlank(paramStr)) {\n throw new IllegalArgumentException(\"Need to specify file path\");\n }\n return new NameCommand(paramStr);\n } else if (\"Where\".equalsIgnoreCase(commandStr)) {\n if (isBlank(paramStr)) {\n throw new IllegalArgumentException(\"Need to specify search criteria\");\n }\n return new WhereCommand(paramStr);\n } else if (\"Analyze\".equalsIgnoreCase(commandStr)) {\n return new AnalyzeCommand();\n } else if (\"Export\".equalsIgnoreCase(commandStr)) {\n if (isBlank(paramStr)) {\n throw new IllegalArgumentException(\"Need to specify export file path\");\n }\n return new ExportCommand(paramStr);\n } else {\n throw new IllegalArgumentException(\"Use either Tag, Where, Name, Export, or Analyze\");\n }\n }", "public CommandHandler() {\r\n\t\tcommands.put(\"userinfo\", new UserInfoCommand());\r\n\t\tcommands.put(\"verify\", new VerifyCommand());\r\n\t\tcommands.put(\"ping\", new PingCommand());\r\n\t\tcommands.put(\"rapsheet\", new RapsheetCommand());\r\n\t\tcommands.put(\"bet\", new BetCommand());\r\n\t\tcommands.put(\"buttons\", new ButtonCommand());\r\n\r\n\t\t// for each command in commands\r\n\t\t// call getAlternativeName and assign to that key\r\n\t\tcommands.keySet().stream().forEach(key -> {\r\n\t\t\tList<String> alts = commands.get(key).getAlternativeNames();\r\n\t\t\tif (alts != null)\r\n\t\t\t\talts.forEach(a -> commandAlternative.put(a, key));\r\n\t\t});\r\n\t}", "public String processCommand(Command command) //refactored\n {\n boolean wantToQuit = false;\n //System.out.println(\"hitter boolean\");\n commandWord = command.getAction();//fehler\n //System.out.println(command);\n //System.out.println(\"enum == null\" + (commandWord == null));\n String result = \"\";\n //System.out.println(\"heyho\");\n //System.out.println(result);\n switch(commandWord){\n //case UNKNOWN: return \"I don't know what you mean...\"; break;\n \n case HELP: result += printHelp(); break;\n case GO: result += goRoom(command); break;\n case QUIT: return quit(command);//refactored from refactoring\n default: result += \"I don't know what you mean...\";\n }\n return result;\n }", "public Command parse(String[] s) {\r\n\t\t\t\r\n\t\tif (s.length == 1 && s[0].equalsIgnoreCase(\"QUIT\"))\r\n\t\t\treturn new Quit();\r\n\t\telse \r\n\t\t\treturn null;\r\n\t}", "public CommandWords()\n {\n validCommands = new HashMap<String, CommandWord>();\n for(CommandWord command : CommandWord.values()) \n {\n if(command != CommandWord.UNKNOWN) \n {\n validCommands.put(command.toString(), command);\n }\n }\n \n commands = new HashMap<CommandWord, Command>();\n commands.put(CommandWord.GO, new GoCommand());\n commands.put(CommandWord.HELP, new HelpCommand());\n commands.put(CommandWord.QUIT, new QuitCommand());\n commands.put(CommandWord.EAT, new EatCommand());\n commands.put(CommandWord.SEE, new SeeCommand());\n commands.put(CommandWord.TAKE, new TakeCommand());\n commands.put(CommandWord.DROP, new DropCommand());\n //commands.put(CommandWord.TO, new ToCommand());\n //commands.put(CommandWord.LOCK, new LockCommand());\n //commands.put(CommandWord.UNLOCK, new UnlockCommand());\n commands.put(CommandWord.USEITEM, new UseCommand());\n commands.put(CommandWord.INSPECT, new InspectCommand());\n commands.put(CommandWord.TEST, new TestCommand());\n commands.put(CommandWord.INSPECTBAG, new InspectBagCommand());\n //commands.put(CommandWord.BACK, new BackCommand());\n commands.put(CommandWord.TALK, new TalkCommand());\n commands.put(CommandWord.BUY, new BuyCommand());\n commands.put(CommandWord.ALEA, new AleaCommand());\n commands.put(CommandWord.FREEZE, new FreezeCommand());\n }", "private static String parseCommandStr(String cmd, String[] args) {\n return cmd + \" \" + String.join(\" \", args);\n }", "private String parseAndRespond() {\n\t\tList<String> commands = new ArrayList<String>();\n\t\twhile (input.hasNext()) {\n\t\t\tString inputToken = input.next();\n\t\t\tcommands.add(inputToken);\n\t\t\tcommands.get(commands.size()-1).chars().forEach(p -> System.out.println(p));\n\t\t\t\n\t\t\t/* trap telnet control c */\n\t\t\tString telnetControlC = IntStream.of(65533,65533,65533,65533,6).collect(StringBuilder::new,\n\t\t\t\t\tStringBuilder::appendCodePoint, StringBuilder::append).toString();\n\t\t\tif (inputToken.contains(telnetControlC)) { \n\t\t\t\tSystem.out.println(\"Caught you CTRL+C evil!\");\n\t\t\t\treturn EXIT;\n\t\t\t}\n\t\t\tif (commands.get(commands.size()-1).equals(\".\")) {\n\t\t\t\tcommands.remove(commands.size()-1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tif (commands.get(commands.size()-1).equals(EXIT)) return EXIT;\n\t\t\t\n\t\t}\n\t\t\n\t\tString response = \"\";\n\t\t/* I'm not sure if I want to trap an error or let it percolate up yet */\n\t\t\n//\t\ttry {\n\t\t\tresponse = commandInterpreter.interpretCommands(commands);\n//\t\t} catch (IOException e) {\n//\t\t\tlogger.log(Level.WARNING, \"Error interpreting commands\", e);\n//\t\t\tresponse = \"Error occured!\";\n//\t\t}\n\t\toutput.format(\"%s\\n>\",response);\n\t\toutput.flush();\n\t\t\n\n\t\treturn \"\";\n\n\t}", "@Override\n public void execute(String commandText) throws Exception {\n parse(commandText);\n }", "void readCommand(String command) throws IOException, ClassNotFoundException, InterruptedException;", "public String readCommand() {\n return scanner.nextLine();\n }", "private void putCommands() {\r\n ShellCommand charset = new CharsetCommand();\r\n commands.put(charset.getCommandName(), charset);\r\n ShellCommand symbol = new SymbolCommand();\r\n commands.put(symbol.getCommandName(), symbol);\r\n ShellCommand exit = new ExitCommand();\r\n commands.put(exit.getCommandName(), exit);\r\n ShellCommand cat = new CatCommand();\r\n commands.put(cat.getCommandName(), cat);\r\n ShellCommand copy = new CopyCommand();\r\n commands.put(copy.getCommandName(), copy);\r\n ShellCommand ls = new LsCommand();\r\n commands.put(ls.getCommandName(), ls);\r\n ShellCommand mkdir = new MkdirCommand();\r\n commands.put(mkdir.getCommandName(), mkdir);\r\n ShellCommand hexdump = new HexdumpCommand();\r\n commands.put(hexdump.getCommandName(), hexdump);\r\n ShellCommand tree = new TreeCommand();\r\n commands.put(tree.getCommandName(), tree);\r\n ShellCommand help = new HelpCommand();\r\n commands.put(help.getCommandName(), help);\r\n ShellCommand pwd = new PwdCommand();\r\n commands.put(pwd.getCommandName(), pwd);\r\n ShellCommand cd = new CdCommand();\r\n commands.put(cd.getCommandName(), cd);\r\n ShellCommand pushd = new PushdCommand();\r\n commands.put(pushd.getCommandName(), pushd);\r\n ShellCommand popd = new PopdCommand();\r\n commands.put(popd.getCommandName(), popd);\r\n ShellCommand listd = new ListdCommand();\r\n commands.put(listd.getCommandName(), listd);\r\n ShellCommand dropd = new DropdCommand();\r\n commands.put(dropd.getCommandName(), dropd);\r\n ShellCommand rmtree = new RmtreeCommand();\r\n commands.put(rmtree.getCommandName(), rmtree);\r\n ShellCommand cptree = new CptreeCommand();\r\n commands.put(cptree.getCommandName(), cptree);\r\n ShellCommand massrename = new MassrenameCommand();\r\n commands.put(massrename.getCommandName(), massrename);\r\n }", "CommandTypes(String command) {\n this.command = command;\n }", "Commands getIf_commands();", "protected IBackendCommand parseCommand(String key, IBackendCommandParser parser, JsonAnalyzer json) {\n\t\treturn parser.parseBackendCommand(json);\n\t}", "public void createDefaultCommands() {\n commands.put(\"Top 10 Items in logs serving 404s sorted by count\", \"grep 'HTTP/1.1\\\\\\\" 404' httpd-access.log | cut -d ' ' -f 7 | sort | uniq -c | sort -nr | head\");\n commands.put(\"Top 10 User agents\", \"cat httpd-access.log | cut -d '\\\\\\\"' -f 6 | sort | uniq -c | sort -nr | head\");\n commands.put(\"Most requested URLs\", \"awk -F\\\\\\\" '{print $2}' httpd-access.log | awk '{print $2}' | sort | uniq -c | sort -nr | head\");\n commands.put(\"Top 10 IP Addresses\", \"cat httpd-access.log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -10\");\n }", "private String parseMethod() {\n\t\tString[] splitted = command.split(\":\", 2);\n\t\tif (splitted.length == 1) {\n\t\t\treturn splitted[0];\n\t\t} else {\n\t\t\treturn splitted[1] + splitted[0].substring(0, 1).toUpperCase() + splitted[0].substring(1);\n\t\t}\n\t}", "public static String parseCommand(final String[] commandLineArguments) throws ClassNotFoundException, SQLException{ \n \t\t\n \t\tString result = \"\";\n \t\t\t\n \t\tString commandName = \"upload divergence\";\n \t\tif (isTheCommandName(commandLineArguments, commandName)){\n \t\t\tresult = uploadCommand(commandLineArguments, \"updiv\");\n \t\t}\n \t\t\t\n \t\tcommandName = \"updiv\";\n \t\tif (isTheCommandName(commandLineArguments, commandName)){\n \t\t\tresult = uploadCommand(commandLineArguments, \"updiv\");\n \t\t}\n \t\t\n \t\tcommandName = \"upload annotation\";\n \t\tif (isTheCommandName(commandLineArguments, commandName)){\n \t\t\tresult = uploadCommand(commandLineArguments, \"upano\");\n \t\t}\n \t\t\n \t\tcommandName = \"upano\";\n \t\tif (isTheCommandName(commandLineArguments, commandName)){\n \t\t\tresult = uploadCommand(commandLineArguments, \"upano\");\n \t\t}\n \t\t\n \t\tcommandName = \"afs\";\n \t\tif (isTheCommandName(commandLineArguments, commandName)){\n \t\t\tresult = vcfCommand(commandLineArguments);\n \t\t}\n \t\t\n \t\tcommandName = \"allele frequency spectra\";\n \t\tif (isTheCommandName(commandLineArguments, commandName)){\n \t\t\tresult = vcfCommand(commandLineArguments);\n \t\t}\n \t\t\n \t\tcommandName = \"delete\";\n \t\tif (isTheCommandName(commandLineArguments, commandName)){\t\t\t\t\t\t\n \t\t\treturn deleteCommand(commandLineArguments);\n \t\t}\n \t\t\n \t\tcommandName = \"view\";\n \t\tif(isTheCommandName(commandLineArguments, commandName)){\n \t\t\treturn viewCommand(commandLineArguments);\n \t\t}\n \t\t\n \t\tcommandName = \"create filter\";\n \t\tif(isTheCommandName(commandLineArguments, commandName)){\n \t\t\tcreateFilterLoop(commandLineArguments);\n \t\t}\n \t\t\n \t\tcommandName = \"crefil\";\n \t\tif(isTheCommandName(commandLineArguments, commandName)){\n \t\t\tcreateFilterLoop(commandLineArguments);\n \t\t}\n \t\t\n \t\tcommandName = \"filter\";\n \t\tif(isTheCommandName(commandLineArguments, commandName)){\n \t\t\tresult = filterCommand(commandLineArguments);\n \t\t}\n \t\t\n \t\treturn result;\n \t}", "protected String processCommand(String command)\n {\n switch (command)\n {\n case \"HELLO\":\n return \"h\";\n case \"MOVE N\":\n return \"mn\";\n case \"MOVE S\":\n return \"ms\";\n case \"MOVE E\":\n return \"me\";\n case \"MOVE W\":\n return \"mw\";\n case \"PICKUP\":\n return \"p\";\n case \"LOOK\":\n return \"l\";\n case \"QUIT\":\n return \"q\";\n default:\n return \"i\";\n }\n }", "@Test\n\tpublic void getCommandTest() {\n\t\tString command = \"Hello World\";\n\t\tString expected = \"Hello\";\n\t\tString actual = Helper.getCommand(command);\n\t\tassertEquals(expected, actual);\n\n\t\tcommand = \"This is a line of commands\";\n\t\texpected = \"This\";\n\t\tactual = Helper.getCommand(command);\n\t\tassertEquals(expected, actual);\n\n\t}", "public static String allCommands() \n {\n String commandWords = \"\";\n for(CommandWord command : CommandWord.values()) {\n commandWords += command + \" \";\n }\n return commandWords;\n }", "public interface CommandExecutor {\n /**\n * This method parse a commands from string and call it\n *\n * @param sender ource of the commands\n * @param connectionCommand commands\n * @return true if a valid commands, otherwise false\n */\n 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 }\n\n /**\n * Executes the given commands, returning its success\n *\n * @param sender ource of the commands\n * @param command Command which was executed\n * @param args Passed commands arguments\n * @param objects Objects\n * @return true if a valid commands, otherwise false\n */\n boolean onCommand(CommandSender sender, String command, String[] args, Object... objects);\n\n}", "public void parseCommand(ActionSet actionset, String command)\n\t\t\tthrows ParseException\n\t{\n\n\t\t_actionset = actionset;\n\t\t_command = command;\n\n\t\tString[] syntax = command.split(\" \");\n\n\t\tfor (String s : syntax)\n\t\t{\n\t\t\ts.trim(); // clean up extra whitespaces\n\t\t}// end loop\n\n\t\tString firstCommand = syntax[0].toUpperCase();\n\t\tString secCommand = syntax[1].toUpperCase();\n\n\t\tswitch (firstCommand)\n\t\t{\n\t\tcase \"DEFINE\":\n\t\t\tswitch (secCommand)\n\t\t\t{\n\t\t\tcase \"TRAP\":\n\t\t\t\tdefineTrap(syntax);\n\t\t\t\tbreak;\n\t\t\tcase \"CATAPULT\":\n\t\t\t\tdefineCatapult(syntax);\n\t\t\t\tbreak;\n\t\t\tcase \"OLS_XMT\":\n\t\t\t\tdefineXMT(syntax);\n\t\t\t\tbreak;\n\t\t\tcase \"OLS_RCV\":\n\t\t\t\tdefineRCV(syntax);\n\t\t\t\tbreak;\n\t\t\tcase \"CARRIER\":\n\t\t\t\tdefineCarrier(syntax);\n\t\t\t\tbreak;\n\t\t\tcase \"FIGHTER\":\n\t\t\t\tdefineFighter(syntax);\n\t\t\t\tbreak;\n\t\t\tcase \"TANKER\":\n\t\t\t\tdefineTanker(syntax);\n\t\t\t\tbreak;\n\t\t\tcase \"BOOM\":\n\t\t\t\tString thirdCommand = syntax[2].toUpperCase();\n\t\t\t\tswitch (thirdCommand)\n\t\t\t\t{\n\t\t\t\tcase \"MALE\":\n\t\t\t\t\tdefineBoomMale(syntax);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"FEMALE\":\n\t\t\t\t\tdefineBoomFemale(syntax);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new ParseException(\"Invalid Command > \" + command);\n\t\t\t\t}// end switch\n\t\t\tcase \"TAILHOOK\":\n\t\t\t\tdefineTailhook(syntax);\n\t\t\t\tbreak;\n\t\t\tcase \"BARRIER\":\n\t\t\t\tdefineBarrier(syntax);\n\t\t\t\tbreak;\n\t\t\tcase \"AUX_TANK\":\n\t\t\t\tdefineAuxTank(syntax);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new ParseException(\"Invalid Command > \" + command);\n\t\t\t}// end switch\n\t\tcase \"UNDEFINE\":\n\t\t\tundefine(syntax);\n\t\t\tbreak;\n\t\tcase \"SHOW\":\n\t\t\tshowTemplates(syntax);\n\t\t\tbreak;\n\t\tcase \"LIST\":\n\t\t\tlistTemplates();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new ParseException(\"Invalid Command > \" + command);\n\t\t}\n\n\t}", "public static Shape parse() {\n Shape shape = null;\n System.out.print(\"Enter command:\");\n try {\n Scanner scanner = new Scanner(System.in);\n String commandString = scanner.nextLine();\n String[] request = commandString.split(\"\\\\s+\"); //the array of strings computed by space\n\n switch (Command.findCommandByAcronyms(request[0])){\n case CANVAS:\n int[] canvasCoordinates = convertStringArrayToIntArray(Arrays.copyOfRange(request,1,request.length));\n canvas = new Canvas(canvasCoordinates);\n shape = canvas;\n break;\n case LINE:\n int[] lineCoordinates = convertStringArrayToIntArray(Arrays.copyOfRange(request,1,request.length));\n shape = new Line(canvas, lineCoordinates);\n break;\n case RECTANGLE:\n int[] rectCoordinates = convertStringArrayToIntArray(Arrays.copyOfRange(request,1,request.length));\n shape = new Rectangle(canvas, rectCoordinates);\n break;\n case FILL:\n shape = new Fill(canvas, Arrays.copyOfRange(request,1,request.length));\n break;\n case EXIT:\n System.out.print(\"Thank you for using the Drawing App! See you again.\");\n System.exit(0);\n default:\n System.out.println(\"Command not supported: \" + request[0]);\n help();\n }\n return shape;\n } catch (NumberFormatException nfe){\n System.out.println(\"Only non negative numbers are allowed in args: \" + nfe.getMessage());\n help();\n } catch (Exception e) {\n System.out.println(\"Sorry! can't parse the entered value. Try again: \" + e.getMessage());\n help();\n }\n return shape;\n }", "protected void init(String command){\n\t\tStringTokenizer st = new StringTokenizer(command);\n\t\t\n\t\tthis.numberOfTokens = st.countTokens() ;\n\t\tthis.tokens = new String[this.numberOfTokens];\n\t\t\n\t\tString currentToken;\n\t\tint tokenNumber = 0;\n\t\t\n\t\t/*inizialize the entire array or cannot concatenate strings\n\t\tin the while belowe: looks like null!Command nullArgument1 ...*/\n\t\t//for(int i = 0; i < this.numberOfTokens; i++) this.tokens[i] = \"\";\n\t\t\n\t\twhile (st.hasMoreTokens()) {\n\t\t\tcurrentToken = st.nextToken();\n\t\t\t//System.out.println(\"token\"+tokenNumber+\": \"+currentToken);\n\t\t\t\n\t\t\tthis.tokens[tokenNumber] = currentToken;\n\t\t\tif(tokenNumber>1)\n\t\t\t\tmiscParam += \" \"+currentToken;\n\t\t\tif(tokenNumber>0 && !currentToken.startsWith(\"$\")) \n\t\t\t\tallParam += \" \"+currentToken;\n\t\t\t\n\t\t\ttokenNumber++;\n\t\t}\n\t\t/*this is just for remove the first <space> from the second param of the command*/\n\t\t//if(this.hasAllParam()) this.tokens[2] = this.tokens[2].substring(1);\n\t}", "private static Object command(String userCommandLine[]) {\n\t\tint size = userCommandLine.length;\n\n\t\tswitch(userCommandLine[0].trim().toUpperCase()) {\n\n\t\t/*\n\t\t * INFORMATION\n\t\t *\n\t\t * Add executecommand on each case\n\t\t * but if it dosn't yet implemented\n\t\t * comment the command allow to user\n\t\t * on the variable string[] commands\n\t\t *\n\t\t */\n\t\t\n\t\t/* ************************************\n\t\t * standard commands\n\t\t *************************************/\n\t\tcase \"QUIT\": return ExecuteCommand.exit();\n\t\tcase \"EXIT\": return ExecuteCommand.exit();\n\t\tcase \"HELP\": help( (size > 1) ? userCommandLine[1].trim() : \"\"); break;\n\t\tcase \"VAR\": ExecuteCommand.showVar(); break;\n\t\tcase \"DEL\" : ExecuteCommand.delVar(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\tcase \"RENAME\": ExecuteCommand.renameVar(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\tcase \"STARTSPARK\": ExecuteCommand.startSpark(); break;\n\t\tcase \"STOPSPARK\": ExecuteCommand.stopSpark(); break;\n\t\t\n\t\t/* ************************************\n\t\t * database\n\t\t *************************************/ \n\t\t\n\t\t/* open database(name: String, filesystem: FileSystem, conf: Config) */\n\t\tcase \"OPEN\" : ExecuteCommand.openDB(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* close database */\n\t\tcase \"CLOSE\" : ExecuteCommand.closeDB(); break;\n\t\t/* restart database */\n\t\tcase \"RESTART\" : ExecuteCommand.restartDB(); break;\n\t\t/* show list of TimeSeries */\n\t\tcase \"SHOW\" : ExecuteCommand.showTS(); break;\n\t\t/* drop a timeSeries */\n\t\tcase \"DROP\" : ExecuteCommand.dropTS(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* exist a timeSeries with name ... */\n\t\tcase \"EXIST\" : ExecuteCommand.existTS(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* get a timeSeries */\n\t\tcase \"GET\" : ExecuteCommand.getTS(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* create a timeSeries */\n\t\tcase \"CREATE\" : ExecuteCommand.createTS2DB(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t\n\t\t\n\t\t/* ************************************\n\t\t * Time Series\n\t\t *************************************/\n\t\t\n\t\t/* create the timeSerie schema */\n\t\tcase \"CREATE_SCHEMA\" : ExecuteCommand.createSchema(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* show the schema of the timeSerie */\n\t\tcase \"SHOW_SCHEMA\" : ExecuteCommand.showSchema(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* get the schema of the timeSerie*/\n\t\tcase \"GET_SCHEMA\" : ExecuteCommand.getSchema(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* insert data at a certain file */\n\t\tcase \"INSERT\" : ExecuteCommand.insertDataFromFile(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* select timeSerie Range from timeStart to timeEnd */\n\t\tcase \"SELECT_RANGE\": break;\n\t\t/* select a column of a timeserie */\n\t\tcase \"SELECT\": ExecuteCommand.selectColumn(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* find max value of timeSerie */\n\t\tcase \"MAX_VALUE\" : ExecuteCommand.maxValue(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* find min value of timeSerie */\n\t\tcase \"MIN_VALUE\" : ExecuteCommand.minValue(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* print first five values */\n\t\tcase \"PRINT\" : ExecuteCommand.printHead(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t\t\t\n\t\t\n\t\t/* ************************************\n\t\t * Transformations\n\t\t *************************************/\n\t\t\n\t\t/* power transformation of timeSerie: square root */\n\t\tcase \"SQRT_TRANSFORM\" : break;\n\t\t/* power transformation of timeSerie: logarithm */\n\t\tcase \"LOG_TRANSFORM\" : break;\n\t\t/* average of timeSerie */\n\t\tcase \"MEAN\" : break;\n\t\t/* shifting timeSerie with coefficient */\n\t\tcase \"SHIFT\" : break;\n\t\t/* scaling timeSerie with coefficient */\n\t\tcase \"SCALE\" : break;\n\t\t/* standard deviation of timeSeries */\n\t\tcase \"STD_DEVIATION\" : break;\n\t\t/* normalize the TimeSerie */\n\t\tcase \"NORMALIZE\" : break;\n\t\t/* search the first time occurs */\n\t\tcase \"SEARCH\" : break;\n\t\t/* moving average */\n\t\tcase \"MOVING_AVERAGE\" : break;\n\t\t/* DFT of timeSerie */\n\t\tcase \"DFT\" : break;\n\t\t/* DTW of 2 timeSerie (similarity between two timeseries) */\n\t\tcase \"DTW\" : break;\n\t\t\n\t\t/* ************************************\n\t\t * Compression \n\t\t *************************************/\n\n\t\t/* compress a timeserie */\n\t\tcase \"COMPRESSION\" : ExecuteCommand.compression(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* decompress a timeserie */\n\t\tcase \"DECOMPRESSION\" : break;\n\n\t\t/* ************************************\n\t\t * indexing \n\t\t *************************************/\n\t\t\n\t\t/* create index for many ts */\n\t\tcase \"CREATE_INDEX\" : ExecuteCommand.createIndex(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t/* return neighbors of a ts from the create index */\n\t\tcase \"NEIGHBORS\" : break;\n\t\t/* ************************************\n\t\t * clustering \n\t\t *************************************/\n\t\t\n\t\t/* ************************************\n\t\t * Application \n\t\t *************************************/\n\t\tcase \"CREATE_DNA\" : break;\n\t\tcase \"DNA_SIMILARITY\" : ExecuteCommand.dnApplication(Arrays.copyOfRange(userCommandLine, 1, size)); break;\n\t\t\n\t\t\t\t\n\t\tdefault: System.out.println(\"oups it may have a code error\");\n\t\t}\n\n\t\treturn true;\n\t}", "public List<RoverMovement> parseCommands(String str) {\n\t\tList<RoverMovement> commands = new ArrayList<RoverMovement>();\n\t\tif (str == null) {\n\t\t\treturn commands;\n\t\t}\n\n\t\tchar[] chars = str.toUpperCase().toCharArray();\n\t\tfor (char c : chars) {\n\t\t\tif (c == 'L') {\n\t\t\t\tcommands.add(RoverMovement.LEFT);\n\t\t\t} else if (c == 'R') {\n\t\t\t\tcommands.add(RoverMovement.RIGHT);\n\t\t\t} else if (c == 'M') {\n\t\t\t\tcommands.add(RoverMovement.FORWARD);\n\t\t\t} else {\n\t\t\t\tthrow new IllegalArgumentException(\"The command sequence contains at least one unsupported character: \" + str);\n\t\t\t}\n\t\t}\n\t\treturn commands;\n\t}", "@Override\n\tpublic void processCommand(String s)\n\t{\n\t\tif (s.contentEquals(\"atStart\"))\n\t\t{\n\t\t\tprinttest(s);\n\t\t\tSystem.out.println(isAtStart());\n\t\t}\n\t\telse if (s.contentEquals(\"atEnd\"))\n\t\t{\n\t\t\tprinttest(s);\n\t\t\tSystem.out.println(isAtEnd());\n\t\t}\n\t\telse if (s.contentEquals(\"moveToStart\"))\n\t\t{\n\t\t\tmoveToStart();\n\t\t\tprinttest(s);\n\t\t}\n\t\telse if (s.contentEquals(\"moveToEnd\"))\n\t\t{\n\t\t\tmoveToEnd();\n\t\t\tprinttest(s);\n\t\t}\n\t\telse if (s.contentEquals(\"toString\"))\n\t\t{\n\t\t\tprinttest(s);\n\t\t}\n\t\telse if (s.startsWith(\"toStringCursor\"))\n\t\t{\n\t\t\tprinttest(s);\n\t\t}\n\t\telse if (s.contentEquals(\"moveLeft\"))\n\t\t{\n\t\t\tmoveLeft();\n\t\t\tprinttest(s);\n\t\t}\n\t\telse if (s.contentEquals(\"moveRight\"))\n\t\t{\n\t\t\tmoveRight();\n\t\t\tprinttest(s);\n\t\t}\n\t\t\n\t\t//ERROR CHECKING\n\t\telse if(left.isEmpty() && right.isEmpty())\n\t\t{\n\t\t\t//we have no inputted characters\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"Now executing the command \" + s + \"...\");\n\t\t\tSystem.out.println(\"The Results of this command are:\");\n\t\t\tSystem.out.println(\"Sorry but you need to input something before using that command...\");\n\t\t}\n\t\telse if (s.startsWith(\"insertChar\"))\n\t\t{\n\t\t\tinsertChar(s.charAt(s.length() - 1));\n\t\t\tprinttest(s);\n\t\t}\n\t\telse if (s.contentEquals(\"backspace\"))\n\t\t{\n\t\t\tbackspace();\n\t\t\tprinttest(s);\n\t\t}\n\t\telse if (s.contentEquals(\"delete\"))\n\t\t{\n\t\t\tdelete();\n\t\t\tprinttest(s);\n\t\t}\n\t\telse if (s.startsWith(\"search\"))\n\t\t{\n\t\t\tsearch(s.charAt(s.length() - 1));\n\t\t\tprinttest(s);\n\t\t}\n\t\t\n\t\t//ERORR CHECKING\n\t\telse\n\t\t{\n\t\t\t//it is an unaccepted command, doing it this way since we cant pass two strings to printtest\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"Now executing the command \" + s + \"...\");\n\t\t\tSystem.out.println(\"The Results of this command are:\");\n\t\t\tSystem.out.println(\"Sorry but this is not valid command...\");\n\t\t}\n\n\t}", "public void readCommand(Scanner s) throws WrongCommandFormatException {\n String next = s.next();\n if (next.equals(\"/by\")) {\n throw new WrongCommandFormatException(\"Wrong keyword used. Please try again with /at\");\n } else if (next.equals(\"/at\")) {\n parseTimeframe(s);\n } else {\n this.description += next + \" \";\n }\n }", "private Command createCommand(String command) {\n\t\tString[] tokens = command.split(\" \");\n\t\tswitch(tokens[0].toLowerCase()) {\n\t\tcase DRAW:\n\t\t\treturn createDrawCommand(command);\n\t\t\n\t\tcase SKIP:\n\t\t\treturn createSkipCommmand(command);\n\t\t\t\n\t\tcase SCALE:\n\t\t\treturn createScaleCommand(command);\n\t\t\t\n\t\tcase ROTATE:\n\t\t\treturn createRotateCommand(command);\n\t\t\t\n\t\tcase PUSH:\n\t\t\treturn createPushCommand();\n\t\t\t\n\t\tcase POP:\n\t\t\treturn createPopCommand();\n\t\t\t\n\t\tcase COLOR:\n\t\t\treturn createColorCommand(command);\n\t\t\t\n\t\tdefault:\n\t\t\tthrow new IllegalArgumentException(\"Invalid command argument\");\n\t\t}\n\t}", "private void getGameCommands(){\n\n }", "public void parseCommand(CommandType command) throws ExecutionException, InterruptedException {\n try {\r\n if (lock.isLocked(new UserSingleType(command.event().getMessageAuthor().asUser().get(), command.event().getServer().get()))) {\r\n command.event().getMessage().delete();\r\n return;\r\n } else if(lock.isChLocked(new UserChannelLockType(new UserSingleType(command.event().getMessageAuthor().asUser().get(), command.event().getServer().get()), command.event().getChannel()))){\r\n command.event().getMessage().delete();\r\n return;\r\n }\r\n }catch (Exception ignored){}\r\n if(command.command().startsWith(prefix)) { // to prevent expressions for unrelated messages\r\n command.api().getServerById(command.event().getServer().get().getId()).get();\r\n if (!command.event().getServer().get().hasPermission(command.api().getYourself(), PermissionType.ADMINISTRATOR)) {// Bot permissions check, without administrator access our bot should be not work\r\n command.event().getMessage().reply(\"This bot cannot be work without Administrator permission.\");\r\n return;\r\n }\r\n if (command.command().equals(prefix + commands[0])) commandAction.commandPing(command);\r\n else if (command.command().equals(prefix + commands[1])) commandAction.commandServer(command);\r\n else if (command.command().equals(prefix + commands[2])) commandAction.commandInf(command);\r\n else if (command.command().equals(prefix + commands[3])) commandAction.commandInvite(command);\r\n else if (command.command().equals(prefix + commands[4])) commandAction.commandKick(command);\r\n else if (command.command().equals(prefix + commands[5])) commandAction.commandBan(command);\r\n else if (command.command().equals(prefix + commands[6])) commandAction.commandMute(command);\r\n else if (command.command().equals(prefix + commands[7])) commandAction.commandUnMute(command);\r\n else if (command.command().equals(prefix + commands[8])) commandAction.commandDef(command);\r\n else if (command.command().equals(prefix + commands[9])) commandAction.commandUnDef(command);\r\n else if (command.command().equals(prefix + commands[10])) commandAction.commandWarn(command);\r\n else if (command.command().equals(prefix + commands[11])) commandAction.commandUnWarn(command);\r\n else if (command.command().equals(prefix + commands[12])) commandAction.commandClear(command);\r\n else if (command.command().equals(prefix + commands[13])) commandAction.commandLock(command, lock);\r\n else if (command.command().equals(prefix + commands[14])) commandAction.commandUnlock(command, lock);\r\n else if (command.command().equals(prefix + commands[15])) commandAction.commandDelete(command);\r\n else if (command.command().equals(prefix + commands[16])) commandAction.commandChLock(command, lock);\r\n else if (command.command().equals(prefix + commands[17])) commandAction.commandChUnlock(command, lock);\r\n else if (command.command().equals(prefix + commands[18])) commandAction.commandUnBanAll(command);\r\n else if (command.command().equals(prefix + commands[19])) commandAction.commandUnlockAll(command, lock);\r\n else if (command.command().equals(prefix + commands[20])) commandAction.commandSet(command);\r\n else if (command.command().equals(prefix + commands[21])) commandAction.commandHelp(command);\r\n }\r\n }", "public static ArrayList<String> commandList() {\n\r\n\t\tArrayList<String> commands = new ArrayList<String>();\r\n\r\n\t\tcommands.add(\"/HELP\");\r\n\t\tcommands.add(\"/QUIT\");\r\n\t\tcommands.add(\"/REMOVE\");\r\n\t\tcommands.add(\"/BAN\");\r\n\t\tcommands.add(\"/BANIP\");\r\n\t\tcommands.add(\"/REMOVEIP\");\r\n\t\tcommands.add(\"/CLEAR\");\r\n\t\tcommands.add(\"/SHOW\");\r\n\t\tcommands.add(\"/WARN\");\r\n\r\n\t\treturn commands;\r\n\t}", "@Test\n public void parseAddCommand_validCommand_success() throws ChatbotException {\n Command addTodoCmd = ChatbotParser.parseCommand(\"todo read book\");\n assertTrue(addTodoCmd instanceof AddCommand);\n assertEquals(((AddCommand) addTodoCmd).getToAdd().getDescription(), \"read book\");\n\n // Test add deadline\n Command addDeadlineCmd = ChatbotParser.parseCommand(\"deadline return book /by 2020-10-10\");\n assertTrue(addDeadlineCmd instanceof AddCommand);\n assertEquals(((AddCommand) addDeadlineCmd).getToAdd().getDescription(), \"return book\");\n assertEquals(((AddCommand) addDeadlineCmd).getToAdd().getDate().toString(), \"2020-10-10\");\n\n // Test add event\n Command addEventCmd = ChatbotParser.parseCommand(\"event attend wedding /at 2020-11-11\");\n assertTrue(addEventCmd instanceof AddCommand);\n assertEquals(((AddCommand) addEventCmd).getToAdd().getDescription(), \"attend wedding\");\n assertEquals(((AddCommand) addEventCmd).getToAdd().getDate().toString(), \"2020-11-11\");\n }", "private void handleCommand(Message msg, String commands) {\n String[] tokens = commands.split(\" \");\n String command = tokens[0];\n\n switch(command) {\n case \"query\":\n queryProblems(msg, tokens);\n break;\n case \"help\":\n printHelpMessage(msg, tokens);\n break;\n default:\n // Implement more commands later\n break;\n }\n }", "@Test\n public void parseCommand_undo() throws Exception {\n assertTrue(parser.parseCommand(UndoCommand.COMMAND_WORD) instanceof UndoCommand);\n assertTrue(parser.parseCommand(UndoCommand.COMMAND_WORD + \" \" + PREFIX_UNDO_REDO + \"all\")\n instanceof UndoCommand);\n assertTrue(parser.parseCommand(UndoCommand.COMMAND_WORD + \" \" + PREFIX_UNDO_REDO + \"5\")\n instanceof UndoCommand);\n assertTrue(parser.parseCommand(UndoCommand.COMMAND_WORD + \" \" + PREFIX_UNDO_REDO + \"0\")\n instanceof UndoCommand);\n assertTrue(parser.parseCommand(UndoCommand.COMMAND_WORD + \" \" + PREFIX_UNDO_REDO + \"-5\")\n instanceof UndoCommand);\n }", "public static Command getCommand(JSONObject obj, Player player, GameData gameData, String cmd) {\n String regExp = obj.get(JSONTag.REGEXP).toString();\n boolean undoable = parseBoolean(obj.get(JSONTag.UNDOABLE).toString());\n ConcreteCommand command = new ConcreteCommand(regExp, undoable, player, gameData, cmd);\n JSONArray conditionsSER = (JSONArray) obj.get(JSONTag.CONDITIONS);\n for (Object o : conditionsSER)\n command.addCondition(ConditionFactory.getCondition((JSONObject) o));\n JSONArray instructionSER = (JSONArray) obj.get(JSONTag.INSTRUCTIONS);\n for (Object o : instructionSER)\n command.addInstruction(InstructionFactory.getInstruction((JSONObject) o));\n return command;\n }", "public void handleCommand(String command);", "public String getCommand() { return command; }", "public static Command parse(String cmdline) throws ShellException {\r\n\t\tint commandIndex = 0;\r\n\t\tCommand[] possibleCommands = new Command[3];\r\n\t\tpossibleCommands[0] = new CallCommand(cmdline);\r\n\t\tpossibleCommands[1] = new SequenceCommand(cmdline);\r\n\t\tpossibleCommands[2] = new PipeCommand(cmdline);\r\n\r\n\t\twhile (true) {\r\n\t\t\ttry {\r\n\t\t\t\tpossibleCommands[commandIndex].parse();\r\n\t\t\t\treturn possibleCommands[commandIndex];\r\n\t\t\t} catch (ShellException e) {\r\n\t\t\t\tif (++commandIndex == possibleCommands.length) {\r\n\t\t\t\t\tthrow e;\r\n\t\t\t\t} else if (e.getMessage().contains(SequenceCommand.MISSING_ARG)) {\r\n\t\t\t\t\tthrow e;\r\n\t\t\t\t}\r\n\r\n\t\t\t} catch (StackOverflowError soe) {\r\n\t\t\t\tthrow new ShellException(soe + \"Invalid command for parsing\");\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private GetLCCommand() {\n initFields();\n }" ]
[ "0.7599479", "0.7187931", "0.71804005", "0.7151624", "0.7144193", "0.7099446", "0.7076864", "0.7068011", "0.7066901", "0.70453775", "0.6994661", "0.69839543", "0.69749224", "0.69685036", "0.694631", "0.6925581", "0.6861957", "0.68366784", "0.67873526", "0.6752906", "0.6743418", "0.6698474", "0.66847944", "0.6684333", "0.6674115", "0.66686475", "0.66664106", "0.66581345", "0.6658036", "0.66260326", "0.6624291", "0.6602058", "0.6578972", "0.6567153", "0.6566017", "0.65631866", "0.65381515", "0.65111744", "0.64923334", "0.6480365", "0.64690787", "0.64194596", "0.64166605", "0.6413845", "0.6402447", "0.63801175", "0.63765806", "0.6373063", "0.63677424", "0.6353756", "0.63318425", "0.6331403", "0.6316403", "0.6313664", "0.62907946", "0.6279611", "0.6277147", "0.62650967", "0.6252742", "0.62510604", "0.62484705", "0.624471", "0.6231472", "0.62276435", "0.6226967", "0.6226818", "0.6226048", "0.6220748", "0.62155527", "0.6194877", "0.6189548", "0.6185901", "0.61806047", "0.6176626", "0.61750054", "0.6172018", "0.61698794", "0.6167495", "0.6154039", "0.6147658", "0.61448395", "0.6143583", "0.6142378", "0.61319494", "0.6099037", "0.60970324", "0.6094783", "0.60921675", "0.6090433", "0.6088522", "0.6083906", "0.6082648", "0.60816026", "0.6075787", "0.6067038", "0.60652065", "0.60528624", "0.60509443", "0.60455245", "0.60334945" ]
0.7000016
10
create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(180, 180)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(8, 8, 8, 8); } else { imageView = (ImageView) convertView; } imageView.setImageResource(electronics[position]); return imageView; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\t\t\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\t\t\tImageView imageView = new ImageView(ImgShowActivity.this);\n\t\t\t\timageView.setImageBitmap(bitmaps[position]);\n\t\t\t\treturn imageView;\n\t\t\t}", "@Override\n public Object instantiateItem(ViewGroup view, int position) {\n view.addView(images.get(position));\n return images.get(position);\n }", "@Override\n public View getView(int i, View view, ViewGroup viewGroup) {\n ViewHolder viewHolder;\n if (view == null) {\n view = inflater.inflate(R.layout.image_grid, null);\n viewHolder = new ViewHolder();\n LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.linlayout);\n if (IMAGE_IDS[i] == R.id.chosen) {\n\n\n TextView chose = new TextView(this.context);\n chose.setLayoutParams(new LinearLayout.LayoutParams(\n LinearLayout.LayoutParams.MATCH_PARENT,\n LinearLayout.LayoutParams.WRAP_CONTENT));\n chose.setId(IMAGE_IDS[i]);\n viewHolder.mTextView=(TextView)chose;\n linearLayout.addView(chose);\n ImageView icon = (ImageView) view.findViewById(R.id.icon);\n viewHolder.mImageView=(ImageView)icon;\n linearLayout.removeView(icon);\n } else {\n ImageView icon = (ImageView) view.findViewById(R.id.icon);\n icon.setImageResource(logos[i]);\n icon.setId(IMAGE_IDS[i]);\n viewHolder.mImageView=(ImageView)icon;\n }\n view.setTag(viewHolder);\n } else {\n viewHolder=(ViewHolder)view.getTag();\n }\n return view;\n }", "@Override\n public Object instantiateItem(ViewGroup container, int position) {\n ImageView imageView = new ImageView(getContext());\n imageView.setImageURI(m_step.getImage(position).getImageURI());\n\n container.addView(imageView, new ViewGroup.LayoutParams(\n ViewGroup.LayoutParams.MATCH_PARENT,\n ViewGroup.LayoutParams.MATCH_PARENT\n ));\n return imageView;\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n ImageView imageView = new ImageView(context);\n imageView.setImageResource(imageIDs[position]);\n imageView.setLayoutParams(new Gallery.LayoutParams(100, 100));\n imageView.setBackgroundResource(itemBackground);\n return imageView;\n }", "public View getView(int index, View view, ViewGroup viewGroup)\n {\n // TODO Auto-generated method stub\n ImageView i = new ImageView(mContext);\n\n// i.setImageResource(mImageIds.get(index));\n\n if(mImageIds.size() > 0 ){\n Picasso.with(mContext).load(mImageIds.get(index)).into(i);\n }\n\n\n i.setLayoutParams(new Gallery.LayoutParams(200, 200));\n\n i.setScaleType(ImageView.ScaleType.FIT_XY);\n\n\n return i;\n }", "@NonNull\n @Override\n public Object instantiateItem(@NonNull ViewGroup container, int position) {\n\n final SimpleDraweeView imageView = new SimpleDraweeView(MainActivity.this);\n imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,\n ViewGroup.LayoutParams.WRAP_CONTENT));\n\n imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n// Uri uri = Uri.parse(bannerList.get(position).getImagePath());\n// imageView.setImageURI(uri);\n imageView.setActualImageResource(bannerImageList.get(position).getImageId());\n\n\n container.addView(imageView);\n return imageView;\n\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n ImageView iv = new ImageView(mContext);\n\n iv.setImageURI(Uri.parse(list.get(position).getURL()));\n LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(265, 265);\n iv.setLayoutParams(lp);\n iv.setPadding(15, 15, 15, 15);\n\n return iv;\n }", "@Override\r\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\r\n\t\tImageView imageView = new ImageView(contexto);\r\n\t\t\r\n\t\timageView.setImageResource(minhasIdsImagem[position]);\r\n\t\timageView.setLayoutParams(new Gallery.LayoutParams(150, 100));\r\n\t\timageView.setScaleType(ImageView.ScaleType.FIT_XY);\r\n\t\timageView.setBackgroundResource(itensMinhaGaleria);\r\n\t\t\r\n\t\treturn imageView;\r\n\t}", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\tImageView imageview = new ImageView(mContext);\n\t\timageview.setImageResource(mImageIds[position]);\n\t\timageview.setLayoutParams(new Gallery.LayoutParams(120,120));\n\t\timageview.setScaleType(ImageView.ScaleType.FIT_CENTER);\n\t\treturn imageview;\n\t}", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder = new ViewHolder();\n if (convertView == null) {\n convertView = LayoutInflater.from(context).inflate(R.layout.grid_item, null);\n\n holder.imageview = (ImageView) convertView.findViewById(R.id.img);\n convertView.setTag(holder);\n\n\n } else {\n\n holder = (ViewHolder) convertView.getTag();\n }\n Picasso.with(context).load(\"http://image.tmdb.org/t/p/w342/\" + getItem(position).poster_path).into(holder.imageview);\n return convertView;\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n ImageView imageView;\n if (convertView == null) { // if it's not recycled, initialize some attributes\n imageView = new ImageView(mContext);\n imageView.setLayoutParams(new GridView.LayoutParams(315, 315));\n imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n imageView.setPadding(8, 8, 8, 8);\n } else {\n imageView = (ImageView) convertView;\n }\n\n\n imageView.setImageBitmap(mThumbIds[position]);\n\n return imageView;\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder;\n if (convertView == null) {\n holder = new ViewHolder();\n holder.image = (ImageView) mInflater.inflate(R.layout.image_make_maopao, parent, false);\n holderList.add(holder);\n holder.image.setTag(holder);\n } else {\n holder = (ViewHolder) convertView.getTag();\n }\n\n\n if (position == getCount() - 1) {\n if (getCount() == (PHOTO_MAX_COUNT + 1)) {\n holder.image.setVisibility(View.INVISIBLE);\n\n } else {\n holder.image.setVisibility(View.VISIBLE);\n holder.image.setImageResource(R.mipmap.ic_add_image);\n holder.uri = \"\";\n }\n } else {\n holder.image.setVisibility(View.VISIBLE);\n PhotoData photoData = mData.get(position);\n Uri data = photoData.uri;\n holder.uri = data.toString();\n\n ImageLoader.getInstance().loadImage(data.toString(), mSize, new SimpleImageLoadingListener() {\n @Override\n public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {\n for (ViewHolder item : holderList) {\n if (item.uri.equals(imageUri)) {\n item.image.setImageBitmap(loadedImage);\n }\n }\n }\n });\n }\n\n return holder.image;\n }", "private void createImageView() {\n /**\n * We use @{@link AdjustableImageView} so that we can have behaviour like setAdjustViewBounds(true)\n * for Android below API 18\n */\n viewsToBeInflated.add(new AdjustableImageView(getActivityContext()));\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n ImageView imageView;\n if (convertView == null) {\n // if it's not recycled, initialize some attributes\n imageView = new ImageView(mContext);\n imageView.setLayoutParams(new GridView.LayoutParams(300,300));\n imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n imageView.setPadding(8, 8, 8, 8);\n } else {\n imageView = (ImageView) convertView;\n }\n\n imageView.setImageResource(mThumbIds[position]);\n return imageView;\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n\n // if it's not recycled, initialize some attributes\n ImageView imageView = (ImageView) convertView;\n if (imageView == null) {\n imageView = new ImageView(mContext);\n GridView gridView = (GridView) parent;\n DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();\n int imageDimension = metrics.widthPixels / gridView.getNumColumns();\n imageView.setLayoutParams(new GridView.LayoutParams(imageDimension, imageDimension));\n imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n imageView.setBackgroundColor(mContext.getResources().getColor(R.color.empty_image));\n }\n // Load the picture into the imageview\n if (mPictureList.get(position).getFile() == null) {\n Picasso.with(mContext)\n .load(mPictureList.get(position).getThumbnailUrl())\n .resize(PictureUtilities.MAX_THUMBNAIL_WIDTH, 0)\n .onlyScaleDown()\n .rotate(mPictureList.get(position).getOrientation())\n .into(imageView);\n } else {\n Picasso.with(mContext)\n .load(mPictureList.get(position).getFile())\n .resize(PictureUtilities.MAX_THUMBNAIL_WIDTH, 0)\n .onlyScaleDown()\n .rotate(mPictureList.get(position).getOrientation())\n .into(imageView);\n }\n return imageView;\n }", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) \n\t{\n\t\tImageView imageView;\n\t\tif (convertView == null) \n\t\t{\n\t\t\timageView = new ImageView(mContext);\n\t\t\timageView.setLayoutParams(new GridView.LayoutParams(imgSize, imgSize));\n\t\t\timageView.setScaleType(ImageView.ScaleType.FIT_XY);\n\t\t\timageView.setPadding(0, 0, 0, 0);\n\t\t\timageView.setScrollContainer(false);\n\t\t} \n else \n {\n imageView = (ImageView) convertView;\n }\n imageView.setImageResource(getImageResourceId(position));\n return imageView;\n\t}", "public View getView(int position, View convertView, ViewGroup parent) {\n ImageView imageView;\n // Try reusing the old view, if possible.\n if (convertView == null) {\n imageView = new ImageView(mContext);\n imageView.setLayoutParams(new GridView.LayoutParams(imageHeight, imageWidth));\n imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n imageView.setPadding(8, 8, 8, 8);\n } else {\n imageView = (ImageView) convertView;\n }\n\n imageView.setImageResource(mThumbIds[position]);\n return imageView;\n }", "@Override\n\t\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\t\tImageView imageView = new ImageView(GridViewAnimationActivity.this);\n\t\t\tResolveInfo info = mApps.get(position % mApps.size());\n\t\t\timageView.setImageDrawable(info.activityInfo\n\t\t\t\t\t.loadIcon(getPackageManager()));\n\t\t\timageView.setScaleType(ImageView.ScaleType.FIT_CENTER);\n\t\t\tfinal int w = (int) (45 * getResources().getDisplayMetrics().density + 0.5f);\n\t\t\timageView.setLayoutParams(new GridView.LayoutParams(w, w));\n\t\t\treturn imageView;\n\t\t}", "private void setAdvertImages()\t{\n\n\t\tviewFlipper = (ViewFlipper) findViewById(R.id.view_flipper_display);\n\n\t\tString[] ids = getImageIDs(shopName);\n\n\t\tif(ids.length == 1)\t{\t\t//Just the logo exists\n\t\t\tLinearLayout ll = new LinearLayout(this);\n\t\t\tll.setOrientation(LinearLayout.VERTICAL);\n\n\t\t\tLinearLayout.LayoutParams lpScan = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);\n\t\t\tll.setLayoutParams(lpScan);\n\t\t\tll.setGravity(Gravity.CENTER);\n\n\t\t\tImageView iv = new ImageView(this);\n\t\t\tiv.setLayoutParams(lpScan);\n\t\t\tiv.setImageBitmap(imageLoadedFromInternalStorage(ids[0]));\t\t//Sets flipper images = logo (ids[0])\n\n\t\t\tll.addView(iv);\n\t\t\tviewFlipper.addView(ll);\t\n\t\t}\n\n\n\t\tfor(int i = 1; i < ids.length; i++)\t{\n\n\t\t\tLinearLayout ll = new LinearLayout(this);\n\t\t\tll.setOrientation(LinearLayout.VERTICAL);\n\n\t\t\tLinearLayout.LayoutParams lpScan = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);\n\t\t\tll.setLayoutParams(lpScan);\n\t\t\tll.setGravity(Gravity.CENTER);\n\n\t\t\tImageView iv = new ImageView(this);\n\t\t\tiv.setLayoutParams(lpScan);\n\t\t\tiv.setImageBitmap(imageLoadedFromInternalStorage(ids[i]));\n\n\t\t\tll.addView(iv);\n\t\t\tviewFlipper.addView(ll);\t\n\t\t}\n\t}", "public ItemViewHolder(View itemView) {\n super(itemView);\n iv_image = (RoundedImageView)itemView.findViewById(R.id.item_photo);\n tv_title = (TextView)itemView.findViewById(R.id.item_title);\n tv_subtitle = (TextView)itemView.findViewById(R.id.item_subtitle);\n iv_image2 = (ImageView)itemView.findViewById(R.id.imageView1);\n }", "@Override\n public View getView(final int position, View convertView, ViewGroup parent) {\n final Holder holder;\n\n if (convertView == null) {\n convertView = inflater.inflate(R.layout.img_item_list, null);\n holder = new Holder();\n holder.iv = convertView.findViewById(R.id.img);\n convertView.setTag(holder);\n } else {\n holder = (Holder) convertView.getTag();\n }\n if (mlist.size() > 1) {\n int sw = Tools.getScreenW(mContext);\n int w = (sw - Tools.dip2px(mContext, 15 + 15 + 60 + 6 + 6)) / 3;\n Double rate = 66.0 / 92;\n\n int h = (int) (w * rate);\n Glide.with(mContext.getApplicationContext()).load(mlist.get(position).getUrl())\n .apply(new RequestOptions()\n .override(w, h)\n .centerCrop()\n .placeholder(R.drawable.iv_default_news_small))\n .into(holder.iv);\n } else {\n int sw = Tools.getScreenW(mContext);\n int w = sw - Tools.dip2px(mContext, 15 + 15 + 60);\n Double rate = 9.0 / 16;\n\n int h = (int) (w * rate);\n Glide.with(mContext.getApplicationContext()).load(mlist.get(position).getUrl())\n .apply(new RequestOptions()\n .override(w, h)\n .centerCrop()\n .placeholder(R.drawable.iv_default_news_single_big))\n .into(holder.iv);\n }\n\n\n return convertView;\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder=null;\n int who=(Integer)chatList.get(position).get(\"person\");\n\n convertView= LayoutInflater.from(context).inflate(\n layout[who==ME?0:1], null);\n holder=new ViewHolder();\n holder.imageView=(ImageView)convertView.findViewById(to[who*2+0]);\n holder.textView=(TextView)convertView.findViewById(to[who*2+1]);\n\n\n System.out.println(holder);\n System.out.println(\"WHYWHYWHYWHYW\");\n System.out.println(holder.imageView);\n holder.imageView.setImageResource((Integer)chatList.get(position).get(from[0]));\n holder.textView.setText(chatList.get(position).get(from[1]).toString());\n return convertView;\n }", "private void fillImageViewList(){\n ImageView imView1 =(ImageView) findViewById(R.id.imgCel1);\n ImageView imView2 =(ImageView) findViewById(R.id.imgCel2);\n ImageView imView3 =(ImageView) findViewById(R.id.imgCel3);\n ImageView imView4 =(ImageView) findViewById(R.id.imgCel4);\n ImageView imView5 =(ImageView) findViewById(R.id.imgCel5);\n ImageView imView6 =(ImageView) findViewById(R.id.imgCel6);\n ImageView imView7 =(ImageView) findViewById(R.id.imgCel7);\n ImageView imView8 =(ImageView) findViewById(R.id.imgCel8);\n ImageView imView9 =(ImageView) findViewById(R.id.imgCel9);\n\n imageList = new ArrayList<>();\n\n imageList.add(imView1); imageList.add(imView2);\n imageList.add(imView3); imageList.add(imView4);\n imageList.add(imView5); imageList.add(imView6);\n imageList.add(imView7); imageList.add(imView8);\n imageList.add(imView9);\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n\t ImageView imageView;\n\t if (convertView == null) { // if it's not recycled, initialize some attributes\n\t imageView = new ImageView(mContext);\n\t //imageView.setLayoutParams(new GridView.LayoutParams(85, 85));\n\t imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n\t imageView.setPadding(8, 8, 8, 8);\n\t imageView.setAdjustViewBounds(true);\n\t imageView.setMaxHeight(90);\n\t imageView.setMaxWidth(90);\n\t } else {\n\t imageView = (ImageView) convertView;\n\t }\n\n\t imageView.setImageResource(toolpic_IDs[position]);\n\t return imageView;\n\t }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n\n View viewProduct;\n if (convertView == null) {\n viewProduct = View.inflate(parent.getContext(), R.layout.item_row, null);\n } else viewProduct = convertView;\n\n ItemInfo itemInfo = (ItemInfo) getItem(position);\n ((TextView) viewProduct.findViewById(R.id.txt_title)).setText( itemInfo.title);\n ((TextView) viewProduct.findViewById(R.id.txt_desc)).setText(itemInfo.description);\n Picasso.with(G.context).load(itemInfo.imageUrl).into((ImageView) viewProduct.findViewById(R.id.img_Icon));\n\n\n return viewProduct;\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n View v = convertView;\n ImageView picture;\n TextView name;\n\n if (v == null) {\n // if it's not recycled, initialize some attributes\n v = mInflater.inflate(R.layout.content_griditem, parent, false);\n v.setTag(R.id.picture_griditem, v.findViewById(R.id.picture_griditem));\n v.setTag(R.id.text_griditem, v.findViewById(R.id.text_griditem));\n }\n\n picture = (ImageView) v.getTag(R.id.picture_griditem);\n name = (TextView) v.getTag(R.id.text_griditem);\n\n Item item = mImageIds.get(position);\n\n picture.setImageResource(item.drawableId);\n name.setText(item.name);\n return v;\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n ImageView imageView;\n if (convertView == null) {\n // if it's not recycled, initialize some attributes\n imageView = new ImageView(mContext);\n imageView.setLayoutParams(new GridView.LayoutParams(\n ViewGroup.LayoutParams.WRAP_CONTENT,\n ViewGroup.LayoutParams.WRAP_CONTENT\n ));\n\n imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n imageView.setPadding(0, 0, 0, 0);\n imageView.setTag(mMovieId[position]);\n } else {\n imageView = (ImageView) convertView;\n }\n\n String base_url = \"http://image.tmdb.org/t/p/w500\";\n if (mPosterUrl[position] != null) {\n Picasso\n .with(mContext)\n .load(base_url + mPosterUrl[position])\n .noFade()\n .resize(540, 850)\n .into(imageView);\n }\n return imageView;\n }", "public void bindItem(ItemList1_Structure item) {\n\n /*Bitmap icon = BitmapFactory.decodeResource(Resources.getSystem(), item.getImage());\n\n iv_image.setImageBitmap(icon);*/\n\n iv_image.setImageResource(item.getImage());\n\n tv_title.setText(item.getTitle());\n tv_subtitle.setText(item.getSubtitle());\n\n\n //LIBRERIA PICASSO\n //CON IMAGENES DEMASIADO GRANDES LANZA UN ERROR EN LA CLASE ROUNDEDIMAGEVIEW...algun conflicto al convertir a bitmap\n Picasso.with(context)\n .load(\"http://whosbehindmask.weebly.com/uploads/2/8/3/6/28365549/5831103_orig.jpg\") //http://viralandscdn.net/posts/13668/image-sg3SqUON.jpg\n .into(iv_image2);\n\n //MUESTRA UN INDICADOR EN LA ESQUINA SUPERIOR IZQUIERDA CON COLOR INDICANDO DE DONDE PROVIENE LA IMAGEN:\n // ROJO = NETWORK, AZUL = DISK, VERDE = MEMORY\n Picasso.with(context).setIndicatorsEnabled(true);\n\n /*** //EJEMPLO LIBRERIA PICASSO, LEER IMAGEN DE INTERNET, LEER DEL HOLDER, ASIGNAR IMAGEN DE ERROR, REDIMENSIONAR IMAGEN Y ROTAR IMAGEN\n Picasso.with(this)\n .load(\"YOUR IMAGE URL HERE\")\n .placeholder(R.drawable.ic_placeholder) // optional\n .error(R.drawable.ic_error_fallback) // optional\n .resize(250, 200) // optional\n .rotate(90) // optional\n .into(imageView);\n *///\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n\t\tMovieImageView imageView;\n if (convertView == null) { // if it's not recycled, initialise some attributes\n imageView = new MovieImageView(this.mOwner, this.movies[position].getId());\n imageView.setLayoutParams(new GridView.LayoutParams(95, 140));\n imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n } else {\n imageView = (MovieImageView) convertView;\n imageView.init(this.movies[position].getId());\n }\n\t\timageView.setImageBitmap(this.movies[position].getThumbnail());\n return imageView;\n\t}", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n View grid;\n final CompanyItem companydetail = company_itemlist.get(position);\n LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n\n if (convertView == null) {\n\n\n grid = new View(mContext);\n grid = inflater.inflate(R.layout.grid_item, null);\n TextView textView = (TextView) grid.findViewById(R.id.txt_gridItem);\n ImageView imageView = (ImageView) grid.findViewById(R.id.img_gridIcon);\n imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n imageView.setScaleX(1.0f);\n imageView.setScaleY(1.0f);\n ImageLoader imageLoader = ImageLoader.getInstance();\n DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(true)\n .cacheOnDisc(true).resetViewBeforeLoading(true)\n .showImageForEmptyUri(R.mipmap.ic_launcher)\n .showImageOnFail(R.mipmap.ic_launcher)\n .showImageOnLoading(R.mipmap.ic_launcher).build();\n\n\n textView.setText(companydetail.getCompany_name());\n\n// Bitmap bit = imageLoader.loadImageSync(companydetail.getCompany_logo());\n\n imageLoader.displayImage(companydetail.getCompany_logo(), imageView, options);\n\n } else {\n grid = (View) convertView;\n }\n\n\n return grid;\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder;\n if (convertView == null) {\n holder = new ViewHolder();\n convertView = LayoutInflater.from(mContext).inflate(R.layout.photo_list_items, parent, false);\n holder.ivImageDisplay = (SquareImageView) convertView.findViewById(R.id.ivImageDisplay);\n holder.tvImageFolderName = (TextView) convertView.findViewById(R.id.tvImageFolderName);\n convertView.setTag(holder);\n } else {\n holder = (ViewHolder) convertView.getTag();\n }\n imageCategorizingModel = getItem(position);\n String imagePath = imageCategorizingModel.getPath();\n String folderName = imageCategorizingModel.getFolderName();\n int imageCount = imageCategorizingModel.getImageCount();\n String displayName = folderName+\" (\"+imageCount+\")\";\n holder.tvImageFolderName.setText(displayName);\n /*Bitmap bitmap = Utils.UriToBitmap(imagePath);\n holder.ivImageDisplay.setImageBitmap(bitmap);*/\n imageLoader.displayImage(\"file://\" + imagePath, holder.ivImageDisplay, options, animateFirstListener);\n return convertView;\n }", "@Override\n\t public View getView(int position, View convertView, ViewGroup parent) {\n\t ViewHolder view;\n\t LayoutInflater inflator = activity.getLayoutInflater();\n\t \n\t if(convertView==null)\n\t {\n\t view = new ViewHolder();\n\t convertView = inflator.inflate(R.layout.gridview_row, null);\n\t \n\t view.imgView = (ImageView) convertView.findViewById(R.id.imageView1);\n\t \n\t convertView.setTag(view);\n\t }\n\t else\n\t {\n\t view = (ViewHolder) convertView.getTag();\n\t }\n\t view.imgView.setImageDrawable(listImg.get(position));\n\t \n\t return convertView;\n\t }", "@Override\n public View getView(final int i, View view, ViewGroup viewGroup) {\n ViewHolder holder;\n LayoutInflater inflator = LayoutInflater.from(context);\n if(view == null) {\n view = inflator.inflate(R.layout.myitem, null);//解出Layout 解壓器,消耗資源\n holder = new ViewHolder();\n holder.name = (TextView)view.findViewById(R.id.textView);\n holder.statement = (TextView)view.findViewById(R.id.textView2);\n holder.img =(ImageView)view.findViewById(R.id.imageView);\n view.setTag(holder);//要加,不然listview滑動會當掉\n holder.name.setText(zooInfo[i].E_Name);\n holder.statement.setText(zooInfo[i].E_Info);\n Picasso.with(context).load(zooInfo[i].E_Pic_URL).into(holder.img);\n } else {\n holder = (ViewHolder) view.getTag();\n }\n return view;\n\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n\n\t\t//create the view\n\t ImageView imageView = new ImageView(c);\n\t //specify the bitmap at this position in the array\n\t\tPicasso.with(c).load(this.getItem(position).getFileImg()).into(imageView);\n\n\t\treturn imageView;\n\t}", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\tHolder holder=null;\n\t\tif(convertView==null){\n\t\t\tconvertView=LayoutInflater.from(context).inflate(R.layout.item_user_card_pets_icon, null);\n\t\t\tholder=new Holder();\n\t\t\tholder.hat=(ImageView)convertView.findViewById(R.id.hat);\n\t\t\tholder.icon=(ImageView)convertView.findViewById(R.id.icon);\n\t\t\tholder.background=convertView.findViewById(R.id.background);\n\t\t\tholder.position=position;\n\t\t\tconvertView.setTag(holder);\n\t\t\t\n\t\t}else{\n\t\t\tholder=(Holder)convertView.getTag();\n\t\t\tholder.position=position;\n\t\t}\n\t\tAnimal animal=animals.get(position);\n\t\tif(animal.master_id==user.userId){\n\t\t\tholder.hat.setVisibility(View.VISIBLE);\n\t\t}else{\n\t\t\tholder.hat.setVisibility(View.GONE);\n\t\t}\n\t\tloadIcon(holder.icon, animal);\n\t\t\n\t\treturn convertView;\n\t}", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n\n final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n// View view = null;\n\n// java.lang.String label;\n// java.lang.String image = null;\n java.lang.String template = null;\n JSONArray itemsArray = null;\n List<JSONObject> itemObjects = new ArrayList<JSONObject>();\n\n try {\n// label = objects.get(position).getString(TAG_LABEL);\n// image = objects.get(position).getString(TAG_IMAGE);\n template = objects.get(position).getString(TAG_TEMPLATE);\n itemsArray = objects.get(position).getJSONArray(TAG_ITEMS);\n\n for (int i = 0; i < itemsArray.length(); i++) {\n itemObjects.add(itemsArray.getJSONObject(i));\n }\n\n if(\"product-template-1\".equals(template)){\n\n Log.i(LOGTAG, \"Position = \" + position);\n View layoutView = layoutInflater.inflate(R.layout.template_one_layout, parent, false);\n// View imageView = layoutInflater.inflate(R.layout.template_one, parent, false);\n\n LinearLayout linearLayout = (LinearLayout) layoutView.findViewById(R.id.vertical_layout);\n\n for (int i = 0; i < itemsArray.length(); i++) {\n\n// ImageView image = (ImageView) imageView.findViewById(R.id.image_1);\n ImageView image = new ImageView(context);\n LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(\n LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);\n image.setLayoutParams(params);\n image.setScaleType(ImageView.ScaleType.FIT_XY);\n\n View divider = new View(context);\n LinearLayout.LayoutParams paramsDivider = new LinearLayout.LayoutParams(\n LinearLayout.LayoutParams.MATCH_PARENT, 20);\n divider.setLayoutParams(paramsDivider);\n\n try {\n java.lang.String imageString = itemsArray.getJSONObject(i).getString(TAG_IMAGE);\n Log.i(LOGTAG, \"Template 1 : URL = \" + imageString);\n Picasso.with(getApplicationContext()).load(imageString).into(image);\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n linearLayout.addView(image);\n linearLayout.addView(divider);\n }\n\n return layoutView;\n\n }else if(\"product-template-2\".equals(template)){\n\n Log.i(LOGTAG, \"Position = \" + position);\n\n /*View view = layoutInflater.inflate(R.layout.template_two, parent, false);\n RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);\n // recyclerView.setHasFixedSize(true);\n\n LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);\n recyclerView.setLayoutManager(linearLayoutManager);\n\n RecyclerAdapter recyclerAdapter = new RecyclerAdapter(itemObjects);\n recyclerView.setAdapter(recyclerAdapter);\n return view;*/\n\n View layoutView = layoutInflater.inflate(R.layout.template_two_layout, parent, false);\n LinearLayout linearLayout = (LinearLayout) layoutView.findViewById(R.id.horizontal_layout);\n\n for (int i = 0; i < itemsArray.length(); i++) {\n\n View imageView = layoutInflater.inflate(R.layout.template_two_detail, null/*, false*/);\n LinearLayout templateTwoDetailLayout = (LinearLayout) imageView.findViewById(R.id.template_two_layout);\n ImageView image = (ImageView) imageView.findViewById(R.id.image_2);\n\n View divider = new View(context);\n LinearLayout.LayoutParams paramsDivider = new LinearLayout.LayoutParams(\n 20, LinearLayout.LayoutParams.MATCH_PARENT);\n divider.setLayoutParams(paramsDivider);\n\n try {\n java.lang.String imageString = itemsArray.getJSONObject(i).getString(TAG_IMAGE);\n Log.i(LOGTAG, \"Template 2 : URL = \" + imageString);\n Picasso.with(getApplicationContext()).load(imageString).into(image);\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n linearLayout.addView(templateTwoDetailLayout);\n linearLayout.addView(divider);\n }\n\n return layoutView;\n\n }else if(\"product-template-3\".equals(template)){\n\n Log.i(LOGTAG, \"Position = \" + position);\n\n View layoutView = layoutInflater.inflate(R.layout.template_three_layout, parent, false);\n ViewPager viewPager = (ViewPager) layoutView.findViewById(R.id.pager);\n\n Log.i(LOGTAG, \"Size of itemsArray template 3 \" + itemsArray.length());\n ScreenSlidePagerAdapter pagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager(), itemsArray);\n viewPager.setAdapter(pagerAdapter);\n viewPager.setOffscreenPageLimit(5);\n\n CirclePageIndicator circlePageIndicator = (CirclePageIndicator) layoutView.findViewById(R.id.circlePageInd);\n circlePageIndicator.setViewPager(viewPager);\n\n return layoutView;\n\n }\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n return new View(context);\n }", "@Override\n public View getView(int position, View ConvertView, ViewGroup parent){ ///position starts from zero,one and goes on, parent would be the layout we want to display all elements\n View row=ConvertView; //to optimize we inflate the item only first else we recycle the view using converterView\n if(row==null) {\n LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n\n //**View of which we want to convert to java view object\n row = inflater.inflate(R.layout.single_row, parent, false);\n }\n //*****From row view we can access the view items and populate it data\n ImageView imageView = (ImageView)row.findViewById(R.id.imageView);\n TextView myDiscription=(TextView)row.findViewById(R.id.myDescription);\n TextView myTitle=(TextView)row.findViewById(R.id.mytitle);\n\n imageView.setImageResource(images[position]); //postion will incremented automaticlly as views will populate\n myDiscription.setText(description[position]);\n myTitle.setText(titles[position]);\n\n return row;\n }", "public View getView(int index, View view, ViewGroup viewGroup)\n {\n // TODO Auto-generated method stub\n ImageView img = new ImageView(context);\n\n //imageloader.DisplayImage(GlobalVariable.link+\"files/\"+array_image_id.get(index), R.drawable.ic_temp_logo, img);\n img.setLayoutParams(new Gallery.LayoutParams(200, 200));\n img.setScaleType(ImageView.ScaleType.FIT_XY);\n\n return img;\n }", "@Override\r\n\t\t\t\tprotected void updateView(AbsListView view, View convertView, int position) {\n\t\t\t\t\tImageView img = (ImageView) convertView.findViewById(mImageViewId);\r\n\t\t\t\t\tif(img != null) {\r\n\t\t\t\t\t\tString url = (String) img.getTag();\r\n\t\t\t\t\t\tint type = retrieveType(url);\r\n\t\t\t\t\t\tswitch(type) {\r\n\t\t\t\t\t\tcase TYPE_URL:\r\n\t\t\t\t\t\t\tsetRemoteImage(img, url, position);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase TYPE_RESOURCES:\r\n\t\t\t\t\t\t\tsetResourceImage(img, Integer.valueOf(retrieveKey(url)), getRequestMinWidth(), 0);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase TYPE_STORAGE:\r\n\t\t\t\t\t\t\tsetStorageImage(img, retrieveKey(url), getRequestMinWidth(), 0);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase TYPE_ASSETS:\r\n\t\t\t\t\t\t\tsetAssetsImage(img, retrieveKey(url), getRequestMinWidth(), 0);\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}", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n Movie mymovie= (Movie) getItem(position);\n LayoutInflater inflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n View row;\n row = inflater.inflate(R.layout.movie_item,parent,false);\n mImg = (ImageView)row.findViewById(R.id.cover_image);\n String url= new StringBuilder()\n .append(BASE_POSTER_URL)\n .append(IMAGE_SIZE)\n .append(mymovie.getPosterPath().trim())\n .toString();\n Picasso.with(ctx)\n .load(url)\n .placeholder(R.mipmap.ic_load)\n .error(R.mipmap.ic_error)\n .into(mImg);\n return row;\n }", "public View getView(int position, View convertView, ViewGroup parent) { \t\n \tImageView imageView = null;\n \ttry{\n \n if (convertView == null) { // if it's not recycled, initialize some attributes\n imageView = new ImageView(mContext);\n imageView.setLayoutParams(new GridView.LayoutParams(70, 70));\n imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n imageView.setPadding(0, 0, 0, 0);\n \n } else {\n imageView = (ImageView) convertView;\n }\n imageView.setImageBitmap(images[position]);\n \t} catch (Exception e) {\n \t\tLog.e(\"log_tag\", \"ERROR IN GET VIIIIIEWWWWWWWWWWWWWWWWWWWWW\");\n \t}\n \n return imageView;\n }", "@Override\r\n public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder=null;\r\n int who=(Integer)chatList.get(position).get(\"person\");\r\n convertView= LayoutInflater.from(context).inflate(\r\n layout[who==ME?0:1], null);\r\n holder=new ViewHolder();\r\n holder.imageView=(ImageView)convertView.findViewById(to[who*2+0]);\r\n holder.textView=(TextView)convertView.findViewById(to[who*2+1]);\r\n //System.out.println(holder);\r\n //System.out.println(\"WHYWHYWHYWHYW\");\r\n //System.out.println(holder.imageView);\r\n holder.imageView.setBackgroundResource((Integer)chatList.get(position).get(from[0]));\r\n holder.textView.setText(chatList.get(position).get(from[1]).toString());\r\n return convertView;\r\n }", "@NonNull\r\n @Override\r\n public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {\n\r\n ImageView view = new ImageView(getApplicationContext());\r\n\r\n\r\n return new RecyclerView.ViewHolder(view) {\r\n\r\n };\r\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n\n LayoutInflater inflater = (LayoutInflater) mContext\n .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n View itemView = inflater.inflate(R.layout.attractions_grid_item, parent,\n false);\n\n ImageView imageView;\n TextView titleTextView;\n\n// if (convertView == null) {\n if (itemView != null) {\n // if it's not recycled, initialize some attributes\n// imageView = new ImageView(mContext);\n imageView = (ImageView)itemView.findViewById(R.id.attractions_grid_item_image);\n// DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics();\n// float dpHeight = displayMetrics.heightPixels / displayMetrics.density;\n// float dpWidth = displayMetrics.widthPixels / displayMetrics.density;\n//\n Display display= ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();\n// int screenHeight = display.getHeight();\n\n// int width = (int)dpWidth / 2;\n// int height = width * 38 / 62;\n\n int width = (int)display.getWidth() / 2;\n int height = width * 38 / 62;\n\n// imageView.setLayoutParams(new GridView.LayoutParams(width, height));\n imageView.setLayoutParams(new RelativeLayout.LayoutParams(width, height));\n imageView.setScaleType(ImageView.ScaleType.FIT_XY);\n imageView.setPadding(8, 8, 8, 8);\n\n titleTextView = (TextView)itemView.findViewById(R.id.attractions_grid_item_title);\n// titleTextView.setTextSize(18 * mContext.getResources().getDisplayMetrics().density);\n\n if (mAttractions != null && mAttractions.size() > position) {\n AroundPlaceAttraction attraction = mAttractions.get(position);\n titleTextView.setText(attraction.getName());\n if (attraction.getImages() != null && attraction.getImages().length > 0)\n Picasso.with(mContext).load(attraction.getImages()[0]).transform(new RoundedTransformation(15, 2)).into(imageView);\n }\n\n\n } /*else {\n imageView = (ImageView) convertView;\n }*/\n\n// imageView.setImageResource(mThumbIds[position]);\n// return imageView;\n return itemView;\n }", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) \n\t{\n\t\tImageView imageView;\n\t\tint Width = (getScreenWidth(mContext)-40)/2;\n\t\tif (convertView == null)\n\t\t{\n\t\t\timageView = new ImageView(mContext); // 给ImageView设置资源\n\t\t\timageView.setLayoutParams(new GridView.LayoutParams(Width, Width)); // 设置布局图片\n\t\t\timageView.setScaleType(ImageView.ScaleType.CENTER_CROP); // 设置显示比例类型\n\t\t}\n\t\telse\n\t\t{\n\t\t\timageView = (ImageView) convertView;\n\t\t}\n\t\timageView.setImageDrawable(makeBmp(mImageIds.elementAt(position),\n\t\tmImage_bs.elementAt(position)));\n\t\treturn imageView;\n\t}", "@Override\n public Object instantiateItem(ViewGroup container, int position) {\n RawHomebannerPagerBinding binding = DataBindingUtil.inflate(mLayoutInflater, R.layout.raw_homebanner_pager, container, false);\n Log.d(\"TAG\",\"Banner url = \"+bannerlist);\n Glide.with(activity).load(\"https://youngersshoppingclub.com/assets/images/\"+bannerlist.get(position)).centerCrop().transform(new CircleCrop()).fitCenter().into(binding.img);\n binding.img.setScaleType(ImageView.ScaleType.FIT_XY);\n// binding.img.setImageResource(GalImages[position]);\n\n container.addView(binding.getRoot());\n\n return binding.getRoot();\n }", "@Override\n\t\tpublic View getView(int position, View convertView, ViewGroup container) {\n\t\t\tImageView imageView;\n\t\t\tif (convertView == null) { // if it's not recycled, instantiate and\n\t\t\t\t\t\t\t\t\t\t// initialize\n\t\t\t\timageView = new ImageView(mContext);\n\t\t\t\timageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n\t\t\t\timageView.setLayoutParams(mImageViewLayoutParams);\n\t\t\t} else { // Otherwise re-use the converted view\n\t\t\t\timageView = (ImageView) convertView;\n\t\t\t}\n\n\t\t\t// Check the height matches our calculated column width\n\t\t\tif (imageView.getLayoutParams().height != mItemHeight) {\n\t\t\t\timageView.setLayoutParams(mImageViewLayoutParams);\n\t\t\t}\n\n\t\t\tCrashReportingApplication.mFinalBitmap.display(imageView, imageUrls[position]);\n//\t\t\tmImageWorker.loadBitmap(imageUrls[position], imageView);\n\t\t\treturn imageView;\n\t\t}", "public ViewHolder(View itemView) {\n // Stores the itemView in a public final member variable that can be used\n // to access the context from any ViewHolder instance.\n super(itemView);\n imageView1 = itemView.findViewById(R.id.item_health_center_first_photo);\n imageView2 = itemView.findViewById(R.id.item_health_center_second_photo);\n imageView3 = itemView.findViewById(R.id.item_health_center_third_photo);\n imageView4 = itemView.findViewById(R.id.item_health_center_forth_photo);\n }", "public void AddImgToRecyclerView()\n {\n imgsource = new Vector();\n Resources res = getResources();\n imgsource.add(res.getIdentifier(\"@drawable/add_overtime_schedule\", null, getPackageName()));\n imgsource.add(res.getIdentifier(\"@drawable/add_overtime\", null, getPackageName()));\n imgsource.add(res.getIdentifier(\"@drawable/clock_in\", null, getPackageName()));\n imgsource.add(res.getIdentifier(\"@drawable/vacation\", null, getPackageName()));\n imgsource.add(res.getIdentifier(\"@drawable/document\", null, getPackageName()));\n imgsource.add(res.getIdentifier(\"@drawable/order\", null, getPackageName()));\n }", "public View getView(int position, View convertView, \n\t\t\t\tViewGroup parent) {\n\n\t\t\t// Get a View to display image data \t\t\t\t\t\n\t\t\tImageView iv = new ImageView(this.myContext);\n\t\t\tiv.setImageResource(this.myImageIds[position]);\n\n\t\t\t// Image should be scaled somehow\n//\t\t\tiv.setScaleType(ImageView.ScaleType.CENTER);\n\t\t\t//iv.setScaleType(ImageView.ScaleType.CENTER_CROP);\t\t\t\n\t\t\t//iv.setScaleType(ImageView.ScaleType.CENTER_INSIDE);\n\t\t\t//iv.setScaleType(ImageView.ScaleType.FIT_CENTER);\n//\t\t\tiv.setScaleType(ImageView.ScaleType.FIT_XY);\n\t\t\tiv.setScaleType(ImageView.ScaleType.FIT_END);\n\t\t\t\n\t\t\t// Set the Width & Height of the individual images\n\t\t\tiv.setLayoutParams(new Gallery.LayoutParams(95, 70));\n\n\t\t\treturn iv;\n\t\t}", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n ImageView imageView=new ImageView(mContext);\n imageView.setImageResource(drawable1[position%drawable1.length]);\n//取余,让图片循环浏览\n\n if(selectItem==position){\n// Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.my_scale_action); //实现动画效果\n Gallery.LayoutParams params = new Gallery.LayoutParams(width*3/5, 500);\n imageView.setLayoutParams(params);\n// imageView.startAnimation(animation); //选中时,这是设置的比较大\n }\n else{\n imageView.setLayoutParams(new Gallery.LayoutParams(width/5,400));\n//未选中\n }\n return imageView;\n }", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\tViewHolder holder;\n\t\tif (convertView == null) {\n\t\t\tholder = new ViewHolder();\n\t\t\tconvertView = inflater.inflate(R.layout.griditem_addpic, null);\n\t\t\tholder.imgView = (ImageView) convertView\n\t\t\t\t\t.findViewById(R.id.imageView1);\n\t\t\tconvertView.setTag(holder);\n\t\t} else {\n\t\t\tholder = (ViewHolder) convertView.getTag();\n\t\t}\n\t\tImageLoader.getInstance().displayImage(\n\t\t\t\timageItem.get(position).get(\"itemImage\").toString(),\n\t\t\t\tholder.imgView);\n\n\t\treturn convertView;\n\t}", "@Override\n\t\t\tpublic void onItemClick(AdapterView<?> parent, View view, int position,\n\t\t\t\t\tlong id) {\n\t\t\t\timgView.setImageResource(imageIds[position]);\n\t\t\t}", "@Override\n public void onBindViewHolder(ViewHolder holder, int position) {\n // - get element from your dataset at this position\n // - replace the contents of the view with that element\n Picasso.get().load(mDataset[position].getImgUrl()).into(holder.imageView);\n }", "public View getView(int position, View convertView, ViewGroup parent) {\r\n\t\t\tImageView imageView;\r\n\t\t\tif (convertView == null) {\r\n\t\t\t\timageView = new ImageView(context);\r\n\t\t\t\t// imageView.setLayoutParams(new GridView.LayoutParams(-1, -1));\r\n\t\t\t\t// imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);\r\n\t\t\t\timageView.setPadding(1, 1, 1, 1);\r\n\t\t\t} else {\r\n\t\t\t\timageView = (ImageView) convertView;\r\n\t\t\t}\r\n\t\t\tint imageID = ((HerdinatorApplication) getApplication()).imageIDs[position];\r\n\t\t\timageView.setImageResource(imageID);\r\n\t\t\treturn imageView;\r\n\t\t}", "@Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id)\n {\n\n Ion.with(getContext())\n .load(classi_images.get(position))\n .withBitmap()\n .placeholder(R.raw.loading)\n .error(R.drawable.error)\n .animateLoad(R.anim.zoom_in)\n .animateIn(R.anim.fade_in)\n .intoImageView(clasified_image);\n }", "@Override\n public void onBindViewHolder(ViewHolder holder, int position) {\n holder.iView.setImageResource(Integer.parseInt(aList.get(position).get(from[0])));\n holder.nameView.setText(aList.get(position).get(from[1]));\n holder.descView.setText(aList.get(position).get(from[2]));\n holder.boostView.setText(aList.get(position).get(from[3]));\n }", "void createPieceViews() {\n\t pieceViews = new ArrayList<ImageView>();\n\t for (int i=0; i<NUM[TOTAL]; i++) {\n\t\t\tpieceViews.add(new ImageView(this));\n\t\t}\n\t}", "public View getView(int position, View convertView, ViewGroup parent) {\n\t\tImageView imageView;\n\t\tif (convertView == null) { // if it's not recycled, initialize some\n\t\t\t\t\t\t\t\t\t// attributes\n\t\t\timageView = new ImageView(mContext);\n\t\t\timageView.setLayoutParams(new GridView.LayoutParams(85, 85));\n\t\t\timageView.setScaleType(ImageView.ScaleType.FIT_CENTER);\n\t\t\timageView.setPadding(8, 8, 8, 8);\n\t\t} else {\n\t\t\timageView = (ImageView) convertView;\n\t\t}\n\n\t\timageView.setImageResource(mThumbIds[position]);\n\t\treturn imageView;\n\t}", "public View getView(int position, View convertView, ViewGroup parent) {\n \t Log.i(TAG, \"starting getView position = \" + position );\n \t \n \t //check to see if it's time to add another batch, if so do\n \t addAnotherBatch(position);\n \n //Sets the current item to be referenced by other classes in the provider\n \t provide.setCurItem(position);\n \n \t //clears focus from like or dislike buttons\n \t dislikeb.setFocusableInTouchMode(false);\n \t likeb.setFocusableInTouchMode(false);\n \t dislikeb.clearFocus();\n \t likeb.clearFocus();\n \t \n //Sets up the landscape based on Current item\n setLandscapeName();\n setLandscapePrice();\n \n Log.i(TAG, \"User name \" + provide.getCurUser().getName());\n Log.i(TAG, \"User id \" + provide.getCurUser().getID());\n \n \n //Sets the view context image\n ImageView i = new ImageView(mContext);\n Log.i(TAG,\"GetbitmapfromURL item namae \" + provide.getCurItem().getName());\n Bitmap bimage = getBitmapFromURL(provide.getCurItem().getImageFileString());\n i.setImageBitmap(bimage);\n i.setAdjustViewBounds(true);\n i.setMaxHeight(499);\n i.setMinimumHeight(499);\n\n //scales the images accordingly\n i.setPadding(50, 0, 50, 0);\n i.setScaleType(ImageView.ScaleType.FIT_XY);\n \n Log.i(TAG, \"bitmap width\"+bimage.getWidth());\n \n \n //Set landscape or portrait gallery/image size\n Gallery.LayoutParams galayout;\n if(mContext.getResources().getConfiguration().orientation==Configuration.ORIENTATION_LANDSCAPE){\n \t galayout = new Gallery.LayoutParams(300,LayoutParams.MATCH_PARENT);\n }\n else{\n \t galayout = new Gallery.LayoutParams(LayoutParams.MATCH_PARENT, 499);\n }\n i.setLayoutParams(galayout);\n\n //sets the border\n i.setBackgroundColor(R.color.white);\n\n return i;\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n if (idealTileHeight == -1) {\n int width_ratio = 2;\n int height_ratio = (getCount() + width_ratio - 1) / width_ratio;\n idealTileWidth = parent.getWidth() / width_ratio;\n idealTileHeight = (parent.getHeight()+height_ratio-1) / height_ratio;\n }\n ImageView imageView;\n\n if (convertView == null) {\n // if it's not recycled, initialize some attributes\n imageView = new ImageView(mContext);\n imageView.setLayoutParams(new GridView.LayoutParams(idealTileWidth, idealTileHeight));\n //imageView.setAdjustViewBounds(true);\n imageView.setScaleType(ImageView.ScaleType.CENTER);\n } else {\n imageView = (ImageView) convertView;\n }\n\n if (mHighlightedBitmaps == null) {\n if (mTask == null) {\n mTask = new CreatingScaledImages().execute();\n }\n return imageView;\n }\n\n imageView.setImageBitmap((position==posSelected) ? mHighlightedBitmaps[position] : mOrigBitmaps[position]);\n return imageView;\n }", "private void setupImageViews(int currentPosition) {\n DataModel prevModel = musicList.get(currentPosition > 0 ? currentPosition - 1 : musicList.size() - 1);\n tv_previous_music.setText(prevModel.getTitle() + \"\\n\" + prevModel.getArtist_actors());\n String prevUrl = getString(R.string.imageUrl) + \"/img/\" + prevModel.getImage();\n Log.e(\"url\", prevUrl);\n Picasso.with(getApplicationContext()).load(prevUrl).fit()\n .error(R.drawable.image_placeholder)\n .placeholder(R.drawable.image_placeholder)\n .into(previous_pic_imv);\n\n\n DataModel nextModel = musicList.get(currentPosition < musicList.size() - 1 ? currentPosition + 1 : 0);\n tv_next_music.setText(nextModel.getTitle() + \"\\n\" + prevModel.getArtist_actors());\n String nextUrl = getString(R.string.imageUrl) + \"/img/\" + nextModel.getImage();\n Log.e(\"url\", nextUrl);\n Picasso.with(getApplicationContext()).load(nextUrl).fit()\n .error(R.drawable.image_placeholder)\n .placeholder(R.drawable.image_placeholder)\n .into(next_pic_imv);\n\n\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder;\n\n holder = new ViewHolder();\n holder.image = (ImageView) mInflater.inflate(R.layout.image_make_maopao, parent, false);\n holder.image.setTag(holder);\n\n if (position == getCount()-1) {\n\n holder.image.setImageResource(R.mipmap.ic_add_video);\n holder.uri = \"\";\n\n } else {\n\n VideoPickActivity.VideoInfo data = videoData.get(position);\n\n holder.image.setImageResource(R.mipmap.ic_default_image);\n new AsyncTask<Object,Void,Bitmap>(){\n ImageView icon;\n\n @Override\n protected Bitmap doInBackground(Object... params) {\n Long id = (Long) params[0];\n\n BitmapFactory.Options options = new BitmapFactory.Options();\n options.inDither = false;\n options.inPreferredConfig = Bitmap.Config.ARGB_8888;\n options.inSampleSize = 1;\n\n Bitmap bitmap = MediaStore.Video.Thumbnails.getThumbnail(getContentResolver(), id, MediaStore.Images.Thumbnails.MINI_KIND, options);\n ImageView icon = (ImageView) params[1];\n\n this.icon = icon;\n return bitmap;\n }\n\n @Override\n protected void onPostExecute(Bitmap bitmap) {\n icon.setImageBitmap(bitmap);\n }\n }.execute(data.photoId,holder.image,position);\n }\n\n return holder.image;\n }", "public View getView(int position, View convertView, ViewGroup parent)\n {\n ImageView imageView;\n BitmapFactory.Options bfOptions=new BitmapFactory.Options();\n bfOptions.inDither=false; //Disable Dithering mode\n bfOptions.inPurgeable=true; //Tell to gc that whether it needs free memory, the Bitmap can be cleared\n bfOptions.inInputShareable=true; //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future\n bfOptions.inTempStorage=new byte[32 * 1024];\n if (convertView == null) {\n imageView = new ImageView(context);\n imageView.setLayoutParams(new GridView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));\n imageView.setPadding(0, 0, 0, 0);\n } else {\n imageView = (ImageView) convertView;\n }\n FileInputStream fs = null;\n Bitmap bm;\n try {\n fs = new FileInputStream(new File(imgPic.get(position).toString()));\n\n if(fs!=null) {\n bm= BitmapFactory.decodeFileDescriptor(fs.getFD(), null, bfOptions);\n imageView.setImageBitmap(bm);\n imageView.setId(position);\n imageView.setLayoutParams(new GridView.LayoutParams(200, 160));\n }\n } catch (IOException e) {\n e.printStackTrace();\n } finally{\n if(fs!=null) {\n try {\n fs.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return imageView;\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n\t\tImageView imageView;\n\t\tif (convertView == null) { // if it's not recycled, initialize some attributes\n\t\t\timageView = new ImageView(mContext);\n\t\t\timageView.setAdjustViewBounds(mItemAdjustViewBound);\n\t\t\timageView.setScaleType(mItemScaleType);\n\t\t\tif(mBackgroundResource!=-1)\n\t\t\t\timageView.setBackgroundResource(mBackgroundResource);\n//\t\t\timageView.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding);\n\n\t\t\t//Width his taken from parent gridview which is setted to 100dp\n\t\t\tif(parent instanceof AbsListView){\n\t\t\t\timageView.setLayoutParams(new AbsListView.LayoutParams(mItemWidth, mItemHeight));\n\t\t\t}else if(parent instanceof Gallery){\n\t\t\t\timageView.setLayoutParams(new Gallery.LayoutParams(mItemWidth, mItemHeight));\n\t\t\t}else if( parent instanceof ViewGroup){\n\t\t\t\timageView.setLayoutParams(new ViewGroup.LayoutParams(mItemWidth, mItemHeight));\n\t\t\t}\n\t\t\t\n\t\t\t//disable hardware acceleration to render this view, because some of the image are too large to be uploaded as a opengl texture\n\t\t\t// avoid error | W/OpenGLRenderer: Bitmap too large to be uploaded into a texture\n\t\t\t//\t\tLog.e(TAG, \"is imageview hardware accelerated before:\" + coverImgView.isHardwareAccelerated());\n\t\t\tif (Build.VERSION.SDK_INT >= 11 && mIsSoftwareRendered){\n\t\t\t\timageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);\n\t\t\t}\n\n\t\t\tif(imageView.getScaleType()==ScaleType.CENTER_CROP){\n\t\t\t\tsetCropToPadding(parent, imageView, true);\n\t\t\t}\n\n\t\t} else {\n\t\t\timageView = (ImageView) convertView;\n\t\t}\n\t\t\n\t\t\n//\t\tif(mImageResource!=-1)\n//\t\t\tToolBox.pickupDefaultImage(mImageResource, imageView);\n//\t\tString url = getItemAtPosition(position);\n//\t\tToolBox.downloadImage(url, imageView, mWantThumbnail, true);\n\t\t\n\t\tif(mImageResource!=-1)\n\t\t\tToolBox.pickupDefaultImage(mImageResource, imageView);\n\t\tString url = getItemAtPosition(position);\n\t\tint resourceId = ToolBox.getResourceIdentifier(mContext, url, \"drawable\", mContext.getPackageName());\n\t\tif(resourceId != 0){//its a resource\n\t\t\tToolBox.pickupDefaultImage(resourceId, imageView);\n\t\t}else{//its an url\n\t\t\tToolBox.downloadImage(url, imageView, mWantThumbnail, true);\n\t\t}\n\n\t\treturn imageView;\n\t}", "public View getView(final int position, View view, ViewGroup parent) {\n ViewHolder holder;\n\n if (view == null) {\n holder = new ViewHolder();\n view = mInflater.inflate(R.layout.item_image, null);\n holder.imgSelect = view.findViewById(R.id.image_select);\n holder.thumbnail = view.findViewById(R.id.image_thumbnail);\n //holder.title = (TextView) view.findViewById(R.id.title);\n // holder.tv_imagelink = (TextView) view.findViewById(R.id.tv_imagelink);\n\n view.setTag(holder);\n } else {\n holder = (ViewHolder) view.getTag();\n }\n\n // holder.thumbnail.setLayoutParams(mImageViewLayoutParams);\n\n // Check the height matches our calculated column width\n// if (holder.thumbnail.getLayoutParams().height != mItemHeight) {\n// holder.thumbnail.setLayoutParams(mImageViewLayoutParams);\n// }\n\n\n GDModel photo = getItem(position);\n Picasso.with(parent.getContext())\n .load(photo.getThumbnailLink())\n .placeholder(R.drawable.image_placeholder)\n .error(R.drawable.image_placeholder)\n .into(holder.thumbnail);\n if (photo.isSelected()) {\n holder.thumbnail.setAlpha(0.4f);\n holder.imgSelect.setVisibility(View.VISIBLE);\n }\n // holder.thumbnail.setScaleType(ImageView.ScaleType.CENTER_CROP);\n //holder.title.setText(photo.title);\n // holder.tv_imagelink.setText(photo.thumbnailLink );\n // AppConfig.setAnimation(mContext, view, 1);\n return view;\n }", "public View getGraphicAfter(T anItem)\n{\n Image img = getImageAfter(anItem);\n return img!=null? new ImageView(img) : null;\n}", "@Override\r\n public View getView(int position, View convertView, ViewGroup parent) {\n String picPath = (String) list.get(position);\r\n view = LayoutInflater.from(getContext()).inflate(R.layout.testone,null);\r\n ImageView image1 = (ImageView) view.findViewById(R.id.test1);\r\n Bitmap bitmap = BitmapFactory.decodeFile(picPath);\r\n image1.setImageBitmap(bitmap);\r\n return view;\r\n }", "@NonNull\n @Override\n public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {\n String name = getItem(position).getName();\n int image = getItem(position).getImage();\n\n //Create the Activity\n //Activity act = new Activity(name);\n LayoutInflater inflater = LayoutInflater.from(mContext);\n convertView = inflater.inflate(mResource, parent, false);\n\n //Create textview items and set values\n TextView tvName = (TextView) convertView.findViewById(R.id.textView2);\n\n tvName.setText(name);\n\n\n ImageView myIV = (ImageView) convertView.findViewById(R.id.MainimageView);\n myIV.setImageResource(image);\n\n return convertView;\n }", "@Override\r\n\t\t\t\tpublic void onItemClick(AdapterView<?> parent, View v, int position,\r\n\t\t\t\t\t\tlong id) {\n\t\t\t\t\timgID=(int)imgadapter.getItemId(position);\r\n\t\t\t\t\timgv.setImageResource(imgID);\r\n\t\t\t\t\t//imgv.setId(imgID);\r\n\t\t\t\t}", "@Override\n\t public Drawable getItem(int position) {\n\t return listImg.get(position);\n\t }", "@Override\n public View getView(final int position, View convertView, ViewGroup parent) {\n final Holder holder=new Holder();\n\n\n\n AuctionBean users = list.get(position);\n convertView = inflater.inflate(R.layout.customelayout, null);\n\n holder.imgThumbnail = (ImageView) convertView.findViewById(R.id.imageview);\n holder.top_sr_no = (TextView) convertView.findViewById(R.id.textsrno);\n holder.bottom_sr_no = (TextView) convertView.findViewById(R.id.textbottom_srno);\n\n return convertView;\n }", "public void setimageitem(items item){\n ImageView item_icon = (ImageView) mView.findViewById(R.id.imageitem);\n //If the current weight is greater than half of the original weight, full Icon is displayed\n if(item.getCurrent_wieght() > item.getOriginal_weight()/2)\n item_icon.setImageResource(R.drawable.fullicon);\n //If the current weight is greater than quarter of the original weight, the half icon will be displayed\n else if (item.getCurrent_wieght() <= item.getOriginal_weight()/ 2 && item.getCurrent_wieght() > item.getOriginal_weight()/ 4)\n item_icon.setImageResource(R.drawable.halficon);\n //If the current weight is less than a quarter of the original weight\n // to suggest that the item is empty, a quarter icon will be displayed.\n else if(item.getCurrent_wieght() <= item.getOriginal_weight()/ 4 && item.getCurrent_wieght()> (item.getOriginal_weight()/ 4)/2 ) {\n item_icon.setImageResource(R.drawable.quartericon);\n }\n //if the item is empty an alert icon will be displayed.\n else if(item.getCurrent_wieght()<= (item.getOriginal_weight()/ 4)/2 ) {\n item_icon.setImageResource(R.drawable.alerticon);\n }\n }", "@Override\r\n public void onBindViewHolder(ViewHolder holder, int position) {\n holder.img.setImageBitmap(StringToBitMap(showroomItems.get(position).getimg()));\r\n }", "@Override\n public void onCreateImageSpace(int index, String src, int left, int top, int width, int height) {\n ImgContainer container = imgContainerMap.get(index);\n\n if (container == null){\n container = new ImgContainer(getContext(), adapter, index, src);\n container.width = width;\n container.height = height;\n container.containerView.setTag(R.id.htmltextview_viewholder_index, index);\n container.containerView.setTag(R.id.htmltextview_viewholder_type, VIEWHOLDER_TYPE_IMG);\n overlay.addView(container.containerView);\n\n imgContainerMap.put(index, container);\n }\n\n LayoutParams lp = new LayoutParams(width, height);\n lp.setMargins(left, top, 0, 0);\n container.containerView.setLayoutParams(lp);\n\n recycleCheck();\n }", "@Override\n public Object instantiateItem(final ViewGroup container, int position) {\n final Story story;\n View view;\n ImageView pagerIamge;\n\n story = list.get(position);\n view = inflater.inflate(R.layout.view_item, container, false);\n TextView pagerTitle = (TextView) view.findViewById(R.id.view_text);\n pagerIamge = (ImageView) view.findViewById(R.id.view_image);\n pagerTitle.setText(story.getTitle());\n new DownloadImage(story.getImages(), pagerIamge, story.getId()).execute();\n Log.i(\"view\", story.getTitle());\n set(view, story);\n container.addView(view);\n return view;\n\n\n/* if (aaa.size() > position) {\n story = list.get(position);\n view = inflater.inflate(R.layout.view_item, container, false);\n TextView pagerTitle = (TextView) view.findViewById(R.id.view_text);\n pagerIamge = (ImageView) view.findViewById(R.id.view_image);\n pagerTitle.setText(story.getTitle());\n new DownloadImage(story.getImages(), pagerIamge, story.getId()).execute();\n Log.i(\"view\", story.getTitle());\n set(view, story);\n container.addView(view);\n return view;\n } else if (aaa.size() <= position) {\n if(aaa == null){\n story = list.get(position);\n view = inflater.inflate(R.layout.view_item, container, false);\n TextView pagerTitle = (TextView) view.findViewById(R.id.view_text);\n pagerIamge = (ImageView) view.findViewById(R.id.view_image);\n pagerTitle.setText(story.getTitle());\n new DownloadImage(story.getImages(), pagerIamge, story.getId()).execute();\n Log.i(\"view\", story.getTitle());\n if(position == 0){\n aaa.add(0, view);\n }else {\n aaa.add(view);\n }\n\n set(view, story);\n container.addView(view);\n }else if(aaa != null){\n story = list.get(position);\n view = inflater.inflate(R.layout.view_item, container, false);\n TextView pagerTitle = (TextView) view.findViewById(R.id.view_text);\n pagerIamge = (ImageView) view.findViewById(R.id.view_image);\n pagerTitle.setText(story.getTitle());\n new DownloadImage(story.getImages(), pagerIamge, story.getId()).execute();\n Log.i(\"view\", story.getTitle());\n if(position == 0){\n view = aaa.get(0);\n }else {\n view = aaa.get(1);\n }\n set(view, story);\n container.addView(view);\n return view;\n }\n container.addView(aaa.get(position));\n return aaa.get(position);\n }*/\n\n //给当前页添加监听\n\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n Recipe myRecipe = getItem(position);\n // Check if an existing view is being reused, otherwise inflate the view\n if (convertView == null) {\n convertView = LayoutInflater.from(getContext()).inflate(R.layout.lista_layout, parent, false);\n }\n // Lookup view for data population\n TextView nombre_receta = (TextView) convertView.findViewById(R.id.nombre_receta);\n // 22 caracteres maximo\n TextView descripcion_receta = (TextView) convertView.findViewById(R.id.descripcion_receta);\n ImageView imagen_receta = (ImageView) convertView.findViewById(R.id.imagen_receta);\n // Populate the data into the template view using the data object\n String aux = myRecipe.getName();\n if (aux.length() > 25){\n aux = aux.substring(0, 22) + \"...\";\n }\n nombre_receta.setText(aux);\n descripcion_receta.setText(Long.toString(myRecipe.getPerson()));\n if(myRecipe.getPicture()!=null) {\n if (myRecipe.getPicture().equals(\"\")) {\n Bitmap bmp = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.recdefault);//image is your image\n bmp = Bitmap.createScaledBitmap(bmp, 500, 500, true);\n imagen_receta.setImageBitmap(bmp);\n } else {\n ByteArrayInputStream imageStream = new ByteArrayInputStream(Base64.decode(myRecipe.getPicture(), Base64.DEFAULT));\n Bitmap theImage = BitmapFactory.decodeStream(imageStream);\n theImage = Bitmap.createScaledBitmap(theImage, 500, 500, true);\n imagen_receta.setImageBitmap(theImage);\n }\n }\n // Return the completed view to render on screen\n return convertView;\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent)\n {\n View grid;\n LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n\n if (convertView == null)\n {\n grid = new View(context);\n grid = inflater.inflate(R.layout.activity_grid, null);\n TextView textView = (TextView) grid.findViewById(R.id.text);\n ImageView imageView = (ImageView)grid.findViewById(R.id.image);\n textView.setText(namesid[position]);\n imageView.setImageResource(imagesid[position]);\n }\n\n else\n grid = convertView;\n\n return grid;\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n //if the view is empty, access the card layout in activity_main_2\n if (convertView == null) {\n convertView = inflater.inflate(R.layout.acitivity_main_2, null);\n }\n //set the title to be equal to the title in the activity_main_2\n title = (TextView) convertView.findViewById(R.id.cardTitle);\n //set the description to be equal to the description in activity_main_2\n description = (TextView) convertView.findViewById(R.id.cardDescription);\n //set the image equal to in activity_main_2\n images = (ImageView) convertView.findViewById(R.id.mainImage);\n\n //set title and description\n title.setText(titleA[position]);\n description.setText(descriptA[position]);\n\n //This section will set the image for each title created in strings.xml\n if (titleA[position].equalsIgnoreCase(\"Weekly View\")) {\n images.setImageResource(R.drawable.weekly);\n } else if (titleA[position].equalsIgnoreCase(\"Calendar View\")) {\n images.setImageResource(R.drawable.calendar);\n } else if (titleA[position].equalsIgnoreCase(\"University Bookstore\")) {\n images.setImageResource(R.drawable.bookstore);\n } else if (titleA[position].equalsIgnoreCase(\"University Email\")) {\n images.setImageResource(R.drawable.email);\n } else if (titleA[position].equalsIgnoreCase(\"Educational Resources\")) {\n images.setImageResource(R.drawable.resources);\n } else if (titleA[position].equalsIgnoreCase(\"Mindfulness\")) {\n images.setImageResource(R.drawable.mindfulness);\n } else {\n images.setImageResource(R.drawable.entertainment);\n }\n\n return convertView;\n }", "public View getView(int position, View convertView, ViewGroup parent)\r\n {\r\n RatioSolidImageView imageView = null;\r\n if(convertView instanceof ImageView)\r\n {\r\n imageView = (RatioSolidImageView)convertView;\r\n }\r\n else\r\n {\r\n imageView = new RatioSolidImageView (mContext);\r\n Gallery.LayoutParams params = new Gallery.LayoutParams(\r\n Gallery.LayoutParams.MATCH_PARENT, Gallery.LayoutParams.MATCH_PARENT);\r\n imageView.setScaleType(ImageView.ScaleType.FIT_XY);\r\n imageView.setLayoutParams(params);\r\n }\r\n \r\n AssetsImageDrawable imageDrawable = new AssetsImageDrawable(adapters[position]);\r\n imageView.setBackgroundDrawable(imageDrawable);\r\n return imageView;\r\n }", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\tViewHolder holder = null;\n\t\tif(convertView == null)\n\t\t{\n\t\t\tholder = new ViewHolder();\n\t\t\tconvertView = inflater.inflate(R.layout.superbike_gridview_item, null);\n\t\t\tholder.ivHead = (CircleImageView)convertView.findViewById(R.id.ivHead);\n\t\t\t\n\t\t\tLinearLayout.LayoutParams lp = (LayoutParams) holder.ivHead.getLayoutParams();\n\t\t\tlp.width = width / 3;\n\t\t\tlp.height = lp.width ;\n\t\t\tholder.ivHead.setLayoutParams(lp);\n\t\t\t\n\t\t\tholder.txtName = (TextView)convertView.findViewById(R.id.txtName);\n\t\t\tconvertView.setTag(holder);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tholder = (ViewHolder) convertView.getTag();\n\t\t}\n\t\t\n\t\tSuperBiker superBiker = list.get(position);\n\t\tString name = superBiker.getName();\n\t\tString url = superBiker.getImageUrl();\n\t\t\n\t\tholder.txtName.setText(name);\n\t\tif(\"test1\".equals(url))\n\t\t\tholder.ivHead.setImageResource(R.drawable.test1);\n\t\telse if(\"test2\".equals(url))\n\t\t\tholder.ivHead.setImageResource(R.drawable.test2);\n\t\telse if(\"test3\".equals(url))\n\t\t\tholder.ivHead.setImageResource(R.drawable.test3);\n\t\telse if(\"test4\".equals(url))\n\t\t\tholder.ivHead.setImageResource(R.drawable.test4);\n\t\telse\n\t\t{\n\t\t\t//TODO 根据网络路劲加载图片\n\t\t}\n\t\treturn convertView;\n\t}", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\tViewHolder holder=null;\n\t\tNewsItem item=newsList.get(position);\n\t\tif(convertView==null){\n\t\t\tholder=new ViewHolder();\n\t\t\t//将layout.xml转换为View\n\t\t\tswitch(item.getStyle()){\n\t\t\tcase 0:\n\t\t\t\t\n\t\t\t\tconvertView=LayoutInflater.from(mActivity).inflate(R.layout.news_item1, null);\n\t\t\t\tholder.ivImg1=(ImageView)convertView.findViewById(R.id.ivNewsImg);\n\t\t\t\tholder.ivImg1.setLayoutParams(new RelativeLayout.LayoutParams(100, 100));\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tconvertView=LayoutInflater.from(mActivity).inflate(R.layout.news_item2, null);\n\t\t\t\tholder.ivImg1=(ImageView)convertView.findViewById(R.id.ivImg1);\n\t\t\t\tholder.ivImg2=(ImageView)convertView.findViewById(R.id.ivImg2);\n\t\t\t\tholder.ivImg3=(ImageView)convertView.findViewById(R.id.ivImg3);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t\n\t\t\t\tconvertView=LayoutInflater.from(mActivity).inflate(R.layout.news_item1, null);\n\t\t\t\tholder.ivImg1=(ImageView)convertView.findViewById(R.id.ivNewsImg);\n\t\t\t\tholder.ivImg1.setLayoutParams(new RelativeLayout.LayoutParams(100, 100));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tholder.tvTilte=(TextView)convertView.findViewById(R.id.tvTitle);\t\n\t\t\tconvertView.setTag(holder);//记录个标识\n\t\t}else{\n\t\t\tholder=(ViewHolder)convertView.getTag();\n\t\t}\n\t\t//向ui元素绑定数据\n\t\tholder.tvTilte.setText(item.getTitle());\n\t\t\n\t\t\n\t\tswitch(item.getStyle()){\n\t\tcase 0:\n\t\t\timageLoader.get(item.getImgUrl()[0], ImageLoader.getImageListener(holder.ivImg1,\n\t\t\t\t\tR.drawable.default_big, R.drawable.default_big));//加载图片,先从内存中加载,内存没有再从网络加载\n\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\timageLoader.get(item.getImgUrl()[1], ImageLoader.getImageListener(holder.ivImg2,\n\t\t\t\t\t\tR.drawable.default_big, R.drawable.default_big));//加载图片,先从内存中加载,内存没有再从网络加载\n\t\t\t\timageLoader.get(item.getImgUrl()[2], ImageLoader.getImageListener(holder.ivImg3,\n\t\t\t\t\t\tR.drawable.default_big, R.drawable.default_big));//加载图片,先从内存中加载,内存没有再从网络加载\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tString imgStr = item.getImgUrl()[0];\n\t\t\t\tbyte[] picByte = Base64.decode(imgStr, Base64.DEFAULT);\n\t\t\t\tBitmap bmp = BitmapFactory.decodeByteArray(picByte, 0, picByte.length);\n\t\t\t\tholder.ivImg1.setImageBitmap(bmp);\n\t\t\t\tbreak;\n\t\t}\n\t\tLog.d(\"jereh\",\"getView()\");\n\t\treturn convertView;\n\t}", "public View getView(int position, View convertView, ViewGroup parent) {\n View v = convertView; // vista \n LayoutInflater layoutInflater = LayoutInflater.from(context); \n // Se infla la vista con el layout de la instalacion \"site_item.xml\"\n v = layoutInflater.inflate(R.layout.site_item, null); \n ... // Se enlazan en la vista el nombre, imagen y descripcion de la instalacion\n // La libreria Glide permite cargar imagenes de enlaces de la web\n RequestManager requestManager = Glide.with(v.getContext());\n RequestBuilder requestBuilder = requestManager.load(filteredSites.get(position).getImageLink()); // Se obtiene la url de la imagen de la instalacion\n requestBuilder.into(imageSite); // Se carga la imagen en la vista\n return v; // Se devuelve la vista\n }", "public View getGraphic(T anItem)\n{\n Image img = getImage(anItem);\n return img!=null? new ImageView(img) : null;\n}", "@Override\n public View onCreateView(LayoutInflater inflater,\n ViewGroup container, Bundle savedInstanceState) {\n Bundle args = getArguments();\n int i = args.getInt(\"ARG_OBJECT\");\n\n View rootView = inflater.inflate(\n R.layout.fragment_collection_object, container, false);\n ImageView imageView = (ImageView) rootView.findViewById(R.id.item_gallery);\n\n if (imageArray.size() > 0) {\n Log.d(\"imageArray i:\", String.valueOf(i));\n imageView.setImageBitmap(imageArray.get(i));\n } else {\n // Insert image to indicate no images present\n Bitmap noImageBitmap = BitmapFactory.decodeResource(getApplicationContext().getResources(),\n R.drawable.no_image_found);\n imageView.setImageBitmap(noImageBitmap);\n }\n\n return rootView;\n\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n\n View view;\n\n if (convertView == null) {\n // if it's not recycled, initialize some attributes\n LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(mContext.LAYOUT_INFLATER_SERVICE);\n view = inflater.inflate(R.layout.grid_item, parent, false);\n\n } else {\n view = convertView;\n }\n ImageView imageView = view.findViewById(R.id.image);\n imageView.setLayoutParams(new LinearLayout.LayoutParams(1000, 1000));\n imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);\n imageView.setPadding(8, 8, 8, 8);\n\n Bitmap image = BitmapFactory.decodeFile(gridItems.get(position).getAbsolutePath());\n imageView.setImageBitmap(image);\n\n TextView description = view.findViewById(R.id.text);\n\n\n ExifInterface exif = null;\n try {\n exif = new ExifInterface(gridItems.get(position).getAbsolutePath());\n } catch (IOException e) {\n e.printStackTrace();\n }\n description.setText(exif.getAttribute(ExifInterface.TAG_IMAGE_DESCRIPTION));\n\n return view;\n }", "public ViewHolder(View itemView) {\n super(itemView);\n imageView = itemView.findViewById(R.id.ivSomeImage);\n textView = itemView.findViewById(R.id.tvSomeText);\n }", "public void onBindViewHolder(C14293a aVar, int i) {\n C32569u.m150519b(aVar, \"holder\");\n aVar.mo75899a().setImageURI(get(i));\n }", "@SuppressLint(\"ResourceAsColor\")\n @Override\n public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {\n holder.imageView1.setImageResource(R.drawable.photo_card1);\n holder.imageView2.setImageResource(R.drawable.photo_card1);\n holder.imageView3.setImageResource(R.drawable.photo_card1);\n holder.imageView4.setImageResource(R.drawable.photo_card1);\n }", "@Override\n public void onBindViewHolder(MyViewHolder holder, int position) {\n // - get element from your dataset at this position\n // - replace the contents of the view with that element\n Log.d(TAG, \"onBindViewHolder \" + position);\n Glide.with(holder.imageView.getContext())\n .load(mDataset.get(position))\n .placeholder(R.drawable.ic_menu_camera)\n .centerCrop()\n .into(holder.imageView);\n }", "@Override\n public void onBindViewHolder(ViewHolder holder, int position) {\n Picture pictures = picture.get(position);\n // - get element from your dataset at this position\n // - replace the contents of the view with that element\n holder.title.setText(pictures.getTitle());\n holder.image.setImageURI(pictures.getUrl());\n\n }", "private void initPoint() {\n\t\tfor (int i = 0; i < images.length; i++) {\r\n\t\t\tView view = new View(SnaDetailsActivity.this);\r\n\t\t\tparamsL.setMargins(YangUtils.dip2px(SnaDetailsActivity.this, 5), 0, 0, 0);\r\n\t\t\tview.setLayoutParams(paramsL);\r\n\t\t\tif (i == 0) {\r\n\t\t\t\tview.setBackgroundResource(R.drawable.sy_03);\r\n\t\t\t} else {\r\n\t\t\t\tview.setBackgroundResource(R.drawable.sy_05);\r\n\t\t\t}\r\n\r\n\t\t\tviews.add(view);\r\n\t\t\tll_point.addView(view);\r\n\t\t}\r\n\t}", "@Override\n public Object getItem(int position) {\n return imageUrls.get(position);\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n // Adapters recycle views to AdapterViews.\n // If this is a new View object we're getting, then inflate the layout.\n // If not, this view already has the layout inflated from a previous call to getView,\n // and we modify the View widgets as usual.\n if (convertView == null) {\n convertView = LayoutInflater.from(getContext()).inflate(\n R.layout.movie_item, parent, false);\n }\n\n // Gets the MovieITem object from the ArrayAdapter at the appropriate position\n MovieItem movieItem = getItem(position);\n\n ImageView iconView = (ImageView) convertView.findViewById(R.id.movie_item_image);\n\n // Use Picasso to manage the images;\n Picasso.with(getContext()).load(movieItem.getPosterPath(getContext())).into(iconView);\n\n TextView movieNameView = (TextView) convertView.findViewById(R.id.movie_item_text);\n movieNameView.setText(movieItem.getTitle());\n\n return convertView;\n }", "@Override\n public Object instantiateItem(ViewGroup container, int position) {\n String url = \"http://\" + ServerConfig.VTDRIP + \"/SD0/PHOTO/\" + mPhotoLists.get\n (position).getName();\n PhotoView photoView = new PhotoView(activity);\n Glide.with(activity).load(url).into(photoView);\n container.addView(photoView);\n\n photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {\n @Override\n public void onPhotoTap(View view, float v, float v1) {\n showTitleBar();\n }\n\n @Override\n public void onOutsidePhotoTap() {\n showTitleBar();\n }\n });\n return photoView;\n }", "@Override\n\t\tpublic View getView(int pos, View convertView, ViewGroup parent) {\n\t\t\tViewHolder holder = null;\n\t\t\tif (convertView == null)\n\t\t\t{\n\t\t\t\tholder=new ViewHolder(); \n\t\t\t\t\n\t\t\t\tconvertView = myInflater.inflate(R.layout.simple_list_item_circle,null);\n\t\t\t\tholder.pic1 = (ImageView)convertView.findViewById(R.id.item_circle_img1);\n\t\t\t\tholder.pic2 = (ImageView)convertView.findViewById(R.id.item_circle_img2);\n\t\t\t\tholder.pic3 = (ImageView)convertView.findViewById(R.id.item_circle_img3);\n\t\t\t\tholder.pic4 = (ImageView)convertView.findViewById(R.id.item_circle_img4);\n\t\t\t\tconvertView.setTag(holder);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tholder = (ViewHolder)convertView.getTag();\n\t\t\t}\n\t\t\tholder.pic1.setImageResource(((Integer)( circle_list.get(pos).get(\"img_1\") ) ).intValue());\n\t\t\tholder.pic2.setImageResource(((Integer)( circle_list.get(pos).get(\"img_2\") ) ).intValue());\n\t\t\tholder.pic3.setImageResource(((Integer)( circle_list.get(pos).get(\"img_3\") ) ).intValue());\n\t\t\tholder.pic4.setImageResource(((Integer)( circle_list.get(pos).get(\"img_4\") ) ).intValue());\n\t\t\treturn convertView;\n\t\t}", "public View getView(int position, View convertView, ViewGroup parent) {\n CatItem item = items.get(position);\n View view;\n if (convertView == null) {\n view = LayoutInflater.from(mContext).inflate(\n R.layout.category_item, parent, false);\n view.setLayoutParams(new GridView.LayoutParams(size, size));\n } else {\n view = convertView;\n }\n TextView textView = (TextView) view.findViewById(R.id.detail_text);\n ImageView imageView = (ImageView) view.findViewById(R.id.detail_img);\n// loadBitmap(item.id,imageView);\n imageView.setImageResource(item.getId());\n textView.setText(item.getName());\n\n return view;\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n View listItem = convertView;\n int pos = position;\n\n if(listItem == null){\n listItem = layoutInflater.inflate(R.layout.item_list, null);\n }\n\n //Colocando na tela os elementos da busca\n ImageView iv = (ImageView) listItem.findViewById(R.id.thumb);\n TextView tvTitle = (TextView) listItem.findViewById(R.id.title);\n TextView tvDate = (TextView) listItem.findViewById(R.id.date);\n\n //aplicando as views no form_contato\n imageLoader.DisplayImage(feed.getItem(pos).getImage(), iv);\n tvTitle.setText(feed.getItem(pos).getTitle());\n tvDate.setText(feed.getItem(pos).getDate());\n\n return listItem;\n }", "@Override\n public void onBindViewHolder(ViewHolder holder, final int position) {\n // - get element from your dataset at this position\n // - replace the contents of the view with that element\n\n Flat flat = mFlatListFiltered.get(position);\n holder.bind(flat);\n String minUrl=flat.getMinUrl();\n\n\n\n Glide\n .with(mContext)\n .load(minUrl)\n .into(holder.flatImage);\n\n }" ]
[ "0.71452034", "0.71411014", "0.71197724", "0.7074658", "0.7059322", "0.7038054", "0.69652206", "0.6958741", "0.6956034", "0.68671596", "0.6846921", "0.68428725", "0.6786976", "0.67771167", "0.67336726", "0.6728429", "0.6726654", "0.6712992", "0.66787225", "0.66743267", "0.6662165", "0.66614217", "0.66325855", "0.6630295", "0.66169727", "0.66131246", "0.6589018", "0.65883404", "0.6587535", "0.6586463", "0.6583964", "0.65802443", "0.65717775", "0.6565694", "0.6536677", "0.65309477", "0.65250665", "0.65124995", "0.6510633", "0.650801", "0.64917314", "0.6486528", "0.6481534", "0.64771265", "0.64757025", "0.64700204", "0.64638525", "0.64599276", "0.6459657", "0.6458434", "0.6454339", "0.64458656", "0.64448184", "0.64427394", "0.6438744", "0.6436946", "0.6429268", "0.64263374", "0.64254004", "0.64212835", "0.641887", "0.64062697", "0.63968045", "0.63951945", "0.6388561", "0.63872045", "0.63755417", "0.6370524", "0.6368937", "0.6353061", "0.6350431", "0.6346343", "0.6334401", "0.6333471", "0.6322665", "0.63125116", "0.63098174", "0.6300583", "0.6300027", "0.6298606", "0.6292163", "0.6292001", "0.62869686", "0.62852764", "0.6278513", "0.62744004", "0.6272308", "0.62694293", "0.62666094", "0.6258422", "0.62515694", "0.62444025", "0.6243713", "0.62401843", "0.62360173", "0.62348723", "0.622906", "0.62273455", "0.62264884", "0.6224232" ]
0.65265626
36
TODO Autogenerated method stub
@Override public int getCount() { if(data.size()>0){ return data.size(); } return 0; }
{ "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}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "private stendhal() {\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\r\n\tpublic void dispase() {\n\r\n\t}", "@Override\n\tprotected void initialize() {\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 }", "@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.66708666", "0.65675074", "0.65229905", "0.6481001", "0.64770633", "0.64584893", "0.6413091", "0.63764185", "0.6275735", "0.62541914", "0.6236919", "0.6223816", "0.62017626", "0.61944294", "0.61944294", "0.61920846", "0.61867654", "0.6173323", "0.61328775", "0.61276996", "0.6080555", "0.6076938", "0.6041293", "0.6024541", "0.6019185", "0.5998426", "0.5967487", "0.5967487", "0.5964935", "0.59489644", "0.59404725", "0.5922823", "0.5908894", "0.5903041", "0.5893847", "0.5885641", "0.5883141", "0.586924", "0.5856793", "0.58503157", "0.58464456", "0.5823378", "0.5809384", "0.58089525", "0.58065355", "0.58065355", "0.5800514", "0.57912874", "0.57912874", "0.57912874", "0.57912874", "0.57912874", "0.57912874", "0.57896614", "0.5789486", "0.5786597", "0.5783299", "0.5783299", "0.5773351", "0.5773351", "0.5773351", "0.5773351", "0.5773351", "0.5760369", "0.5758614", "0.5758614", "0.574912", "0.574912", "0.574912", "0.57482654", "0.5732775", "0.5732775", "0.5732775", "0.57207066", "0.57149917", "0.5714821", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57115865", "0.57045746", "0.5699", "0.5696016", "0.5687285", "0.5677473", "0.5673346", "0.56716853", "0.56688815", "0.5661065", "0.5657898", "0.5654782", "0.5654782", "0.5654782", "0.5654563", "0.56536144", "0.5652585", "0.5649566" ]
0.0
-1
TODO Autogenerated method stub
@Override public Object getItem(int position) { return data.get(position); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
@Override public long getItemId(int position) { return 0; }
{ "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
State pattern realization for scale mode. Scale mode defines method of trace scaling inside each Slot
public interface IScaleModeState { /** * Should be called before other methods using * * @param graphs * List<PlotData> for current Slot * @param allViews * List<Slot> All views for graph panel * @param timeRange * TimeInterval set in graph panel * @param meanState * current mean state * @param height * height of current view, in pixels */ public void init(List<PlotData> graphs, int currentGraphNum, List<Slot> allViews, TimeInterval timeRange, IMeanState meanState, int height); /** * @param value * trace value * @return Y screen panel coordinate to draw */ public int getY(double value, int graphNum); /** * @param y * Y screen panel coordinate * @return trace value */ public double getValue(int y); /** * @return name of state */ public String getStateName(); /** * @return max value for all traces in current Slot */ public double getMaxValue(); /** * @return min value for all traces in current Slot */ public double getMinValue(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void\nupdateStatelistScale(int updateScaleType) {\n\n\tfor (int istate=0; istate<=systemDesign_.numstatelist; istate++) {\n\n\t\tswitch (updateScaleType) {\n\n\t\t\tcase UPDATE_STATELIST_SCALE_PFAIL:\n\t\t\t\tsystemDesign_.statelist[istate].pfailurescale = systemDesign_.pfailurescale;\n\t\t\t\tbreak;\n\n\t\t\tcase UPDATE_STATELIST_SCALE_PFAIL_SURVIVE:\n\t\t\t\tsystemDesign_.statelist[istate].pfailuresurvivescale = systemDesign_.pfailuresurvivescale;\n\t\t\t\tbreak;\n\n\t\t\tcase UPDATE_STATELIST_SCALE_REMOTE_TRAFFIC:\n\t\t\t\tsystemDesign_.statelist[istate].remotetrafficscale = systemDesign_.remotetrafficscale;\n\t\t\t\tsystemDesign_.statelist[istate].pfailurescale = 0;\t// 22sept03\t\n\t\t\t\tbreak;\n\n\t\t\tcase UPDATE_STATELIST_SCALE_HAMMING:\n\t\t\t\tsystemDesign_.statelist[istate].hammingscale = systemDesign_.hammingscale;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tfloat objx = systemDesign_.statelist[istate].fixedcost * systemDesign_.statelist[istate].fixedcostscale;\n\t\tobjx += systemDesign_.statelist[istate].monthlycost * systemDesign_.statelist[istate].monthlycostscale;\n\t\tobjx += (1 - systemDesign_.statelist[istate].psuccess) * systemDesign_.statelist[istate].pfailurescale;\n\t\tobjx += systemDesign_.statelist[istate].responsetime * systemDesign_.statelist[istate].responsetimescale;\n\t\tobjx += systemDesign_.statelist[istate].remotetraffic * systemDesign_.statelist[istate].remotetrafficscale; // 'messaging mods\n\t\tobjx += systemDesign_.statelist[istate].pfailuresurvive * systemDesign_.statelist[istate].pfailuresurvivescale; // 'marc EN 1.1 smoothing\n\t\tobjx += systemDesign_.statelist[istate].hamming * systemDesign_.statelist[istate].hammingscale; // 'marc EN 1.1 hamming\n\t\tsystemDesign_.statelist[istate].e = objx;\n\t\t} // Next istate\n\n\t}", "public void rescale()\r\n\t{\n\t}", "public interface ScalingUtils$StatefulScaleType {\n Object m21594a();\n}", "void setScale(ScaleSelector sensor, int scaleNo);", "private void updateScale() {\n target.setScaleX(scaleValue);\n target.setScaleY(scaleValue);\n }", "void scale(double factor);", "void initScale(){\n samplingScale = getScaleAdaptive(x);\n }", "void onScaleChange(float scaleFactor, float focusX, float focusY);", "public void scale(Point P, int scaleFactor) {\n\n\n }", "public interface Scalable {\n public void scale(TimeTick base, double ratio);\n}", "private void scaleFrames(RMShape aShape, int aStartTime, float aFactor)\n{\n // If shape timeline available, have it scale records\n if(aShape.getTimeline()!=null) {\n \n // Scale timeline records\n aShape.getTimeline().scaleRecords(aStartTime, aFactor);\n \n // Reset time\n resetShapeTimeline(aShape);\n }\n \n // Forward scale frames on to shape children\n for(int i=0, iMax=aShape.getChildCount(); i<iMax; i++)\n scaleFrames(aShape.getChild(i), aStartTime, aFactor);\n}", "public void scaleBy(float scale) {\n internalGroup.scaleBy(scale);\n dataTrait.scaleX = internalGroup.getScaleX();\n dataTrait.scaleY = internalGroup.getScaleY();\n resetSprite();\n\n }", "public void setScale(float scale);", "public void handle(ActionEvent ae) {\n scaleFactor += 0.1; \n if(scaleFactor > 2.0) scaleFactor = 0.4; \n \n scale.setX(scaleFactor); \n scale.setY(scaleFactor); \n \n }", "private void Scale()\n {\n Song scale = new Song();\n scale.add(new Note(noteA1,WHOLE_NOTE/2));\n scale.add(new Note(noteBB1,WHOLE_NOTE/2));\n scale.add(new Note(noteB1,WHOLE_NOTE/2));\n scale.add(new Note(noteC1,WHOLE_NOTE/2));\n scale.add(new Note(noteCS1,WHOLE_NOTE/2));\n scale.add(new Note(noteD1,WHOLE_NOTE/2));\n scale.add(new Note(noteDS1,WHOLE_NOTE/2));\n scale.add(new Note(noteE1,WHOLE_NOTE/2));\n scale.add(new Note(noteF1,WHOLE_NOTE/2));\n scale.add(new Note(noteFS1,WHOLE_NOTE/2));\n scale.add(new Note(noteG1,WHOLE_NOTE/2));\n scale.add(new Note(noteGS1,WHOLE_NOTE/2));\n\n\n playSong(scale);\n }", "public double getScale() {\n return scale;\n }", "public void scale(double sx, double sy)\r\n\t{\r\n\t\t// System.out.println(\"scale\");\r\n\t}", "private ScaleEntityDownAction(){\r\n\t\tscaleFactor = 0.1f;\r\n\t}", "public void scale(double s);", "public int getScale() {\n return scale_;\n }", "public void go_to_scale_position() {\n stop_hold_arm();\n Dispatcher.get_instance().add_job(new JMoveArm(RobotMap.Arm.pot_value_scale, 0.9, 0.7, 0.7, 0.2, 0.8, false, false));\n hold_arm();\n }", "public Scale getScale() {\n return this.scale;\n }", "public void visitScale( DevCat devCat ) {}", "public double getScale() {\r\n return scale;\r\n }", "public void setScale(Scale scale) {\n this.scale = scale;\n }", "public int getScale(){\n return scale;\n }", "private void percentageScaling() {\n switch (slot) {\n case Torso -> updateBonusStats(1);\n case Head -> updateBonusStats(0.8);\n case Legs -> updateBonusStats(0.6);\n }\n }", "public double getScale(){\n\t\treturn scale;\n\t}", "public int getScale() {\r\n return scale;\r\n }", "public double getScale() {\n return scale;\n }", "public int getScaleValue() {\r\n return ScaleValue;\r\n }", "void setScale(int objIndex,Vector3f scale){\n look[objIndex].setScale(scale);\n usedScale.set(objIndex);\n }", "@Override\n public float getScale() {\n return scale;\n }", "public void setScale(int indexInST, float time, Vector3f scale) {\n PointInTime toAdd=findTime(time);\n toAdd.setScale(indexInST,scale);\n }", "public RaiseToScale() {\n super(\"RaiseToScale\", kP, kI, kD);\n requires(this.elevator = Elevator.getInstance());\n requires(this.intake = Intake.getInstance());\n this.getPIDController().setOutputRange(-RobotMap.ELEVATOR_SPEED,\n RobotMap.ELEVATOR_SPEED);\n setInterruptible(true);\n }", "public double getScale() {\n return this.scale;\n }", "public float getScale() {\n return this.scale;\n }", "public void updateScale()\n {\n // get scale from world presenter\n s2 = (cam.getScale());\n //Convert to English Miles if appropriate\n if( !SettingsScreen.getUnits() ) s2 *= 0.60934;\n s1 = s2/2;\n repaint();\n }", "protected double getShapeScale(Plot plot,int series,int item, double x, double y) {\n return scale;\n }", "public float getScale();", "public void setScale(float scale) {\n this.scale = scale;\n }", "public void setScale(double n) {\n\n\t}", "int getScale();", "@Override\n\tpublic void handleScaledCFComponent(CFComponent component) {\n\n\t}", "@Override\n\tpublic void setScale(Vector3d scale) {\n\t\t\n\t}", "public interface Scale {\r\n void setScale(Cell[] board, int key);\r\n}", "public Integer getScale() {\n return _scale;\n }", "public Integer getScale() {\n return _scale;\n }", "private void onScaleClick() {\n PropertyValuesHolder scaleXHolder = PropertyValuesHolder.ofFloat(\"scaleX\", 1.5f);\r\n PropertyValuesHolder scaleYHolder = PropertyValuesHolder.ofFloat(\"scaleY\", 1.5f);\r\n Animator scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(\r\n animatedView, scaleXHolder, scaleYHolder);\r\n scaleAnimator.setDuration(animationDuration);\r\n scaleAnimator.setInterpolator(new AccelerateDecelerateInterpolator());\r\n scaleAnimator.start();\r\n }", "public TempScale getInputScale() {return inputScale;}", "public void beginScaling() {\n xScale = 1.0f;\n yScale = 1.0f;\n }", "protected void updateScales() {\n hscale = 1f;\n vscale = 1f;\n viewData.setHscale(hscale);\n viewData.setVscale(vscale);\n }", "public float getScale()\n\t{\n\t\treturn scale;\n\t}", "public void setScale( float scale ) {\n\t\tthis.scale = scale;\n\t}", "public float getScale() {\n \t\treturn scale;\n \t}", "@Override\n public void setScale(float scale) {\n this.scale = scale;\n }", "public void increaseTimescale() {\n\t\ttimeScaler = timeScaler>=5 ? 5 : timeScaler + TIMESCLALER_FACTOR;\n\t}", "public double getScale() {\r\n\t\treturn scale;\r\n\t}", "public final void setScale(float scale) {\n\t\n \tthis.svd(this);\n \tthis.mul(scale);\n }", "private static <T extends Shape> void scaleShape(T shape, double scale){\r\n\t\tshapeContainer = new ShapeContainer<Shape>(shape);\r\n\t\ttry {\r\n\t\t\tshapeContainer.changeShapeScale(scale);\r\n\t\t} catch (Exception e) {\r\n\t\t\tSystem.out.println(e);\r\n\t\t}\r\n\t}", "public Scale(Scale newScale){\n \tsuper(newScale);\n }", "public float getScale() {\n\t\treturn scale;\n\t}", "public double getScale(\n )\n {return scale;}", "public void decreaseTimescale() {\n\t\ttimeScaler = timeScaler<=1 ? 1 : timeScaler - TIMESCLALER_FACTOR;\n\t}", "public void scaleAnimetion(SpriteBatch batch){\n }", "ScaleType getScale();", "float getScaler();", "public void setScale(double value) {\n this.scale = value;\n }", "public float getScale() {\n\t\treturn getLifeStageHelper().getScale();\n\t}", "@Override\r\n\tprotected void preRenderCallback(EntityAngel entitylivingbaseIn, float partialTickTime)\r\n {\r\n GlStateManager.scale(0.8F, 0.8F, 0.8F);\r\n }", "private void setScale() {\n this.particleScale = (1 - ((float) slowTime / 50)) * (1.5f * (float) offset);\n }", "@Override\n public Double scalingFactor() {\n return 1.55d;\n }", "public void scaleModel(float f){\n\t\tfor(int i = 0; i < point.length; i++)\n\t\t\tpoint[i].mul(f);\n\t\tmodSize.mul(f);\n\t}", "public void InitScaling() {\n\tc2.InitScaling();\n\tc3.InitScaling();\n\tc1.InitScaling();\n\tc3.CalcPrev();\n\tc3.UpdateAllNoCoord();\n }", "@Override\n protected void afterAttach(){\n\n float scaleE = (float) Math.pow(toValue, 1.0 / totalIterations);\n scaleTransform.updateValues(scaleE, scaleE, scaleE);\n }", "public void setScale(double s){\n\t\tsetParameters(location, s);\n\t}", "public boolean hasScale() { return hasScale; }", "public void setScaleFactor(float scale){\n scaleFactor = scale;\n }", "float getCostScale();", "public void setScale(float scale) {\n \t\tthis.scale = scale;\n \t\tupdateTransform();\n \t\tfireEvent(new ScalingEvent(scale));\n \t}", "public void setScaleY(double aValue)\n{\n if(aValue==getScaleY()) return;\n repaint();\n firePropertyChange(\"ScaleY\", getRSS().scaleY, getRSS().scaleY = aValue, -1);\n}", "void setQuantizerScale(int value)\n {\n quantizerScale = value;\n }", "public final float getScale() {\n\treturn svd(null);\n }", "public float spiderScaleAmount()\n {\nreturn 1F;\n }", "public void setScale(float scale) {\n setLocalScale(scale);\n }", "public void scale(double factor) {\r\n for (int i = 0; i < components.length; i++) {\r\n components[i] *= factor;\r\n }\r\n }", "public void scaleBy(float scaleX, float scaleY) {\n internalGroup.scaleBy(scaleX, scaleY);\n dataTrait.scaleX = internalGroup.getScaleX();\n dataTrait.scaleY = internalGroup.getScaleY();\n resetSprite();\n }", "public Configuration getScale() {\n return scale;\n }", "void scaleArea(float scaleFactor) {\n\t\t// for more advanced (more than 4 points), use this algorithm:\n\t\t// http://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons\n\t\tfor (int i = 0; i < amount; i++) {\n\t\t\tPVector tmp = PVector.sub(point[i].position, anchor);\n\t\t\ttmp.mult(scaleFactor);\n\t\t\tpoint[i].position.set(PVector.add(anchor, tmp));\n\t\t}\n\t}", "private void buildScaleInputs(StateObservation stateObs) {\n viewWidth = 5;\n viewHeight = 10;\n //*****************************\n\n int blockSize;\n int avatarColNumber;\n\n int numGridRows, numGridCols;\n\n ArrayList<Observation>[][] gameGrid;\n\n gameGrid = stateObs.getObservationGrid();\n numGridRows = gameGrid[0].length;\n numGridCols = gameGrid.length;\n\n blockSize = stateObs.getBlockSize();\n\n // get where the player is\n avatarColNumber = (int) (stateObs.getAvatarPosition().x / blockSize);\n\n // create the inputs\n MLPScaledInputs = new double[viewWidth * viewHeight];\n\n int colStart = avatarColNumber - (viewWidth / 2);\n int colEnd = avatarColNumber + (viewWidth / 2);\n\n int index = 0;\n\n for (int i = numGridRows - (viewHeight + 1); i < viewHeight; i++) { // rows\n\n for (int j = colStart; j <= colEnd; j++) { // rows\n if (j < 0) {\n // left outside game window\n MLPScaledInputs[index] = 1;\n } else if (j >= numGridCols) {\n // right outside game window\n MLPScaledInputs[index + 1] = 1;\n } else if (gameGrid[j][i].isEmpty()) {\n MLPScaledInputs[index] = 0;\n } else {\n for (Observation o : gameGrid[j][i]) {\n\n switch (o.itype) {\n case 3: // obstacle sprite\n MLPScaledInputs[index + 2] = 1;\n break;\n case 1: // user ship\n MLPScaledInputs[index + 3] = 1;\n break;\n case 9: // alien sprite\n MLPScaledInputs[index + 4] = 1;\n break;\n case 6: // missile\n MLPScaledInputs[index + 5] = 1;\n break;\n }\n }\n }\n index++;\n }\n }\n }", "@Override public void update(float dt)\n\t{\n\t\tthis.setScale((this.getScale().getX() + 0.1f) * 0.99f, (this.getScale().getY() + 0.1f) * 0.99f);\n\n\n\t}", "ShapeState apply(int tick);", "public void setCanScale(boolean scale){\n mScale = scale;\n }", "public void setScale(final float scale) {\n if (equal(mScale, scale) != true) {\n Log.d(TAG, \"setScale(): old: %.2f, new: %.2f\", mScale, scale);\n mScale = scale;\n setScale(mSceneRootObject, scale);\n setScale(mMainCameraRootObject, scale);\n setScale(mLeftCameraRootObject, scale);\n setScale(mRightCameraRootObject, scale);\n for (OnScaledListener listener : mOnScaledListeners) {\n try {\n listener.onScaled(scale);\n } catch (Exception e) {\n e.printStackTrace();\n Log.e(TAG, e, \"setScale()\");\n }\n }\n }\n }", "public void setScale(final double scale) {\r\n\t\tthis.scale = scale;\r\n\t}", "@Override\n public void scale(double x, double y, double z) {\n GL11.glScaled(x, y, z);\n }", "public final void set(float scale) {\n\tm00 = scale; m01 = 0.0f; m02 = 0.0f;\n\tm10 = 0.0f; m11 = scale; m12 = 0.0f;\n\tm20 = 0.0f; m21 = 0.0f; m22 = scale;\n }", "double getStep() {\n\t\t\treturn scale;\n\t\t}", "@Override\r\n\tpublic void reset() {\n\t\tsuper.reset();\r\n\t\tthis.setScale(0.75f);\r\n\t}", "public SceneGraphNode setScale(double sx, double sy, double sz) {\n\t\tscaleX = sx;\n\t\tscaleY = sy;\n\t\tscaleZ = sz;\n\t\treturn this;\n\t}" ]
[ "0.6369467", "0.6131041", "0.59449923", "0.5924567", "0.58940774", "0.5885475", "0.5857292", "0.58456385", "0.5824094", "0.58209693", "0.5800628", "0.5792206", "0.5788432", "0.5780344", "0.5763428", "0.575489", "0.5752257", "0.5738142", "0.5728918", "0.572493", "0.57173026", "0.5705892", "0.56888026", "0.56872874", "0.5686244", "0.56717527", "0.5660756", "0.56539774", "0.56425935", "0.56346107", "0.5625156", "0.5617318", "0.5602988", "0.5600801", "0.5596539", "0.55898815", "0.55886036", "0.55844414", "0.55712885", "0.5551197", "0.5547939", "0.55336237", "0.5530857", "0.55268514", "0.5519744", "0.5518766", "0.5515", "0.5515", "0.55139023", "0.55068684", "0.5500122", "0.5498463", "0.5480602", "0.54772544", "0.5477139", "0.5471289", "0.546731", "0.5464084", "0.5462534", "0.5458112", "0.545247", "0.54418844", "0.5432594", "0.5432418", "0.5409347", "0.5408056", "0.53937083", "0.53923", "0.5387115", "0.5377455", "0.537501", "0.5370469", "0.5361698", "0.5359817", "0.5337265", "0.53368104", "0.53360564", "0.53291994", "0.5328818", "0.53285825", "0.53261584", "0.5321726", "0.52804744", "0.5273617", "0.5268115", "0.52665764", "0.5260983", "0.5253925", "0.52509266", "0.5250723", "0.52435094", "0.5241979", "0.5235692", "0.5233703", "0.5229401", "0.52277774", "0.5221686", "0.5215914", "0.5211397", "0.5206035" ]
0.73991716
0
Should be called before other methods using
public void init(List<PlotData> graphs, int currentGraphNum, List<Slot> allViews, TimeInterval timeRange, IMeanState meanState, int height);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void preRun() {\n super.preRun();\n }", "protected void onFirstUse() {}", "@Override\n public void beforeFirstLogic() {\n }", "protected abstract void before();", "@Override\n @Before\n public void before() throws Exception {\n\n super.before();\n }", "@Before\r\n\tpublic void before() {\r\n\t}", "protected void preRun() {\r\n\t\tthis.preparePairs();\r\n\t}", "@Override\n public void beforeStart() {\n \n }", "protected abstract void beforeCall();", "protected void runBeforeIteration() {}", "@Override\r\n\tprotected void doPre() {\n\t\t\r\n\t}", "@Override\n\tpublic void beforeClassSetup() {\n\t\t\n\t}", "default void beforeUse() {\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "protected void initialize() {}", "protected void initialize() {}", "@Before\n public void before() {\n }", "@Before\n public void before() {\n }", "@Override\r\n\tprotected void processInit() {\n\t\t\r\n\t}", "@BeforeMethod\n\tpublic void beforeMethod() {\n\t}", "public void prePerform() {\n // nothing to do by default\n }", "@Override\n protected void initialize() \n {\n \n }", "@Override\n\tpublic void afterInit() {\n\t\t\n\t}", "@Override\n\tpublic void afterInit() {\n\t\t\n\t}", "private void initialize() {\n\t\t\n\t}", "@Before\r\n public void before() throws Exception {\r\n }", "@Override\n protected void initialize() {\n\n \n }", "@Override\r\n\tprotected void processInit() {\n\r\n\t}", "protected abstract void preRun();", "private void initialize() {\n\t}", "@Override\n\tpublic void pre()\n\t{\n\n\t}", "void PrepareRun() {\n }", "@Stub\n\tpublic void before()\n\t{\n\t\t//\n\t}", "@Before\n\t public void setUp() {\n\t }", "private void initialize() {\n }", "protected void setup() {\r\n }", "protected void beforeJobExecution() {\n\t}", "@Override\n\tpublic void postInit() {\n\t\t\n\t}", "protected void initialize() {\n\t\t\n\t}", "protected void initialize() {\n\t\t\n\t}", "@Override public void postInit()\n\t\t{\n\t\t}", "@Before\n @Override\n public void init() {\n }", "protected void runBeforeIterations() {}", "protected void init() {\n // to override and use this method\n }", "@Override\n protected void setup() {\n }", "@Override\n\t\t\tprotected void onPreExecute()\n\t\t\t{\n\n\t\t\t}", "protected void initialize() {\n\n\t}", "protected void aktualisieren() {\r\n\r\n\t}", "@Before\n\tpublic void init() {\n\t}", "@Before\n\tpublic void setup() \n\t{\n\t\tsuper.setup();\n\t\t\n }", "protected void runBeforeStep() {}", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Before\n public void init() {\n }", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "protected void initialize()\n\t{\n\t}", "protected void initialize() {\r\n }", "protected void initialize() {\r\n }", "protected void initialize() {\n \t\n }", "void before();", "public void postInit() {\n }", "@Override\n\t\tprotected void onPreExecute() \n\t\t{\n\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "private void init() {\n\n\t}", "void preInit();", "void preInit();", "@Override\r\n\tprotected final void setup() {\r\n \tsuper.setup();\r\n\r\n \tdoSetup();\r\n }", "protected void initialize()\r\n {\n }", "protected void init() {\n\t}", "protected void init() {\n\t}", "protected void beforeParentInit() {\n // by default do nothing\n }", "protected void initialize() {\n\t}", "@Override\n public void initialize() {\n \n }", "@Override\r\n\tprotected void prepare()\r\n\t{\r\n\r\n\t}", "void initBeforeParsing() {\r\n }", "@BeforeMethod\r\n\tpublic void beforeMethod() {\r\n\t\t//initializeTestBaseSetup();\r\n\t}", "void beforeRun();", "private void initSharedPre() {\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "protected void additionalProcessing() {\n\t}", "@Override\r\n\t\t\t\tpublic void autInitProcess() {\n\t\t\t\t\t\r\n\t\t\t\t}", "@Override\r\n\t\t\t\tpublic void autInitProcess() {\n\t\t\t\t\t\r\n\t\t\t\t}", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }" ]
[ "0.7364154", "0.73615545", "0.7177791", "0.70843846", "0.6992482", "0.6953121", "0.6862449", "0.6853891", "0.6803089", "0.67909974", "0.6756204", "0.6754708", "0.6751305", "0.670926", "0.670926", "0.670926", "0.670926", "0.670926", "0.670926", "0.6689571", "0.6689571", "0.66870433", "0.66870433", "0.666428", "0.6643626", "0.6633028", "0.6623574", "0.6619503", "0.6619503", "0.6607524", "0.6607267", "0.6601923", "0.6600194", "0.65809816", "0.6580316", "0.6571832", "0.6558159", "0.65326315", "0.65313303", "0.6525529", "0.65200293", "0.6518544", "0.6516342", "0.6513356", "0.6513356", "0.65106434", "0.65084994", "0.65078366", "0.64913386", "0.6485848", "0.6479969", "0.64777994", "0.64774966", "0.6476143", "0.64742136", "0.64718896", "0.64685816", "0.64685243", "0.6463488", "0.6457407", "0.64569515", "0.64569515", "0.64408714", "0.6435438", "0.6431505", "0.64179295", "0.641388", "0.641388", "0.641388", "0.641388", "0.641388", "0.6410325", "0.64102554", "0.64102554", "0.6406443", "0.64059603", "0.6402877", "0.6402877", "0.6399461", "0.63955134", "0.6391887", "0.63856566", "0.63763726", "0.6376075", "0.6370165", "0.6367701", "0.6366906", "0.6366906", "0.6366643", "0.63582176", "0.63582176", "0.6353848", "0.6353848", "0.6353848", "0.6353848", "0.6353848", "0.6353848", "0.6353848", "0.6353848", "0.6353848", "0.6353848" ]
0.0
-1
Declare and define an array
public static void main(String[] args) { String [] cities = {"New York", "San Francisco", "Miami", "Malmö" }; System.out.println(cities[0]); System.out.println(cities[1]); System.out.println(cities[2]); System.out.println(cities[3]); //Declare array String[] countries; // Define the array countries = new String[3]; countries[0] = "USA"; countries[1] = "Denmark"; countries[2] = "Sweden"; System.out.println(countries[2]); System.out.println("**********"); //Declare & define the array (only size) String[] states = new String [5]; states [0] = "California"; states [1] = "Ohio"; states [2] = "New Jersay"; states [3] = "Texas"; states [4] = "Skåne"; int i = 0; // Do Loop: enters the loop THEN tests condition do { System.out.println("STATE " + states[i]); i = i + 1; } while (i < 5); // While Loop: tests condition first then enters loop int n = 0; boolean stateFound = false; while (!stateFound) { String state = states[n]; System.out.println(state); if (state == "Texas") { System.out.println("STATE FOUND!"); stateFound = true; } n++; } System.out.println("\nPRINTING WITH FOR LOOP"); // For Loop: Best structure for iterating through an array for (int x = 0; x < 5; x++ ) { System.out.println(states[x]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Array createArray();", "private void declareArray() {\n\t\twriter.println();\n\t\twriter.println(\"; array of 52 for variables:\");\n\t\twriter.print(variables + \" dw\");\n\t\tfor (int i = 0; i < 51; i++) {\n\t\t\twriter.print(\" 0,\");\n\t\t}\n\t\twriter.println(\" 0\");\n\t}", "public static void arrayDemo() {\n\t}", "public static void arrayDeclarationInitialization() {\n\n double[] arrayOfDoubles = new double[] { 12.56, 45.87, 14.85 };\n\n // This is also ok.\n\n int[] arrayOfInts = { 12, 21, 0, 5, 7 };\n\n int[] i = new int[10 + 5]; // Array size can be an expression resulting an integer\n\n int[] i1 = new int[(byte) 10]; // byte is auto-widened to int\n\n // int i3 = new int[10.25]; //Compile Time Error : size can not be double\n }", "ArrayValue createArrayValue();", "public ArrayAccessor() {\r\n super(\"<array>\");\r\n }", "ArrayTypeRule createArrayTypeRule();", "Array() {\n\t\tarray = new int[0];\n\t}", "ArrayADT() {\n this.size = 10;\n this.base = createArrayInstance(this.size);\n this.length = 0;\n }", "@Override\n public void visit(ArrayDeclaration node) {\n }", "Array(int[] n) {\n\t\tarray = n;\n\t}", "public void makeArray() {\r\n for (int i = 0; i < A.length; i++) {\r\n A[i] = i;\r\n }\r\n }", "public static void arrayCreation() {\n int[] arr = new int[3];\n // as we are using new operator and that is how we create objects hence arrays\n // are called objects\n // every array in java is an object\n System.out.println(arr.getClass()\n .getSimpleName()); // int[]\n System.out.println(arr.getClass()\n .getName()); // [I\n\n int[] a1 = new int[3];\n int[][] a2 = new int[3][3];\n double[] a3 = new double[3];\n short[] a4 = new short[3];\n byte[] a5 = new byte[3];\n boolean[] a6 = new boolean[3];\n long[] a7 = new long[3];\n float[] a8 = new float[3];\n Integer[] a9 = new Integer[3];\n\n System.out.println(a1.getClass()\n .getName()); // [I\n System.out.println(a2.getClass()\n .getName()); // [[I\n System.out.println(a3.getClass()\n .getName()); // [D\n System.out.println(a4.getClass()\n .getName()); // [S\n System.out.println(a5.getClass()\n .getName()); // [B\n System.out.println(a6.getClass()\n .getName()); // [Z\n System.out.println(a7.getClass()\n .getName()); // [J\n System.out.println(a8.getClass()\n .getName()); // [F\n System.out.println(a9.getClass()\n .getName()); // [Ljava.lang.Integer;\n\n // at the time of the array initialization we should compulsory specify the size\n // new int[3] we should specify the size else it will lead to compilation error\n\n // It is legal to have size zero in java\n int[] a = new int[0];\n System.out.println(a);\n\n }", "FunWithArrays(int size){\r\n\t\tnumbers = new int[size];\r\n\t}", "public ZYArraySet(){\n elements = (ElementType[])new Object[DEFAULT_INIT_LENGTH];\n }", "public final void mARRAY_DECLARE() throws RecognitionException {\n try {\n int _type = ARRAY_DECLARE;\n // /Users/benjamincoe/HackWars/C.g:20:15: ( 'array_declare' )\n // /Users/benjamincoe/HackWars/C.g:20:17: 'array_declare'\n {\n match(\"array_declare\"); \n\n\n }\n\n this.type = _type;\n }\n finally {\n }\n }", "public Stmt\ninitiateArray(\n Exp pArray, Exp pInitExp,\n Exp pFrom, Exp pTo, Subp pSubp );", "private final int[] initializeInstanceVariable() {\n\t\tint n = 10;\n\t\tint[] temp = new int[n];\n\t\tfor (int i = 0; i < n; i++) {temp[i] = i;}\n\t\treturn temp;\n\t}", "public ExpandableArray() {\n\n\t}", "public static void createArrays() {\n\t\tinitArrays();\n\t\tcreateNodeTable();\n\t\tcreateEdgeTables();\n\t\t// Helper.Time(\"Read File\");\n\t\tcreateOffsetTable();\n\t}", "public void setArray(int i, Array x);", "public MyArray() {\n this.length = 10;\n this.array = (T[]) Array.newInstance(MyArray.class, length);\n this.size = 0;\n }", "public void setArr(int[] arr){ this.arr = arr; }", "public static NewArrayExpression newArrayInit(Class type, Iterable<Expression> expressions) { throw Extensions.todo(); }", "public void testCreateArray() {\n System.out.println(\"createArray\");// NOI18N\n \n TypeID type = new TypeID(TypeID.Kind.PRIMITIVE, \"javacode\");// NOI18N\n PrimitiveDescriptor arrayDescriptor = new PrimitiveDescriptor() {\n public Object deserialize(String serialized) {\n return \"array\"; //NOI18N\n }\n public boolean isValidInstance(Object object) {\n return true;\n }\n public String serialize(Object value) {\n return \"array\"; // NOI18N\n }\n };\n \n PropertyValue arrayPropertyValue = PropertyValue.createValue( arrayDescriptor, type, DesignComponentTest.PROPERTY3_VALUE_STRING);// NOI18N\n List<PropertyValue> array = new ArrayList();\n array.add(arrayPropertyValue);\n \n PropertyValue result = PropertyValue.createArray(type, array);\n \n assertEquals(PropertyValue.Kind.ARRAY, result.getKind());\n type = type.getArrayType();\n assertEquals(type,result.getType());\n assertNotNull(result.getArray());\n }", "public void makeArray(int size) {\n\t\t\n\t}", "public DynamicArray() {\n this(16);\n }", "protected void setArray(Expression expr)\n {\n setExpression(expr);\n }", "private static int[] arrayInitializer(int length) {\n int[] myArray = new int[length];\n Random rand = new Random();\n for (int i = 0; i < length; i++) {\n myArray[i] = rand.nextInt(1000);\n }\n return myArray;\n }", "public static NewArrayExpression newArrayInit(Class type, Expression[] expressions) { throw Extensions.todo(); }", "public DynamicArray(){\n\t \n\t array = (E[]) new Object[dim];\n }", "public abstract void startArray();", "public Array()\n {\n assert DEFAULT_CAPACITY > 0;\n\n array = new Object[DEFAULT_CAPACITY];\n }", "Object createArray(int capacity);", "Exp getArrayExp();", "private void newArrayInitialize(NewArrayIRTuple instr) throws IOException{\n\n String type = (String)instr.getArg0();\n ArgumentVariable arg1 = new ArgumentVariable(instr.getArg1());\n ArgumentVariable result = new ArgumentVariable(instr.getResult());\n\n //Store $ra on stack\n writer.write(\"addi $sp, $sp, -20\\n\");\n writer.write(\"sw $ra, 16($sp)\\n\");\n\n //Store $a0\n writer.write(\"sw $a0, 12($sp)\\n\");\n\n //Store $t0-$t1 on the stack\n for(int i = 0; i < 2; i++)\n {\n writer.write(\"sw $t\" + i + \", \" + (8 - (4*i)) + \"($sp)\\n\");\n }\n\n //Store $v0 on the stack\n writer.write(\"sw $v0, 0($sp)\\n\");\n\n if(arg1.type.equals(\"constant\"))\n writer.write(\"li $a0, \" + arg1.getValue(curAddTable) + \"\\n\");\n else\n writer.write(\"move $a0, \" + arg1.getValue(curAddTable) + \"\\n\");\n if(type.equals(\"int\"))\n writer.write(\"sll $a0, $a0, 2\\n\");\n\n //Call the function of \"_new_array\"\n writer.write(\"jal _new_array\\n\");\n writer.write(\"lw $t0, 8($sp)\\n\");\n writer.write(\"lw $t1, 4($sp)\\n\");\n\n writer.write(\"lw $a0, 12($sp)\\n\");\n writer.write(\"move \" + result.getValue(curAddTable) + \", $v0\\n\");\n\n writer.write(\"lw $v0, 0($sp)\\n\");\n writer.write(\"lw $ra, 16($sp)\\n\");\n writer.write(\"addi $sp, $sp, 20\\n\");\n\n }", "public ulsinArray(int length) {\n intArr = new int[length];\n }", "private RubyArray(Ruby runtime, IRubyObject[] vals, int begin) {\n super(runtime, runtime.getArray());\n this.values = vals;\n this.begin = begin;\n this.realLength = vals.length - begin;\n this.isShared = true;\n }", "private ArrayOps() {\r\n }", "private static int[] createArray() {\n\t\trnd = new Random();\r\n\t\trandomArray = new int[8];\r\n\t\tfor (int i = 0; i < 8; i++) {\r\n\t\t\trandomArray[i] = rnd.nextInt(45);\r\n\t\t}\r\n\t\treturn randomArray;\r\n\t}", "public static int[] getConstArray(){\n return new int[]{NAME, PHONE, EMAIL, DATE, TIME, DATE_TIME, URL, PRICE, PHOTO, ITEM_LIST, PRICE_LIST, TEXT, MESSAGE, NUMBER, DECIMAL, DROPDOWN, CHECKBOX, RATING, SUBJECT};\n }", "Array(int x) {\n\t\tarray = new int[x];\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tarray[i] = 0; // make each index 0\n\t\t}\n\t}", "private void createArray() {\n\t\tdata = new Integer[userInput];\n\t\tRandom rand = new Random();\n\n\t\t// load the array with random numbers\n\t\tfor (int i = 0; i < data.length; i++) {\n\t\t\tdata[i] = rand.nextInt(maximumNumberInput);\n\t\t}\n\n\t\t// copy the array to the sorting method\n\t\tinsertionData = data.clone();\n\t\tquickData = data.clone();\n\n\t}", "private RubyArray(Ruby runtime, long length) {\n super(runtime, runtime.getArray());\n checkLength(length);\n values = new IRubyObject[(int)length];\n }", "public float[] array() {\r\n\t\treturn new float[] { x, y, z };\r\n\t}", "private RubyArray(Ruby runtime, RubyClass klass, int length) {\n super(runtime, klass);\n values = new IRubyObject[length];\n }", "public static int[][] init() {\n int[][] arr={\n {0,1,0,1,0,0,0},\n {0,0,1,0,0,1,0},\n {1,0,0,1,0,1,0},\n {0,0,1,0,0,1,0},\n {0,0,1,1,0,1,0},\n {1,0,0,0,0,0,0}\n };\n return arr;\n }", "public XmlsonArray(String name) {\n\t\tsuper(name);\n\t}", "private int[] createArrays(int size) {//creating method, using variable \"SIZE\"\n\t\tint [] array = new int[size];\n\t\treturn array;\n\t}", "public purchaseDesign()\n {\n priceArray = new int[5][4];\n }", "public ZYArraySet(int initLength){\n if(initLength<0)\n throw new IllegalArgumentException(\"The length cannot be nagative\");\n elements = (ElementType[])new Object[initLength];\n }", "public Integer[] createArray() {\n Integer[] value = new Integer[defaultLaenge];\n\n for (int i = 0; i < value.length; i++) {\n value[i] = (int)(value.length*Math.random());\n }\n\n return value;\n }", "public SuperArray() { \n \t_data = new Comparable[10];\n \t_lastPos = -1; //flag to indicate no lastpos yet\n \t_size = 0;\t\n }", "private RubyArray(Ruby runtime, boolean objectSpace) {\n super(runtime, runtime.getArray(), objectSpace);\n }", "void mo3807a(C0985po[] poVarArr);", "protected Object[] getArray(){\r\n\t \treturn array;\r\n\t }", "@Test\n public void testArrayCreation() {\n final String[] array = ArrayUtils.toArray(\"foo\", \"bar\");\n assertEquals(2, array.length);\n assertEquals(\"foo\", array[0]);\n assertEquals(\"bar\", array[1]);\n }", "void mo12207a(int[] iArr);", "@Override\n\tpublic void VisitArrayLiteralNode(BunArrayNode Node) {\n\n\t}", "public void makeArray(int num)\n {\n \tmakeArray(num,0);\n }", "public CircularQueueUsingArray() {\n\t\tarray = new int[size];\n\t}", "public void generateArray(PhpWriter out)\n throws IOException\n {\n ExprGenerator objGen = ((ExprPro) _objExpr).getGenerator();\n\n objGen.generateObject(out);\n out.print(\".getFieldArray(env, \");\n out.printIntern(_name);\n out.print(\")\");\n }", "private int [] createXArray(){\r\n\t\tint [] xCoord = {\r\n\t\t\t\txStart,\r\n\t\t\t\txStart + 50,\r\n\t\t\t\txStart + 65,\r\n\t\t\t\txStart + 65,\r\n\t\t\t\txStart + 50, \r\n\t\t\t\txStart,\r\n\t\t\t\txStart,\r\n\t\t\t\txStart + 50,\r\n\t\t\t\txStart + 50,\r\n\t\t\t\txStart,\r\n\t\t\t\txStart\r\n\t\t};\r\n\t\treturn xCoord;\r\n\t}", "public final void createVarArray(final int length) {\r\n varArray = new FileMincVarElem[length];\r\n }", "void setArrayGeneric(int paramInt)\n/* */ {\n/* 1062 */ this.length = paramInt;\n/* 1063 */ this.datums = new Datum[paramInt];\n/* 1064 */ this.pickled = null;\n/* 1065 */ this.pickledCorrect = false;\n/* */ }", "private RubyArray(Ruby runtime, IRubyObject[] vals, boolean objectSpace) {\n super(runtime, runtime.getArray(), objectSpace);\n values = vals;\n realLength = vals.length;\n }", "public static void main(String[] args){\n\t\tint[] anArray;\n\t\tanArray = new int[10];\n\t\t\n\t\tanArray[1] = 10;\n\t}", "public void set_array(String type){\n while (true){\n\n General_imp construct = new General_imp();\n\n construct.print_type( type);\n String ans = construct.input();\n if (ans.equals(\"EXIT\"))\n break;\n setatribs(ans, type);\n }\n }", "private RubyArray(Ruby runtime, IRubyObject[] vals) {\n super(runtime, runtime.getArray());\n values = vals;\n realLength = vals.length;\n }", "public IntArrays()\n\t{\n\t\tthis(10);\n\t}", "public ArrayOfFraction()\r\n\t{\r\n\t\ta=new Fraction [2];\r\n\t\tn=0;\r\n\t}", "public void testGetArray() {\n System.out.println(\"getArray\"); // NOI18N\n \n TypeID type = new TypeID(TypeID.Kind.PRIMITIVE, \"javacode\");// NOI18N\n PropertyValue arrayPropertyValue = PropertyValue.createValue(primitveDescritor, type, DesignComponentTest.PROPERTY1_VALUE_STRING); // NOI18N\n List<PropertyValue> array = new ArrayList();\n \n array.add(arrayPropertyValue);\n \n PropertyValue result = PropertyValue.createArray(type,array);\n \n type = type.getArrayType();\n assertEquals(type,result.getType());\n assertNotNull(result.getArray());\n }", "@jdk.Exported\npublic interface ArrayType extends ReferenceType {\n\n /**\n * Creates a new instance of this array class in the target VM.\n * The array is created with the given length and each component\n * is initialized to is standard default value.\n *\n * @param length the number of components in the new array\n * @return the newly created {@link ArrayReference} mirroring\n * the new object in the target VM.\n *\n * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.\n */\n ArrayReference newInstance(int length);\n\n /**\n * Gets the JNI signature of the components of this\n * array class. The signature\n * describes the declared type of the components. If the components\n * are objects, their actual type in a particular run-time context\n * may be a subclass of the declared class.\n *\n * @return a string containing the JNI signature of array components.\n */\n String componentSignature();\n\n /**\n * Returns a text representation of the component\n * type of this array.\n *\n * @return a text representation of the component type.\n */\n String componentTypeName();\n\n /**\n * Returns the component type of this array,\n * as specified in the array declaration.\n * <P>\n * Note: The component type of a array will always be\n * created or loaded before the array - see\n * <cite>The Java&trade; Virtual Machine Specification</cite>,\n * section 5.3.3 - Creating Array Classes.\n * However, although the component type will be loaded it may\n * not yet be prepared, in which case the type will be returned\n * but attempts to perform some operations on the returned type\n * (e.g. {@link ReferenceType#fields() fields()}) will throw\n * a {@link ClassNotPreparedException}.\n * Use {@link ReferenceType#isPrepared()} to determine if\n * a reference type is prepared.\n *\n * @see Type\n * @see Field#type() Field.type() - for usage examples\n * @return the {@link Type} of this array's components.\n */\n Type componentType() throws ClassNotLoadedException;\n}", "public void setArray(int[] array) {\r\n this.array = array;\r\n }", "public void inicialisation(){\r\n\t\t\r\n\t\tgoods = new AutoParts[0];\r\n\t\tclient = new Client[0];\r\n\t\t\r\n\t\tshop = new Shopping[0];\r\n\t\tsale = new Sale[0];\r\n\t\ttransaction = new Document[0];\r\n\t\t\r\n\t\tbalancesAutoParts = new BalancesAutoParts[0];\r\n\t\t\r\n\t\tprices = new Prices[0];\r\n\t\t\r\n\t\tagriment = new Agreement[0];\r\n\t\t\r\n\t}", "public static void main(String[] args) {\n int[] someInts2 = new int[3];\n// int[] someInts3 = new int[1, 2, 3,];\n int[] someInts4 = {1, 2, 3,};\n\n// someInts1 = {1, 2, 3};\n someInts2[0] = 1;\n// System.out.println(someInts2[0]);\n// System.out.println(someInts2[1]);\n// int aInt = someInts4[2];\n// System.out.println(aInt);\n System.out.println(someInts4.length);\n\n }", "public SimpleArray(int size)\n\t{\n\t\tarray = new int[size];\n\t}", "public RubyArray(Ruby ruby) {\n \t\tthis(ruby, new ArrayList());\n \t}", "public MyArray() {\n\t\tcapacity = DEFAULT_CAPACITY;\n\t\tnumElements = 0;\n\t\telements = (E[]) new Object[capacity];\n\t}", "public void constructArray(){\n\t\tfor (int col = 0; col < cols; col++){\n\t\t\tfor (int row = 0; row < rows; row++){\n\t\t\t\tmap[col][row] = new Pixel();\n\t\t\t}\n\t\t}\n\t}", "public interface IArrayInterface<T> {\n /**\n * Getter\n * @return return value\n */\n T[] getArray();\n\n /**\n * Setter\n * @param array incoming arg\n */\n void setArray(final T[] array);\n}", "@Test\n public void testArrayCreationWithDifferentTypes() {\n final Number[] array = ArrayUtils.<Number>toArray(Integer.valueOf(42), Double.valueOf(Math.PI));\n assertEquals(2, array.length);\n assertEquals(Integer.valueOf(42), array[0]);\n assertEquals(Double.valueOf(Math.PI), array[1]);\n }", "public static void main(String[] args) \n\t{\n\t\tint a[][];\n\t\t\n\t}", "@Override\n public ArrayDeclScript createScript(Map<Integer,String> lineArrayMatcherMap) throws Exception{\n\n if(lineArrayMatcherMap == null){\n return null;\n }\n \n String arrayTypeLeft = lineArrayMatcherMap.get(1);\n String arrayVariableStr = lineArrayMatcherMap.get(2);\n String leftSideArrayBracket = lineArrayMatcherMap.get(3);\n String execStartingStr = lineArrayMatcherMap.get(4);\n String newKeyWordStr = lineArrayMatcherMap.get(5);\n String arrayTypeRight = lineArrayMatcherMap.get(6);\n String rightSideArrayBracket = lineArrayMatcherMap.get(7);\n String execParameters = lineArrayMatcherMap.get(8);\n \n boolean rhsArrayUsed = false;\n boolean execUsed = false;\n boolean newArrayInitialization = false;\n if(execStartingStr.isEmpty() && execParameters.isEmpty() ){\n if(!newKeyWordStr.isEmpty()&&!arrayTypeLeft.equals(arrayTypeRight)){\n throw new Error(\"invalid array declaration\");\n }\n if(!leftSideArrayBracket.isEmpty() && !rightSideArrayBracket.isEmpty() && !newKeyWordStr.equals(newKeyWord)){\n throw new Error(\"requires \\\"new\\\" keyword while creating a hawk array\");\n }\n execUsed = false;\n if(rightSideArrayBracket.isEmpty() && newKeyWordStr.isEmpty()){\n rhsArrayUsed = true;\n newArrayInitialization = false;\n }else{\n rhsArrayUsed = false;\n newArrayInitialization = true;\n }\n \n }else if(!execStartingStr.isEmpty() && !execParameters.isEmpty() ){\n if(!(newKeyWordStr.isEmpty() && rightSideArrayBracket.isEmpty())){\n throw new Exception(\"invalid array declaration\");\n }\n if(!execParameters.endsWith(\"`\")){\n throw new Exception(\"invalid array declaration\");\n }\n execUsed = true;\n rhsArrayUsed =false;\n newArrayInitialization = false;\n }else{\n throw new Exception(\"invalid array declaration\");\n }\n ArrayDeclScript arrayDeclScript = new ArrayDeclScript();\n ArrayTypeEnum arrayType = ArrayTypeEnum.valueOf(VarTypeEnum.parse(arrayTypeLeft));\n arrayDeclScript.setArrayType(arrayType);\n if(arrayDeclScript.isStructType()){\n \n StructureDefnScript structureDefnScript = AppContainer.getInstance().getBean( StructureDefinitionScriptCache.class)\n .getStructureDefnMap()\n .get(arrayTypeLeft);\n if(structureDefnScript == null){\n throw new Error(\"Could not find struct {\"+arrayTypeLeft+\"}\");\n }\n\n \n }\n boolean isVarType = arrayDeclScript.getArrayType().isVarArray(); \n Variable arrayVariable = new Variable\n (\n isVarType?VarTypeEnum.VAR:VarTypeEnum.STRUCT,\n isVarType?null:arrayTypeLeft,\n arrayVariableStr,\n isVarType?ArrayTypeEnum.VAR:ArrayTypeEnum.STRUCT\n );\n arrayDeclScript.setArrayVariable(arrayVariable);\n if(rhsArrayUsed || execUsed){\n \n if(rhsArrayUsed){\n arrayDeclScript.setArrayDeclTypeEnum(ArrayDeclTypeEnum.OLDARRAY);\n ArrayDeclScript rhsArrayDeclScript = new ArrayDeclScript();\n rhsArrayDeclScript.setArrayType(arrayDeclScript.getArrayType());\n Variable rhsArrayVariable = new Variable\n (\n isVarType?VarTypeEnum.VAR:VarTypeEnum.STRUCT,\n isVarType?null:arrayVariableStr,\n arrayTypeRight,\n isVarType?ArrayTypeEnum.VAR:ArrayTypeEnum.STRUCT\n );\n rhsArrayDeclScript.setArrayVariable(rhsArrayVariable);\n arrayDeclScript.setRhsArrayDeclScript(rhsArrayDeclScript);\n }\n if(execUsed){\n arrayDeclScript.setArrayDeclTypeEnum(ArrayDeclTypeEnum.EXEC);\n String execExpStr = execStartingStr +\" \"+ arrayTypeRight +\" \" + execParameters;\n arrayDeclScript.setExecScriptExpression(execExpStr);\n }\n }else{\n arrayDeclScript.setArrayDeclTypeEnum(ArrayDeclTypeEnum.NEWARRAY);\n }\n return arrayDeclScript;\n }", "private void makeArrays()\n\t{\n\t\tfor (String key : sub.keySet())\n\t\t\tsub.put(key, ((List<String>) sub.get(key)).toArray(s0));\n\t\tfor (String key : attrs.keySet())\n\t\t\tattrs.put(key, ((List<String>) attrs.get(key)).toArray(s0));\n\t\tfor (String key : defs.keySet())\n\t\t\tdefs.put(key, ((List<String>) defs.get(key)).toArray(s0));\n\t\tfor (String key : smodes.keySet())\n\t\t{\n\t\t\tList<Integer> list = (List<Integer>) smodes.get(key);\n\t\t\tint[] array = new int[list.size()];\n\t\t\tfor (int i = 0; i < list.size(); i++)\n\t\t\t\tarray[i] = list.get(i);\n\t\t\tsmodes.put(key, array);\n\t\t}\n\t\tfor (String key : amodes.keySet())\n\t\t{\n\t\t\tList<Integer> list = (List<Integer>) amodes.get(key);\n\t\t\tint[] array = new int[list.size()];\n\t\t\tfor (int i = 0; i < list.size(); i++)\n\t\t\t\tarray[i] = list.get(i);\n\t\t\tamodes.put(key, array);\n\t\t}\n\t}", "public GenericDynamicArray() {this(11);}", "public static void main(String[] args) {\n int arrayName[] = new int[]{'a','b','c','1','2'};\n String objArray[] = new String[]{\"Shreya\",\"Paul\"};\n System.out.println(arrayName);\n System.out.println(objArray);\n //Arrays are objects and refer to a collection of primitive data types or other objects.(same data type)\n int [] multiarray []; // 2 dimensional or multi dimensional array\n // no elements of an array are created when it’s declared, it’s invalid to define the size of an array with its declaration.\n //int [3] declarearray[2]; this line fails as no elements are created but we have given the size\n // An array type can be any of the following:\n // Primitive data type ,Interface ,Abstract class ,Concrete class\n // Arrays can be of any data type other than null.\n int arr[] []= new int[3][];\n System.out.println(\"this is \"+arr);\n int intArray[]; // it is declaration\n intArray = new int[2]; // allocation\n for(int i=0;i<intArray.length;i++){\n intArray[i] = 4+i; // initializing the loop\n }\n System.out.println(intArray[1]);\n int multidimArray[][];\n multidimArray = new int[2][2];\n for (int i=0;i<multidimArray.length;i++){\n for (int j=0;j<multidimArray.length;j++){\n multidimArray[i][j] = j+i;\n System.out.println(multidimArray[1][0]);\n }\n }\n String all3[] = new String[]{\"apple\",\"call\",\"ball\",\"doll\"}; // creates an array of string and initializes\n all3[2] = null; // sets the value of array index 2 to null\n for (String val:all3) {\n System.out.println(val);\n }\n String ar[] = {\"app\",\"bpp\"};\n int aw[] = {1,2}; // these 3 lines are single line declarations,allocations and initializations\n int multarra[][] = {{1,2},{3,4,5},{}}; // the length is 3\n System.out.println(multarra.length);\n // int intArray2[] = new int[2]{0, 1}; this line fails as When you combine an array declaration, allocation, and initialization in a single step, you can’t specify the size of the array.\n // The size of the array is calculated by the number of values that are assigned to the array.\n int intArray2[] = new int[]{0, 1}; // this is acceptable\n // a multidimensional array can be asymmetrical. An array can define a different number of columns for each of its rows.\n String multiStrArr[][] = new String[][]{\n {\"A\", \"B\"},\n null,\n {\"Jan\", \"Feb\", \"Mar\"}};\n System.out.println(multiStrArr[2][2]);\n multiStrArr[2][2] = null;\n System.out.println(multiStrArr[2][2]);\n System.out.println(multiStrArr[1]);\n }", "public ArrayIns(int max) // constructor\r\n {\r\n a = new long[max]; // create the array\r\n nElems = 0; // no items yet\r\n }", "public static void main(String[] args) {\n\tint[] a = new int[3];\r\n\t\r\n\t// At the time of construction we must specify the size\r\n\t//int[] a = new int[]; => Gives compile time error.\r\n\t\r\n\tint[] b = new int[0]; //=> Legal to have zero size array\r\n\t\r\n\tint[] c = new int[-6]; //=> no compile time error but gives run time exception\r\n\t\r\n\t// Array size can be specified using byte,short,int,char types of data.\r\n\t\r\n\tint[] d = new int['a']; //char type\r\n\t\r\n\tbyte e = 10;\r\n\tint[] f = new int[e]; //byte type\r\n\t\r\n\tshort g = 20;\r\n\tint[] h = new int[g]; //short type\r\n\t\r\n //int[] i = new int[58l]; // Compile time error\r\n //int[] j = new int[10.2]; //Compile time error\r\n\t\r\n\t\r\n\t//========> Construction of multi dimensional Arrays <=========//\r\n\t\r\n\t// In Java multi dimensional arrays are implemented by using Array of Arrays concept\r\n\t\r\n\tint[][] i = new int[3][]; \r\n\ti[0] = new int[2];\r\n\ti[1] = new int[3];\r\n\ti[2] = new int[8];\r\n\t\r\n\t\r\n\tint[][][] j = new int[2][][];\r\n\tj[0] = new int[3][];\r\n\tj[0][0] = new int[1];\r\n\tj[0][1] = new int[2];\r\n\tj[0][2] = new int[3];\r\n\tj[1] = new int[2][2];\r\n\t\r\n\t\r\n\t\r\n\t\r\n}", "public void init(int[] a){\n this.array = a;\n moves = 0; \n }", "public static void main(String[] args) {\n \n\t\t/*int[] a = new int[3];\n\t\ta[0] =7;\n\t\ta[1] =9;\n\t\ta[2] =11;\n\t\tSystem.out.println(a[0]);\n\t\tSystem.out.println(a[1]);\n\t\tSystem.out.println(a[2]);*/\n\t\t\n\t\tint[] a = {7,9,11};// shortcut of single array\n\t\tSystem.out.println(a.length);\n\t\t/*System.out.println(a[0]);\n\t\tSystem.out.println(a[1]);\n\t\tSystem.out.println(a[2]);*/\n\t\t\n\t\t\n\t}", "void setStarArray(stars.StarType[] starArray);", "private ConfigurationObject createArray(String name, String arrayType, String dimension,\r\n String values) throws Exception {\r\n ConfigurationObject array = new DefaultConfigurationObject(name);\r\n array.setPropertyValue(PROPERTY_ARRAY_TYPE, arrayType);\r\n array.setPropertyValue(PROPERTY_DIMENSION, dimension);\r\n array.setPropertyValue(PROPERTY_VALUES, values);\r\n\r\n return array;\r\n }", "protected void setArray(Object[] array){\r\n\t \tthis.array = array;\r\n\t }", "public SpecimenArray()\r\n\t{\r\n\t\tsuper();\r\n\t}", "public Object getArray() {\n\t\treturn array;\n\t}", "SAFEARRAY.ByReference SafeArrayCreate(VARTYPE vt, UINT cDims,\n\t\t\tSAFEARRAYBOUND[] rgsabound);", "@Test\r\n public void testGenericArray()\r\n {\r\n Type t0 = Types.create(List.class).withType(Number.class).build();\r\n Type arrayType = Types.createGenericArrayType(t0);\r\n test(arrayType);\r\n }", "public static AsonValue CreateRootArray() {\n return CreateRootArray(null);\n }", "public static void createArrayOfEvens()\n {\n int[] evens = new int[10];\n \n \n /*\n * Set all the values of the elements in teh array to the first ten positive even integers.\n * \n * \"length\" is used to query the number of elements in the array.\n * \n * square brackets are used to reference a specific element of the array.\n */\n for(int i = 0; i < evens.length; i++)\n {\n evens[ i ] = (i + 1) * 2;\n }\n \n // print the array's elements\n for(int i = 0; i < evens.length; i++)\n {\n System.out.println(i + \": \" + evens[i] );\n }\n \n System.out.println( evens ); // prints the reference to the array\n }", "LLVMValueRef createTableArray(CodeGenEnv env){\n var type = tableType();\n var tb = LLVMAddGlobal(env.module, type, \"VT_\" + class_.name.str);\n var pointers = new PointerPointer<LLVMValueRef>( members.size() );\n int j = 0;\n for (var i:members){\n var v = i.funRef;\n // convert to char *\n var v2 = LLVMConstBitCast(v, env.char_star);\n pointers.put(j, v2);\n j += 1;\n }\n var const_arr = LLVMConstArray(CodeGenEnv.char_star, pointers , members.size());\n LLVMSetInitializer(tb, const_arr);\n return tb;\n }" ]
[ "0.7442229", "0.72583216", "0.69292235", "0.6920459", "0.6649295", "0.66144246", "0.65603983", "0.65252304", "0.64830387", "0.64812905", "0.6434596", "0.6427511", "0.64183164", "0.62094", "0.6204506", "0.61905587", "0.61892927", "0.61814505", "0.61794627", "0.61674017", "0.6130777", "0.6118077", "0.6084621", "0.60777664", "0.6070112", "0.60672456", "0.6053364", "0.60487133", "0.6046403", "0.60354686", "0.6034608", "0.6017039", "0.598445", "0.59833735", "0.5976203", "0.59739625", "0.59337384", "0.5923336", "0.59102494", "0.5890257", "0.58851975", "0.5881188", "0.5875736", "0.58723", "0.58668697", "0.58552235", "0.5852388", "0.584733", "0.5833348", "0.5828133", "0.58207387", "0.5804255", "0.57933575", "0.5790313", "0.578491", "0.57691336", "0.5756803", "0.5751257", "0.5744002", "0.5743459", "0.5736026", "0.5720722", "0.5693742", "0.5687707", "0.5669364", "0.5669269", "0.56665444", "0.5663936", "0.5663143", "0.56464595", "0.56412596", "0.5640988", "0.5638449", "0.55982834", "0.5594145", "0.5593549", "0.55827343", "0.5582623", "0.55813265", "0.5578132", "0.5575587", "0.55661863", "0.5564576", "0.5564121", "0.5561474", "0.5560785", "0.5555324", "0.5552772", "0.5545065", "0.5544556", "0.5541335", "0.5535217", "0.5527956", "0.5526076", "0.55185956", "0.55054", "0.55025315", "0.5502186", "0.5500864", "0.54965305", "0.5493919" ]
0.0
-1
walks over the collection and returns true as soon as one element f(el) yields true
public<T> boolean containsAny(final Collection<T> collection, final Filter<T> filter ){ for(T t:query.getOrEmpty(collection)){ if(filter.applicable(t)){ return true; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean test(E element);", "public boolean forEach(I2ForEach<T> func)\n\t{\n\t\tfor (T e : this)\n\t\t{\n\t\t\tif (!func.ForEach(e))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "boolean hasNextElement();", "public boolean hasNextElement();", "@Override\n public boolean hasNext() {\n return nextElementSet || setNextElement();\n }", "public boolean next() {\n boolean result = true;\n try {\n element = iterator.next();\n } catch(NoSuchElementException ex) {\n result = false;\n }\n return result;\n }", "public boolean hasNext() {\n for (; pos < elem.length; pos++) {\n if (merges(elem[pos])) {\n elem[pos].setUsed();\n continue;\n }\n\n return true;\n }\n\n return false;\n }", "public boolean hasNext() {\n\t\t\treturn !elements.isEmpty();\n\t\t}", "@Override\n public boolean hasNext() {\n boolean result = false;\n if (checkCurrentIterator(this.currentIterator) && this.currentIterator.hasNext()) {\n return true;\n } else if (it.hasNext()) {\n this.currentIterator = getIterator(it);\n return this.hasNext();\n }\n return result;\n\n }", "public /* synthetic */ boolean hasNext() {\n return this.a.hasNext();\n }", "public boolean hasNext() {\r\n if (current + 1 >= elem.length) {\r\n current = 0;\r\n }\r\n return elem[current + 1] != null;\r\n }", "private boolean hasNext() {\n\t\treturn iterator != null;\n\t}", "static boolean elements(PsiBuilder b, int l) {\n if (!recursion_guard_(b, l, \"elements\")) return false;\n boolean r;\n Marker m = enter_section_(b);\n r = element(b, l + 1);\n r = r && elements_1(b, l + 1);\n r = r && elements_2(b, l + 1);\n exit_section_(b, m, null, r);\n return r;\n }", "@Override\n public boolean hasNext() {\n return(it.hasNext());\n }", "@Override\n public boolean hasNext() {\n if (wrapped == null) {\n return false;\n }\n failFast(this);\n return wrapped.hasNext();\n }", "public boolean hasNext()\n {\n return _iterator.hasNext();\n }", "boolean hasMatchedElements();", "public boolean hasNext() {\n return wrappedIterator.hasNext();\n }", "public boolean hasNext()\r\n {\r\n if(e.get(index+1) == null)\r\n return false;\r\n else\r\n return true;\r\n }", "@Override\n\t\tpublic boolean hasNext() {\t\t\t\n\t\t\treturn current != null;\n\t\t}", "static boolean E() {\n int save = next;\n if (E1()) return true;\n next = save; if (E2()) return true;\n next = save; if (E3()) return true;\n next = save; if (E4()) return true;\n next = save;\n return false;\n }", "public abstract Iter<Boolean> search(T element);", "@Override\n public boolean hasNext() {\n setCurrent();\n return current != null;\n }", "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 }", "public boolean hasNext()\n\t{\n\t\treturn (curr<vector.size());\n\t}", "@Override\n public boolean hasNext() {\n return iter.hasNext();\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 }", "boolean hasElement();", "@Override\n public boolean hasNext() {\n return j < size; // size is field of outer instance\n }", "default boolean every( Predicate<V> predicate ) {\n if ( ((Tensor<V>)this).isVirtual() ) return predicate.test( this.item() );\n return stream().allMatch(predicate);\n }", "public boolean hasNext() {\n\t\t\twhile(outerListIter.hasNext() && ! innerListIter.hasNext()) {\n\t\t\t\tinnerList = outerListIter.next();\n\t\t\t\tinnerListIter = innerList.iterator();\n\t\t\t}\n\t\t\treturn innerListIter.hasNext();\n\t\t}", "@Override\r\n\tpublic boolean hasMoreElements() {\n\t\treturn it.hasNext();\r\n\t}", "@Override\n\t\tpublic boolean hasNext() {\n\t\t\treturn nextIndex() >= 0;\n\t\t}", "public boolean hasNext(){\n if(index < size && listI.get(index) != null){\n return true;\n }\n return false;\n }", "public boolean hasMoreElements() {\n/* 64 */ return this.iterator.hasNext();\n/* */ }", "@Override\n\t\tpublic boolean hasNext() {\n\t\t\treturn (this.next != null);\n\t\t}", "public static Boolean foreach(FeatureNode fn, FeatureNodeCallback cb)\n\t{\n\t\tif (fn == null) return false;\n\n\t\tBoolean stop = cb.FNCallback(fn);\n\t\tif (stop) return stop;\n\n\t\tfn = fn.get(\"phr-head\");\n\t\twhile (fn != null)\n\t\t{\n\t\t\tFeatureNode subf = fn.get(\"phr-head\");\n\t\t\tif (subf != null) {\n\t\t\t\tstop = foreach(fn, cb);\n\t\t\t\tif (stop) return stop;\n\t\t\t}\n\t\t\tfn = fn.get(\"phr-next\");\n\t\t}\n\t\treturn false;\n\t}", "@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 }", "@Override\n\t\tpublic boolean hasNext() {\n\t\t\treturn i > 0;\n\t\t}", "@Override\n\tpublic boolean hasNext() {\n\t return current != null;\n\t}", "@Override\r\n\t\tpublic boolean hasNext() {\n\t\t\treturn current!=null;\r\n\t\t}", "public boolean hasNext() {\n return curr.hasNext();\n }", "public boolean hasNext() {\n return curr.hasNext();\n }", "@Override\n public boolean hasNext()\n {\n Node testNode = getNth(idx);\n if(testNode.getElement() == null)\n {\n return false;\n }\n else\n {\n return true;\n }\n }", "public boolean hasNext(){\n return (index < nElem);\n }", "public boolean hasNext(){\n if(index < size && listR.get(index) != null){\n return true;\n }\n return false;\n }", "public boolean hasNext() { return (current != null && current.item != null); }", "boolean accepts(T element);", "Boolean forAll(Predicate<X> p);", "@Test\n public void hasNextTrueTest() {\n this.it.next();\n this.it.next();\n this.it.hasNext();\n assertThat(true, is(this.it.hasNext()));\n }", "public boolean hasNext() {\n return (itrCounter < size());\n }", "@Override\n public boolean hasNext() {\n return (nextItem != null);\n }", "@Override\n public boolean hasNext() {\n return next != null;\n }", "@Override\r\n\t\tpublic boolean hasNext() {\r\n\t\t\tif (first.next == null) {\r\n\t\t\t\treturn false;\r\n\t\t\t} else\r\n\t\t\t\treturn true;\r\n\t\t}", "default boolean any( Predicate<V> predicate ) {\n if ( ((Tensor<V>)this).isVirtual() ) return predicate.test( this.item() );\n return stream().anyMatch(predicate);\n }", "boolean isElement(Object object);", "@Override\n public boolean hasNext() {\n return null != current;\n }", "public boolean hasNext()\n {\n \n if(index < size() && arrayList.get(index) != null)\n return true;\n else\n return false; \n }", "public boolean hasNext()\n {\n\treturn current != null; \n }", "public boolean moreToIterate() {\r\n\t\treturn curr != null;\r\n\t}", "public boolean process(ElementListener listener) {\n try {\n for (Iterator i = iterator(); i.hasNext(); ) {\n listener.add((Element) i.next());\n }\n return true;\n }\n catch(DocumentException de) {\n return false;\n }\n }", "public boolean hasNext() {\r\n\t\t\trequireModificationCountUnchanged();\r\n\r\n\t\t\treturn nextEntry != null;\r\n\t\t}", "public boolean test() {\r\n\t\treturn (hit() == size);\r\n\t}", "@Override\n public boolean hasNext() {\n // Made into a `while` loop to fix issue reported by @Nim\n // In a while loop because we may find an entry with 'null' in it and we don't want that.\n while (next == null && stop > 0) {\n // Scan to the next non-free node.\n while (stop > 0 && it.free.get() == true) {\n it = it.next;\n // Step down 1.\n stop -= 1;\n }\n if (stop > 0) {\n next = it.element;\n }\n }\n return next != null;\n }", "@Override\n public boolean hasNext() {\n return this.nextObject != null;\n }", "public boolean hasNext()\r\n {\r\n return (next != null);\r\n }", "@Override\n public boolean hasNext() {\n // If there is a valid next, return true\n if (this.next != null){\n return true;\n } else {\n // If next is not calculated, compute the next valid\n Node<S> next = popNextUnvisitedNode();\n this.next = next;\n return next != null;\n }\n }", "default boolean hasChildren() {\n return iterator().hasNext();\n }", "public boolean hasNext() { \n\t\t\t\n\t\t\tif ( collection.size() <= 0 ) \n\t\t\t{\t\n\t\t\t\treturn false; \n\t\t\t}\n\t\t\tif ( currIndex == (collection.size() - 1)) \n\t\t\t{\t\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}", "public boolean hasNext() {\n\t\treturn actual!=null;\t\t\n\t}", "@Override\r\n\t\tpublic boolean hasNext() {\n\t\t\treturn nextNode != null;\r\n\t\t}", "@Override\n public boolean hasNext() {\n return currentIterator != null;\n }", "public boolean hasNext() {\n return !lov.isEmpty();\n }", "public boolean hasNext() {\n return !lov.isEmpty();\n }", "public boolean hasNextInSet() {\n return (hasNext() &&\n (indexOfCurrentElement + 1 < firstIndexOfCurrentSet + quantity) &&\n (indexOfCurrentElement + 1 >= firstIndexOfCurrentSet)); \n }", "@Override\n\t\tpublic boolean hasNext() {\n\t\t\treturn nextNode != null;\n\t\t}", "public boolean e()\r\n/* 50: */ {\r\n/* 51:102 */ return this.a.size() > 45;\r\n/* 52: */ }", "boolean hasE();", "boolean hasE();", "public boolean hasNext() {\r\n return true;\r\n }", "boolean hasNext();", "boolean hasNext();", "boolean hasNext();", "boolean hasNext();", "boolean hasNext();", "@Override\n public boolean hasNext() {\n return itListCell != first;\n }", "public boolean elementDirect(Element elem) {\r\n\r\n boolean test = false;\r\n\r\n for (int i = 0; i < element.size(); i++) {\r\n if (element.get(i).getNom().equals(elem.getNom())) {\r\n test = true;\r\n }\r\n }\r\n return test;\r\n }", "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 }", "public boolean hasNext() {\n\t\t\tif (index < numberOfElements)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}", "public boolean hasNext() {\r\n\t\treturn curr != null;\r\n\t}", "@Override\r\n\t\tpublic boolean hasNext() {\r\n\t\t\t\r\n\t\t\treturn currentNode.nextNode != null;\r\n\t\t}", "public boolean hasNext()\r\n/* 30: */ {\r\n/* 31:36 */ return this.nextResult != null;\r\n/* 32: */ }", "public boolean hasNext() {\n\t\t\treturn current != null;\r\n\t\t}", "public abstract boolean hasNext();", "public abstract boolean hasNext();", "public boolean hasNextElement() {\n return resultsEnumeration.hasMoreElements();\n }", "public boolean hasNext() {\n return this.next != null;\n }", "public boolean hasNext();", "public boolean hasNext();", "public boolean hasNext();", "public boolean hasNext();" ]
[ "0.6526855", "0.6521194", "0.6462387", "0.6348891", "0.6262858", "0.62214154", "0.6204558", "0.61589825", "0.6124434", "0.60936713", "0.60754395", "0.6065864", "0.6053157", "0.59866786", "0.59834117", "0.59804314", "0.5964179", "0.5947316", "0.59401", "0.5933288", "0.59248537", "0.5918111", "0.5909103", "0.59051126", "0.59048545", "0.59027904", "0.587687", "0.5871289", "0.58507013", "0.5848715", "0.58478856", "0.58246887", "0.58166826", "0.5815598", "0.5812782", "0.58123654", "0.58098", "0.5799704", "0.5797574", "0.57918155", "0.5771639", "0.5751999", "0.5751999", "0.57473147", "0.5741747", "0.5739829", "0.573795", "0.5727887", "0.57208616", "0.571228", "0.57094204", "0.5707647", "0.5700518", "0.56990707", "0.56952846", "0.56949764", "0.56728446", "0.5664551", "0.56555766", "0.5653929", "0.56528014", "0.56508684", "0.5650126", "0.5646647", "0.56411403", "0.5640843", "0.5639191", "0.56361824", "0.5631352", "0.56312305", "0.5625542", "0.56249344", "0.5624163", "0.5624163", "0.56161344", "0.5608686", "0.56083494", "0.5603619", "0.5603619", "0.5595732", "0.5595262", "0.5595262", "0.5595262", "0.5595262", "0.5595262", "0.55911404", "0.5590599", "0.55893403", "0.5586554", "0.5580074", "0.5577391", "0.55682206", "0.5564703", "0.5564184", "0.5564184", "0.55640197", "0.55518365", "0.55512464", "0.55512464", "0.55512464", "0.55512464" ]
0.0
-1
walks over the collection and returns false as soon as one element f(el) yields false
public<T> boolean containsOnly(final Collection<T> collection, final Filter<T> filter ){ for(T t:query.getOrEmpty(collection)){ if(!filter.applicable(t)){ return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean test(E element);", "boolean hasNextElement();", "public boolean forEach(I2ForEach<T> func)\n\t{\n\t\tfor (T e : this)\n\t\t{\n\t\t\tif (!func.ForEach(e))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "@Override\n public boolean hasNext() {\n return nextElementSet || setNextElement();\n }", "public boolean hasNextElement();", "public boolean next() {\n boolean result = true;\n try {\n element = iterator.next();\n } catch(NoSuchElementException ex) {\n result = false;\n }\n return result;\n }", "public boolean hasNext() {\n\t\t\treturn !elements.isEmpty();\n\t\t}", "public boolean hasNext() {\n for (; pos < elem.length; pos++) {\n if (merges(elem[pos])) {\n elem[pos].setUsed();\n continue;\n }\n\n return true;\n }\n\n return false;\n }", "private boolean hasNext() {\n\t\treturn iterator != null;\n\t}", "@Override\n public boolean hasNext() {\n if (wrapped == null) {\n return false;\n }\n failFast(this);\n return wrapped.hasNext();\n }", "public boolean hasNext()\r\n {\r\n if(e.get(index+1) == null)\r\n return false;\r\n else\r\n return true;\r\n }", "public boolean hasNext() {\r\n if (current + 1 >= elem.length) {\r\n current = 0;\r\n }\r\n return elem[current + 1] != null;\r\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 }", "static boolean elements(PsiBuilder b, int l) {\n if (!recursion_guard_(b, l, \"elements\")) return false;\n boolean r;\n Marker m = enter_section_(b);\n r = element(b, l + 1);\n r = r && elements_1(b, l + 1);\n r = r && elements_2(b, l + 1);\n exit_section_(b, m, null, r);\n return r;\n }", "@Override\n public boolean hasNext()\n {\n Node testNode = getNth(idx);\n if(testNode.getElement() == null)\n {\n return false;\n }\n else\n {\n return true;\n }\n }", "public /* synthetic */ boolean hasNext() {\n return this.a.hasNext();\n }", "@Override\n\t\tpublic boolean hasNext() {\t\t\t\n\t\t\treturn current != null;\n\t\t}", "static boolean E() {\n int save = next;\n if (E1()) return true;\n next = save; if (E2()) return true;\n next = save; if (E3()) return true;\n next = save; if (E4()) return true;\n next = save;\n return false;\n }", "@Override\n public boolean hasNext() {\n return(it.hasNext());\n }", "@Override\n public boolean hasNext() {\n boolean result = false;\n if (checkCurrentIterator(this.currentIterator) && this.currentIterator.hasNext()) {\n return true;\n } else if (it.hasNext()) {\n this.currentIterator = getIterator(it);\n return this.hasNext();\n }\n return result;\n\n }", "public boolean hasMoreElements() {\n/* 64 */ return this.iterator.hasNext();\n/* */ }", "public boolean hasNext(){\n return (index < nElem);\n }", "@Override\n public boolean hasNext() {\n return itListCell != first;\n }", "boolean hasElement();", "@Override\n public boolean hasNext() {\n return j < size; // size is field of outer instance\n }", "@Override\n public boolean hasNext() {\n return iter.hasNext();\n }", "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 }", "public abstract Iter<Boolean> search(T element);", "@Override\r\n\tpublic boolean hasMoreElements() {\n\t\treturn it.hasNext();\r\n\t}", "@Override\n public boolean hasNext() {\n setCurrent();\n return current != null;\n }", "public boolean hasNext()\n {\n return _iterator.hasNext();\n }", "public boolean\nmatches( SoElement element)\n{\n//#ifdef DEBUG\n SoDebugError.post(\"SoLazyElement.matches\", \n \"Should never be called\\n\");\n//#endif\n return true;\n}", "@Override\n public boolean hasNext() {\n return null != current;\n }", "@Override\n\t\tpublic boolean hasNext() {\n\t\t\treturn (this.next != null);\n\t\t}", "@Override\n\tpublic boolean hasNext() {\n\t return current != null;\n\t}", "@Override\n public boolean hasNext() {\n return next != null;\n }", "@Override\n\t\tpublic boolean hasNext() {\n\t\t\treturn i > 0;\n\t\t}", "public boolean e()\r\n/* 50: */ {\r\n/* 51:102 */ return this.a.size() > 45;\r\n/* 52: */ }", "@Override\n\t\tpublic boolean hasNext() {\n\t\t\treturn nextIndex() >= 0;\n\t\t}", "@Test\n public void hasNextFalseTest() {\n this.it.next();\n this.it.next();\n this.it.next();\n this.it.next();\n this.it.hasNext();\n this.it.hasNext();\n assertThat(false, is(this.it.hasNext()));\n }", "public boolean hasNext() { \n\t\t\t\n\t\t\tif ( collection.size() <= 0 ) \n\t\t\t{\t\n\t\t\t\treturn false; \n\t\t\t}\n\t\t\tif ( currIndex == (collection.size() - 1)) \n\t\t\t{\t\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}", "@Override\n public boolean hasNext() {\n return (nextItem != null);\n }", "public boolean hasNext() {\n return nodeIndex != iterN;\n }", "public boolean hasNext(){\n if(index < size && listI.get(index) != null){\n return true;\n }\n return false;\n }", "public boolean hasNext() {\n\t\treturn actual!=null;\t\t\n\t}", "default boolean hasChildren() {\n return iterator().hasNext();\n }", "@Override\r\n\t\tpublic boolean hasNext() {\n\t\t\treturn current!=null;\r\n\t\t}", "public boolean hasNext()\n\t{\n\t\treturn (curr<vector.size());\n\t}", "public boolean hasNext(){\n if(index < size && listR.get(index) != null){\n return true;\n }\n return false;\n }", "public boolean hasNext() {\n return wrappedIterator.hasNext();\n }", "boolean hasNext() {\n return !next.isSentinel();\n }", "@Override\n\tpublic boolean hasNext() {\n\t\treturn false;\n\t}", "boolean hasE();", "boolean hasE();", "@Override\n public boolean hasNext() {\n // Made into a `while` loop to fix issue reported by @Nim\n // In a while loop because we may find an entry with 'null' in it and we don't want that.\n while (next == null && stop > 0) {\n // Scan to the next non-free node.\n while (stop > 0 && it.free.get() == true) {\n it = it.next;\n // Step down 1.\n stop -= 1;\n }\n if (stop > 0) {\n next = it.element;\n }\n }\n return next != null;\n }", "public boolean hasNext() { return (current != null && current.item != null); }", "boolean isElement(Object object);", "public boolean elementDirect(Element elem) {\r\n\r\n boolean test = false;\r\n\r\n for (int i = 0; i < element.size(); i++) {\r\n if (element.get(i).getNom().equals(elem.getNom())) {\r\n test = true;\r\n }\r\n }\r\n return test;\r\n }", "boolean hasMatchedElements();", "@Override\n public boolean hasNext() {\n return (arreglo[i] != null) & arreglo.length > i ;\n }", "public boolean moreToIterate() {\r\n\t\treturn curr != null;\r\n\t}", "@Override\r\n\t\tpublic boolean hasNext() {\r\n\t\t\tif (first.next == null) {\r\n\t\t\t\treturn false;\r\n\t\t\t} else\r\n\t\t\t\treturn true;\r\n\t\t}", "public boolean member(D elt) {\n\treturn false;\n }", "@Override\n public boolean hasNext() {\n // If there is a valid next, return true\n if (this.next != null){\n return true;\n } else {\n // If next is not calculated, compute the next valid\n Node<S> next = popNextUnvisitedNode();\n this.next = next;\n return next != null;\n }\n }", "public boolean hasNext() {\n if (this.index < nElem)\n return true;\n else{\n this.index--;\n return false;\n }\n }", "@Override\r\n\t\tpublic boolean hasNext() {\n\t\t\treturn false;\r\n\t\t}", "@Override\n public boolean hasNext(){\n try{\n return this.notNone();\n } catch(IOException e){\n return false;\n }\n }", "public boolean hasNext()\r\n/* 30: */ {\r\n/* 31:36 */ return this.nextResult != null;\r\n/* 32: */ }", "public boolean hasNext()\n {\n\treturn current != null; \n }", "@Override\n\tpublic boolean hasNext() throws IOException, CollectionException {\n\t\treturn idx < docElements.size();\n\t}", "@Override\n public boolean hasNext() {\n return currentIterator != null;\n }", "@Override\n\t\tpublic boolean hasNext() {\n\t\t\treturn false;\n\t\t}", "public boolean hasNext(){\r\n\t\t\tif (expectedModCount != modCount){\r\n\t\t\t\tthrow new ConcurrentModificationException();\r\n\t\t\t}\r\n\t\t\t//Check this condition, may need to check for empty future nodes\r\n\t\t\tif ((current == null)){//&&(currentNode.getLast()==current)){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t\t//current is not endmarker, \r\n\t\t\t\r\n\t\t\t/*if ((currentNode.getLast()!=current))\r\n\t\t\t\treturn true;\r\n\t\t\tif (currentNode.next.getArraySize()!= 0)\r\n\t\t\t\treturn true;\r\n\t\t\treturn false;*/\r\n\t\t}", "default boolean every( Predicate<V> predicate ) {\n if ( ((Tensor<V>)this).isVirtual() ) return predicate.test( this.item() );\n return stream().allMatch(predicate);\n }", "boolean accepts(T element);", "public boolean hasNext()\n/* */ {\n/* 82 */ return this.m_offset < this.m_array.length;\n/* */ }", "public boolean hasNext() {\n return (itrCounter < size());\n }", "public boolean hasNext() {\n\t\t\twhile(outerListIter.hasNext() && ! innerListIter.hasNext()) {\n\t\t\t\tinnerList = outerListIter.next();\n\t\t\t\tinnerListIter = innerList.iterator();\n\t\t\t}\n\t\t\treturn innerListIter.hasNext();\n\t\t}", "@Override\r\n\t\tpublic boolean hasNext() {\n\t\t\treturn nextNode != null;\r\n\t\t}", "public boolean hasNextElement() {\n return resultsEnumeration.hasMoreElements();\n }", "@Override\n public boolean hasNext() {\n return this.nextObject != null;\n }", "public boolean hasNext() {\n return !lov.isEmpty();\n }", "public boolean hasNext() {\n return !lov.isEmpty();\n }", "@Test\n public void hasNextTrueTest() {\n this.it.next();\n this.it.next();\n this.it.hasNext();\n assertThat(true, is(this.it.hasNext()));\n }", "public boolean hasNext() {\n return curr.hasNext();\n }", "public boolean hasNext() {\n return curr.hasNext();\n }", "public boolean hasNext()\r\n {\r\n return (next != null);\r\n }", "public boolean match( ElementExp p ) { return false; }", "@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 }", "public boolean hasNext() {\r\n\t\t\trequireModificationCountUnchanged();\r\n\r\n\t\t\treturn nextEntry != null;\r\n\t\t}", "@Override\n\tpublic boolean okToTraverse(Level3Element ele)\n\t{\n\t\treturn !ubiqueIDs.contains(ele.getUri());\n\t}", "@Override\n public boolean hasNext() {\n \n if (iter != null && iter.hasNext()) {\n return true;\n }\n do {\n index++;\n if (index >= table.length) {\n return false;\n }\n } while (table[index] == null);\n iter = table[index].iterator();\n return iter.hasNext();\n }", "@Override public boolean hasNext() {\n return !pila.esVacia();\n }", "@Override\n\t\tpublic boolean hasNext() {\n\t\t\treturn nextNode != null;\n\t\t}", "public boolean canAdd() {\r\n int temp = 0;\r\n for (int i = 0; i < elem.length; i++) {\r\n if (elem[i] == null) {\r\n temp++;\r\n }\r\n }\r\n if (temp > 1) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "public static boolean element(PsiBuilder b, int l) {\n if (!recursion_guard_(b, l, \"element\")) return false;\n boolean r;\n Marker m = enter_section_(b, l, _NONE_, ELEMENT, \"<element>\");\n r = spreadElement(b, l + 1);\n if (!r) r = ifElement(b, l + 1);\n if (!r) r = forElement(b, l + 1);\n if (!r) r = mapEntry(b, l + 1);\n if (!r) r = expression(b, l + 1);\n exit_section_(b, l, m, r, false, null);\n return r;\n }", "@Override public boolean hasNext() {\n return !pila.esVacio();\n }", "@Override\n\tpublic boolean contains(E e) {\n\t\treturn false;\n\t}", "@Override\r\n\tpublic boolean buscar(T elemento) {\n\t\treturn false;\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 }", "@Override\n public boolean hasNext() {\n return nextNode != null;\n }" ]
[ "0.66523063", "0.64263594", "0.6358613", "0.6298121", "0.6264511", "0.61871165", "0.61639893", "0.61605036", "0.60718364", "0.6031444", "0.6003466", "0.6001168", "0.5980916", "0.5980413", "0.59759855", "0.595482", "0.59438866", "0.5931857", "0.5917368", "0.5913871", "0.59024024", "0.58963954", "0.5891427", "0.5889639", "0.5880781", "0.58697987", "0.5867886", "0.5863134", "0.58562475", "0.5845204", "0.5833432", "0.5827029", "0.58207", "0.58192223", "0.5813849", "0.5811762", "0.5803611", "0.57988626", "0.57874906", "0.5785653", "0.577693", "0.5776921", "0.5773386", "0.5769766", "0.5766451", "0.5765392", "0.57632464", "0.57567674", "0.57426965", "0.5739946", "0.5723525", "0.5714554", "0.57116115", "0.57116115", "0.57111716", "0.5705991", "0.5704989", "0.57012117", "0.5701065", "0.5700411", "0.56910187", "0.56852853", "0.5682651", "0.5679928", "0.5676861", "0.56722784", "0.56670594", "0.5653508", "0.5650354", "0.565024", "0.5641201", "0.56390566", "0.5622512", "0.5618111", "0.561366", "0.5613105", "0.5607972", "0.56042624", "0.56014544", "0.5599768", "0.55978", "0.55975705", "0.55975705", "0.5595614", "0.55939186", "0.55939186", "0.5588506", "0.55884653", "0.55826926", "0.55818206", "0.55815595", "0.55797386", "0.5576109", "0.55743057", "0.5569068", "0.5567613", "0.55596834", "0.5558016", "0.55532587", "0.5552003", "0.5551428" ]
0.0
-1
walks over the collection and adds the elements to the list until one filter(el) returns false;
public<T> List<T> takeWhile(final Collection<T> collection, final Filter<T> filter ){ List<T> result = create.createLinkedList(); for(T t:query.getOrEmpty(collection)){ if(!filter.applicable(t)){ return result; } result.add(t); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public List<Element> filter(Predicate<Element> p)\n\t{\n\t\treturn recursive_filter(new ArrayList<Element>(), p, group);\n\t}", "<E extends CtElement> List<E> getElements(Filter<E> filter);", "@Override\r\n public List<Element> findElements()\r\n {\n return null;\r\n }", "Collection<V> getAllElements();", "public static <T> Collection<T> extractElementsSuch(Collection<T> collection, Condition<T> condition) {\n \tCollection<T> ret = compatibleWith(collection);\n\n \tfor (T element : collection) {\n\t\t\tif(condition.isTrueFor(element)) ret.add(element);\n\t\t}\n \treturn ret;\n\t}", "private <T> List<T> filterList(Iterable<?> iterable, Class<T> clazz) {\n List<T> result = new ArrayList<>();\n for (Object object : iterable) {\n if (clazz.isInstance(object)) {\n @SuppressWarnings(\"unchecked\")\n // Checked using clazz.isInstance\n T tObject = (T) object;\n result.add(tObject);\n }\n }\n return result;\n }", "public static <T> List<T> filter(Predicate<? super T> p, Collection<T> c) {\r\n List<T> res = new ArrayList<>();\r\n\r\n for (T item : c) {\r\n if (p.apply(item)) {\r\n res.add(item);\r\n }\r\n }\r\n\r\n return res;\r\n }", "public static void main(String[] args) {\n\t\t\n\t\tList<Integer> list = new ArrayList<>();\n\t\tlist.add(1);\n\t\tlist.add(2);\n\t\tlist.add(3);\n\t\tlist.add(7);\n\t\t\n\t\tIterator<Integer> it = list.iterator();\n\t\t\n\t\twhile(it.hasNext()) {\n\t\t\tint element = it.next();\n\t\t\tSystem.out.println(\"element \"+element);\n\t\t\tif(element == 1) {\n\t\t\t\tit.remove();\n\t\t\t\tit.next();\n\t\t\t\tit.remove();\n\t\t\t\t//it.forEachRemaining(Filter::add);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t//System.out.println(\"list \"+list);\n\t\t\n\t\t//forEach\n\t//\tlist.forEach(System.out::println);\n\t\t//list.forEach(Filter::filter);\n\t//\tlist.forEach(new Filter());\n\t}", "private static List<Sticker> m33731b(Collection<Sticker> collection) {\n List<Sticker> arrayList = new ArrayList(collection.size());\n for (Sticker sticker : collection) {\n if (!sticker.isFriendmoji()) {\n arrayList.add(sticker);\n }\n }\n return arrayList;\n }", "public static void ignoreElements() {\n Observable.fromIterable(Utils.getData())\n .ignoreElements()\n .subscribe(new MyCompletableObserver());\n }", "@Override\n\tpublic boolean addAll(Collection<? extends T> elements) {\n\t\tif ((elements == null) || (elements.size() == 0))\n\t\t\treturn false;\n\t\tboolean result = false;\n\t\tdouble prob = 1.0 / elements.size();\n\t\tfor (T item : elements) {\n\t\t\tresult = result | add(item, prob);\n\t\t}\n\t\treturn result;\n\t}", "private void findHiElements(ArrayList p_result, Element p_element)\n {\n for (int i = 0, max = p_element.nodeCount(); i < max; i++)\n {\n Node child = (Node)p_element.node(i);\n\n if (child instanceof Element)\n {\n findHiElements(p_result, (Element)child);\n }\n }\n\n if (p_element.getName().equals(\"hi\"))\n {\n p_result.add(p_element);\n }\n }", "public void filterByMyDisplayAll(){\n // add them into the new list\n for (int i = 0; i < moodListBeforeFilterMy.getCount(); i++ ){\n moodListAfterFilter.add(moodListBeforeFilterMy.getMoodEvent(i));\n }\n }", "public interface Collection2<T> extends Collection {\n default void forEachId(Consumer<T> action, Predicate<T> filter) {\n Objects.requireNonNull(filter);\n final Iterator<T> each = iterator();\n while (each.hasNext()) {\n T element = each.next();\n if (filter.test(element)) {\n action.accept(element);\n }\n }\n }\n}", "final <E, T extends Collection<E>> T filter(\n Class<?>[] arr, Class<?> from, T c, int type, T prototype\n ) {\n T ret = null;\n\n\n// optimistic strategy expecting we will not need to filter\nTWICE: \n for (;;) {\n Iterator<E> it = c.iterator();\nBIG: \n while (it.hasNext()) {\n E res = it.next();\n\n if (!isObjectAccessible(arr, from, res, type)) {\n if (ret == null) {\n // we need to restart the scanning again \n // as there is an active filter\n ret = prototype;\n continue TWICE;\n }\n\n continue BIG;\n }\n\n if (ret != null) {\n // if we are running the second round from TWICE\n ret.add(res);\n }\n }\n\n // ok, processed\n break TWICE;\n }\n\n return (ret != null) ? ret : c;\n }", "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 List<Element> listElements() {\r\n List<Element> result = new ArrayList<>(numElements);\r\n for (Entry<Fitness, List<Element>> entry\r\n : elementsByFitness.descendingMap().entrySet()) {\r\n List<Element> list = entry.getValue();\r\n assert !list.isEmpty();\r\n result.addAll(list);\r\n }\r\n\r\n return result;\r\n }", "public XmlProtoElementBuilder removeChildrenElementsIf(Predicate<XmlProtoNodeBuilder> filter) {\n ImmutableList<XmlNode> keptChildren =\n getChildren()\n .filter(filter.negate())\n .map(builder -> builder.build().getProto())\n .collect(toImmutableList());\n if (getProtoChildrenList().size() != keptChildren.size()) {\n element.clearChild().addAllChild(keptChildren);\n }\n return this;\n }", "@Override\n protected void publishResults(CharSequence constraint, FilterResults results) {\n @SuppressWarnings(\"unchecked\")\n ArrayList<Exercice> filteredList = (ArrayList<Exercice>) results.values;\n if(results.count > 0) {\n clear();\n for (Exercice e : filteredList) {\n add(e);\n }\n notifyDataSetChanged();\n }\n }", "public static void main(String[] args) {\n String[] animals = {\"Cat\", \"Dog\", \"Dog\", \"Bird\", \"Fish\", \"Cat\"};\n\n ArrayList<String> animalsList = new ArrayList<>(Arrays.asList(animals));\n System.out.println(animalsList);\n\n /*\n Remove Cat elements and print your ArrayList again\n\n EXPECTED RESULT:\n [Dog, Bird, Fish]\n */\n\n System.out.println(\"\\n---Removing-Cat-1st way creating a new list---\\n\");\n ArrayList<String> animalsWithoutCats = new ArrayList<>(); // empty at this line\n\n for(String element: animalsList){\n if(!element.equalsIgnoreCase(\"cat\")) animalsWithoutCats.add(element);\n }\n\n System.out.println(\"List after removing cats = \" + animalsWithoutCats);\n\n\n System.out.println(\"\\n---Removing-Dog-2nd way using iterator---\\n\");\n\n Iterator<String> myIterator = animalsList.iterator();\n\n while(myIterator.hasNext()){\n if(myIterator.next().equalsIgnoreCase(\"dog\")) myIterator.remove();\n }\n\n System.out.println(\"List after removing dogs = \" + animalsList);\n }", "@Override // java.util.Collection, java.util.Set\r\n public boolean addAll(Collection<? extends E> collection) {\r\n b(this.f513d + collection.size());\r\n boolean added = false;\r\n Iterator<? extends E> it = collection.iterator();\r\n while (it.hasNext()) {\r\n added |= add(it.next());\r\n }\r\n return added;\r\n }", "public void removeAll(Object element);", "@Override\n public boolean addAll(Collection<? extends E> c) {\n boolean result = true;\n for (E current : c) {\n result &= add(current);\n }\n return result;\n }", "ObservableList<Link> getUnfilteredLinkList();", "public synchronized void processAll()\r\n {\r\n if (!myItems.isEmpty())\r\n {\r\n myProcessor.accept(New.list(myItems));\r\n myItems.clear();\r\n }\r\n }", "public void filterByFoDisplayAll(){\n // add them into the new list\n for (int i = 0; i < moodListBeforeFilterFo.getCount(); i++ ){\n moodListAfterFilter.add(moodListBeforeFilterFo.getMoodEvent(i));\n }\n }", "void consume(List<E> elements) throws Exception;", "List<T> collect();", "@CanIgnoreReturnValue\n public static <T> boolean addAll(Collection<T> collection, Iterator<? extends T> it) {\n Preconditions.checkNotNull(collection);\n Preconditions.checkNotNull(it);\n boolean z = false;\n while (it.hasNext()) {\n z |= collection.add(it.next());\n }\n return z;\n }", "boolean addAll(Collection<? extends E> c);", "public ArrayList<Element> listeElementsDansEspaces(final Set<String> espaces) {\n return(new ArrayList<Element>());\n }", "private ImmutableSetMultimap<TypeElement, Element> validElements(RoundEnvironment roundEnv) {\n ImmutableSet<ElementName> prevDeferredElementNames = ImmutableSet.copyOf(deferredElementNames);\n deferredElementNames.clear();\n\n ImmutableSetMultimap.Builder<TypeElement, Element> deferredElementsByAnnotationBuilder =\n ImmutableSetMultimap.builder();\n for (ElementName deferredElementName : prevDeferredElementNames) {\n Optional<? extends Element> deferredElement = deferredElementName.getElement(elements);\n if (deferredElement.isPresent()) {\n findAnnotatedElements(\n deferredElement.get(),\n getSupportedAnnotationTypeElements(),\n deferredElementsByAnnotationBuilder);\n } else {\n deferredElementNames.add(deferredElementName);\n }\n }\n\n ImmutableSetMultimap<TypeElement, Element> deferredElementsByAnnotation =\n deferredElementsByAnnotationBuilder.build();\n\n ImmutableSetMultimap.Builder<TypeElement, Element> validElements =\n ImmutableSetMultimap.builder();\n\n Set<ElementName> validElementNames = new LinkedHashSet<>();\n\n // Look at the elements we've found and the new elements from this round and validate them.\n for (TypeElement annotationType : getSupportedAnnotationTypeElements()) {\n Set<? extends Element> roundElements = roundEnv.getElementsAnnotatedWith(annotationType);\n ImmutableSet<Element> prevRoundElements = deferredElementsByAnnotation.get(annotationType);\n for (Element element : Sets.union(roundElements, prevRoundElements)) {\n ElementName elementName = ElementName.forAnnotatedElement(element);\n boolean isValidElement =\n validElementNames.contains(elementName)\n || (!deferredElementNames.contains(elementName)\n && validateElement(\n element.getKind().equals(PACKAGE) ? element : getEnclosingType(element)));\n if (isValidElement) {\n validElements.put(annotationType, element);\n validElementNames.add(elementName);\n } else {\n deferredElementNames.add(elementName);\n }\n }\n }\n\n return validElements.build();\n }", "@Override\n public boolean hasNext() {\n return nextElementSet || setNextElement();\n }", "@Override\n public boolean hasNext() {\n return(it.hasNext());\n }", "@Override\n public synchronized Enumeration elements() {\n if ((System.currentTimeMillis() - this.lastCheck) > this.CACHE_TIME) {\n update();\n }\n return super.elements();\n }", "private void collectAllElements(List<Node<E>> list) {\n list.add(root);\n for (int i = 0; i < list.size(); i++) {\n if (list.get(i).children != null) {\n list.addAll(list.get(i).children);\n }\n }\n }", "private void findSubElements(ArrayList p_result, Element p_element)\n {\n for (int i = 0, max = p_element.nodeCount(); i < max; i++)\n {\n Node child = (Node)p_element.node(i);\n\n if (child instanceof Element)\n {\n findSubElements(p_result, (Element)child);\n }\n }\n\n if (p_element.getName().equals(\"sub\"))\n {\n p_result.add(p_element);\n }\n }", "public boolean hasNext() {\n\t\t\treturn !elements.isEmpty();\n\t\t}", "@Override\n public boolean addAll(final Collection<? extends T> collection) {\n this.checkCollectionNotNull(collection);\n final Iterator<? extends T> iterator = collection.iterator();\n\n while (iterator.hasNext()) {\n this.add(iterator.next());\n }\n\n return collection.size() != 0;\n }", "public JodeList search(Predicate<Jode> filter) {\n List<Node> ret = new ArrayList<>();\n if (filter.test(this)) {\n ret.add(this.extend());\n }\n for (Jode j : this.children()) {\n JodeList subResult = j.search(filter);\n for (Jode subJ : subResult) {\n ret.add(subJ.extend());\n }\n }\n return new JodeList(ret);\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 }", "@Override\n\tpublic Iterator<WebElement> iterator() {\n\t\treturn this.elements.iterator();\n\t}", "private static <T> void cloneCollection(Collection<T> originalCollection, Collection<T> clonedCollection, PropertyFilter propertyFilter) {\n\t\tJpaCloner jpaCloner = new JpaCloner(propertyFilter);\n\t\tSet<Object> exploredEntities = new HashSet<Object>();\n\t\tfor (T root : originalCollection) {\n\t\t\tclonedCollection.add(clone(root, jpaCloner, exploredEntities));\n\t\t}\n\t}", "void edgeFilter() {\n for (int i = 0; i < size(); i++) {\n Exp f = get(i);\n if (f.isFilter() && f.size() > 0 && f.get(0).type() == TEST\n && i >= 1 && get(i - 1).isEdge()) {\n Exp edge = get(i - 1);\n if (match(edge, f)) {\n edge.add(f);\n }\n }\n }\n }", "public ArrayList<Element> listeElementsHorsEspace(final String espace) {\n if (espace == null)\n return(new ArrayList<Element>());\n else\n return(listeTousElements());\n }", "public static List<Element> getElementsPreorder(Element elt) {\n List<Element> res = new ArrayList<>();\n res.add(elt);\n Node nod = elt.getFirstChild();\n while (nod != null) {\n if (nod.getNodeType() == Node.ELEMENT_NODE) {\n res.addAll(getElementsPreorder((Element) nod));\n }\n nod = nod.getNextSibling();\n }\n return res;\n }", "public ArrayList<T> getNonZeroOrderedElements() {\n\t\tArrayList<T> ordered = getOrderedElements();\n\t\tfor (Iterator<T> iter = ordered.iterator(); iter.hasNext();) {\n\t\t\tT element = iter.next();\n\t\t\tif (itemProbs_.get(element) == 0)\n\t\t\t\titer.remove();\n\t\t}\n\t\treturn ordered;\n\t}", "public Collection<P> getPoolableElements();", "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 }", "@Override\n\tpublic boolean addAll(Collection<? extends E> c) {\n\t\treturn false;\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 List allElements() {\r\n\t\tArrayList elems = new ArrayList();\r\n\t\tfor (int i = 0; i < elements.size(); ++i) {\r\n\t\t\tObject ob = elements.get(i);\r\n\t\t\tif (ob instanceof Operator) {\r\n\t\t\t} else if (ob instanceof FunctionDef) {\r\n\t\t\t\tExpression[] params = ((FunctionDef) ob).getParameters();\r\n\t\t\t\tfor (int n = 0; n < params.length; ++n) {\r\n\t\t\t\t\telems.addAll(params[n].allElements());\r\n\t\t\t\t}\r\n\t\t\t} else if (ob instanceof TObject) {\r\n\t\t\t\tTObject tob = (TObject) ob;\r\n\t\t\t\tif (tob.getTType() instanceof TArrayType) {\r\n\t\t\t\t\tExpression[] exp_list = (Expression[]) tob.getObject();\r\n\t\t\t\t\tfor (int n = 0; n < exp_list.length; ++n) {\r\n\t\t\t\t\t\telems.addAll(exp_list[n].allElements());\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\telems.add(ob);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\telems.add(ob);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn elems;\r\n\t}", "@Test\n public void testAddAll_Collection_Overflow() {\n SegmentedOasisList<Integer> instance = new SegmentedOasisList<>(2, 2);\n instance.add(3);\n instance.add(2);\n instance.add(2);\n\n Collection c = Arrays.asList(1, 2, 3);\n\n boolean expResult = true;\n boolean result = instance.addAll(c);\n assertEquals(expResult, result);\n\n }", "@Override\n public Iterator<E> iterator() {\n return new SimpleArrayListIterator<E>();\n }", "@Override\n public Iterator<E> iterator() {\n return new ElementIterator();\n }", "public Layer_ElementsCollection()\n\t{\n\t\tthis.elements = new ArrayList<GIS_element>();\n\t}", "public void filter(Filter filter) throws NoTestsRemainException {\n childrenLock.lock();\n try {\n List<T> children = new ArrayList<T>(getFilteredChildren());\n for (Iterator<T> iter = children.iterator(); iter.hasNext(); ) {\n T each = iter.next();\n if (shouldRun(filter, each)) {\n try {\n filter.apply(each);\n } catch (NoTestsRemainException e) {\n iter.remove();\n }\n } else {\n iter.remove();\n }\n }\n filteredChildren = Collections.unmodifiableCollection(children);\n if (filteredChildren.isEmpty()) {\n throw new NoTestsRemainException();\n }\n } finally {\n childrenLock.unlock();\n }\n }", "private static Iterator getAllElementsIterator(EventSource session, CollectionType collectionType, Object collection) {\n\t\treturn collectionType.getElementsIterator(collection, session);\n\t}", "public List<T> getCopyOfUnfilteredItemList(){\n synchronized (listsLock){\n if (originalList != null){\n return new ArrayList<T>(originalList);\n } else {\n // if original list is null filtered list is unfiltered\n return new ArrayList<T>(filteredList);\n }\n }\n }", "@SuppressWarnings(\"unchecked\")\n public static ImmutableList<Element> getEnclosedElements(Element element) {\n return (ImmutableList<Element>) enclosedBy(element).immutableSortedCopy(element.getEnclosedElements());\n }", "public void addNoCollisionElements(Collection<Particle> ps)\n {\n Iterator<Particle> p = ps.iterator();\n while (p.hasNext())\n {\n addNoCollisionElement(p.next());\n }\n }", "Iterable<? extends XomNode> elements();", "@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 }", "public boolean addAll(Collection<? extends Element> elements) {\n for (Element element : elements) {\n if (!add(element)) {\n return false;\n }\n }\n\n return true;\n }", "public static <T> ImmutableList<T> listAndElement(Collection<? extends T> coll, T elem) {\n return ImmutableList.<T>builderWithExpectedSize(coll.size() + 1).addAll(coll).add(elem).build();\n }", "@Test\n public void testRemoveAll_Overflow() {\n SegmentedOasisList<Integer> instance = new SegmentedOasisList<>(2, 2);\n instance.add(3);\n instance.add(2);\n instance.add(3);\n instance.add(2);\n instance.add(3);\n instance.add(2);\n\n Collection c = Arrays.asList(2, 3);\n boolean expectedResult = true;\n boolean result = instance.removeAll(c);\n\n assertEquals(expectedResult, result);\n\n }", "@Override\n public void reset() {\n iterator = collection.iterator();\n }", "Collection<T> getMinElements();", "@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 Iterator reachable() {\n Set s = SortedArraySet.FACTORY.makeSet(HashCodeComparator.INSTANCE);\n s.add(IdentityHashCodeWrapper.create(this));\n this.reachable(s);\n return new FilterIterator(s.iterator(), filter);\n }", "@Override\n public boolean retainAll(Collection<?> c) {\n Set<T> toRemove = new HashSet<>(elements);\n toRemove.removeAll(c);\n return removeAll(toRemove);\n }", "List<E> list(Predicate<E> predicate);", "public boolean hasNext() {\n for (; pos < elem.length; pos++) {\n if (merges(elem[pos])) {\n elem[pos].setUsed();\n continue;\n }\n\n return true;\n }\n\n return false;\n }", "default void addAllTo(Collection<? super E> collection) {\n // Accepting a Collection<? super E> allows us to add elements to\n // any collection that can hold E elements, including Collection<Object>.\n for (E element : this) {\n collection.add(element);\n }\n }", "public List<MaestroNote> collect(Predicate<? super MaestroNote> predicate) {\n logger.trace(\"Collecting messages\");\n\n final List<MaestroNote> ret = new ArrayList<>(collected.size());\n\n for (final MaestroNote note : collected) {\n if (predicate.test(note)) {\n collected.remove(note);\n ret.add(note);\n }\n }\n\n logger.trace(\"Number of messages collected: {}\", ret.size());\n return ret;\n }", "public Iterator iterator() {\n maintain();\n return new MyIterator(collection.iterator());\n }", "@Override\r\n\tpublic boolean hasMoreElements() {\n\t\treturn it.hasNext();\r\n\t}", "private List<Element> selectDiv(){\n\t\tElements allDiv = htmlParsed.select(\"div\");\n\t\treturn allDiv.stream().filter(div -> div.children().select(\"div\").isEmpty()).collect(Collectors.toList());\n\t}", "@Test\n public void whenAddElementToTreeThenIteratorReturnsSorted() {\n final List<Integer> resultList = Arrays.asList(4, 3, 6);\n final List<Integer> testList = new LinkedList<>();\n this.tree.add(4);\n this.tree.add(6);\n this.tree.add(3);\n\n Iterator<Integer> iterator = this.tree.iterator();\n testList.add(iterator.next());\n testList.add(iterator.next());\n testList.add(iterator.next());\n\n assertThat(testList, is(resultList));\n }", "public boolean addAll(Collection<? extends E> c) {\n\t\tfor(Iterator<? extends E> it = c.iterator(); it.hasNext();)\r\n\t\t\tadd((E)it.next());\r\n\t\treturn !c.isEmpty();\r\n\t}", "private static Set<ARGState> removeSet(Set<ARGState> elements) {\n Set<ARGState> toWaitlist = new LinkedHashSet<ARGState>();\n int i=0;\n for (ARGState ae : elements) {\n if(ae.getParents()!=null){\n for (ARGState parent : ae.getParents()) {\n if (!elements.contains(parent)) {\n toWaitlist.add(parent);\n }\n }\n if(ae.getChildren()!=null)\n ae.removeFromARG();\n else\n ae.setDestroyed(true);\n }\n\n // ae.setNull();\n }\n return toWaitlist;\n }", "public static <T> ImmutableList<T> elementAndList(T elem, Collection<? extends T> coll) {\n return ImmutableList.<T>builderWithExpectedSize(coll.size() + 1).add(elem).addAll(coll).build();\n }", "public static void cleanNonSerializables(Collection c) {\n\t\tIterator it = c.iterator();\n\t\twhile (it.hasNext()) {\n\t\t\tObject o = it.next();\n\t\t\t\n\t\t\tClass objClass = o.getClass();\n\t\t\tif (shouldRemove(o)) {\n\t\t\t\tit.remove();\n\t\t\t\tlogger.info(\"Remove obj: \" + o);\n\t\t\t}\n\t\t\t\n\t\t\t/*if (blackObjects.contains(o.getClass())) {\n\t\t\tit.remove();\n\t\t} else if (!attemptSerialization(o)) {\n\t\t\tblackObjects.add(o.getClass());\n\t\t\tlogger.info(\"Remove non-serializable obj: \" + o);\n\t\t\t\n\t\t\tit.remove();\n\t\t}*/\n\t\t}\n\t}", "private void btnFiltrareActionPerformed(java.awt.event.ActionEvent evt) { \n List<Contact> lista = (List<Contact>) listaContacte.stream().filter(Agenda.predicate).sorted(Agenda.map.get(Agenda.criteriu)).collect(Collectors.toList());\n model.clear();\n lista.forEach((o) -> {\n model.addElement(o);\n });\n }", "boolean doFilter() { return false; }", "public void iterateEventList();", "public Object[] filter(Viewer viewer, Object parent, Object[] elements) {\n Object[] result = null;\n if (getWorkingSet() != null) {\n\t\t\tcachedWorkingSet = getWorkingSet().getElements();\n\t\t}\n try {\n result = super.filter(viewer, parent, elements);\n } finally {\n cachedWorkingSet = null;\n }\n return result;\n }", "public synchronized Iterator<E> iteratorUpAll()\n {\n if (isEmpty())\n return new CNullIterator<E>();\n\n return new NodeIteratorUp<E>(this, this.m_FirstNode, this.m_LastNode.m_Element);\n }", "public ElementIterator(List l) {\n\t myList = l;\n\t }", "@Test\n public void testRemoveAll_Not_Empty_Overflow() {\n SegmentedOasisList<Integer> instance = new SegmentedOasisList<>(2, 2);\n instance.add(3);\n instance.add(2);\n instance.add(3);\n instance.add(2);\n instance.add(3);\n instance.add(1);\n instance.add(2);\n\n Collection c = Arrays.asList(2, 3);\n instance.removeAll(c);\n\n int expectedResult = 1;\n assertEquals(expectedResult, instance.size());\n\n }", "@NotNull\r\n default List<Object> getMatchingElements(@NotNull Condition c) {\r\n return new ArrayList<>();\r\n }", "protected void refreshFromImports() {\r\n\t\t\t\t\r\n\t\tList<?> elements = collectItemsFromImports();\t\t\t\t\r\n\t\t\t\t\r\n\t\tif (fFilteredList != null) {\r\n\t\t\tfFilteredList.setAllowDuplicates(showDuplicates);\r\n\t\t\tfFilteredList.setElements( contentProvider.getElements(elements) );\r\n\t\t\tfFilteredList.setEnabled(true);\t\t\r\n\t\t}\t\t\t\t\r\n\t}", "OIterator<V> before();", "private void filterAndSort()\n {\n filteredAndSortedElements = elements;\n\n // filter and sort, use Job if too much elements\n if ( configuration.getFilter().isFiltered() || configuration.getSorter().isSorted() )\n {\n if ( elements.length > BrowserUIPlugin.getDefault().getPreferenceStore()\n .getInt( BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SORT_FILTER_LIMIT )\n && mainWidget.getViewer() != null && !mainWidget.getViewer().getTable().isDisposed() )\n {\n // deactivate fitering and sorting for large data set\n // FilterAndSortRunnable runnable = new FilterAndSortRunnable( configuration, mainWidget, elements );\n // RunnableContextRunner.execute( runnable, null, true );\n // filteredAndSortedElements = runnable.getFilteredAndSortedElements();\n }\n else if ( elements.length > 0 && mainWidget.getViewer() != null\n && !mainWidget.getViewer().getTable().isDisposed() )\n {\n filteredAndSortedElements = configuration.getFilter().filter( mainWidget.getViewer(), \"\", elements ); //$NON-NLS-1$\n configuration.getSorter().sort( mainWidget.getViewer(), filteredAndSortedElements );\n }\n }\n\n // update virtual table\n mainWidget.getViewer().setItemCount( filteredAndSortedElements.length );\n\n // update state\n String url = \"\"; //$NON-NLS-1$\n boolean enabled = true;\n \n if ( input instanceof ISearch )\n {\n ISearch search = ( ISearch ) input;\n\n if ( filteredAndSortedElements.length < elements.length )\n {\n url += filteredAndSortedElements.length + Messages.getString( \"SearchResultEditorContentProvider.Of\" ); //$NON-NLS-1$\n }\n\n if ( search.getSearchResults() == null )\n {\n url += Messages.getString( \"SearchResultEditorContentProvider.SearchNotPerformed\" ); //$NON-NLS-1$\n enabled = false;\n }\n else if ( search.getSearchResults().length == 1 )\n {\n url += search.getSearchResults().length\n + Messages.getString( \"SearchResultEditorContentProvider.Result\" ); //$NON-NLS-1$\n }\n else\n {\n url += search.getSearchResults().length\n + Messages.getString( \"SearchResultEditorContentProvider.Results\" ); //$NON-NLS-1$\n }\n\n // url += search.getURL();\n url += Messages.getString( \"SearchResultEditorContentProvider.SearchBase\" ) + search.getSearchBase().getName() + \" - \"; //$NON-NLS-1$ //$NON-NLS-2$\n url += Messages.getString( \"SearchResultEditorContentProvider.Filter\" ) + search.getFilter(); //$NON-NLS-1$\n\n boolean showDn = BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(\n BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN )\n || search.getReturningAttributes().length == 0;\n configuration.getFilter().inputChanged( search, showDn );\n configuration.getSorter().inputChanged( search, showDn );\n }\n else\n {\n url = Messages.getString( \"SearchResultEditorContentProvider.NoSearchSelected\" ); //$NON-NLS-1$\n enabled = false;\n }\n\n if ( mainWidget.getInfoText() != null && !mainWidget.getInfoText().isDisposed() )\n {\n mainWidget.getInfoText().setText( url );\n }\n if ( mainWidget.getQuickFilterWidget() != null )\n {\n mainWidget.getQuickFilterWidget().setEnabled( enabled );\n }\n if ( mainWidget.getViewer() != null && !mainWidget.getViewer().getTable().isDisposed() )\n {\n mainWidget.getViewer().getTable().setEnabled( enabled );\n }\n\n }", "private List<TestCandidate> getFilteredTestCandidates() {\n // Apply suite filters.\n if (!suiteFilters.isEmpty()) {\n for (Filter f : suiteFilters) {\n if (!f.shouldRun(suiteDescription)) {\n return Collections.emptyList();\n }\n }\n }\n \n // Apply method filters.\n if (testFilters.isEmpty()) {\n return testCandidates;\n }\n \n final List<TestCandidate> filtered = new ArrayList<TestCandidate>(testCandidates);\n for (Iterator<TestCandidate> i = filtered.iterator(); i.hasNext(); ) {\n final TestCandidate candidate = i.next();\n for (Filter f : testFilters) {\n if (!f.shouldRun(Description.createTestDescription(\n candidate.instance.getClass(), candidate.method.getName()))) {\n i.remove();\n break;\n }\n }\n }\n return filtered;\n }", "public static <T> List<T> toList(Iterator<T> elements) {\n List<T> list = new LinkedList<T>();\n\n while (elements.hasNext()) {\n list.add(elements.next());\n }\n\n return list;\n }", "ObservableList<Deliverable> getFilteredDeliverableList();", "public Iterator next() {\n return new FilterIterator(succ.iterator(), filter);\n }", "public void emptySelectionLists() {\n\t\tArrayList selectionsCopy = new ArrayList();\n\t\tselectionsCopy.addAll(selections);\n\t\tIterator it = selectionsCopy.iterator();\n\t\twhile (it.hasNext()) {\n\t\t\tXsdNode node = (XsdNode) it.next();\n\t\t\tunselectNode(node);\n\t\t}\n\t\tlineNode = null;\n\t\telementFilters = new HashMap();\n\t}", "ObservableList<Link> getFilteredLinkList();" ]
[ "0.5719073", "0.56238645", "0.5385297", "0.534123", "0.5306552", "0.52914417", "0.51879007", "0.51724017", "0.5125909", "0.51240337", "0.5119416", "0.5100183", "0.5056567", "0.50338125", "0.50288796", "0.5014123", "0.50061035", "0.500335", "0.5002815", "0.5002155", "0.497763", "0.49642056", "0.48965898", "0.48843357", "0.48836163", "0.48476505", "0.48373702", "0.48323524", "0.48255804", "0.4809615", "0.4801827", "0.48005867", "0.4795398", "0.47941977", "0.47904927", "0.47816518", "0.47742796", "0.47670394", "0.47665983", "0.47639477", "0.47630537", "0.47546116", "0.47510192", "0.4747073", "0.47344425", "0.47321865", "0.47262612", "0.47240204", "0.4719235", "0.4718545", "0.47129518", "0.4701408", "0.47002184", "0.46922317", "0.46911016", "0.46833897", "0.4681691", "0.4676595", "0.46680003", "0.4667001", "0.4660525", "0.46511474", "0.46437126", "0.46378422", "0.46232837", "0.46202302", "0.46158686", "0.46153313", "0.4615007", "0.46129137", "0.46023834", "0.4601543", "0.45896924", "0.45872942", "0.4584556", "0.45769846", "0.45691764", "0.45689994", "0.4567641", "0.45624202", "0.45550245", "0.45397872", "0.45348707", "0.45263353", "0.451779", "0.45160422", "0.45114192", "0.45055732", "0.45055598", "0.44973102", "0.44957098", "0.4494835", "0.4493206", "0.44905034", "0.44901758", "0.44872445", "0.44851997", "0.44776094", "0.44766068", "0.44750917" ]
0.6147002
0
turns a collection(T) into collection(U)
public<T,U> List<U> map(final Collection<T> collection, final Operation<T,U> operation ){ List<U> result = create.createLinkedList(); for(T t:query.getOrEmpty(collection)){ result.add(operation.apply(t)); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Nullable\n @SuppressWarnings(\"unchecked\")\n protected Collection createCollection(MappingContext context, Object value) {\n if (value instanceof Iterable<?>) {\n TypeInformation entryType = context.getGenericTypeInfoOrFail(0);\n Collection result = createCollectionMatchingType(context);\n\n int index = 0;\n for (Object entry : (Iterable) value) {\n Object convertedEntry = convertValueForType(context.createChild(\"[\" + index + \"]\", entryType), entry);\n if (convertedEntry == null) {\n context.registerError(\"Cannot convert value at index \" + index);\n } else {\n result.add(convertedEntry);\n }\n }\n return result;\n }\n return null;\n }", "static Object[] m59445a(Collection<?> collection) {\n return m59444a((Iterable<?>) collection, new Object[collection.size()]);\n }", "@SuppressWarnings(\"unchecked\")\n public static <T> Collection<T> compatibleWith(Collection<T> collection) {\n \ttry {\n \t\treturn (Collection<T>)collection.getClass().newInstance();\n \t} \n \tcatch (InstantiationException exception) {}\n \tcatch (IllegalAccessException exception) {}\n \treturn new ArrayList<T>();\n }", "public static <T> List<T> adaptCollection(Collection<?> collection, Class<T> klass)\n {\n List<T> r = new ArrayList<T>();\n \n for(Object o : collection)\n {\n T t = adapt(o, klass);\n if(t != null)\n {\n r.add(t);\n }\n }\n \n return r;\n }", "List<T> collect();", "public abstract ImmutableCollection<V> A2u(K k);", "public static <T> Collection<T> copyToUnmodifiableCollection(Collection<T> collection)\n {\n if (collection != null)\n {\n Collection<T> collectionCopy = new ArrayList(collection);\n return Collections.unmodifiableCollection(collectionCopy);\n }\n else\n {\n return Collections.emptyList();\n }\n }", "public <E> Collection<E> mo8156u(Collection<E> collection) {\n return Collections.unmodifiableList((List) collection);\n }", "public static <T> List<T> convertCollectionToList(Collection<T> collection) {\r\n\t\t\r\n\t\t// Si la collection est nulle\r\n\t\tif(collection == null) return null;\r\n\t\t\r\n\t\t// On retourne la Liste\r\n\t\treturn new ArrayList<T>(collection);\r\n\t}", "protected abstract <T> Collection<T> createCollection(Class<T> clazz);", "protected abstract Collection createCollection();", "static <T> T[] m59446a(Collection<?> collection, T[] tArr) {\n int size = collection.size();\n if (tArr.length < size) {\n tArr = m59448a(tArr, size);\n }\n m59444a((Iterable<?>) collection, (Object[]) tArr);\n if (tArr.length > size) {\n tArr[size] = null;\n }\n return tArr;\n }", "Collect getColl();", "static public Collection bagFlatten(Object source) {\n\t\tCollection result = new ArrayList();\n\t\tif ( source instanceof Collection ) {\n\t\t\tIterator it = ((Collection)source).iterator();\n\t\t\twhile ( it.hasNext() ) {\n\t\t\t\tObject elem = it.next();\n\t\t\t\tif ( elem instanceof Collection ) {\n\t\t\t\t\tresult.addAll( bagFlatten(elem));\n\t\t\t\t} else {\n\t\t\t\t\tresult.add(elem);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "public static <T> Set<T> convertCollectionToSet(Collection<T> collection) {\r\n\t\t\r\n\t\t// Si la collection est nulle\r\n\t\tif(collection == null) return null;\r\n\t\t\r\n\t\t// On retourne l'ensemble\r\n\t\treturn new HashSet<T>(collection);\r\n\t}", "public List<UserOutputDTO> convert(Collection<User> users){\n\t\treturn users\n\t\t\t\t.stream()\n\t\t\t\t.map(this :: convert)\n\t\t\t\t.collect(Collectors.toList());\n\t}", "abstract Collection<Object> mapResultClass(Collection<Object> resultSet);", "<T, U> Collection<U> map(Collection<T> sources, TypeToken<Collection<U>> destinationTypeToken);", "private void arrayToCollection(String name, Collection<Object>lst, JSONArray jarr, Type ptype) throws Exception {\n\t\tCollectionType ctype = (CollectionType) ptype;\n\t\tString cname = lst.getClass().getSimpleName() + \": \" + name;\n\t\tfor(Object jsonObj : jarr) {\n\t\t\tObject obj =jsonToAttribute(cname, ctype.getElementType(), jsonObj, ptype);\n\t\t\tif(obj!=null)\n\t\t\t\tlst.add(obj);\n\t\t}\n\t}", "public static <S, D> Collection<D> transform(Collection<S> collection, Transformation<S, D> transformation) {\n \tCollection<D> ret = new ArrayList<D>();\n \tfor(S element : collection) {\n \t\tret.add(transformation.applyTo(element));\n \t}\n \treturn ret;\n }", "@SuppressWarnings(\"unchecked\")\n public <T> void asCollection(final Collection<T> destination) {\n for (final Object o : this) {\n destination.add((T) o);\n }\n }", "public static <T> UnoCollection<T> getCollection(Object o, Class<T> c)\n {\n XEnumerationAccess enuAccess = UNO.XEnumerationAccess(o);\n if (enuAccess != null)\n {\n return new UnoCollection<>(enuAccess, c);\n }\n\n return null;\n }", "protected Collection createCollectionMatchingType(MappingContext mappingContext) {\n Class<?> collectionType = mappingContext.getTypeInformation().getSafeToWriteClass();\n if (collectionType.isAssignableFrom(ArrayList.class)) {\n return new ArrayList();\n } else if (collectionType.isAssignableFrom(LinkedHashSet.class)) {\n return new LinkedHashSet();\n } else {\n throw new ConfigMeMapperException(mappingContext, \"Unsupported collection type '\" + collectionType + \"'\");\n }\n }", "protected Collection<V> newCollection() {\r\n \treturn new ArrayList<V>();\r\n }", "public static <T> List<T> toList(final Collection<T> collection) {\n\n if (isEmpty(collection)) {\n return new ArrayList<T>(0);\n } else {\n return new ArrayList<T>(collection);\n }\n }", "Set<X> toSet();", "<T> Collection<T> parseToCollectionObjects(Object json, Type typeClass);", "@Override\n public Collection<SonarQubeIssueModel> convert(final Collection<InspectCodeIssueModel> issueCollection) {\n if (issueCollection == null || issueCollection.isEmpty()) {\n return java.util.Collections.emptySet();\n }\n\n // Convert the entire collection in parallel using the Java Stream API and return the converted collection\n return issueCollection.parallelStream()\n .map(this::convert)\n .collect(Collectors.toSet());\n }", "public static <T extends Collection> T addTo( Collection l, Object ... os ){\n Collections.addAll( l, os );\n return (T) l;\n }", "private List<Object> serializeActualCollectionMembers(AbstractPersistentCollection collection)\r\n\t{\r\n\t\tList<Object> result = new ArrayList<Object>();\r\n\t\tif (!collection.wasInitialized())\r\n\t\t{\r\n\t\t\tcollection.forceInitialization();\r\n\t\t}\r\n\t\tIterator<Object> itr = collection.entries(null);\r\n\t\twhile (itr.hasNext())\r\n\t\t{\r\n\t\t\tObject next = itr.next();\r\n\t\t\tObject newObj = serialize(next);\r\n\t\t\tresult.add(newObj);\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "public void triCollection(){\r\n Collections.sort(collection);\r\n }", "public static <T> ConstList<T> make(Iterable<T> collection) {\n if (collection == null)\n return make();\n if (collection instanceof ConstList)\n return (ConstList<T>) collection;\n if (collection instanceof Collection) {\n Collection<T> col = (Collection<T>) collection;\n if (col.isEmpty())\n return make();\n else\n return new ConstList<T>(new ArrayList<T>(col));\n }\n ArrayList<T> ans = null;\n for (T x : collection) {\n if (ans == null)\n ans = new ArrayList<T>();\n ans.add(x);\n }\n if (ans == null)\n return make();\n else\n return new ConstList<T>(ans);\n }", "Listof<X> toList();", "set.addAll(Arrays.asList(a));", "private static <T> T identity(Collection<T> collection) {\n return identity(collection.iterator());\n }", "public static <T> UnoCollection<T> getCollection(XEnumerationAccess enuAccess, Class<T> c)\n {\n return new UnoCollection<>(enuAccess, c);\n }", "Set <JAVATYPE> convertSet(Set<JAVATYPE> oldSet, final METATYPE meta);", "public Collection<T> fromEach(Collection<?> source) {\n\t\treturn new TranslationSession(configuration, variables)\n\t\t\t\t.getEachTranslation(source, destinationClass);\n\t}", "@SuppressWarnings(\"unchecked\")\n static <T extends I, I>\n Set<T> castDown(Class<T> type, Set<I> src, Function<I, T> converter, boolean every) {\n if (src == null || src.isEmpty()) return Collections.emptySet();\n val first = src.iterator().next();\n if (type.isAssignableFrom(first.getClass()) && !every) {\n return ((Set<T>) src);\n }\n val list = new HashSet<T>();\n for (I i : src) {\n T t = converter.apply(i);\n list.add(t);\n }\n return list;\n }", "public static <T> Set<T> toSet(final Collection<T> collection) {\n\n if (isEmpty(collection)) {\n return new HashSet<T>(0);\n } else {\n return new HashSet<T>(collection);\n }\n }", "public static <E, C extends Collection<E>> SynchronizedMutableCollection<E> of(C collection)\n {\n return new SynchronizedMutableCollection<E>(CollectionAdapter.adapt(collection));\n }", "public <T> Collection<T> initialize(Collection<T> entities);", "public static void TestGenericMethod_addToCollection()\r\n\t{\n\t\tCollection<Object> objc = new ArrayList<Object>();\r\n\t\tCollection<Integer> intc = new ArrayList<Integer>();\r\n\t\tObject[] objs = new Object[2];\r\n\t\taddToCollection(objs, objc);\r\n\t\tString[] strings = new String[2];\r\n\t\tfor (int i = 0; i < strings.length; ++i)\r\n\t\t\tstrings[i] = Integer.toString(i);\r\n\t\t// Object argument inferred.\r\n\t\taddToCollection(strings, objc);\r\n\t\t// now you can print the array of objects ONLY.\r\n\t\tCollection<String> stringc = new ArrayList<String>();\r\n\t\taddToCollection(strings, stringc);\r\n\t\tint[] ints = new int[2];\r\n\t\tfor (int i = 0; i < ints.length; ++i)\r\n\t\t\tints[i] = i;\r\n\t\t// FAILS: is it an int or string?\r\n\t\t//addToCollection(ints, stringc);\r\n\t\t// FAILS: No autoboxing.\r\n\t\t//addToCollection<Integer>(ints,intc);\r\n\t}", "Collection<T> getSimpleModelObjects();", "public static <F> /*@ pure @*/ /*@ non_null @*/\n JMLObjectSet<F> convertFrom(/*@ non_null @*/ F[] a)\n {\n /*@ non_null @*/ JMLObjectSet<F> ret = EMPTY;\n for (int i = 0; i < a.length; i++) {\n ret = ret.insert(a[i]);\n }\n return ret;\n }", "public void buildFromCollection(List<? extends T> source) {\r\n\t\tsource.stream()\r\n\t\t\t\t.forEach(item -> addElement(item));\r\n\t}", "public static java.util.Collection unmodifiableCollection(java.util.Collection arg0)\n { return null; }", "@SuppressWarnings(\"rawtypes\")\n\t@Test\n\tpublic void retrieveCollections() {\n\t\t// We can also query for the collections themselves, since they are\n\t\t// first class objects.\n\n\t\tObjectSet result = db.queryByExample(new ArrayList());\n\t\tlistResult(result);\n\n\t\t// as we are initializing readouts\n\t\tassertEquals(2, result.size());\n\n\t}", "static public List orderedsetFlatten(Object source) {\n\t\tList result = new ArrayList();\n\t\tif ( source instanceof Collection ) {\n\t\t\tIterator it = ((Collection)source).iterator();\n\t\t\twhile ( it.hasNext() ) {\n\t\t\t\tObject elem = it.next();\n\t\t\t\tif ( elem instanceof Collection ) {\n\t\t\t\t\tresult.addAll( orderedsetFlatten(elem));\n\t\t\t\t} else {\n\t\t\t\t\tresult.add(elem);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "private <T> Collection<T> reverse(Collection<T> col) {\n List<T> list = new ArrayList<>();\n col.forEach(list::add);\n Collections.reverse(list);\n return list;\n }", "public static void main(String[] args) {\n //Generic Version of Collection\n ArrayList<String> arrayList = new ArrayList<>();\n arrayList.add(\"Deepak\");\n arrayList.add(\"Kumar\");\n arrayList.add(\"Hello\");\n arrayList.add(\"Sandeep\");\n System.out.println(\"Collection Before Array Conversion=\" + arrayList);\n String[] names = new String[arrayList.size()];\n arrayList.toArray(names);\n System.out.println(\"Array After Conversion From Collection\");\n for (int i = 0; i < names.length; i++) {\n System.out.println(names[i]);\n }\n //Collection Normal Version\n ArrayList arrayList1 = new ArrayList<>();\n arrayList1.add(\"Deepak\");\n arrayList1.add('a');\n arrayList1.add(1);\n arrayList1.add(10.9f);\n arrayList1.add(10.90);\n arrayList1.add(true);\n\n\n System.out.println(\"Normal Colection without Conversion\"+arrayList1);\n Object[] object = arrayList1.toArray();\n\n System.out.println(\"Array After Conversion From Normal Collection\");\n for (int i = 0; i < object.length; i++) {\n System.out.println(object[i]);\n }\n\n ///Array to Collection Conversion\n String[] names1 = new String[]{\"Deepak\",\"Kuldeep\",\"Sandeep\",\"Pardeep\"};\n ArrayList<String> namesCollection = new ArrayList(Arrays.asList(names1));\n System.out.println(namesCollection);\n\n\n }", "default void addAllTo(Collection<? super E> collection) {\n // Accepting a Collection<? super E> allows us to add elements to\n // any collection that can hold E elements, including Collection<Object>.\n for (E element : this) {\n collection.add(element);\n }\n }", "public static <T> List<T> flatten(final Collection<List<T>> collection) {\n return collection.stream().flatMap(Collection::stream).collect(Collectors.toList());\n }", "static void flatten(Value value, Collection<Value> result) {\r\n if (value instanceof ContainerValue) {\r\n ContainerValue cont = (ContainerValue) value;\r\n for (int i = 0, size = cont.getElementSize(); i < size; i++) {\r\n flatten(cont.getElement(i), result);\r\n } \r\n } else {\r\n result.add(value);\r\n }\r\n }", "public static void AddToCollection(Collection<? extends Person> c)\r\n\t{\r\n\t\t//c.add(new Person(\"abc\"));\r\n\t\t//c.add(new Worker(\"a\", \"b\"));\r\n\t\t//c.add(new Object());\r\n\t\t//Collection<? extends Object> c1 = new ArrayList<Person>();\r\n\t\t//c1.add(new Object());\r\n\t}", "public abstract List<T> convertToEntities(List<D> dtos);", "private static <T> Collection<T> fromNullSafeArray(T[] valor){\r\n\t\tCollection<T> collection = null;\r\n\t\tif (valor != null){\r\n\t\t\tcollection = Arrays.asList(valor);\r\n\t\t}\r\n\t\treturn collection;\r\n\t}", "protected Class toProxyableCollectionType(Class type) {\n if (type.getName().endsWith(PROXY_SUFFIX))\n type = type.getSuperclass();\n else if (type.isInterface()) {\n type = toConcreteType(type, _stdCollections);\n if (type == null)\n throw new UnsupportedException(_loc.get(\"no-proxy-intf\", type));\n } else if (Modifier.isAbstract(type.getModifiers()))\n throw new UnsupportedException(_loc.get(\"no-proxy-abstract\", type));\n return type;\n }", "static public Set setFlatten(Object source) {\n\t\tSet result = new HashSet();\n\t\tif ( source instanceof Collection ) {\n\t\t\tIterator it = ((Collection)source).iterator();\n\t\t\twhile ( it.hasNext() ) {\n\t\t\t\tObject elem = it.next();\n\t\t\t\tif ( elem instanceof Collection ) {\n\t\t\t\t\tresult.addAll( setFlatten(elem));\n\t\t\t\t} else {\n\t\t\t\t\tresult.add(elem);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "static public List sequenceFlatten(Object source) {\n\t\tList result = new ArrayList();\n\t\tif ( source instanceof Collection ) {\n\t\t\tIterator it = ((Collection)source).iterator();\n\t\t\twhile ( it.hasNext() ) {\n\t\t\t\tObject elem = it.next();\n\t\t\t\tif ( elem instanceof Collection ) {\n\t\t\t\t\tresult.addAll( sequenceFlatten(elem));\n\t\t\t\t} else {\n\t\t\t\t\tresult.add(elem);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "public static CollectionModel toCollectionModel(Object value)\n {\n if (value instanceof CollectionModel)\n return (CollectionModel) value;\n else\n {\n return new SortableModel(value);\n }\n }", "List <JAVATYPE> convertList(List<JAVATYPE> oldList, final METATYPE meta);", "public static <T> T[] toArray(final Collection<T> collection) {\n\n T next = getFirstNotNullValue(collection);\n if (next != null) {\n Object[] objects = collection.toArray();\n @SuppressWarnings(\"unchecked\")\n T[] convertedObjects = (T[]) Array.newInstance(next.getClass(), objects.length);\n System.arraycopy(objects, 0, convertedObjects, 0, objects.length);\n return convertedObjects;\n } else {\n return null;\n }\n }", "public static <T> List<T> createList(Collection<T> collection) {\n\t\treturn Collections.list(Collections.enumeration(collection));\n\t}", "public static CollectionLikeType upgradeFrom(JavaType baseType, JavaType elementType)\n/* */ {\n/* 86 */ if ((baseType instanceof TypeBase)) {\n/* 87 */ return new CollectionLikeType((TypeBase)baseType, elementType);\n/* */ }\n/* 89 */ throw new IllegalArgumentException(\"Can not upgrade from an instance of \" + baseType.getClass());\n/* */ }", "public <T> Collection<T> getCollection(String propertyName, Class<T> c) {\n if (this.propertyBag.has(propertyName) && !this.propertyBag.isNull(propertyName)) {\n JSONArray jsonArray = this.propertyBag.getJSONArray(propertyName);\n Collection<T> result = new ArrayList<T>();\n boolean isBaseClass = false;\n boolean isEnumClass = false;\n boolean isJsonSerializable = false;\n\n // Check once.\n if (Number.class.isAssignableFrom(c) || String.class.isAssignableFrom(c)\n || Boolean.class.isAssignableFrom(c) || Object.class == c) {\n isBaseClass = true;\n } else if (Enum.class.isAssignableFrom(c)) {\n isEnumClass = true;\n } else if (JsonSerializable.class.isAssignableFrom(c)) {\n isJsonSerializable = true;\n } else {\n JsonSerializable.checkForValidPOJO(c);\n }\n\n for (int i = 0; i < jsonArray.length(); i++) {\n if (isBaseClass) {\n // Number, String, Boolean \n result.add(c.cast(jsonArray.get(i)));\n } else if (isEnumClass) {\n try {\n result.add(c.cast(c.getMethod(\"valueOf\", String.class).invoke(null,\n String.class.cast(jsonArray.get(i)))));\n } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException\n | NoSuchMethodException | SecurityException | JSONException e) {\n throw new IllegalStateException(\"Failed to create enum.\", e);\n }\n } else if (isJsonSerializable) {\n JSONObject jsonObject = jsonArray.getJSONObject(i);\n // JsonSerializable\n try {\n result.add(c.getConstructor(String.class).newInstance(jsonObject.toString()));\n } catch (InstantiationException | IllegalAccessException | IllegalArgumentException\n | InvocationTargetException | NoSuchMethodException | SecurityException e) {\n throw new IllegalStateException(\"Failed to instantiate class object.\", e);\n }\n } else {\n JSONObject jsonObject = jsonArray.getJSONObject(i);\n // POJO\n try {\n result.add(this.getMapper().readValue(jsonObject.toString(), c));\n } catch (IOException e) {\n throw new IllegalStateException(\"Failed to get POJO.\", e);\n }\n }\n }\n\n return result;\n }\n\n return null;\n }", "void setLibroCollection1(Collection<Libro> libroCollection1);", "private List<SillyBot> convert(Collection<SillyBot> botsToAdd) {\n\t\tList<SillyBot> bots = new ArrayList<>();\n\t\tbots.addAll(botsToAdd);\n\t\treturn bots;\n\t}", "java.lang.String getCollection();", "<C> CollectionItem<C> createCollectionItem();", "@SuppressWarnings(\"WeakerAccess\")\n @NonNull\n protected List<T> convert(@NonNull final Object data) {\n final List<Object> objects = CoreReflection.getObjects(data, false);\n if (objects == null) return Collections.singletonList(convertSingle(data));\n\n final ArrayList<T> list = new ArrayList<>();\n for (final Object object: objects)\n if (!CoreReflection.isNotSingle(object))\n list.add(convertSingle(object));\n\n return list;\n }", "public static Collection<Triple> toCollection(Iterator<Triple> i) {\n LinkedList<Triple> list= new LinkedList<Triple>();\n while (i.hasNext()) {\n list.add(i.next());\n }\n return list;\n }", "@SuppressWarnings(\"UnusedDeclaration\")\npublic interface YCollection<T> extends Collection<T> {\n\n YCollection<T> emptyInstance();\n\n YCollection<T> filter(Predicate<? super T> predicate);\n\n default <K> YMap<K, YList<T>> groupBy(Function<T, K> grouper) {\n YMap<K, YList<T>> result = hm();\n for (T t : this) {\n K group = grouper.apply(t);\n YList<T> gg = result.get(group);\n if (gg == null) {\n gg = al();\n result.put(group, gg);\n }\n gg.add(t);\n }\n return result;\n }\n\n default boolean isAny(Predicate<? super T> predicate) {\n for (T t : this) if (predicate.test(t)) return true;\n return false;\n }\n\n default boolean isAll(Predicate<? super T> predicate) {\n for (T t : this) if (!predicate.test(t)) return false;\n return true;\n }\n\n <R> YCollection<R> map(Function<? super T, ? extends R> mapper);\n\n //TODO test\n default <R> YCollection<R> mapWithIndex(BiFunction<Integer, ? super T, ? extends R> mapper) {\n Iterator<T> it = iterator();\n YCollection<R> result = al();\n for (int i = 0; i < size(); i++) {\n result.add(mapper.apply(i, it.next()));\n }\n return result;\n }\n\n //TODO test\n <R> YCollection<R> flatMap(Function<? super T, ? extends Collection<? extends R>> mapper);\n\n /**\n * The same as 'forEach', but returns 'this' so can continue using the instasnce.\n */\n default YCollection<T> forEachFun(Consumer<T> consumer) {\n for (T t : this) consumer.accept(t);\n return this;\n }\n\n //TODO test\n default <T2> YCollection<T> forZip(YCollection<T2> b, BiConsumer<T, T2> f) {\n Iterator<T> i1 = this.iterator();\n Iterator<T2> i2 = b.iterator();\n while(true) {\n if (i1.hasNext() != i2.hasNext()) throw new RuntimeException(\"Expected the same size\");\n if (!i1.hasNext()) break;\n f.accept(i1.next(), i2.next());\n }\n return this;\n }\n\n default YCollection<T> forWithIndex(BiConsumer<Integer, ? super T> consumer) {\n Iterator<T> it = iterator();\n int i = 0;\n while(it.hasNext()) consumer.accept(i++, it.next());\n return this;\n }\n\n default <R> R reduce(R first, BiFunction<R, T, R> folder) {\n R result = first;\n for (T t : this) result = folder.apply(result, t);\n return result;\n }\n\n //TODO test\n default T reduce(BiFunction<T, T, T> folder) {\n if (isEmpty()) return null;\n Iterator<T> i = iterator();\n T result = i.next();\n while (i.hasNext()) result = folder.apply(result, i.next());\n return result;\n }\n\n //TODO test\n default T car() {\n return iterator().next();\n }\n\n //TODO test\n default T cadr() {\n Iterator<T> iterator = iterator();\n iterator.next();\n return iterator.next();\n }\n\n YCollection<T> cdr();\n\n default T first() {\n return car();\n }\n\n default T firstOr(T t) {\n if (isEmpty()) return t;\n return first();\n }\n\n default T firstOrCalc(Supplier<T> supplier) {\n if (isEmpty()) return supplier.get();\n return first();\n }\n\n //TODO test\n default T first(Predicate<? super T> predicate) {\n for (T t : this) if (predicate.test(t)) return t;\n return null;\n }\n\n //TODO firstOr(Predicate<? super T> predicate, T default)\n //TODO lastOr(Predicate<? super T> predicate, T default)\n\n //TODO test\n default T last(Predicate<? super T> predicate) {\n T result = null;\n for (T t : this) if (predicate.test(t)) result = t;\n return result;\n }\n\n default T max() {\n return YCollections.maxFromCollection(this);\n }\n\n default T max(Comparator<? super T> comparator) {\n return YCollections.maxFromCollection(this, comparator);\n }\n\n default <CMP extends Comparable<CMP>> T max(Function<T, CMP> evaluator) {\n if (isEmpty()) throw new RuntimeException(\"can't get max on empty collection\");\n T max = null;\n CMP maxComparable = null;\n for (T t : this) {\n CMP nextComparable = evaluator.apply(t);\n if (nextComparable == null) throw new RuntimeException(\"evaluator shouldn't return null values\");\n if (maxComparable == null || maxComparable.compareTo(nextComparable) < 0) {\n max = t;\n maxComparable = nextComparable;\n }\n }\n return max;\n }\n\n default T maxByFloat(Function_float_T<T> evaluator) {\n if (isEmpty()) throw new RuntimeException(\"can't get max on empty collection\");\n T max = null;\n float maxComparable = 0;\n boolean found = false;\n for (T t : this) {\n float nextComparable = evaluator.apply(t);\n if (!found || nextComparable > maxComparable) {\n max = t;\n maxComparable = nextComparable;\n }\n found = true;\n }\n return max;\n }\n\n default T min() {\n return YCollections.minFromCollection(this);\n }\n\n default T min(Comparator<? super T> comparator) {\n return YCollections.minFromCollection(this, comparator);\n }\n\n default <CMP extends Comparable<CMP>> T min(Function<T, CMP> evaluator) {\n if (isEmpty()) throw new RuntimeException(\"can't get min on empty collection\");\n T min = null;\n CMP minComparable = null;\n for (T t : this) {\n CMP nextComparable = evaluator.apply(t);\n if (nextComparable == null) throw new RuntimeException(\"evaluator shouldn't return null values\");\n if (minComparable == null || minComparable.compareTo(nextComparable) >= 0) {\n min = t;\n minComparable = nextComparable;\n }\n }\n return min;\n }\n\n default T minByFloat(Function_float_T<T> evaluator) {\n if (isEmpty()) throw new RuntimeException(\"can't get min on empty collection\");\n T min = null;\n float minComparable = 0;\n boolean found = false;\n for (T t : this) {\n float nextComparable = evaluator.apply(t);\n if (!found || nextComparable < minComparable) {\n min = t;\n minComparable = nextComparable;\n }\n found = true;\n }\n return min;\n }\n\n default YSet<T> toSet() {\n return toYSet(this);\n }\n\n default YList<T> toList() {\n return toYList(this);\n }\n\n YCollection<T> withAll(Collection<T> c);\n\n YCollection<T> with(T t);\n\n @SuppressWarnings(\"unchecked\")\n YCollection<T> with(T... t);\n\n YCollection<T> withoutAll(Collection<T> c);\n\n YCollection<T> without(T t);\n @SuppressWarnings(\"unchecked\")\n YCollection<T> without(T... t);\n\n //TODO reversed\n //YSet returns not YSet but YList, because sorting algorithm itself creates list //TODO fix this?\n default YList<T> sorted() {\n return YCollections.sortedCollection(this);\n }\n\n default YList<T> sorted(Comparator<? super T> comparator) {\n return YCollections.sortedCollection(this, comparator);\n }\n\n default YList<T> sorted(Function<T, Comparable> evaluator) {\n return YCollections.sortedCollection(this, (v1, v2) -> evaluator.apply(v1).compareTo(evaluator.apply(v2)));\n }\n\n YCollection<T> take(int count);\n\n //TODO test\n default int count(Predicate<? super T> predicate) {\n int result = 0;\n for (T t : this) if (predicate.test(t)) result++;\n return result;\n }\n\n //TODO test\n @SuppressWarnings(\"unchecked\")\n default boolean containsAll(T... tt) {\n for (T t : tt) if (!contains(t)) return false;\n return true;\n }\n\n //TODO test\n @SuppressWarnings(\"unchecked\")\n default boolean containsAny(Collection<? extends T> tt) {\n for (T t : tt) if (contains(t)) return true;\n return false;\n }\n\n //TODO test\n @SuppressWarnings(\"unchecked\")\n default boolean containsAny(T... tt) {\n for (T t : tt) if (contains(t)) return true;\n return false;\n }\n\n //TODO test\n default String toString(String infix) {\n StringBuilder sb = new StringBuilder(\"\");\n boolean was = false;\n for (Object o : this) {\n if (was) sb.append(infix);\n sb.append(o);\n was = true;\n }\n return sb.toString();\n }\n\n //TODO test\n default String toStringSuffix(String suffix) {\n StringBuilder sb = new StringBuilder(\"\");\n for (Object o : this) sb.append(o).append(suffix);\n return sb.toString();\n\n }\n\n //TODO test\n default String toStringInfix(String infix) {\n return toString(infix);\n }\n\n //TODO test\n default String toStringPrefixInfix(String prefix, String infix) {\n boolean first = true;\n StringBuilder sb = new StringBuilder();\n for (Object o : this) {\n if (first) first = false;\n else sb.append(infix);\n sb.append(prefix).append(o == null ? \"null\" : o.toString());\n }\n return sb.toString();\n }\n\n //TODO test\n default String toStringPrefixSuffix(String prefix, String suffix) {\n StringBuilder sb = new StringBuilder();\n for (Object o : this) {\n sb.append(prefix).append(o == null ? \"null\" : o.toString()).append(suffix);\n }\n return sb.toString();\n }\n\n //TODO test\n default <V> YMap<T, V> toMapKeys(Function<T, V> f) {\n YMap<T, V> result = hm();\n for (T k : this) result.put(k, f.apply(k));\n return result;\n }\n\n //TODO test\n default boolean notEmpty() {\n return !isEmpty();\n }\n\n default <V> V ifEmpty(V v, Function<YCollection<T>, V> Else) {\n if (isEmpty()) return v;\n return Else.apply(this);\n }\n\n default YCollection<T> assertSize(int s) {\n if (size() != s) throw new RuntimeException(\"Expected size \" + s + \" but was \" + size());\n return this;\n }\n}", "public static <T> Collection<T> consolidate(Collection<Collection<T>> inputCollections) {\n\t\tCollection<T> collection = new ArrayList<T>();\n\t\tfor (Collection<T> inputCollection : inputCollections)\n\t\t\tcollection.addAll(inputCollection);\n\t\treturn collection;\n\t}", "public static Collection transform(Collection source) {\n Collection target = new Collection(MetadataFormat.DC);\n if (source.getFormat() == MetadataFormat.MARC) {\n for (Record record : source.getRecords()) {\n target.add(transform(record));\n }\n } else {\n System.err.println(\"Cannot transform non-MARC collection\");\n }\n return target;\n }", "<T> Collection<T> get(Class<T> type, Iterable<Node> nodes);", "Collection<V> getAllElements();", "public static <D> Set<D> convert(Set<?> source, Class<D> type) {\n return modelMapper.map(source, new SetOfType<D>(type));\n }", "public static <T> Collection<String> toString(Collection<T> collection) {\n\t\tCollection<String> strings = new ArrayList<String>();\n\t\tfor (T item : collection)\n\t\t\tstrings.add(item.toString());\n\t\treturn strings;\n\t}", "protected List getList() {\n/* 88 */ return (List)getCollection();\n/* */ }", "public Object convert(Class type, Object value) {\n\n if (shouldReturnNullValue(value)) {\n return _nullValueToReturn;\n }\n\n // If the value passed in is an instance of a Collection, then create an array from\n // it and return it. \n if (value instanceof Collection) {\n return ApiFunctions.toStringArray((Collection)value);\n }\n\n else {\n return _converter.convert(type, value);\n } \n }", "public Collection<T> readAll();", "<T> void lookupAll(Class<T> type, Collection<T> out);", "List<Object> getCollectionProxies(PersistentCollection collection)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tEventSource session = (EventSource) sessionFactory.getCurrentSession();\r\n\r\n\t\t\tCollectionPersister persister = session.getFactory().getCollectionPersister(collection.getRole());\r\n\t\t\tif (persister instanceof AbstractCollectionPersister)\r\n\t\t\t{\r\n\t\t\t\tAbstractCollectionPersister collectionPersister = (AbstractCollectionPersister) persister;\r\n\t\t\t\tString className = collectionPersister.getElementType().getName();\r\n\t\t\t\tEntityPersister entityPersister = session.getFactory().getEntityPersister(className);\r\n\t\t\t\tCollectionProxyResolver collectionProxyResolver = getCollectionProxyResolver(collectionPersister, entityPersister);\r\n\t\t\t\tif (session instanceof Session)\r\n\t\t\t\t{\r\n\t\t\t\t\tList<IHibernateProxyDescriptor> proxyDescriptors = collectionProxyResolver.getCollectionProxies(session, collection);\r\n\r\n\t\t\t\t\t// create a new HibernateProxy for each id.\r\n\t\t\t\t\tList<Object> proxies = new ArrayList<Object>();\r\n\t\t\t\t\tfor (IHibernateProxyDescriptor proxyDescriptor : proxyDescriptors)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tASObject as = getASObject(proxyDescriptor);\r\n\t\t\t\t\t\tproxies.add(as);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn proxies;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Throwable ex)\r\n\t\t{\r\n\t\t\tex.printStackTrace();\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "@Test\n void testCollect() {\n List<Integer> numbers = Stream.of(1, 2, 3, 4)\n .collect(Collectors.toList());\n assertEquals(List.of(1, 2, 3, 4), numbers);\n\n // collect to a Set\n numbers = List.of(1, 1, 2, 2);\n Set<Integer> unique = numbers.stream()\n .collect(Collectors.toSet());\n assertEquals(Set.of(1, 2), unique);\n\n // collect to a different collection like a Queue\n Queue<Integer> queue = numbers.stream()\n .collect(Collectors.toCollection(LinkedList::new));\n assertEquals(Integer.valueOf(1), queue.poll());\n assertEquals(Integer.valueOf(1), queue.poll());\n assertEquals(Integer.valueOf(2), queue.poll());\n assertEquals(Integer.valueOf(2), queue.poll());\n\n // collect to one single String\n List<String> letters = List.of(\"S\", \"t\", \"r\", \"e\", \"a\", \"m\", \"s\");\n String word = letters.stream()\n .collect(Collectors.joining());\n assertEquals(\"Streams\", word);\n\n String another = letters.stream()\n .collect(Collectors.joining(\" \", \"*\", \"!\"));\n assertEquals(\"*S t r e a m s!\", another);\n }", "T collect(V source);", "public Collection<T> mo29734a() {\n return new ArrayList();\n }", "@Test\n public void initializeFromAnotherCollectionWhenCreating() {\n List<Integer> lst1 = new ArrayList<>(List.of(3, 1, 2));\n assertThat(lst1).hasSize(3);\n\n // create and initialize an ArrayList from Arrays.asList\n List<Integer> lst2 = new ArrayList<>(Arrays.asList(3, 1, 2));\n assertThat(lst2).hasSize(3);\n\n // create and initialize an ArrayList from Java 9+ Set.of\n List<Integer> lst3 = new ArrayList<>(Set.of(5, 4, 6));\n assertThat(lst3).hasSize(3);\n\n // create and initialize from an existing collection\n List<Integer> lst4 = new ArrayList<>(lst3);\n assertThat(lst4).hasSize(3);\n }", "public JsonDeserializer<?> modifyCollectionLikeDeserializer(DeserializationConfig config, CollectionLikeType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)\n/* */ {\n/* 150 */ return deserializer;\n/* */ }", "public static <T> Set<T> set(Collection<T> collection) {\n if (collection == null) return new HashSet<>();\n return collection.stream().filter(Objects::nonNull).collect(Collectors.toSet());\n }", "private void updateCollection(Resource subject, Property property,\r\n\t\t\tCollection<?> c) {\r\n\t\tif (supportsDelete(c))\r\n\t\t\tsubject.removeAll(property);\r\n\t\tAddSaver saver = new AddSaver(subject, property);\r\n\t\tfor (Object o : c)\r\n\t\t\tif (isPrimitive(o))\r\n\t\t\t\tsaver.write(o); // leaf\r\n\t\t\telse\r\n\t\t\t\tsubject.addProperty(property, _write(o, true)); // recursive\r\n\t}", "public List<T> toList() {\n return Query.toList(iterable);\n }", "@Override\n\tpublic long insertObjs(Collection<T> t) {\n\t\treturn insertObjs(false, t);\n\t}", "public static <T, V> Set<V> set(Collection<T> collection, Function<T, V> mapping) {\n if (mapping == null) throw new IllegalArgumentException(\"Mapping function not set!\");\n if (collection == null) return set();\n return collection.stream()\n .filter(Objects::nonNull)\n .map(mapping)\n .filter(Objects::nonNull)\n .collect(Collectors.toSet());\n }", "static public Collection<String> convertCollection(Collection<Language> langs) {\r\n\t\tCollection<String> stringCollection = new ArrayList<>();\r\n\r\n\t\tfor (Language l : langs) {\r\n\t\t\tstringCollection.add(l.getName());\r\n\t\t}\r\n\r\n\t\treturn stringCollection;\r\n\t}", "public JsonDeserializer<?> modifyCollectionDeserializer(DeserializationConfig config, CollectionType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)\n/* */ {\n/* 142 */ return deserializer;\n/* */ }", "public static <T> void addToCollection(Collection<T> collection, Iterator<T> elementsToAdd)\n {\n while (elementsToAdd.hasNext())\n {\n T next = elementsToAdd.next();\n collection.add(next);\n }\n }", "@SuppressWarnings(\"unchecked\")\n static <T extends I, I>\n List<T> castDown(Class<T> type, List<I> src, Function<I, T> converter, boolean every) {\n if (src == null || src.isEmpty()) return Collections.emptyList();\n if (type.isAssignableFrom(src.get(0).getClass()) && !every) {\n return ((List<T>) src);\n }\n val list = new ArrayList<T>();\n for (I i : src) {\n T t = converter.apply(i);\n list.add(t);\n }\n return list;\n }", "public static <D> List<D> convert(List<?> source, Class<D> type) {\n return modelMapper.map(source, new ListOfType<D>(type));\n }", "@SuppressWarnings(\"unchecked\")\n public static Observable.Transformer<SetList, List<Category>> mapSetToCategory() {\n return categoryTransformer;\n }" ]
[ "0.6483135", "0.6454874", "0.633476", "0.62919515", "0.6269374", "0.61964023", "0.6167256", "0.6114386", "0.60543376", "0.6038125", "0.6023326", "0.60185796", "0.59965616", "0.5992209", "0.59661305", "0.59593534", "0.59463465", "0.5941982", "0.5897948", "0.58716387", "0.5752443", "0.57352394", "0.5692627", "0.5691218", "0.5676723", "0.56537175", "0.5646823", "0.5627736", "0.56272334", "0.56205386", "0.56203604", "0.56163967", "0.5601314", "0.5598588", "0.5563121", "0.55523455", "0.5548414", "0.5545655", "0.55316395", "0.55108166", "0.55038285", "0.54866683", "0.54823536", "0.54643726", "0.5462445", "0.5454873", "0.54526323", "0.545086", "0.54240876", "0.54207295", "0.5417731", "0.5414491", "0.5402585", "0.5402367", "0.5396585", "0.5370731", "0.5362785", "0.5351164", "0.5334137", "0.5326542", "0.53211296", "0.53113556", "0.5308547", "0.52931607", "0.52624154", "0.5260803", "0.52593076", "0.5259216", "0.5256471", "0.52541924", "0.5254044", "0.52445596", "0.5239227", "0.52348524", "0.52309424", "0.52138186", "0.5205057", "0.5204295", "0.51944256", "0.51747924", "0.5173736", "0.5154947", "0.5153995", "0.51409566", "0.5132811", "0.5126582", "0.5117763", "0.5103525", "0.51003456", "0.5060299", "0.50576884", "0.5051611", "0.5046667", "0.5034179", "0.5034034", "0.501833", "0.501675", "0.5014863", "0.501106", "0.50096416" ]
0.5360873
57
fold/reduce the collection into value U walk over the elements and then take initial/current U and apply current = operation(el, U)
public <T,U> U foldLeft(final Collection<T> collection, final FoldOperation<T,U> operation, final U initial){ U current = initial; for(T el: query.getOrEmpty(collection)){ current = operation.apply(el, current); } return current; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public <T,U> U foldRight(final Collection<T> collection, final FoldOperation<T,U> operation, final U initial){\n\t\tList<T> temp = new ArrayList<T>(query.getOrEmpty(collection));\n\t\tCollections.reverse(temp);\n\t\treturn foldLeft(temp, operation, initial);\n\t}", "public<T,U> List<U> map(final Collection<T> collection, final Operation<T,U> operation ){\t\t\n\t\tList<U> result = create.createLinkedList();\n\t\tfor(T t:query.getOrEmpty(collection)){\n\t\t\tresult.add(operation.apply(t));\n\t\t}\n\t\treturn result;\n\t}", "interface ContainerValueOperation {\r\n\r\n /**\r\n * Evaluates the specific function on a container and a value possibly modifying <code>result</code>.\r\n * \r\n * @param cont the container (must not be modified)\r\n * @param value the value \r\n * @param result the result (to be modified as a side effect)\r\n */\r\n public void evaluate(ContainerValue cont, Value value, List<Value> result);\r\n }", "public void evaluate(ContainerValue cont, Value value, List<Value> result);", "static Integer foo(final List<Integer> list,\n final Integer initial,\n final Function2<Integer, Integer, Integer> operator) {\n Integer accumulator = initial;\n for (final Integer element : list) {\n accumulator = operator.apply(accumulator, element);\n }\n\n return accumulator;\n }", "public Exp fold();", "static void flatten(Value value, Collection<Value> result) {\r\n if (value instanceof ContainerValue) {\r\n ContainerValue cont = (ContainerValue) value;\r\n for (int i = 0, size = cont.getElementSize(); i < size; i++) {\r\n flatten(cont.getElement(i), result);\r\n } \r\n } else {\r\n result.add(value);\r\n }\r\n }", "R apply(T t, U u);", "@Override\n public void collect(T elem) {\n value = elem;\n }", "@Override\n\tpublic void run() {\n\t\tresult =\n\t\t\tStream.iterate(new int[]{0, 1}, s -> new int[]{s[1], s[0] + s[1]})\n\t\t\t\t.limit(limit)\n\t\t\t\t.map(n -> n[0])\n\t\t\t\t.collect(toList());\n\n\t}", "public void Reduce(float[] inData, float[] outData, MpiOp op, int root) {\n\n if (TREE) {\n tree_reduce(inData, outData, op, root);\n } else {\n naive_reduce(inData, outData, op, root);\n }\n\n REDUCE_TAG--;\n }", "public void Reduce(int[] inData, int[] outData, MpiOp op, int root) {\n\n if (TREE) {\n tree_reduce(inData, outData, op, root);\n } else {\n naive_reduce(inData, outData, op, root);\n }\n\n REDUCE_TAG--;\n }", "public void Reduce(double[] inData, double[] outData, MpiOp op, int root) {\n\n if (TREE) {\n tree_reduce(inData, outData, op, root);\n } else {\n naive_reduce(inData, outData, op, root);\n }\n\n REDUCE_TAG--;\n }", "public void Reduce(long[] inData, long[] outData, MpiOp op, int root) {\n\n if (TREE) {\n tree_reduce(inData, outData, op, root);\n } else {\n naive_reduce(inData, outData, op, root);\n }\n\n REDUCE_TAG--;\n }", "@Override\n\t\tpublic void reduce() {\n\t\t\t\n\t\t}", "private static <T, R> R getOf(final Collection<T> collection, Function<T, R> func, BinaryOperator<R> mapper, Function<R, R> sumator) {\n R r = null;\n for (T t: collection) {\n r = mapper.apply(r, func.apply(t));\n }\n return sumator.apply(r);\n }", "public <O extends FighterOperation> O apply(O operation);", "R apply(T t, U u, V v);", "public static Expression reduce(Expression expression) { throw Extensions.todo(); }", "O transform(R result);", "public void AllReduce(double[] inData, double[] outData, MpiOp op) {\n\n double[] result = new double[inData.length];\n\n\n\n Reduce(inData, result, op, 0);\n\n //REDUCE_TAG--;\n\n Bcast(result, 0);\n\n System.arraycopy(result, 0, outData, 0, result.length);\n }", "public Collection<Element> getOperations() {\n Stream<Element> combinedStream = Stream.of(aCollection, cCollection)\n .flatMap(Collection::stream);\n return combinedStream.collect(Collectors.toList());\n }", "public void AllReduce(float[] inData, float[] outData, MpiOp op) {\n\n float[] result = new float[inData.length];\n\n\n Reduce(inData, result, op, 0);\n\n //REDUCE_TAG--;\n\n Bcast(result, 0);\n\n System.arraycopy(result, 0, outData, 0, result.length);\n }", "public void AllReduce(int[] inData, int[] outData, MpiOp op) {\n\n int[] result = new int[inData.length];\n\n\n Reduce(inData, result, op, 0);\n\n //REDUCE_TAG--;\n\n Bcast(result, 0);\n\n System.arraycopy(result, 0, outData, 0, result.length);\n }", "void evaluate()\n\t{\n\t\toperation.evaluate();\n\t}", "public void AllReduce(long[] inData, long[] outData, MpiOp op) {\n\n long[] result = new long[inData.length];\n\n\n\n Reduce(inData, result, op, 0);\n\n //REDUCE_TAG--;\n\n Bcast(result, 0);\n\n System.arraycopy(result, 0, outData, 0, result.length);\n }", "static AggregateOperation compose(Iterable<AggregateOperation> operations) {\n // NOTE(user): It's possible to replace the following two sets with a single map.\n Set<SegmentId> segmentsToRemove = new TreeSet<SegmentId>(segmentComparator);\n Set<SegmentId> segmentsToAdd = new TreeSet<SegmentId>(segmentComparator);\n Set<SegmentId> segmentsToEndModifying = new TreeSet<SegmentId>(segmentComparator);\n Set<SegmentId> segmentsToStartModifying = new TreeSet<SegmentId>(segmentComparator);\n Set<ParticipantId> participantsToRemove = new TreeSet<ParticipantId>(participantComparator);\n Set<ParticipantId> participantsToAdd = new TreeSet<ParticipantId>(participantComparator);\n Map<String, DocOpList> docOps = new TreeMap<String, DocOpList>();\n for (AggregateOperation operation : operations) {\n composeIds(operation.segmentsToRemove, segmentsToRemove, segmentsToAdd);\n composeIds(operation.segmentsToAdd, segmentsToAdd, segmentsToRemove);\n composeIds(operation.segmentsToEndModifying, segmentsToEndModifying, segmentsToStartModifying);\n composeIds(operation.segmentsToStartModifying, segmentsToStartModifying, segmentsToEndModifying);\n composeIds(operation.participantsToRemove, participantsToRemove, participantsToAdd);\n composeIds(operation.participantsToAdd, participantsToAdd, participantsToRemove);\n for (DocumentOperations documentOps : operation.docOps) {\n DocOpList docOpList = docOps.get(documentOps.id);\n if (docOpList != null) {\n docOps.put(documentOps.id, docOpList.concatenateWith(documentOps.operations));\n } else {\n docOps.put(documentOps.id, documentOps.operations);\n }\n }\n }\n return new AggregateOperation(\n new ArrayList<SegmentId>(segmentsToRemove),\n new ArrayList<SegmentId>(segmentsToAdd),\n new ArrayList<SegmentId>(segmentsToEndModifying),\n new ArrayList<SegmentId>(segmentsToStartModifying),\n new ArrayList<ParticipantId>(participantsToRemove),\n new ArrayList<ParticipantId>(participantsToAdd),\n mapToList(docOps));\n }", "public static <E, R> R foldLeft(Iterable<E> elems, R init, BiFunction<R, E, R> foldFun) {\n R acc = init;\n for (E elem : elems) {\n acc = foldFun.apply(acc, elem);\n }\n return acc;\n }", "private List<Node> compute() {\n\t\t\tgetGraphFromResolvedTree(root);\n\t\t\tdepthFirst(root);\n\t\t\treturn result;\n\t\t}", "private static void lowerDfs(int acc, int offset, List<Integer> list, int[] array, List<Integer> ops, List<String> res, int target){\n\t\tif(offset == list.size() - 1){\n\t\t\tif(acc == target)\n\t\t\t\tputRes(array, ops, );\n\t\t}\n\t}", "public abstract ArrayList<Object> calculateTransform(ArrayList<Integer> arr);", "@Override\r\n public Double reduce(Double identity, Function accumulator) {\r\n return head.reduce(identity, accumulator);\r\n }", "public EvPopulation<T> apply(EvPopulation<T> population) {\n\n int population_size = population.size();\n\n combine_parent_selector.init(population, 2, population_size);\n\n EvPopulation<T> result = new EvPopulation<T>(population_size + 3);\n\n // Generate children since population is not filled\n while (result.size() < population_size)\n combine(combine_parent_selector.getNextParents(), result);\n\n // Remove overfull\n while (result.size() > population_size)\n result.remove(result.size() - 1);\n\n return result;\n }", "public void reduce( T mrt ) { }", "public void reduce( T mrt ) { }", "R apply(T t, U u, S s, E e);", "Double reduce(Double identity, Function accumulator);", "public final void sub() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue - topMostValue);\n\t\t}\n\t}", "T collect(V source);", "Population<T> operate(Population<T> population);", "public Object reduce( Set<Action> requiredActions, final ReduceFn fn,\n\t\t\tfinal Object initial ) throws AccessDeniedException,\n\t\t\tEmptyListException, ListIndexException, InvalidListException;", "public void apply(at.ac.tuwien.dsg.mela.common.monitoringConcepts.ServiceMonitoringSnapshot serviceMonitoringSnapshot) {\n\n //1'step extract the monitoring data for the target service elements\n Map<MonitoredElement, MonitoredElementMonitoringSnapshot> levelMonitoringData = serviceMonitoringSnapshot.getMonitoredData(targetMonitoredElementLevel);\n\n if (levelMonitoringData == null) {\n Logger.getRootLogger().log(Level.WARN, \"Level \" + targetMonitoredElementLevel + \" not found in monitoring data\");\n return;\n }\n\n Collection<MonitoredElementMonitoringSnapshot> toBeProcessed = new ArrayList<MonitoredElementMonitoringSnapshot>();\n\n //step 2\n //if target IDs have ben supplied, use them to extract only the monitoring data for the target elements, else process all elements on this level\n if (targetMonitoredElementIDs.isEmpty()) {\n //if all on level, get each elementy data, and add its children data. Might destroy the data in the long run\n Collection<MonitoredElementMonitoringSnapshot> levelData = levelMonitoringData.values();\n for (MonitoredElementMonitoringSnapshot levelElementData : levelData) {\n\n toBeProcessed.add(levelElementData);\n }\n } else {\n for (String id : targetMonitoredElementIDs) {\n\n //TODO: an issue is that in the MonitoredElementMonitoringSnapshot I do NOT hold the children snapshots.\n //So now I follow the MonitoredElement children, get their MonitoredElementMonitoringSnapshot, and enrich the MonitoredElementMonitoringSnapshot supplied to the operations\n MonitoredElement element = new MonitoredElement(id);\n if (levelMonitoringData.containsKey(element)) {\n MonitoredElementMonitoringSnapshot elementData = levelMonitoringData.get(element);\n toBeProcessed.add(elementData);\n } else {\n Logger.getRootLogger().log(Level.WARN, \"Element with ID \" + id + \" not found in monitoring data\");\n }\n }\n }\n //step 3 \n //for each MonitoredElementMonitoringSnapshot apply composition rule and enrich monitoring data in place\n for (MonitoredElementMonitoringSnapshot snapshot : toBeProcessed) {\n\n MetricValue result = operation.apply(snapshot);\n// resultingMetric.setMonitoredElement(snapshot.getMonitoredElement());\n if (result != null) {\n //put new composite metric\n snapshot.putMetric(resultingMetric, result);\n }\n }\n }", "@Override\n\tpublic Object reduce( final ReduceFn fn, final Object initial )\n\t\t\tthrows AccessDeniedException, EmptyListException,\n\t\t\tListIndexException, InvalidListException;", "R apply(T input1, U input2, V input3);", "@Override\n public BinaryOperator<List<Integer>> combiner() {\n return (resultList1, resultList2) -> {\n Integer currentTotal1 = resultList1.get(0);\n Integer currentTotal2 = resultList2.get(0);\n currentTotal1 += currentTotal2;\n resultList1.set(0, currentTotal1);\n return resultList1;\n };\n }", "R apply(T t);", "protected void updateValues(){\n double total = 0;\n for(int i = 0; i < values.length; i++){\n values[i] = \n operation(minimum + i * (double)(maximum - minimum) / (double)numSteps);\n \n total += values[i];\n }\n for(int i = 0; i < values.length; i++){\n values[i] /= total;\n }\n }", "K apply(T arg1, U arg2);", "public void reduce4( T mrt ) {\n // Reduce any AppendableVecs\n for( int i=0; i<_fr._vecs.length; i++ )\n if( _fr._vecs[i] instanceof AppendableVec )\n ((AppendableVec)_fr._vecs[i]).reduce((AppendableVec)mrt._fr._vecs[i]);\n // User's reduction\n reduce(mrt);\n }", "public static Object compute(OpUnary op, Object value) {\n\t\tswitch (op) {\n\t\tcase BITNOT:\n\t\t\treturn ValueUtil.not(value);\n\t\tcase LOGIC_NOT:\n\t\t\treturn ValueUtil.logicNot(value);\n\t\tcase MINUS:\n\t\t\treturn ValueUtil.negate(value);\n\t\tcase NUM_ELTS:\n\t\t\treturn ValueUtil.length(value);\n\t\tdefault:\n\t\t\treturn null;\n\t\t}\n\t}", "public void runOneIteration() {\n // Update user latent vectors\n\n //IntStream.range(0,userCount).peek(i->update_user(i)).forEach(j->{});\n\n for (int u = 0; u < userCount; u ++) {\n update_user(u);\n }\n\n // Update item latent vectors\n for (int i = 0; i < itemCount; i ++) {\n update_item(i);\n }\n }", "interface Container2Operation {\r\n \r\n /**\r\n * Evaluates the specific function on two container values possibly modifying <code>result</code>.\r\n * \r\n * @param c1 the first container (must not be modified)\r\n * @param c2 the second container (must not be modified)\r\n * @param result the result (to be modified as a side effect)\r\n */\r\n public void evaluate(ContainerValue c1, ContainerValue c2, List<Value> result);\r\n }", "private static <T> T identity(Collection<T> collection) {\n return identity(collection.iterator());\n }", "public void evaluate(ContainerValue c1, ContainerValue c2, List<Value> result);", "public void applyToAncestors( Operation operation ) {\n PlanNode ancestor = getParent();\n while (ancestor != null) {\n operation.apply(ancestor);\n ancestor = ancestor.getParent();\n }\n }", "@Override\n\tpublic void forEach(Processor processor) {\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tprocessor.process(elements[i]);\n\t\t}\n\t}", "protected ConstraintSyntaxTree reduce(OCLFeatureCall assignment) { \n result = assignment;\n \n if (OclKeyWords.ASSIGNMENT.equals(assignment.getOperation())) {\n result = null;\n assignment.getParameter(0).accept(this);\n \n if (filtered && null != result) {\n result = new OCLFeatureCall(assignment.getOperand(), assignment.getOperation(), result);\n try {\n // Needed for setting the correct operation\n result.inferDatatype();\n } catch (CSTSemanticException e) {\n result = null;\n Bundle.getLogger(AssignmentReducer.class).exception(e);\n }\n } else if (!filtered) {\n result = assignment;\n }\n }\n \n return result;\n }", "public void apply( Traversal order,\n Operation operation ) {\n assert order != null;\n switch (order) {\n case LEVEL_ORDER:\n operation.apply(this);\n applyLevelOrder(order, operation);\n break;\n case PRE_ORDER:\n operation.apply(this);\n for (PlanNode child : this) {\n child.apply(order, operation);\n }\n break;\n case POST_ORDER:\n for (PlanNode child : this) {\n child.apply(order, operation);\n }\n operation.apply(this);\n break;\n }\n }", "@Override // com.google.common.collect.AbstractIterator\n public C computeNext() {\n while (!this.elemItr.hasNext()) {\n if (!this.rangeItr.hasNext()) {\n return (C) ((Comparable) endOfData());\n }\n this.elemItr = ContiguousSet.create(this.rangeItr.next(), AsSet.this.domain).iterator();\n }\n return this.elemItr.next();\n }", "default <V> Fn<V, U> compose(Fn<V, T> before){\n Objects.requireNonNull(before);\n return (V v)-> apply(before.apply(v));\n }", "public synchronized Iterator<E> iteratorUpAll()\n {\n if (isEmpty())\n return new CNullIterator<E>();\n\n return new NodeIteratorUp<E>(this, this.m_FirstNode, this.m_LastNode.m_Element);\n }", "public static <R, T> R foldr(Function2<R, T, R> f, R ini, Collection<T> c) {\r\n @SuppressWarnings(\"unchecked\")\r\n T[] array = (T[]) c.toArray();\r\n\r\n R result = ini;\r\n for (int i = array.length - 1; i >= 0; i--) {\r\n result = f.apply(array[i], result);\r\n }\r\n\r\n return result;\r\n }", "private void operateOverSubnodes(Node node, OperationOverNodes operation) {\n\t\tif (node != null) {\n\t\t\toperation.operate(node);\n\t\t\tNode next = node.getSubnode();\n\t\t\twhile (next != null) {\n\t\t\t\toperateOverSubnodes(next, operation);\n\t\t\t\tnext = next.getNext();\n\t\t\t}\n\t\t}\n\t}", "protected ContainerValueOperationEvaluator(ContainerValueOperation op) {\r\n this.op = op;\r\n }", "void recalc() {\n\t\tthis.currentValue = baseValue;\n\t\tthis.modifiers.stream().forEach(a -> this.currentValue += a.getValue());\n\t}", "protected abstract boolean reduce();", "protected SortedSet<Operation> nestOperations(SortedSet<Operation> operations) {\n\t\tSet<Operation> markedForRemoval = new HashSet<Operation>();\n\t\tfor (Operation op : operations) {\n\t\t\tSortedSet<Operation> toBeNested = new TreeSet<Operation>(SORT_BY_POSITION_AND_SUSPECT_TYPE);\n\t\t\tif (toBeNested.contains(op)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tSourcePosition opPos = op.getPosition();\n\t\t\tSortedSet<Operation> tailSet = operations.tailSet(op);\n\t\t\tIterator<Operation> tailIter = tailSet.iterator();\n\t\t\ttailIter.next(); // skip op itself\n\t\t\twhile (tailIter.hasNext()) {\n\t\t\t\tOperation tailOp = tailIter.next();\n\t\t\t\tSourcePosition tailOpPos = tailOp.getPosition();\n\t\t\t\tif (tailOpPos.getURL().equals(opPos.getURL()) && tailOpPos.getStartOffset() < opPos.getEndOffset()) {\n\t\t\t\t\t// if the next operation has the same URL and should be nested.\n\t\t\t\t\ttoBeNested.add(tailOp);\n\t\t\t\t} else {\n\t\t\t\t\t// no need to look further, there won't be any nesting further down\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (toBeNested.size() > 0) {\n\t\t\t\top.addChildren(nestOperations(toBeNested));\n\t\t\t}\n\t\t\tmarkedForRemoval.addAll(toBeNested);\n\t\t}\n\t\t// remove the nested Operations from the this level\n\t\toperations.removeAll(markedForRemoval);\n\t\treturn operations;\n\t}", "protected static void performReduceWithABinaryOperator() {\n Integer sum = Stream.of(1, 2, 3, 4, 5).reduce(0, Integer::sum);\n\n Integer minValue = Stream.of(5, 4, 9, 2, 1).reduce(Integer.MIN_VALUE, Integer::max);\n\n String concatenation = Stream.of(\"str \", \"= \", \"alt \", \"string\")\n // the first parameter becomes the target of the concat method and the second one is the argument to concat\n // the target, the parameter and the result are of the same type and this can be considered a binary\n // operator for the reduce method\n .reduce(\"\", String::concat);\n System.out.println(concatenation);\n }", "void apply(T input);", "@Override\r\n\tpublic Integer getValue() {\r\n\r\n\t\treturn op.perform(left, right);\r\n\t}", "public static final <T, R> R foldIndices(java.util.List<? extends T> r3, R r4, kotlin.jvm.functions.Function2<? super R, ? super T, ? extends R> r5) {\n /*\n java.lang.String r0 = \"$this$foldIndices\"\n kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull(r3, r0)\n java.lang.String r0 = \"operation\"\n kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull(r5, r0)\n r0 = r3\n java.util.Collection r0 = (java.util.Collection) r0\n int r0 = r0.size()\n r1 = 0\n L_0x0012:\n if (r1 >= r0) goto L_0x001f\n java.lang.Object r2 = r3.get(r1)\n java.lang.Object r4 = r5.invoke(r4, r2)\n int r1 = r1 + 1\n goto L_0x0012\n L_0x001f:\n return r4\n */\n throw new UnsupportedOperationException(\"Method not decompiled: coil.util.Collections.foldIndices(java.util.List, java.lang.Object, kotlin.jvm.functions.Function2):java.lang.Object\");\n }", "static public void doCollapse_collection(RunData data)\n\t{\n\t\tSessionState state = ((JetspeedRunData)data).getPortletSessionState (((JetspeedRunData)data).getJs_peid ());\n\t\tSortedSet expandedItems = (SortedSet) state.getAttribute(STATE_EXPANDED_COLLECTIONS);\n\t\tif(expandedItems == null)\n\t\t{\n\t\t\texpandedItems = new TreeSet();\n\t\t}\n\t\tMap folderSortMap = (Map) state.getAttribute(STATE_EXPANDED_FOLDER_SORT_MAP);\n\t\tif(folderSortMap == null)\n\t\t{\n\t\t\tfolderSortMap = new Hashtable();\n\t\t\tstate.setAttribute(STATE_EXPANDED_FOLDER_SORT_MAP, folderSortMap);\n\t\t}\n\n\t\t//get the ParameterParser from RunData\n\t\tParameterParser params = data.getParameters ();\n\t\tString collectionId = params.getString(\"collectionId\");\n\n\t\t// save the current selections\n\t\tSet selectedSet = new TreeSet();\n\t\tString[] selectedItems = data.getParameters ().getStrings (\"selectedMembers\");\n\t\tif(selectedItems != null)\n\t\t{\n\t\t\tselectedSet.addAll(Arrays.asList(selectedItems));\n\t\t}\n\t\tstate.setAttribute(STATE_LIST_SELECTIONS, selectedSet);\n\n\t\tSortedSet newSet = new TreeSet();\n\t\tIterator l = expandedItems.iterator();\n\t\twhile (l.hasNext ())\n\t\t{\n\t\t\t// remove the collection id and all of the subcollections\n//\t\t Resource collection = (Resource) l.next();\n//\t\t\tString id = (String) collection.getId();\n\t\t String id = (String) l.next();\n\n\t\t\tif (id.indexOf (collectionId)==-1)\n\t\t\t{\n\t//\t\t\tnewSet.put(id,collection);\n\t\t\t\tnewSet.add(id);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfolderSortMap.remove(id);\n\t\t\t}\n\t\t}\n\n\t\tstate.setAttribute(STATE_EXPANDED_COLLECTIONS, newSet);\n\n\t\t// remove this folder id into the set to be event-observed\n\t\tremoveObservingPattern(collectionId, state);\n\n\t}", "@Override\n protected Integer compute() {\n final int currentSize = endPos - startPos;\n if (currentSize <= UNIT_SIZE) {\n return computeSum();\n }\n int center = currentSize / 2;\n\n /*\n * On the right part, it calls `compute()`; on the left part, it\n * calls `fork()`:\n *\n * 1. Calling `fork()` makes it execute asynchronously.\n * 2. Calling `compute()` will recursively create (left and right)\n * `CalcSum` objects, if it still needs to be divided into\n * smaller tasks.\n */\n int leftEnd = startPos + center;\n CalcSum leftSum = new CalcSum(values, startPos, leftEnd);\n leftSum.fork();\n\n int rightStart = startPos + center + 1;\n CalcSum rightSum = new CalcSum(values, rightStart, endPos);\n /*\n * `leftSum.join()` waits until it returns a value; `compute()`\n * is main computation performed by task.\n */\n return rightSum.compute() + leftSum.join();\n }", "public void calcualteFeatureValue(Collection<Instance> instanceCollection);", "protected double sum(IntegralImage II, int u, int v, double scale) {\n\t\tdouble sum = 0;\n\t\tfor (FeatureTree tree : trees) {\n\t\t\tsum = sum + tree.eval(II, u, v, scale);\n\t\t}\n\t\treturn sum;\n\t}", "@Override // com.google.common.collect.AbstractIterator\n public C computeNext() {\n while (!this.elemItr.hasNext()) {\n if (!this.rangeItr.hasNext()) {\n return (C) ((Comparable) endOfData());\n }\n this.elemItr = ContiguousSet.create(this.rangeItr.next(), AsSet.this.domain).descendingIterator();\n }\n return this.elemItr.next();\n }", "@Override\n public BiConsumer<List<Integer>, Employee> accumulator() {\n return (resultList, employee) -> {\n if (resultList.isEmpty()) resultList.add(employee.getSalary());\n else {\n Integer currentTotal = resultList.get(0);\n currentTotal += employee.getSalary();\n resultList.set(0, currentTotal);\n }\n };\n }", "public static <S, D> Collection<D> transform(Collection<S> collection, Transformation<S, D> transformation) {\n \tCollection<D> ret = new ArrayList<D>();\n \tfor(S element : collection) {\n \t\tret.add(transformation.applyTo(element));\n \t}\n \treturn ret;\n }", "Operations operations();", "public static <E,F> F fold_with_map(\n Stream<E> stream,\n Function<? super E,F> folding_adapter\n ) {\n if (stream == null) return null;\n Stream<F> folding_stream = stream.map(folding_adapter);\n return Streams.last(folding_stream);\n }", "public double getCurrent( )\r\n {\r\n\t double element = 0; \r\n\t if(isCurrent() != true){// Student will replace this return statement with their own code:\r\n\t throw new IllegalStateException (\"no current element, getCurrent may not be called\");\r\n\t }\r\n\t else\r\n\t \t element = element + (cursor.getData()) ;\r\n\t return element; \r\n }", "public abstract T accumulate(T left, T right);", "@Override\n public void apply(Operation operation) {\n try {\n waitingOperations.put(operation);\n } catch (InterruptedException ex) {\n //handle\n }\n }", "public void ExtremeValuesTraversal(NodeVisitor action){\n\t\tQueue queue = new Queue();\n\t\tqueue.enqueue(this);\n\t\twhile( ! queue.isEmpty() )\n\t\t{\n\t\t\tBinaryTree tree = (BinaryTree)queue.dequeue();\n\t\t\tif ( ! tree.isEmpty() )\n {\n \t\t\taction.visit(tree.getElement());\n \t\t\tqueue.enqueue(tree.leftTree());\n \t\t\tqueue.enqueue(tree.rightTree());\n }\n\t\t}\n\t\t\n\t}", "public final PropagationStrategy coll(ArrayList<? extends ISchedulable> elements, CombinedAttribute ca) throws RecognitionException {\n PropagationStrategy ps = null;\n\n\n CommonTree r = null;\n CommonTree m = null;\n Iterator it = null;\n\n\n if (elements.isEmpty()) {\n LOGGER.error(\"% Create a empty collection\");\n throw new FZNException(\"Create a empty collection\");\n } else if (elements.size() == 1) {\n LOGGER.warn(\"% Create a collection with a single element\");\n }\n\n try {\n // parser/flatzinc/FlatzincFullExtWalker.g:435:5: ( ^( QUEUE it= qiter ) | ^( LIST (r= REV )? it= liter ) | ^( HEAP (m= MAX )? it= qiter ) )\n int alt24 = 3;\n switch (input.LA(1)) {\n case QUEUE: {\n alt24 = 1;\n }\n break;\n case LIST: {\n alt24 = 2;\n }\n break;\n case HEAP: {\n alt24 = 3;\n }\n break;\n default:\n NoViableAltException nvae =\n new NoViableAltException(\"\", 24, 0, input);\n\n throw nvae;\n\n }\n\n switch (alt24) {\n case 1:\n // parser/flatzinc/FlatzincFullExtWalker.g:435:7: ^( QUEUE it= qiter )\n {\n match(input, QUEUE, FOLLOW_QUEUE_in_coll978);\n\n match(input, Token.DOWN, null);\n pushFollow(FOLLOW_qiter_in_coll982);\n it = qiter();\n\n state._fsp--;\n\n\n match(input, Token.UP, null);\n\n\n ps = new Queue(elements.toArray(new ISchedulable[elements.size()]));\n ps = it.set(ps);\n ps.attachEvaluator(ca);\n\n\n }\n break;\n case 2:\n // parser/flatzinc/FlatzincFullExtWalker.g:441:7: ^( LIST (r= REV )? it= liter )\n {\n match(input, LIST, FOLLOW_LIST_in_coll998);\n\n match(input, Token.DOWN, null);\n // parser/flatzinc/FlatzincFullExtWalker.g:441:15: (r= REV )?\n int alt22 = 2;\n switch (input.LA(1)) {\n case REV: {\n alt22 = 1;\n }\n break;\n }\n\n switch (alt22) {\n case 1:\n // parser/flatzinc/FlatzincFullExtWalker.g:441:15: r= REV\n {\n r = (CommonTree) match(input, REV, FOLLOW_REV_in_coll1002);\n\n }\n break;\n\n }\n\n\n pushFollow(FOLLOW_liter_in_coll1007);\n it = liter();\n\n state._fsp--;\n\n\n match(input, Token.UP, null);\n\n\n ISchedulable[] elts = elements.toArray(new ISchedulable[elements.size()]);\n // check if an order is required\n boolean order = false;\n for (int i = 0; i < elts.length; i++) {\n try {\n elts[i].evaluate();\n order = true;\n } catch (NullPointerException npe) {\n if (order) {\n LOGGER.error(\"% Cannot sort the collection, keys are missing\");\n throw new FZNException(\"Cannot sort the collection, keys are missing\");\n }\n }\n }\n ps = new Sort(order, r != null, elts);\n ps = it.set(ps);\n ps.attachEvaluator(ca);\n\n\n }\n break;\n case 3:\n // parser/flatzinc/FlatzincFullExtWalker.g:461:7: ^( HEAP (m= MAX )? it= qiter )\n {\n match(input, HEAP, FOLLOW_HEAP_in_coll1023);\n\n match(input, Token.DOWN, null);\n // parser/flatzinc/FlatzincFullExtWalker.g:461:15: (m= MAX )?\n int alt23 = 2;\n switch (input.LA(1)) {\n case MAX: {\n alt23 = 1;\n }\n break;\n }\n\n switch (alt23) {\n case 1:\n // parser/flatzinc/FlatzincFullExtWalker.g:461:15: m= MAX\n {\n m = (CommonTree) match(input, MAX, FOLLOW_MAX_in_coll1027);\n\n }\n break;\n\n }\n\n\n pushFollow(FOLLOW_qiter_in_coll1032);\n it = qiter();\n\n state._fsp--;\n\n\n match(input, Token.UP, null);\n\n\n ISchedulable[] elts = elements.toArray(new ISchedulable[elements.size()]);\n for (int i = 0; i < elts.length; i++) {\n try {\n elts[i].evaluate();\n } catch (NullPointerException npe) {\n LOGGER.error(\"% Cannot sort the collection, keys are missing\");\n throw new FZNException(\"Cannot sort the collection, keys are missing\");\n }\n }\n ps = new SortDyn(m != null, elts);\n ps = it.set(ps);\n ps.attachEvaluator(ca);\n\n\n }\n break;\n\n }\n } catch (RecognitionException re) {\n reportError(re);\n recover(input, re);\n } finally {\n // do for sure before leaving\n }\n return ps;\n }", "protected T operation(final String operatorName, final List<T> elements) {\n Operation<T> operation = registry.getElement(operatorName);\n Assert.notNull(operation, \"Unknown operation: \" + operatorName);\n LOGGER.debug(\"{} {} elements\", operation.getKey(), elements.size());\n return operation.calculate(elements);\n }", "public void enfoncerMult() {\n\t\ttry {\n\t\t\tthis.op = new Mult();\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 (EmptyStackException e) {\n\t\t\tSystem.out.println(\"Erreur de syntaxe : Saisir deux operandes avant de saisir un operateur\");\n\t\t}\n\t}", "protected class_496 method_1607() {\n if (this.field_934.field_183 != this.field_938) {\n throw new ConcurrentModificationException();\n } else {\n class_496 var1 = this.field_937;\n if (var1 == null) {\n throw new NoSuchElementException(\"No next() entry in the iteration\");\n } else {\n class_496[] var2 = this.field_934.field_181;\n int var3 = this.field_935;\n\n class_496 var4;\n for(var4 = var1.field_903; var4 == null && var3 > 0; var4 = var2[var3]) {\n --var3;\n }\n\n this.field_937 = var4;\n this.field_935 = var3;\n this.field_936 = var1;\n return var1;\n }\n }\n }", "public static Expression reduceAndCheck(Expression expression) { throw Extensions.todo(); }", "@Override\n\tpublic void operation() {\n\t\tfor(Object object:list) {\n\t\t\t((Component)object).operation();\n\t\t}\n\t}", "@Override\n public void reduce() {\n if(null != getState())\n switch(getState()) {\n case OPERATOR:\n if (getDispenser().tokenIsOperator() && numOpNumOnStack())\n priorityReduce();\n break;\n case RIGHT_PAREN:\n if (getDispenser().tokenIsRightParen()) {\n if (!getStack().contains('('))\n throw new RuntimeException(\"Error -- mismatched parentheses\");\n while ((char)getStack().get(getStack().size() - 2) != '(')\n reduceNumOpNum();\n double aNum = (double)getStack().pop();\n getStack().pop();\n getStack().push(aNum);\n }\n break;\n case END:\n if (getDispenser().tokenIsEOF()) {\n if(getStack().contains('('))\n throw new RuntimeException(\"Error -- mismatched parentheses\");\n while(numOpNumOnStack())\n reduceNumOpNum();\n if(getStack().size() != 1)\n throw new RuntimeException(\"Error -- mismatched parentheses\");\n }\n break;\n }\n }", "public final void collect(Collection<? super T> output) {\n Node n = getHead();\n while (true) {\n Node next = (Node) n.get();\n if (next != null) {\n Object v = leaveTransform(next.value);\n if (!NotificationLite.isComplete(v) && !NotificationLite.isError(v)) {\n output.add(NotificationLite.getValue(v));\n n = next;\n } else {\n return;\n }\n } else {\n return;\n }\n }\n }", "private void processCollection(MotifCollection collection, String strategy) throws ExecutionError {\n List<Motif> list=collection.getPayload();\n for (Motif motif:list) {\n String motifname=motif.getName();\n Motif[] temp=null;\n try {\n temp=getMotif(motifname);\n } catch (ExecutionError gme) { // this happens if the motifname is not a recognized ID\n if (skipUnrecognizedCheckbox.isSelected()) continue;\n else throw gme;\n }\n Motif originalMotif=temp[0];\n Motif updatedMotif=temp[1]; \n try {\n if (strategy.equals(REPLACE_CURRENT)) {\n String shortname=motif.getShortName();\n if (shortname!=null && !shortname.isEmpty()) updatedMotif.setShortName(shortname);\n String longname=motif.getLongName();\n if (longname!=null && !longname.isEmpty()) updatedMotif.setLongName(longname);\n String classification=motif.getClassification();\n if (classification!=null && !classification.isEmpty()) updatedMotif.setClassification(classification);\n int quality=motif.getQuality();\n if (quality!=6) updatedMotif.setQuality(quality);\n String part=motif.getPart();\n if (part!=null && !part.equals(Motif.FULL)) updatedMotif.setPart(part);\n String factors=motif.getBindingFactors();\n if (factors!=null && !factors.isEmpty()) updatedMotif.setBindingFactors(factors);\n String organisms=motif.getOrganisms();\n if (organisms!=null && !organisms.isEmpty()) updatedMotif.setOrganisms(organisms);\n ArrayList<String> alternatives=motif.getKnownDuplicatesNames();\n String[] namelist=new String[alternatives.size()];\n if (alternatives!=null && !alternatives.isEmpty()) updatedMotif.setKnownDuplicatesNames(alternatives.toArray(namelist));\n ArrayList<String> interaction=motif.getInteractionPartnerNames();\n namelist=new String[interaction.size()];\n if (interaction!=null && !interaction.isEmpty()) updatedMotif.setInteractionPartnerNames(interaction.toArray(namelist));\n ArrayList<String> tissues=motif.getTissueExpressionAsStringArray();\n namelist=new String[tissues.size()];\n if (tissues!=null && !tissues.isEmpty()) updatedMotif.setTissueExpression(tissues.toArray(namelist));\n for (String userproperty:motif.getUserDefinedProperties()) {\n Object value=motif.getUserDefinedPropertyValue(userproperty);\n if (value instanceof ArrayList) value=((ArrayList)value).clone();\n updatedMotif.setUserDefinedPropertyValue(userproperty, value);\n }\n double[][] matrix=motif.getMatrix();\n if (matrix!=null) updatedMotif.setMatrix(matrix);\n }\n else if (strategy.equals(MERGE_OR_REPLACE_CURRENT)) {\n String shortname=motif.getShortName();\n if (shortname!=null && !shortname.isEmpty()) updatedMotif.setShortName(shortname);\n String longname=motif.getLongName();\n if (longname!=null && !longname.isEmpty()) updatedMotif.setLongName(longname);\n String classification=motif.getClassification();\n if (classification!=null && !classification.isEmpty()) updatedMotif.setClassification(classification);\n int quality=motif.getQuality();\n if (quality!=6) updatedMotif.setQuality(quality);\n String part=motif.getPart();\n if (part!=null && !part.equals(Motif.FULL)) updatedMotif.setPart(part);\n \n String factors=motif.getBindingFactors(); \n if (factors!=null && !factors.isEmpty()) mergeOrReplaceCurrentProperty(originalMotif,updatedMotif, \"Factors\", factors);\n String organisms=motif.getOrganisms();\n if (organisms!=null && !organisms.isEmpty()) mergeOrReplaceCurrentProperty(originalMotif,updatedMotif, \"Organisms\", organisms);\n \n ArrayList<String> alternatives=motif.getKnownDuplicatesNames();\n ArrayList<String> alternativesOriginal=originalMotif.getKnownDuplicatesNames();\n if (alternatives!=null && !alternatives.isEmpty()) updatedMotif.setKnownDuplicatesNames(mergeStringLists(alternativesOriginal, alternatives));\n \n ArrayList<String> interactions=motif.getInteractionPartnerNames();\n ArrayList<String> interactionsOriginal=originalMotif.getInteractionPartnerNames();\n if (interactions!=null && !interactions.isEmpty()) updatedMotif.setInteractionPartnerNames(mergeStringLists(interactionsOriginal, interactions));\n \n ArrayList<String> tissues=motif.getTissueExpressionAsStringArray();\n ArrayList<String> tissuesOriginal=originalMotif.getTissueExpressionAsStringArray();\n if (tissues!=null && !tissues.isEmpty()) updatedMotif.setTissueExpression(mergeStringLists(tissuesOriginal, tissues));\n \n double[][] matrix=motif.getMatrix();\n if (matrix!=null) updatedMotif.setMatrix(matrix); \n \n for (String userproperty:motif.getUserDefinedProperties()) {\n Class type=Motif.getClassForUserDefinedProperty(userproperty, gui.getEngine());\n if (type!=null && (type.equals(ArrayList.class) || type.equals(String.class))) { // can the new properties be merged?\n String merged=mergeStringsLists( (String)originalMotif.getUserDefinedPropertyValueAsType(userproperty,String.class), (String)motif.getUserDefinedPropertyValueAsType(userproperty,String.class)); \n String[] mergedSplit=merged.split(\"\\\\s*,\\\\s*\");\n ArrayList<String> value=new ArrayList<String>(mergedSplit.length);\n value.addAll(Arrays.asList(merged));\n updatedMotif.setUserDefinedPropertyValue(userproperty, value);\n } else updatedMotif.setUserDefinedPropertyValue(userproperty, motif.getUserDefinedPropertyValue(userproperty)); // the property can not be merged \n } \n \n }\n else if (strategy.equals(MERGE_OR_KEEP_CURRENT)) {\n String shortname=motif.getShortName();\n String originalshortname=originalMotif.getShortName();\n if (shortname!=null && !shortname.isEmpty() && (originalshortname==null || originalshortname.isEmpty())) updatedMotif.setShortName(shortname);\n String longname=motif.getLongName();\n String originallongname=originalMotif.getLongName();\n if (longname!=null && !longname.isEmpty() && (originallongname==null || originallongname.isEmpty())) updatedMotif.setLongName(longname);\n String classification=motif.getClassification();\n String originalclassification=originalMotif.getClassification(); \n if (classification!=null && !classification.isEmpty() && (originalclassification==null || originalclassification.isEmpty())) updatedMotif.setClassification(classification);\n// int quality=motif.getQuality();\n// if (quality!=6) updatedMotif.setQuality(quality);\n// String part=motif.getPart();\n// if (part!=null && !part.equals(Motif.FULL)) updatedMotif.setPart(part);\n String factors=motif.getBindingFactors(); \n if (factors!=null && !factors.isEmpty()) mergeOrKeepCurrentProperty(originalMotif,updatedMotif, \"Factors\", factors);\n String organisms=motif.getOrganisms();\n if (organisms!=null && !organisms.isEmpty()) mergeOrKeepCurrentProperty(originalMotif,updatedMotif, \"Organisms\", organisms);\n \n ArrayList<String> alternatives=motif.getKnownDuplicatesNames();\n ArrayList<String> alternativesOriginal=originalMotif.getKnownDuplicatesNames();\n if (alternatives!=null && !alternatives.isEmpty()) updatedMotif.setKnownDuplicatesNames(mergeStringLists(alternativesOriginal, alternatives));\n \n ArrayList<String> interactions=motif.getInteractionPartnerNames();\n ArrayList<String> interactionsOriginal=originalMotif.getInteractionPartnerNames();\n if (interactions!=null && !interactions.isEmpty()) updatedMotif.setInteractionPartnerNames(mergeStringLists(interactionsOriginal, interactions));\n \n ArrayList<String> tissues=motif.getTissueExpressionAsStringArray();\n ArrayList<String> tissuesOriginal=originalMotif.getTissueExpressionAsStringArray();\n if (tissues!=null && !tissues.isEmpty()) updatedMotif.setTissueExpression(mergeStringLists(tissuesOriginal, tissues));\n \n if (originalMotif.getMatrix()==null) {\n double[][] matrix=motif.getMatrix();\n if (matrix!=null) updatedMotif.setMatrix(matrix); \n }\n \n for (String userproperty:motif.getUserDefinedProperties()) {\n Class type=Motif.getClassForUserDefinedProperty(userproperty, gui.getEngine());\n if (type!=null && (type.equals(ArrayList.class) || type.equals(String.class))) { // can the new properties be merged?\n String merged=mergeStringsLists( (String)originalMotif.getUserDefinedPropertyValueAsType(userproperty,String.class), (String)motif.getUserDefinedPropertyValueAsType(userproperty,String.class)); \n String[] mergedSplit=merged.split(\"\\\\s*,\\\\s*\");\n ArrayList<String> value=new ArrayList<String>(mergedSplit.length);\n value.addAll(Arrays.asList(merged));\n updatedMotif.setUserDefinedPropertyValue(userproperty, value);\n } else updatedMotif.setUserDefinedPropertyValue(userproperty, originalMotif.getUserDefinedPropertyValue(userproperty)); // the property can not be merged \n } \n }\n } catch (ExecutionError e) {\n throw new ExecutionError(\"ParseError for motif '\"+motifname+\"'.\\n\"+e.getMessage());\n } \n }\n }", "public Object take() {\r\n\t\tObject result = elements[elements.length - 1];\r\n\t\tObject[] newElements = new Object[elements.length - 1];\r\n\t\tSystem.arraycopy(elements, 0, newElements, 0, newElements.length);\r\n\t\telements = newElements;\r\n\t\treturn result;\r\n\t}", "protected void reduce4( T mrt ) {\n // Reduce any AppendableVecs\n if( _noutputs > 0 )\n for( int i=0; i<_appendables.length; i++ )\n _appendables[i].reduce(mrt._appendables[i]);\n // User's reduction\n reduce(mrt);\n }", "public E next() {\n int index = 0;\n\n // iterating over collections\n for (Collection<E> coll : collectionList) {\n // checking if current collection contains the desired element (i.e. itrCounter falls in coll)\n if (coll.size() <= itrCounter - index)\n // desired index doesn't lie in current collection -> skipping all elements\n index += coll.size();\n // current collection contains desired element\n else {\n // finding desired element; iterating over coll\n for (E element : coll){\n // desired index found -> increment itrCounter and return element\n if (index == itrCounter) {\n itrCounter++;\n return element;\n }\n // desired index not reached yet -> increment index\n else index++;\n }\n }\n }\n // could not find next element\n throw new NoSuchElementException();\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}", "default YCollection<T> forEachFun(Consumer<T> consumer) {\n for (T t : this) consumer.accept(t);\n return this;\n }", "@Override\n public void compose() {\n final Continuation currCon = (Continuation)closure.getArgument(0);\n\n ResultValueWrapper best = null;\n double shortest = Double.MAX_VALUE;\n\n int i=1;\n while(true) {\n try {\n final ResultValueWrapper rvw = ((ResultValueWrapper) closure.getArgument(i++));\n if((Double)rvw.getN() < shortest) {\n best = rvw;\n shortest = (Double)rvw.getN();\n }\n } catch (IndexOutOfBoundsException e) { break;}\n }\n\n currCon.setReturnVal(best);\n sendArgument(currCon);\n }", "private static Integer deductOne(Integer element) {\n return element - 1;\n }" ]
[ "0.63304627", "0.5413871", "0.53411824", "0.51426554", "0.5141429", "0.51230216", "0.5117413", "0.5116319", "0.5052188", "0.503958", "0.5028471", "0.50215924", "0.50010145", "0.49862963", "0.49659076", "0.49624345", "0.49496174", "0.48588243", "0.48445466", "0.48224497", "0.4754795", "0.47207478", "0.4715588", "0.47118667", "0.47016466", "0.46879882", "0.46843216", "0.46530342", "0.46514976", "0.46234187", "0.46178022", "0.4616886", "0.46096292", "0.45611537", "0.45611537", "0.45598903", "0.45314285", "0.4529976", "0.4526198", "0.45138723", "0.4502557", "0.44868803", "0.44859943", "0.44781387", "0.44604293", "0.4459662", "0.44461253", "0.44445068", "0.44308084", "0.4430069", "0.44268224", "0.44262022", "0.43939233", "0.43921834", "0.4390238", "0.43902108", "0.4388702", "0.4380206", "0.4365817", "0.43497962", "0.43451828", "0.4340745", "0.43402776", "0.4321966", "0.4320443", "0.43178862", "0.43009073", "0.4294959", "0.4292658", "0.4291448", "0.42910096", "0.4290832", "0.42898336", "0.4283617", "0.42765966", "0.42690745", "0.42683822", "0.42611408", "0.42598677", "0.42561257", "0.4246726", "0.42420202", "0.42297703", "0.42293987", "0.42261595", "0.42244303", "0.4222526", "0.42222634", "0.4216747", "0.42152646", "0.4207818", "0.4206387", "0.4206376", "0.42038497", "0.42014608", "0.41974056", "0.41967002", "0.41735068", "0.4167958", "0.4166229" ]
0.7042949
0
fold/reduce the collection into value U walk over the elements and then take initial/current U and apply current = operation(el, U)
public <T,U> U foldRight(final Collection<T> collection, final FoldOperation<T,U> operation, final U initial){ List<T> temp = new ArrayList<T>(query.getOrEmpty(collection)); Collections.reverse(temp); return foldLeft(temp, operation, initial); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public <T,U> U foldLeft(final Collection<T> collection, final FoldOperation<T,U> operation, final U initial){\n\t\tU current = initial;\n\t\tfor(T el: query.getOrEmpty(collection)){\n\t\t\tcurrent = operation.apply(el, current);\n\t\t}\n\t\treturn current;\n\t}", "public<T,U> List<U> map(final Collection<T> collection, final Operation<T,U> operation ){\t\t\n\t\tList<U> result = create.createLinkedList();\n\t\tfor(T t:query.getOrEmpty(collection)){\n\t\t\tresult.add(operation.apply(t));\n\t\t}\n\t\treturn result;\n\t}", "interface ContainerValueOperation {\r\n\r\n /**\r\n * Evaluates the specific function on a container and a value possibly modifying <code>result</code>.\r\n * \r\n * @param cont the container (must not be modified)\r\n * @param value the value \r\n * @param result the result (to be modified as a side effect)\r\n */\r\n public void evaluate(ContainerValue cont, Value value, List<Value> result);\r\n }", "public void evaluate(ContainerValue cont, Value value, List<Value> result);", "static Integer foo(final List<Integer> list,\n final Integer initial,\n final Function2<Integer, Integer, Integer> operator) {\n Integer accumulator = initial;\n for (final Integer element : list) {\n accumulator = operator.apply(accumulator, element);\n }\n\n return accumulator;\n }", "public Exp fold();", "static void flatten(Value value, Collection<Value> result) {\r\n if (value instanceof ContainerValue) {\r\n ContainerValue cont = (ContainerValue) value;\r\n for (int i = 0, size = cont.getElementSize(); i < size; i++) {\r\n flatten(cont.getElement(i), result);\r\n } \r\n } else {\r\n result.add(value);\r\n }\r\n }", "R apply(T t, U u);", "@Override\n public void collect(T elem) {\n value = elem;\n }", "@Override\n\tpublic void run() {\n\t\tresult =\n\t\t\tStream.iterate(new int[]{0, 1}, s -> new int[]{s[1], s[0] + s[1]})\n\t\t\t\t.limit(limit)\n\t\t\t\t.map(n -> n[0])\n\t\t\t\t.collect(toList());\n\n\t}", "public void Reduce(float[] inData, float[] outData, MpiOp op, int root) {\n\n if (TREE) {\n tree_reduce(inData, outData, op, root);\n } else {\n naive_reduce(inData, outData, op, root);\n }\n\n REDUCE_TAG--;\n }", "public void Reduce(int[] inData, int[] outData, MpiOp op, int root) {\n\n if (TREE) {\n tree_reduce(inData, outData, op, root);\n } else {\n naive_reduce(inData, outData, op, root);\n }\n\n REDUCE_TAG--;\n }", "public void Reduce(double[] inData, double[] outData, MpiOp op, int root) {\n\n if (TREE) {\n tree_reduce(inData, outData, op, root);\n } else {\n naive_reduce(inData, outData, op, root);\n }\n\n REDUCE_TAG--;\n }", "public void Reduce(long[] inData, long[] outData, MpiOp op, int root) {\n\n if (TREE) {\n tree_reduce(inData, outData, op, root);\n } else {\n naive_reduce(inData, outData, op, root);\n }\n\n REDUCE_TAG--;\n }", "@Override\n\t\tpublic void reduce() {\n\t\t\t\n\t\t}", "private static <T, R> R getOf(final Collection<T> collection, Function<T, R> func, BinaryOperator<R> mapper, Function<R, R> sumator) {\n R r = null;\n for (T t: collection) {\n r = mapper.apply(r, func.apply(t));\n }\n return sumator.apply(r);\n }", "public <O extends FighterOperation> O apply(O operation);", "R apply(T t, U u, V v);", "public static Expression reduce(Expression expression) { throw Extensions.todo(); }", "O transform(R result);", "public void AllReduce(double[] inData, double[] outData, MpiOp op) {\n\n double[] result = new double[inData.length];\n\n\n\n Reduce(inData, result, op, 0);\n\n //REDUCE_TAG--;\n\n Bcast(result, 0);\n\n System.arraycopy(result, 0, outData, 0, result.length);\n }", "public Collection<Element> getOperations() {\n Stream<Element> combinedStream = Stream.of(aCollection, cCollection)\n .flatMap(Collection::stream);\n return combinedStream.collect(Collectors.toList());\n }", "public void AllReduce(float[] inData, float[] outData, MpiOp op) {\n\n float[] result = new float[inData.length];\n\n\n Reduce(inData, result, op, 0);\n\n //REDUCE_TAG--;\n\n Bcast(result, 0);\n\n System.arraycopy(result, 0, outData, 0, result.length);\n }", "public void AllReduce(int[] inData, int[] outData, MpiOp op) {\n\n int[] result = new int[inData.length];\n\n\n Reduce(inData, result, op, 0);\n\n //REDUCE_TAG--;\n\n Bcast(result, 0);\n\n System.arraycopy(result, 0, outData, 0, result.length);\n }", "void evaluate()\n\t{\n\t\toperation.evaluate();\n\t}", "public void AllReduce(long[] inData, long[] outData, MpiOp op) {\n\n long[] result = new long[inData.length];\n\n\n\n Reduce(inData, result, op, 0);\n\n //REDUCE_TAG--;\n\n Bcast(result, 0);\n\n System.arraycopy(result, 0, outData, 0, result.length);\n }", "static AggregateOperation compose(Iterable<AggregateOperation> operations) {\n // NOTE(user): It's possible to replace the following two sets with a single map.\n Set<SegmentId> segmentsToRemove = new TreeSet<SegmentId>(segmentComparator);\n Set<SegmentId> segmentsToAdd = new TreeSet<SegmentId>(segmentComparator);\n Set<SegmentId> segmentsToEndModifying = new TreeSet<SegmentId>(segmentComparator);\n Set<SegmentId> segmentsToStartModifying = new TreeSet<SegmentId>(segmentComparator);\n Set<ParticipantId> participantsToRemove = new TreeSet<ParticipantId>(participantComparator);\n Set<ParticipantId> participantsToAdd = new TreeSet<ParticipantId>(participantComparator);\n Map<String, DocOpList> docOps = new TreeMap<String, DocOpList>();\n for (AggregateOperation operation : operations) {\n composeIds(operation.segmentsToRemove, segmentsToRemove, segmentsToAdd);\n composeIds(operation.segmentsToAdd, segmentsToAdd, segmentsToRemove);\n composeIds(operation.segmentsToEndModifying, segmentsToEndModifying, segmentsToStartModifying);\n composeIds(operation.segmentsToStartModifying, segmentsToStartModifying, segmentsToEndModifying);\n composeIds(operation.participantsToRemove, participantsToRemove, participantsToAdd);\n composeIds(operation.participantsToAdd, participantsToAdd, participantsToRemove);\n for (DocumentOperations documentOps : operation.docOps) {\n DocOpList docOpList = docOps.get(documentOps.id);\n if (docOpList != null) {\n docOps.put(documentOps.id, docOpList.concatenateWith(documentOps.operations));\n } else {\n docOps.put(documentOps.id, documentOps.operations);\n }\n }\n }\n return new AggregateOperation(\n new ArrayList<SegmentId>(segmentsToRemove),\n new ArrayList<SegmentId>(segmentsToAdd),\n new ArrayList<SegmentId>(segmentsToEndModifying),\n new ArrayList<SegmentId>(segmentsToStartModifying),\n new ArrayList<ParticipantId>(participantsToRemove),\n new ArrayList<ParticipantId>(participantsToAdd),\n mapToList(docOps));\n }", "public static <E, R> R foldLeft(Iterable<E> elems, R init, BiFunction<R, E, R> foldFun) {\n R acc = init;\n for (E elem : elems) {\n acc = foldFun.apply(acc, elem);\n }\n return acc;\n }", "private List<Node> compute() {\n\t\t\tgetGraphFromResolvedTree(root);\n\t\t\tdepthFirst(root);\n\t\t\treturn result;\n\t\t}", "private static void lowerDfs(int acc, int offset, List<Integer> list, int[] array, List<Integer> ops, List<String> res, int target){\n\t\tif(offset == list.size() - 1){\n\t\t\tif(acc == target)\n\t\t\t\tputRes(array, ops, );\n\t\t}\n\t}", "public abstract ArrayList<Object> calculateTransform(ArrayList<Integer> arr);", "@Override\r\n public Double reduce(Double identity, Function accumulator) {\r\n return head.reduce(identity, accumulator);\r\n }", "public EvPopulation<T> apply(EvPopulation<T> population) {\n\n int population_size = population.size();\n\n combine_parent_selector.init(population, 2, population_size);\n\n EvPopulation<T> result = new EvPopulation<T>(population_size + 3);\n\n // Generate children since population is not filled\n while (result.size() < population_size)\n combine(combine_parent_selector.getNextParents(), result);\n\n // Remove overfull\n while (result.size() > population_size)\n result.remove(result.size() - 1);\n\n return result;\n }", "public void reduce( T mrt ) { }", "public void reduce( T mrt ) { }", "R apply(T t, U u, S s, E e);", "Double reduce(Double identity, Function accumulator);", "public final void sub() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue - topMostValue);\n\t\t}\n\t}", "T collect(V source);", "Population<T> operate(Population<T> population);", "public Object reduce( Set<Action> requiredActions, final ReduceFn fn,\n\t\t\tfinal Object initial ) throws AccessDeniedException,\n\t\t\tEmptyListException, ListIndexException, InvalidListException;", "public void apply(at.ac.tuwien.dsg.mela.common.monitoringConcepts.ServiceMonitoringSnapshot serviceMonitoringSnapshot) {\n\n //1'step extract the monitoring data for the target service elements\n Map<MonitoredElement, MonitoredElementMonitoringSnapshot> levelMonitoringData = serviceMonitoringSnapshot.getMonitoredData(targetMonitoredElementLevel);\n\n if (levelMonitoringData == null) {\n Logger.getRootLogger().log(Level.WARN, \"Level \" + targetMonitoredElementLevel + \" not found in monitoring data\");\n return;\n }\n\n Collection<MonitoredElementMonitoringSnapshot> toBeProcessed = new ArrayList<MonitoredElementMonitoringSnapshot>();\n\n //step 2\n //if target IDs have ben supplied, use them to extract only the monitoring data for the target elements, else process all elements on this level\n if (targetMonitoredElementIDs.isEmpty()) {\n //if all on level, get each elementy data, and add its children data. Might destroy the data in the long run\n Collection<MonitoredElementMonitoringSnapshot> levelData = levelMonitoringData.values();\n for (MonitoredElementMonitoringSnapshot levelElementData : levelData) {\n\n toBeProcessed.add(levelElementData);\n }\n } else {\n for (String id : targetMonitoredElementIDs) {\n\n //TODO: an issue is that in the MonitoredElementMonitoringSnapshot I do NOT hold the children snapshots.\n //So now I follow the MonitoredElement children, get their MonitoredElementMonitoringSnapshot, and enrich the MonitoredElementMonitoringSnapshot supplied to the operations\n MonitoredElement element = new MonitoredElement(id);\n if (levelMonitoringData.containsKey(element)) {\n MonitoredElementMonitoringSnapshot elementData = levelMonitoringData.get(element);\n toBeProcessed.add(elementData);\n } else {\n Logger.getRootLogger().log(Level.WARN, \"Element with ID \" + id + \" not found in monitoring data\");\n }\n }\n }\n //step 3 \n //for each MonitoredElementMonitoringSnapshot apply composition rule and enrich monitoring data in place\n for (MonitoredElementMonitoringSnapshot snapshot : toBeProcessed) {\n\n MetricValue result = operation.apply(snapshot);\n// resultingMetric.setMonitoredElement(snapshot.getMonitoredElement());\n if (result != null) {\n //put new composite metric\n snapshot.putMetric(resultingMetric, result);\n }\n }\n }", "@Override\n\tpublic Object reduce( final ReduceFn fn, final Object initial )\n\t\t\tthrows AccessDeniedException, EmptyListException,\n\t\t\tListIndexException, InvalidListException;", "R apply(T input1, U input2, V input3);", "@Override\n public BinaryOperator<List<Integer>> combiner() {\n return (resultList1, resultList2) -> {\n Integer currentTotal1 = resultList1.get(0);\n Integer currentTotal2 = resultList2.get(0);\n currentTotal1 += currentTotal2;\n resultList1.set(0, currentTotal1);\n return resultList1;\n };\n }", "R apply(T t);", "protected void updateValues(){\n double total = 0;\n for(int i = 0; i < values.length; i++){\n values[i] = \n operation(minimum + i * (double)(maximum - minimum) / (double)numSteps);\n \n total += values[i];\n }\n for(int i = 0; i < values.length; i++){\n values[i] /= total;\n }\n }", "K apply(T arg1, U arg2);", "public void reduce4( T mrt ) {\n // Reduce any AppendableVecs\n for( int i=0; i<_fr._vecs.length; i++ )\n if( _fr._vecs[i] instanceof AppendableVec )\n ((AppendableVec)_fr._vecs[i]).reduce((AppendableVec)mrt._fr._vecs[i]);\n // User's reduction\n reduce(mrt);\n }", "public static Object compute(OpUnary op, Object value) {\n\t\tswitch (op) {\n\t\tcase BITNOT:\n\t\t\treturn ValueUtil.not(value);\n\t\tcase LOGIC_NOT:\n\t\t\treturn ValueUtil.logicNot(value);\n\t\tcase MINUS:\n\t\t\treturn ValueUtil.negate(value);\n\t\tcase NUM_ELTS:\n\t\t\treturn ValueUtil.length(value);\n\t\tdefault:\n\t\t\treturn null;\n\t\t}\n\t}", "public void runOneIteration() {\n // Update user latent vectors\n\n //IntStream.range(0,userCount).peek(i->update_user(i)).forEach(j->{});\n\n for (int u = 0; u < userCount; u ++) {\n update_user(u);\n }\n\n // Update item latent vectors\n for (int i = 0; i < itemCount; i ++) {\n update_item(i);\n }\n }", "interface Container2Operation {\r\n \r\n /**\r\n * Evaluates the specific function on two container values possibly modifying <code>result</code>.\r\n * \r\n * @param c1 the first container (must not be modified)\r\n * @param c2 the second container (must not be modified)\r\n * @param result the result (to be modified as a side effect)\r\n */\r\n public void evaluate(ContainerValue c1, ContainerValue c2, List<Value> result);\r\n }", "private static <T> T identity(Collection<T> collection) {\n return identity(collection.iterator());\n }", "public void evaluate(ContainerValue c1, ContainerValue c2, List<Value> result);", "public void applyToAncestors( Operation operation ) {\n PlanNode ancestor = getParent();\n while (ancestor != null) {\n operation.apply(ancestor);\n ancestor = ancestor.getParent();\n }\n }", "@Override\n\tpublic void forEach(Processor processor) {\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tprocessor.process(elements[i]);\n\t\t}\n\t}", "protected ConstraintSyntaxTree reduce(OCLFeatureCall assignment) { \n result = assignment;\n \n if (OclKeyWords.ASSIGNMENT.equals(assignment.getOperation())) {\n result = null;\n assignment.getParameter(0).accept(this);\n \n if (filtered && null != result) {\n result = new OCLFeatureCall(assignment.getOperand(), assignment.getOperation(), result);\n try {\n // Needed for setting the correct operation\n result.inferDatatype();\n } catch (CSTSemanticException e) {\n result = null;\n Bundle.getLogger(AssignmentReducer.class).exception(e);\n }\n } else if (!filtered) {\n result = assignment;\n }\n }\n \n return result;\n }", "public void apply( Traversal order,\n Operation operation ) {\n assert order != null;\n switch (order) {\n case LEVEL_ORDER:\n operation.apply(this);\n applyLevelOrder(order, operation);\n break;\n case PRE_ORDER:\n operation.apply(this);\n for (PlanNode child : this) {\n child.apply(order, operation);\n }\n break;\n case POST_ORDER:\n for (PlanNode child : this) {\n child.apply(order, operation);\n }\n operation.apply(this);\n break;\n }\n }", "@Override // com.google.common.collect.AbstractIterator\n public C computeNext() {\n while (!this.elemItr.hasNext()) {\n if (!this.rangeItr.hasNext()) {\n return (C) ((Comparable) endOfData());\n }\n this.elemItr = ContiguousSet.create(this.rangeItr.next(), AsSet.this.domain).iterator();\n }\n return this.elemItr.next();\n }", "default <V> Fn<V, U> compose(Fn<V, T> before){\n Objects.requireNonNull(before);\n return (V v)-> apply(before.apply(v));\n }", "public synchronized Iterator<E> iteratorUpAll()\n {\n if (isEmpty())\n return new CNullIterator<E>();\n\n return new NodeIteratorUp<E>(this, this.m_FirstNode, this.m_LastNode.m_Element);\n }", "public static <R, T> R foldr(Function2<R, T, R> f, R ini, Collection<T> c) {\r\n @SuppressWarnings(\"unchecked\")\r\n T[] array = (T[]) c.toArray();\r\n\r\n R result = ini;\r\n for (int i = array.length - 1; i >= 0; i--) {\r\n result = f.apply(array[i], result);\r\n }\r\n\r\n return result;\r\n }", "private void operateOverSubnodes(Node node, OperationOverNodes operation) {\n\t\tif (node != null) {\n\t\t\toperation.operate(node);\n\t\t\tNode next = node.getSubnode();\n\t\t\twhile (next != null) {\n\t\t\t\toperateOverSubnodes(next, operation);\n\t\t\t\tnext = next.getNext();\n\t\t\t}\n\t\t}\n\t}", "protected ContainerValueOperationEvaluator(ContainerValueOperation op) {\r\n this.op = op;\r\n }", "void recalc() {\n\t\tthis.currentValue = baseValue;\n\t\tthis.modifiers.stream().forEach(a -> this.currentValue += a.getValue());\n\t}", "protected abstract boolean reduce();", "protected SortedSet<Operation> nestOperations(SortedSet<Operation> operations) {\n\t\tSet<Operation> markedForRemoval = new HashSet<Operation>();\n\t\tfor (Operation op : operations) {\n\t\t\tSortedSet<Operation> toBeNested = new TreeSet<Operation>(SORT_BY_POSITION_AND_SUSPECT_TYPE);\n\t\t\tif (toBeNested.contains(op)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tSourcePosition opPos = op.getPosition();\n\t\t\tSortedSet<Operation> tailSet = operations.tailSet(op);\n\t\t\tIterator<Operation> tailIter = tailSet.iterator();\n\t\t\ttailIter.next(); // skip op itself\n\t\t\twhile (tailIter.hasNext()) {\n\t\t\t\tOperation tailOp = tailIter.next();\n\t\t\t\tSourcePosition tailOpPos = tailOp.getPosition();\n\t\t\t\tif (tailOpPos.getURL().equals(opPos.getURL()) && tailOpPos.getStartOffset() < opPos.getEndOffset()) {\n\t\t\t\t\t// if the next operation has the same URL and should be nested.\n\t\t\t\t\ttoBeNested.add(tailOp);\n\t\t\t\t} else {\n\t\t\t\t\t// no need to look further, there won't be any nesting further down\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (toBeNested.size() > 0) {\n\t\t\t\top.addChildren(nestOperations(toBeNested));\n\t\t\t}\n\t\t\tmarkedForRemoval.addAll(toBeNested);\n\t\t}\n\t\t// remove the nested Operations from the this level\n\t\toperations.removeAll(markedForRemoval);\n\t\treturn operations;\n\t}", "protected static void performReduceWithABinaryOperator() {\n Integer sum = Stream.of(1, 2, 3, 4, 5).reduce(0, Integer::sum);\n\n Integer minValue = Stream.of(5, 4, 9, 2, 1).reduce(Integer.MIN_VALUE, Integer::max);\n\n String concatenation = Stream.of(\"str \", \"= \", \"alt \", \"string\")\n // the first parameter becomes the target of the concat method and the second one is the argument to concat\n // the target, the parameter and the result are of the same type and this can be considered a binary\n // operator for the reduce method\n .reduce(\"\", String::concat);\n System.out.println(concatenation);\n }", "void apply(T input);", "@Override\r\n\tpublic Integer getValue() {\r\n\r\n\t\treturn op.perform(left, right);\r\n\t}", "public static final <T, R> R foldIndices(java.util.List<? extends T> r3, R r4, kotlin.jvm.functions.Function2<? super R, ? super T, ? extends R> r5) {\n /*\n java.lang.String r0 = \"$this$foldIndices\"\n kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull(r3, r0)\n java.lang.String r0 = \"operation\"\n kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull(r5, r0)\n r0 = r3\n java.util.Collection r0 = (java.util.Collection) r0\n int r0 = r0.size()\n r1 = 0\n L_0x0012:\n if (r1 >= r0) goto L_0x001f\n java.lang.Object r2 = r3.get(r1)\n java.lang.Object r4 = r5.invoke(r4, r2)\n int r1 = r1 + 1\n goto L_0x0012\n L_0x001f:\n return r4\n */\n throw new UnsupportedOperationException(\"Method not decompiled: coil.util.Collections.foldIndices(java.util.List, java.lang.Object, kotlin.jvm.functions.Function2):java.lang.Object\");\n }", "static public void doCollapse_collection(RunData data)\n\t{\n\t\tSessionState state = ((JetspeedRunData)data).getPortletSessionState (((JetspeedRunData)data).getJs_peid ());\n\t\tSortedSet expandedItems = (SortedSet) state.getAttribute(STATE_EXPANDED_COLLECTIONS);\n\t\tif(expandedItems == null)\n\t\t{\n\t\t\texpandedItems = new TreeSet();\n\t\t}\n\t\tMap folderSortMap = (Map) state.getAttribute(STATE_EXPANDED_FOLDER_SORT_MAP);\n\t\tif(folderSortMap == null)\n\t\t{\n\t\t\tfolderSortMap = new Hashtable();\n\t\t\tstate.setAttribute(STATE_EXPANDED_FOLDER_SORT_MAP, folderSortMap);\n\t\t}\n\n\t\t//get the ParameterParser from RunData\n\t\tParameterParser params = data.getParameters ();\n\t\tString collectionId = params.getString(\"collectionId\");\n\n\t\t// save the current selections\n\t\tSet selectedSet = new TreeSet();\n\t\tString[] selectedItems = data.getParameters ().getStrings (\"selectedMembers\");\n\t\tif(selectedItems != null)\n\t\t{\n\t\t\tselectedSet.addAll(Arrays.asList(selectedItems));\n\t\t}\n\t\tstate.setAttribute(STATE_LIST_SELECTIONS, selectedSet);\n\n\t\tSortedSet newSet = new TreeSet();\n\t\tIterator l = expandedItems.iterator();\n\t\twhile (l.hasNext ())\n\t\t{\n\t\t\t// remove the collection id and all of the subcollections\n//\t\t Resource collection = (Resource) l.next();\n//\t\t\tString id = (String) collection.getId();\n\t\t String id = (String) l.next();\n\n\t\t\tif (id.indexOf (collectionId)==-1)\n\t\t\t{\n\t//\t\t\tnewSet.put(id,collection);\n\t\t\t\tnewSet.add(id);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfolderSortMap.remove(id);\n\t\t\t}\n\t\t}\n\n\t\tstate.setAttribute(STATE_EXPANDED_COLLECTIONS, newSet);\n\n\t\t// remove this folder id into the set to be event-observed\n\t\tremoveObservingPattern(collectionId, state);\n\n\t}", "@Override\n protected Integer compute() {\n final int currentSize = endPos - startPos;\n if (currentSize <= UNIT_SIZE) {\n return computeSum();\n }\n int center = currentSize / 2;\n\n /*\n * On the right part, it calls `compute()`; on the left part, it\n * calls `fork()`:\n *\n * 1. Calling `fork()` makes it execute asynchronously.\n * 2. Calling `compute()` will recursively create (left and right)\n * `CalcSum` objects, if it still needs to be divided into\n * smaller tasks.\n */\n int leftEnd = startPos + center;\n CalcSum leftSum = new CalcSum(values, startPos, leftEnd);\n leftSum.fork();\n\n int rightStart = startPos + center + 1;\n CalcSum rightSum = new CalcSum(values, rightStart, endPos);\n /*\n * `leftSum.join()` waits until it returns a value; `compute()`\n * is main computation performed by task.\n */\n return rightSum.compute() + leftSum.join();\n }", "public void calcualteFeatureValue(Collection<Instance> instanceCollection);", "protected double sum(IntegralImage II, int u, int v, double scale) {\n\t\tdouble sum = 0;\n\t\tfor (FeatureTree tree : trees) {\n\t\t\tsum = sum + tree.eval(II, u, v, scale);\n\t\t}\n\t\treturn sum;\n\t}", "@Override // com.google.common.collect.AbstractIterator\n public C computeNext() {\n while (!this.elemItr.hasNext()) {\n if (!this.rangeItr.hasNext()) {\n return (C) ((Comparable) endOfData());\n }\n this.elemItr = ContiguousSet.create(this.rangeItr.next(), AsSet.this.domain).descendingIterator();\n }\n return this.elemItr.next();\n }", "@Override\n public BiConsumer<List<Integer>, Employee> accumulator() {\n return (resultList, employee) -> {\n if (resultList.isEmpty()) resultList.add(employee.getSalary());\n else {\n Integer currentTotal = resultList.get(0);\n currentTotal += employee.getSalary();\n resultList.set(0, currentTotal);\n }\n };\n }", "public static <S, D> Collection<D> transform(Collection<S> collection, Transformation<S, D> transformation) {\n \tCollection<D> ret = new ArrayList<D>();\n \tfor(S element : collection) {\n \t\tret.add(transformation.applyTo(element));\n \t}\n \treturn ret;\n }", "Operations operations();", "public static <E,F> F fold_with_map(\n Stream<E> stream,\n Function<? super E,F> folding_adapter\n ) {\n if (stream == null) return null;\n Stream<F> folding_stream = stream.map(folding_adapter);\n return Streams.last(folding_stream);\n }", "public double getCurrent( )\r\n {\r\n\t double element = 0; \r\n\t if(isCurrent() != true){// Student will replace this return statement with their own code:\r\n\t throw new IllegalStateException (\"no current element, getCurrent may not be called\");\r\n\t }\r\n\t else\r\n\t \t element = element + (cursor.getData()) ;\r\n\t return element; \r\n }", "public abstract T accumulate(T left, T right);", "@Override\n public void apply(Operation operation) {\n try {\n waitingOperations.put(operation);\n } catch (InterruptedException ex) {\n //handle\n }\n }", "public void ExtremeValuesTraversal(NodeVisitor action){\n\t\tQueue queue = new Queue();\n\t\tqueue.enqueue(this);\n\t\twhile( ! queue.isEmpty() )\n\t\t{\n\t\t\tBinaryTree tree = (BinaryTree)queue.dequeue();\n\t\t\tif ( ! tree.isEmpty() )\n {\n \t\t\taction.visit(tree.getElement());\n \t\t\tqueue.enqueue(tree.leftTree());\n \t\t\tqueue.enqueue(tree.rightTree());\n }\n\t\t}\n\t\t\n\t}", "public final PropagationStrategy coll(ArrayList<? extends ISchedulable> elements, CombinedAttribute ca) throws RecognitionException {\n PropagationStrategy ps = null;\n\n\n CommonTree r = null;\n CommonTree m = null;\n Iterator it = null;\n\n\n if (elements.isEmpty()) {\n LOGGER.error(\"% Create a empty collection\");\n throw new FZNException(\"Create a empty collection\");\n } else if (elements.size() == 1) {\n LOGGER.warn(\"% Create a collection with a single element\");\n }\n\n try {\n // parser/flatzinc/FlatzincFullExtWalker.g:435:5: ( ^( QUEUE it= qiter ) | ^( LIST (r= REV )? it= liter ) | ^( HEAP (m= MAX )? it= qiter ) )\n int alt24 = 3;\n switch (input.LA(1)) {\n case QUEUE: {\n alt24 = 1;\n }\n break;\n case LIST: {\n alt24 = 2;\n }\n break;\n case HEAP: {\n alt24 = 3;\n }\n break;\n default:\n NoViableAltException nvae =\n new NoViableAltException(\"\", 24, 0, input);\n\n throw nvae;\n\n }\n\n switch (alt24) {\n case 1:\n // parser/flatzinc/FlatzincFullExtWalker.g:435:7: ^( QUEUE it= qiter )\n {\n match(input, QUEUE, FOLLOW_QUEUE_in_coll978);\n\n match(input, Token.DOWN, null);\n pushFollow(FOLLOW_qiter_in_coll982);\n it = qiter();\n\n state._fsp--;\n\n\n match(input, Token.UP, null);\n\n\n ps = new Queue(elements.toArray(new ISchedulable[elements.size()]));\n ps = it.set(ps);\n ps.attachEvaluator(ca);\n\n\n }\n break;\n case 2:\n // parser/flatzinc/FlatzincFullExtWalker.g:441:7: ^( LIST (r= REV )? it= liter )\n {\n match(input, LIST, FOLLOW_LIST_in_coll998);\n\n match(input, Token.DOWN, null);\n // parser/flatzinc/FlatzincFullExtWalker.g:441:15: (r= REV )?\n int alt22 = 2;\n switch (input.LA(1)) {\n case REV: {\n alt22 = 1;\n }\n break;\n }\n\n switch (alt22) {\n case 1:\n // parser/flatzinc/FlatzincFullExtWalker.g:441:15: r= REV\n {\n r = (CommonTree) match(input, REV, FOLLOW_REV_in_coll1002);\n\n }\n break;\n\n }\n\n\n pushFollow(FOLLOW_liter_in_coll1007);\n it = liter();\n\n state._fsp--;\n\n\n match(input, Token.UP, null);\n\n\n ISchedulable[] elts = elements.toArray(new ISchedulable[elements.size()]);\n // check if an order is required\n boolean order = false;\n for (int i = 0; i < elts.length; i++) {\n try {\n elts[i].evaluate();\n order = true;\n } catch (NullPointerException npe) {\n if (order) {\n LOGGER.error(\"% Cannot sort the collection, keys are missing\");\n throw new FZNException(\"Cannot sort the collection, keys are missing\");\n }\n }\n }\n ps = new Sort(order, r != null, elts);\n ps = it.set(ps);\n ps.attachEvaluator(ca);\n\n\n }\n break;\n case 3:\n // parser/flatzinc/FlatzincFullExtWalker.g:461:7: ^( HEAP (m= MAX )? it= qiter )\n {\n match(input, HEAP, FOLLOW_HEAP_in_coll1023);\n\n match(input, Token.DOWN, null);\n // parser/flatzinc/FlatzincFullExtWalker.g:461:15: (m= MAX )?\n int alt23 = 2;\n switch (input.LA(1)) {\n case MAX: {\n alt23 = 1;\n }\n break;\n }\n\n switch (alt23) {\n case 1:\n // parser/flatzinc/FlatzincFullExtWalker.g:461:15: m= MAX\n {\n m = (CommonTree) match(input, MAX, FOLLOW_MAX_in_coll1027);\n\n }\n break;\n\n }\n\n\n pushFollow(FOLLOW_qiter_in_coll1032);\n it = qiter();\n\n state._fsp--;\n\n\n match(input, Token.UP, null);\n\n\n ISchedulable[] elts = elements.toArray(new ISchedulable[elements.size()]);\n for (int i = 0; i < elts.length; i++) {\n try {\n elts[i].evaluate();\n } catch (NullPointerException npe) {\n LOGGER.error(\"% Cannot sort the collection, keys are missing\");\n throw new FZNException(\"Cannot sort the collection, keys are missing\");\n }\n }\n ps = new SortDyn(m != null, elts);\n ps = it.set(ps);\n ps.attachEvaluator(ca);\n\n\n }\n break;\n\n }\n } catch (RecognitionException re) {\n reportError(re);\n recover(input, re);\n } finally {\n // do for sure before leaving\n }\n return ps;\n }", "protected T operation(final String operatorName, final List<T> elements) {\n Operation<T> operation = registry.getElement(operatorName);\n Assert.notNull(operation, \"Unknown operation: \" + operatorName);\n LOGGER.debug(\"{} {} elements\", operation.getKey(), elements.size());\n return operation.calculate(elements);\n }", "public void enfoncerMult() {\n\t\ttry {\n\t\t\tthis.op = new Mult();\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 (EmptyStackException e) {\n\t\t\tSystem.out.println(\"Erreur de syntaxe : Saisir deux operandes avant de saisir un operateur\");\n\t\t}\n\t}", "protected class_496 method_1607() {\n if (this.field_934.field_183 != this.field_938) {\n throw new ConcurrentModificationException();\n } else {\n class_496 var1 = this.field_937;\n if (var1 == null) {\n throw new NoSuchElementException(\"No next() entry in the iteration\");\n } else {\n class_496[] var2 = this.field_934.field_181;\n int var3 = this.field_935;\n\n class_496 var4;\n for(var4 = var1.field_903; var4 == null && var3 > 0; var4 = var2[var3]) {\n --var3;\n }\n\n this.field_937 = var4;\n this.field_935 = var3;\n this.field_936 = var1;\n return var1;\n }\n }\n }", "public static Expression reduceAndCheck(Expression expression) { throw Extensions.todo(); }", "@Override\n\tpublic void operation() {\n\t\tfor(Object object:list) {\n\t\t\t((Component)object).operation();\n\t\t}\n\t}", "@Override\n public void reduce() {\n if(null != getState())\n switch(getState()) {\n case OPERATOR:\n if (getDispenser().tokenIsOperator() && numOpNumOnStack())\n priorityReduce();\n break;\n case RIGHT_PAREN:\n if (getDispenser().tokenIsRightParen()) {\n if (!getStack().contains('('))\n throw new RuntimeException(\"Error -- mismatched parentheses\");\n while ((char)getStack().get(getStack().size() - 2) != '(')\n reduceNumOpNum();\n double aNum = (double)getStack().pop();\n getStack().pop();\n getStack().push(aNum);\n }\n break;\n case END:\n if (getDispenser().tokenIsEOF()) {\n if(getStack().contains('('))\n throw new RuntimeException(\"Error -- mismatched parentheses\");\n while(numOpNumOnStack())\n reduceNumOpNum();\n if(getStack().size() != 1)\n throw new RuntimeException(\"Error -- mismatched parentheses\");\n }\n break;\n }\n }", "public final void collect(Collection<? super T> output) {\n Node n = getHead();\n while (true) {\n Node next = (Node) n.get();\n if (next != null) {\n Object v = leaveTransform(next.value);\n if (!NotificationLite.isComplete(v) && !NotificationLite.isError(v)) {\n output.add(NotificationLite.getValue(v));\n n = next;\n } else {\n return;\n }\n } else {\n return;\n }\n }\n }", "private void processCollection(MotifCollection collection, String strategy) throws ExecutionError {\n List<Motif> list=collection.getPayload();\n for (Motif motif:list) {\n String motifname=motif.getName();\n Motif[] temp=null;\n try {\n temp=getMotif(motifname);\n } catch (ExecutionError gme) { // this happens if the motifname is not a recognized ID\n if (skipUnrecognizedCheckbox.isSelected()) continue;\n else throw gme;\n }\n Motif originalMotif=temp[0];\n Motif updatedMotif=temp[1]; \n try {\n if (strategy.equals(REPLACE_CURRENT)) {\n String shortname=motif.getShortName();\n if (shortname!=null && !shortname.isEmpty()) updatedMotif.setShortName(shortname);\n String longname=motif.getLongName();\n if (longname!=null && !longname.isEmpty()) updatedMotif.setLongName(longname);\n String classification=motif.getClassification();\n if (classification!=null && !classification.isEmpty()) updatedMotif.setClassification(classification);\n int quality=motif.getQuality();\n if (quality!=6) updatedMotif.setQuality(quality);\n String part=motif.getPart();\n if (part!=null && !part.equals(Motif.FULL)) updatedMotif.setPart(part);\n String factors=motif.getBindingFactors();\n if (factors!=null && !factors.isEmpty()) updatedMotif.setBindingFactors(factors);\n String organisms=motif.getOrganisms();\n if (organisms!=null && !organisms.isEmpty()) updatedMotif.setOrganisms(organisms);\n ArrayList<String> alternatives=motif.getKnownDuplicatesNames();\n String[] namelist=new String[alternatives.size()];\n if (alternatives!=null && !alternatives.isEmpty()) updatedMotif.setKnownDuplicatesNames(alternatives.toArray(namelist));\n ArrayList<String> interaction=motif.getInteractionPartnerNames();\n namelist=new String[interaction.size()];\n if (interaction!=null && !interaction.isEmpty()) updatedMotif.setInteractionPartnerNames(interaction.toArray(namelist));\n ArrayList<String> tissues=motif.getTissueExpressionAsStringArray();\n namelist=new String[tissues.size()];\n if (tissues!=null && !tissues.isEmpty()) updatedMotif.setTissueExpression(tissues.toArray(namelist));\n for (String userproperty:motif.getUserDefinedProperties()) {\n Object value=motif.getUserDefinedPropertyValue(userproperty);\n if (value instanceof ArrayList) value=((ArrayList)value).clone();\n updatedMotif.setUserDefinedPropertyValue(userproperty, value);\n }\n double[][] matrix=motif.getMatrix();\n if (matrix!=null) updatedMotif.setMatrix(matrix);\n }\n else if (strategy.equals(MERGE_OR_REPLACE_CURRENT)) {\n String shortname=motif.getShortName();\n if (shortname!=null && !shortname.isEmpty()) updatedMotif.setShortName(shortname);\n String longname=motif.getLongName();\n if (longname!=null && !longname.isEmpty()) updatedMotif.setLongName(longname);\n String classification=motif.getClassification();\n if (classification!=null && !classification.isEmpty()) updatedMotif.setClassification(classification);\n int quality=motif.getQuality();\n if (quality!=6) updatedMotif.setQuality(quality);\n String part=motif.getPart();\n if (part!=null && !part.equals(Motif.FULL)) updatedMotif.setPart(part);\n \n String factors=motif.getBindingFactors(); \n if (factors!=null && !factors.isEmpty()) mergeOrReplaceCurrentProperty(originalMotif,updatedMotif, \"Factors\", factors);\n String organisms=motif.getOrganisms();\n if (organisms!=null && !organisms.isEmpty()) mergeOrReplaceCurrentProperty(originalMotif,updatedMotif, \"Organisms\", organisms);\n \n ArrayList<String> alternatives=motif.getKnownDuplicatesNames();\n ArrayList<String> alternativesOriginal=originalMotif.getKnownDuplicatesNames();\n if (alternatives!=null && !alternatives.isEmpty()) updatedMotif.setKnownDuplicatesNames(mergeStringLists(alternativesOriginal, alternatives));\n \n ArrayList<String> interactions=motif.getInteractionPartnerNames();\n ArrayList<String> interactionsOriginal=originalMotif.getInteractionPartnerNames();\n if (interactions!=null && !interactions.isEmpty()) updatedMotif.setInteractionPartnerNames(mergeStringLists(interactionsOriginal, interactions));\n \n ArrayList<String> tissues=motif.getTissueExpressionAsStringArray();\n ArrayList<String> tissuesOriginal=originalMotif.getTissueExpressionAsStringArray();\n if (tissues!=null && !tissues.isEmpty()) updatedMotif.setTissueExpression(mergeStringLists(tissuesOriginal, tissues));\n \n double[][] matrix=motif.getMatrix();\n if (matrix!=null) updatedMotif.setMatrix(matrix); \n \n for (String userproperty:motif.getUserDefinedProperties()) {\n Class type=Motif.getClassForUserDefinedProperty(userproperty, gui.getEngine());\n if (type!=null && (type.equals(ArrayList.class) || type.equals(String.class))) { // can the new properties be merged?\n String merged=mergeStringsLists( (String)originalMotif.getUserDefinedPropertyValueAsType(userproperty,String.class), (String)motif.getUserDefinedPropertyValueAsType(userproperty,String.class)); \n String[] mergedSplit=merged.split(\"\\\\s*,\\\\s*\");\n ArrayList<String> value=new ArrayList<String>(mergedSplit.length);\n value.addAll(Arrays.asList(merged));\n updatedMotif.setUserDefinedPropertyValue(userproperty, value);\n } else updatedMotif.setUserDefinedPropertyValue(userproperty, motif.getUserDefinedPropertyValue(userproperty)); // the property can not be merged \n } \n \n }\n else if (strategy.equals(MERGE_OR_KEEP_CURRENT)) {\n String shortname=motif.getShortName();\n String originalshortname=originalMotif.getShortName();\n if (shortname!=null && !shortname.isEmpty() && (originalshortname==null || originalshortname.isEmpty())) updatedMotif.setShortName(shortname);\n String longname=motif.getLongName();\n String originallongname=originalMotif.getLongName();\n if (longname!=null && !longname.isEmpty() && (originallongname==null || originallongname.isEmpty())) updatedMotif.setLongName(longname);\n String classification=motif.getClassification();\n String originalclassification=originalMotif.getClassification(); \n if (classification!=null && !classification.isEmpty() && (originalclassification==null || originalclassification.isEmpty())) updatedMotif.setClassification(classification);\n// int quality=motif.getQuality();\n// if (quality!=6) updatedMotif.setQuality(quality);\n// String part=motif.getPart();\n// if (part!=null && !part.equals(Motif.FULL)) updatedMotif.setPart(part);\n String factors=motif.getBindingFactors(); \n if (factors!=null && !factors.isEmpty()) mergeOrKeepCurrentProperty(originalMotif,updatedMotif, \"Factors\", factors);\n String organisms=motif.getOrganisms();\n if (organisms!=null && !organisms.isEmpty()) mergeOrKeepCurrentProperty(originalMotif,updatedMotif, \"Organisms\", organisms);\n \n ArrayList<String> alternatives=motif.getKnownDuplicatesNames();\n ArrayList<String> alternativesOriginal=originalMotif.getKnownDuplicatesNames();\n if (alternatives!=null && !alternatives.isEmpty()) updatedMotif.setKnownDuplicatesNames(mergeStringLists(alternativesOriginal, alternatives));\n \n ArrayList<String> interactions=motif.getInteractionPartnerNames();\n ArrayList<String> interactionsOriginal=originalMotif.getInteractionPartnerNames();\n if (interactions!=null && !interactions.isEmpty()) updatedMotif.setInteractionPartnerNames(mergeStringLists(interactionsOriginal, interactions));\n \n ArrayList<String> tissues=motif.getTissueExpressionAsStringArray();\n ArrayList<String> tissuesOriginal=originalMotif.getTissueExpressionAsStringArray();\n if (tissues!=null && !tissues.isEmpty()) updatedMotif.setTissueExpression(mergeStringLists(tissuesOriginal, tissues));\n \n if (originalMotif.getMatrix()==null) {\n double[][] matrix=motif.getMatrix();\n if (matrix!=null) updatedMotif.setMatrix(matrix); \n }\n \n for (String userproperty:motif.getUserDefinedProperties()) {\n Class type=Motif.getClassForUserDefinedProperty(userproperty, gui.getEngine());\n if (type!=null && (type.equals(ArrayList.class) || type.equals(String.class))) { // can the new properties be merged?\n String merged=mergeStringsLists( (String)originalMotif.getUserDefinedPropertyValueAsType(userproperty,String.class), (String)motif.getUserDefinedPropertyValueAsType(userproperty,String.class)); \n String[] mergedSplit=merged.split(\"\\\\s*,\\\\s*\");\n ArrayList<String> value=new ArrayList<String>(mergedSplit.length);\n value.addAll(Arrays.asList(merged));\n updatedMotif.setUserDefinedPropertyValue(userproperty, value);\n } else updatedMotif.setUserDefinedPropertyValue(userproperty, originalMotif.getUserDefinedPropertyValue(userproperty)); // the property can not be merged \n } \n }\n } catch (ExecutionError e) {\n throw new ExecutionError(\"ParseError for motif '\"+motifname+\"'.\\n\"+e.getMessage());\n } \n }\n }", "public Object take() {\r\n\t\tObject result = elements[elements.length - 1];\r\n\t\tObject[] newElements = new Object[elements.length - 1];\r\n\t\tSystem.arraycopy(elements, 0, newElements, 0, newElements.length);\r\n\t\telements = newElements;\r\n\t\treturn result;\r\n\t}", "protected void reduce4( T mrt ) {\n // Reduce any AppendableVecs\n if( _noutputs > 0 )\n for( int i=0; i<_appendables.length; i++ )\n _appendables[i].reduce(mrt._appendables[i]);\n // User's reduction\n reduce(mrt);\n }", "public E next() {\n int index = 0;\n\n // iterating over collections\n for (Collection<E> coll : collectionList) {\n // checking if current collection contains the desired element (i.e. itrCounter falls in coll)\n if (coll.size() <= itrCounter - index)\n // desired index doesn't lie in current collection -> skipping all elements\n index += coll.size();\n // current collection contains desired element\n else {\n // finding desired element; iterating over coll\n for (E element : coll){\n // desired index found -> increment itrCounter and return element\n if (index == itrCounter) {\n itrCounter++;\n return element;\n }\n // desired index not reached yet -> increment index\n else index++;\n }\n }\n }\n // could not find next element\n throw new NoSuchElementException();\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}", "default YCollection<T> forEachFun(Consumer<T> consumer) {\n for (T t : this) consumer.accept(t);\n return this;\n }", "@Override\n public void compose() {\n final Continuation currCon = (Continuation)closure.getArgument(0);\n\n ResultValueWrapper best = null;\n double shortest = Double.MAX_VALUE;\n\n int i=1;\n while(true) {\n try {\n final ResultValueWrapper rvw = ((ResultValueWrapper) closure.getArgument(i++));\n if((Double)rvw.getN() < shortest) {\n best = rvw;\n shortest = (Double)rvw.getN();\n }\n } catch (IndexOutOfBoundsException e) { break;}\n }\n\n currCon.setReturnVal(best);\n sendArgument(currCon);\n }", "private static Integer deductOne(Integer element) {\n return element - 1;\n }" ]
[ "0.7042949", "0.5413871", "0.53411824", "0.51426554", "0.5141429", "0.51230216", "0.5117413", "0.5116319", "0.5052188", "0.503958", "0.5028471", "0.50215924", "0.50010145", "0.49862963", "0.49659076", "0.49624345", "0.49496174", "0.48588243", "0.48445466", "0.48224497", "0.4754795", "0.47207478", "0.4715588", "0.47118667", "0.47016466", "0.46879882", "0.46843216", "0.46530342", "0.46514976", "0.46234187", "0.46178022", "0.4616886", "0.46096292", "0.45611537", "0.45611537", "0.45598903", "0.45314285", "0.4529976", "0.4526198", "0.45138723", "0.4502557", "0.44868803", "0.44859943", "0.44781387", "0.44604293", "0.4459662", "0.44461253", "0.44445068", "0.44308084", "0.4430069", "0.44268224", "0.44262022", "0.43939233", "0.43921834", "0.4390238", "0.43902108", "0.4388702", "0.4380206", "0.4365817", "0.43497962", "0.43451828", "0.4340745", "0.43402776", "0.4321966", "0.4320443", "0.43178862", "0.43009073", "0.4294959", "0.4292658", "0.4291448", "0.42910096", "0.4290832", "0.42898336", "0.4283617", "0.42765966", "0.42690745", "0.42683822", "0.42611408", "0.42598677", "0.42561257", "0.4246726", "0.42420202", "0.42297703", "0.42293987", "0.42261595", "0.42244303", "0.4222526", "0.42222634", "0.4216747", "0.42152646", "0.4207818", "0.4206387", "0.4206376", "0.42038497", "0.42014608", "0.41974056", "0.41967002", "0.41735068", "0.4167958", "0.4166229" ]
0.63304627
1
String path = "C:\\\\work\\\\Data\\\\";
public static void main(String[] args) { int loop = 20; loop = loop - 4; // remove initial Point double dt = 0.25; double K = 0.3; KuramotoNetWork_Manage nm = new KuramotoNetWork_Manage(loop, size, dt, K); for(int i = 0; i < loop; i++) { nm.addNewNode(); } // WriteWire ww = new WriteWire(); // ww.write(path, nm.getAllNode()); JFrame frame = new JFrame(); frame.setTitle("DataPlot"); frame.setSize(size, size); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Kuramoto_DataPlot dp = new Kuramoto_DataPlot(nm); // dp.drawBANode(nm.getAllNode()); dp.setVisible(true); dp.repaint(); frame.getContentPane().add(dp); frame.setVisible(true); System.out.println("fin"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static String localPath(String name) {\n\t\tchar c = File.separatorChar;\n\t\treturn name.replace((char) (c ^ '/' ^ '\\\\'), c);\n\t}", "private String getEclipsePathFromWindowsPath(String path) {\n StringBuilder sbPath = new StringBuilder();\n char [] chars = path.toCharArray();\n for (int i = 0; i < chars.length; i++) {\n char c = chars[i];\n if (c == '\\\\') {\n sbPath.append('/');\n } else {\n sbPath.append(c);\n }\n }\n path = sbPath.toString();\n return path;\n }", "public static String convertToWindowsPath(String path) {\n\t\treturn \"E:\" + path;\n\t}", "@Test\n public void testPathParsing_withAlternateSeparator() {\n PathService windowsPathService = PathServiceTest.fakeWindowsPathService();\n assertEquals(\n windowsPathService.parsePath(\"foo\\\\bar\\\\baz\"), windowsPathService.parsePath(\"foo/bar/baz\"));\n assertEquals(\n windowsPathService.parsePath(\"C:\\\\foo\\\\bar\"), windowsPathService.parsePath(\"C:\\\\foo/bar\"));\n assertEquals(\n windowsPathService.parsePath(\"c:\\\\foo\\\\bar\\\\baz\"),\n windowsPathService.parsePath(\"c:\", \"foo/\", \"bar/baz\"));\n }", "static String escapePathName(String path) {\n if (path == null || path.length() == 0) {\n throw new RuntimeException(\"Path should not be null or empty: \" + path);\n }\n\n StringBuilder sb = null;\n for (int i = 0; i < path.length(); i++) {\n char c = path.charAt(i);\n if (needsEscaping(c)) {\n if (sb == null) {\n sb = new StringBuilder(path.length() + 2);\n for (int j = 0; j < i; j++) {\n sb.append(path.charAt(j));\n }\n }\n escapeChar(c, sb);\n } else if (sb != null) {\n sb.append(c);\n }\n }\n if (sb == null) {\n return path;\n }\n return sb.toString();\n }", "public static String getPath(String file_path)\n {\n String file_separator = System.getProperty(\"file.separator\"); //Bug Id 81741\n if (file_path == null)\n return null;\n else if (file_path.substring(file_path.length() - 1).equals(file_separator))//Bug Id 81741, substitute file_separator to System.getProperty(\"file.separator\")\n return file_path;\n else\n {\n \t //Bug Id 81741, Start \n\t if (\"/\".equals(file_separator) && (file_path.indexOf(file_separator) == -1))\n\t {\n\t file_path = file_path.replaceAll(\"\\\\\\\\\", \"/\");\n\t return ((new File(file_path)).getParent()).replaceAll(\"/\",\"\\\\\\\\\");\n\t }\n\t //Bug Id 81741, End\n\t else\n return (new File(file_path)).getParent();\n }\n }", "public static String unixPath(String path) {\n String convert = path.replace(\"\\\\\", \"/\");\n return convert;\n }", "private String normalizePath(String path)\n {\n return path.replaceAll(\"\\\\\\\\{1,}\", \"/\");\n }", "String getRealPath(String path);", "String getFilepath();", "public ResourcePath() {\n //_externalFolder = \"file:///C:/Program%20Files/ESRI/GPT9/gpt/\";\n //_localFolder = \"gpt/\";\n}", "void path(String path);", "void path(String path);", "public static String localizePath(String path)\r\n {\r\n StringBuilder result = new StringBuilder();\r\n char nextChar;\r\n for(int i = 0; i < path.length(); i++)\r\n {\r\n nextChar = path.charAt(i);\r\n if((nextChar == '/') || (nextChar == '\\\\'))\r\n {\r\n // Convert the URI separator to the system dependent path separator\r\n result.append(File.separatorChar);\r\n }\r\n else\r\n {\r\n result.append(nextChar);\r\n }\r\n }\r\n \r\n return result.toString();\r\n }", "public String getWorkDirectory(){\n String wd = \"\";\n try {\n wd = new File(\"test.txt\").getCanonicalPath().replace(\"/test.txt\",\"\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n return wd;\n }", "public static String normalizePath(String path)\r\n {\r\n StringBuilder result = new StringBuilder();\r\n char nextChar;\r\n for(int i = 0; i < path.length(); i++)\r\n {\r\n nextChar = path.charAt(i);\r\n if((nextChar == '\\\\'))\r\n {\r\n // Convert the Windows style path separator to the standard path separator\r\n result.append('/');\r\n }\r\n else\r\n {\r\n result.append(nextChar);\r\n }\r\n }\r\n \r\n return result.toString();\r\n }", "protected String getFileNamePath()\n {\n String sep = System.getProperty(\"file.separator\", \"/\");\n// String path = System.getProperty(\"user.dir\", \".\");\n\n String filename = getPath() + sep + \"sec.dat\";\n\n return filename;\n }", "@Test\r\n public void testToPath() {\r\n System.out.println(\"toPath\");\r\n String id = \"c_58__47_Dojo_32_Workshop_47_test_46_txt\";\r\n String expResult = \"c:/Dojo Workshop/test.txt\";\r\n String result = FileRestHelper.toPath(id);\r\n assertEquals(expResult, result);\r\n }", "private String fixPath(String Path) {\n\n // Nothing to do if we're running the plugin on a Windows machine.\n if (Global.IsWindowsOS()) {\n return Path;\n }\n\n // Replace all of the Windows separator characters with linux separator characters.\n String NewPath = Path.replaceAll(\"\\\\\\\\\", File.separator);\n\n Log.getInstance().write(Log.LOGLEVEL_TRACE, \"RecordingEpisode.fixPath: \" + Path + \"->\" + NewPath);\n \n return NewPath;\n }", "private static void process() {\n try {\n \tpath = path.replaceAll(\"\\\\\\\\\",\"\\\\\\\\\\\\\\\\\");\n Process process = Runtime.getRuntime().exec(\"cmd /c start \"+\"\\\"\"+\"\\\" \\\"\"+ path+\"\\\"\");\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n }", "public String getPath()\n\t{\n\t\treturn letter + \":/\";\n\t}", "Path createPath();", "String getPath();", "String getPath();", "String getPath();", "String getPath();", "String getPath();", "String getExternalPath(String path);", "public String getPath () throws java.io.IOException, com.linar.jintegra.AutomationException;", "private String toCompletePath(String fullRequest) {\n \n///Parse request for file path\nString requestLine[] = new String[] {\" \", \" \", \" \"};\n requestLine = fullRequest.split(\" \");\nString partialPath = requestLine[1];\n \n//If requested path is just \"/\" or \"\", don't return any path\n if(partialPath.length() <= 1) {\n noFileRequested = true;\n return null;\n }\n \nString completePath;\n//If using my Windows machine, the path is different than the school Linux machines\nif (Windows)\n completePath = \"C:/Users/Michelle/eclipse-workspace/P1\" + partialPath;\nelse\n completePath = \".\" + partialPath;\n \n return completePath;\n}", "public static String getPath() {\n\t\t// Lấy đường dẫn link\n\t\tAuthentication auth1 = SecurityContextHolder.getContext().getAuthentication();\n\t\tAgentconnection cus = (Agentconnection) auth1.getPrincipal();\n\t\t \n\t\t//String PATH_STRING_REAL = fileStorageProperties.getUploadDir()+cus.getMerchant()+\"/hotel/images/\" + year + \"/\" + month + \"/\" ;\n\t String PATH_STRING_REAL = \"E:/ezcloud/upload/\"+cus.getMerchant()+\"/hotel/images/\" + year + \"/\" + month + \"/\" ;\n\t return PATH_STRING_REAL;\n\t}", "public Path getDataDirectory();", "public final String path() {\n return string(preparePath(concat(path, SLASH, name)));\n }", "private static String verifyPath(String fileOrDir) {\n if (!new File(fileOrDir).exists()) {\n if (fileOrDir.startsWith(File.separator) || fileOrDir.startsWith(\"\\\\\") || fileOrDir.startsWith(\"/\")) {\n fileOrDir = systemDataDirectory + fileOrDir;\n } else {\n fileOrDir = systemDataDirectory + File.separator + fileOrDir;\n }\n }\n return fileOrDir;\n }", "public String path(String path1, String path2);", "@Test\n public void testInvalidSlashesRuleMatches() throws Exception {\n Assume.assumeFalse(SystemInfo.isWindows);\n\n File file = new File(\"at\\\\least/one\\\\of/these\\\\slashes/are\\\\wrong\");\n assertRuleFails(myFileOp, PathValidator.INVALID_SLASHES, file);\n }", "private static File parsePath(String path) {\n\t\tpath = (path == null ? \"\" : path.trim());\n\t\tif (path.startsWith(\"file://\")) {\n\t\t\tpath = path.substring(\"file://\".length());\n\t\t} else if (path.startsWith(\"file:\")) { \n\t\t\tpath = path.substring(\"file:\".length());\t\n\t\t}\n\t\t\n\t\tif (path.length() == 0 || path.equals(\".\")) {\n\t\t\tpath = System.getProperty(\"user.dir\", \".\"); // CWD\n\t\t} else {\t\n\t\t\t// convert separators to native format\n\t\t\tpath = path.replace('\\\\', File.separatorChar);\n\t\t\tpath = path.replace('/', File.separatorChar);\n\t\t\t\n\t\t\tif (path.startsWith(\"~\")) {\n\t\t\t\t// substitute Unix style home dir: ~ --> user.home\n\t\t\t\tString home = System.getProperty(\"user.home\", \"~\");\n\t\t\t\tpath = home + path.substring(1);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn new File(path);\n\t}", "private String addSlashes(String in) {\n StringBuffer sb = new StringBuffer();\n int index = 0;\n int i = in.indexOf(\"\\\\\");\n int ii = in.indexOf(\"\\\\\\\\\");\n\n if (i == -1) {\n return in;\n }\n\n if (i != ii) {\n sb.append(in.substring(index,i+1)+\"\\\\\");\n }\n index = i+1;\n boolean done = false;\n while (!done) {\n i = in.indexOf(\"\\\\\", index);\n ii = in.indexOf(\"\\\\\\\\\", index);\n if (i == -1) {\n sb.append(in.substring(index));\n done = true;\n }\n else if (i != ii) {\n sb.append(in.substring(index,i+1)+\"\\\\\");\n index = i+1;\n }\n }\n return sb.toString();\n }", "private static void findPath()\r\n {\r\n String temp_path = System.getProperty(\"user.dir\");\r\n char last = temp_path.charAt(temp_path.length() - 1);\r\n if(last == 'g')\r\n {\r\n path = \".\";\r\n }\r\n else\r\n {\r\n path = \"./bag\";\r\n }\r\n \r\n }", "private String removeSlashes(String in) {\n StringBuffer sb = new StringBuffer();\n int i = in.indexOf(\"\\\\\\\\\");\n if (i != -1) {\n return in;\n }\n\n sb.append(in.substring(0,i+1));\n \n int index = i+2;\n boolean done = false;\n while (!done) {\n i = in.indexOf(\"\\\\\\\\\",index);\n if (i == -1) {\n sb.append(in.substring(index));\n done = true;\n }\n else {\n sb.append(in.substring(index,i+1)+\"\\\\\");\n index = i+2;\n }\n }\n return sb.toString();\n }", "private String db4oDBFullPath(Context ctx) {\t\n\t\treturn ctx.getDir(\"data\", 0) + \"/\" + LOCAL_SERVER;\n\t\n\t}", "private char[] getPath() {\n\t\treturn null;\n\t}", "private static String getFullPath(String pathname) {\n String fullPath = null;\n\n // make sure the path starts with a slash\n if (pathname.startsWith(\"/\"))\n fullPath = pathname;\n else\n fullPath = process.getDir() + \"/\" + pathname;\n return fullPath;\n }", "public String getMountedObbPath(String rawPath) throws RemoteException;", "public void setPath (\r\n String strPath) throws java.io.IOException, com.linar.jintegra.AutomationException;", "protected String getMyVarPath(String path){\n\t\treturn \"getVariableData('\"+VARNAME+\"', 'part1', '/nswomoxsd:receive/nswomoxsd:evt/\"+path+\"') \";\n\t}", "public String getPath(String strPathName) {\t\t\n\t\tPathproperties = new Properties();\n\t try {\n\t FileInputStream Master = new FileInputStream(filePath);\n\t Pathproperties.load(Master);\n\t Master.close();\n\t }catch (IOException e) {\n\t System.out.println(e.getMessage());\n\t }\n\t return Pathproperties.getProperty(strPathName);\n\t}", "Path getPath();", "@DISPID(76)\r\n\t// = 0x4c. The runtime will prefer the VTID if present\r\n\t@VTID(74)\r\n\tjava.lang.String path();", "@DISPID(35)\r\n\t// = 0x23. The runtime will prefer the VTID if present\r\n\t@VTID(40)\r\n\tjava.lang.String fullPath();", "public static String getPathSeparator() {\n return File.separator;\n }", "public String getDataPath() {\n\t\treturn \"data\";\r\n\t}", "String displayableFileName(String path) {\n String result = \"\";\n StringTokenizer tok = new StringTokenizer(path, \"\\\\/\");\n while (tok.hasMoreTokens()) {\n result = tok.nextToken();\n }\n return result;\n }", "@DISPID(34)\r\n\t// = 0x22. The runtime will prefer the VTID if present\r\n\t@VTID(39)\r\n\tjava.lang.String path();", "public static String convertPath(String path) {\n String clean = path.replaceAll(\"[^a-zA-Z0-9.-\\\\/]\", \"_\");\n String convert = clean.replace(\"\\\\\", \"/\");\n return convert;\n }", "private static String constructPath(String parent, String child) throws Exception {\r\n File file = new File(parent + \"\\\\\" + child);\r\n boolean tmpBool;\r\n if (File.Exists(file.FullName))\r\n tmpBool = true;\r\n else\r\n tmpBool = File.Exists(file.FullName); \r\n if (!tmpBool)\r\n {\r\n //UPGRADE_TODO: Method 'java.io.File.mkdirs' was converted to 'System.IO.Directory.CreateDirectory' which has a different behavior. \"ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioFilemkdirs'\"\r\n File.CreateDirectory(file.FullName);\r\n }\r\n else if (!File.Exists(file.FullName))\r\n return null;\r\n \r\n String result = file.toString();\r\n //UPGRADE_TODO: Method 'java.lang.System.getProperty' was converted to 'System.IO.Path.DirectorySeparatorChar.ToString' which has a different behavior. \"ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangSystemgetProperty_javalangString'\"\r\n String separator = String.valueOf(File.separatorChar);\r\n if (result.length() > 0 && !result.endsWith(separator))\r\n result += separator;\r\n \r\n return result;\r\n }", "public static String path(final String fileName) {\n final int sep = fileName.lastIndexOf(File.separatorChar);\n return fileName.substring(0, sep);\n }", "String getScratchDirectoryPath(String name);", "public String getLocationPath();", "@DISPID(77)\r\n\t// = 0x4d. The runtime will prefer the VTID if present\r\n\t@VTID(75)\r\n\tjava.lang.String fullPath();", "public static void main(String... args) {\nPath path = Paths.get(\".\");\ntry {\n out.println(path.normalize());\n} catch(IOException e){out.println(e);}\n\ntry {\n out.println(path.toRealPath());\n} catch(IOException e){out.println(e);}\n\n}", "public void setPath(String path)\r\n/* 21: */ {\r\n/* 22:53 */ this.path = path;\r\n/* 23: */ }", "private String getPath() {\n\t\treturn context.getRealPath(\"WEB-INF/ConnectionData\");\n\t}", "private String getPath() {\n\t\treturn context.getRealPath(\"WEB-INF/ConnectionData\");\n\t}", "private String getPath() {\n\t\treturn context.getRealPath(\"WEB-INF/ConnectionData\");\n\t}", "private String getPath() {\n\t\treturn context.getRealPath(\"WEB-INF/ConnectionData\");\n\t}", "private static String windowsPathToRegex(String windowsPath)\n\t{\n\t\tif(windowsPath == null)\n\t\t\treturn null;\n\t\t\n\t\t// Escape special characters\n\t\tString regex = windowsPath.replaceAll(\"([\\\\\\\"\\\\+\\\\(\\\\)\\\\^\\\\$\\\\.\\\\{\\\\}\\\\[\\\\]\\\\|\\\\\\\\])\", \"\\\\\\\\$1\");\n\t\t\n\t\t// Replace wildcards\n\t\treturn regex.replace(\"*\", \".*\").replace(\"?\", \".\");\n\t}", "String getPathName();", "String getPathName();", "public abstract String getFullPath();", "private String getDataPath()\n {\n Location location = Platform.getInstanceLocation();\n if (location == null) {\n return \"@none\";\n } else {\n return location.getURL().getPath();\n }\n }", "private static String createDir(String s) {\r\n \tint len = s.length() - 1;\r\n \tString tempBuff;\r\n \tString result;\r\n \tif (s.charAt(len) != '/') {\r\n \t\ttempBuff = String.format(\"%s/\", s);\r\n \t}\r\n \telse {\r\n \t\ttempBuff = s;\r\n \t}\r\n \tresult = tempBuff;\r\n \treturn result;\r\n }", "public static void main(String[] args) {\n\t\tPath iP = Paths.get(\"/\", \"First.txt\");\t// C\n\t\t//Path iP = Paths.toPath(\"/First.txt\");\t// D\n\t\tSystem.out.println(iP) ;\n\t}", "public String getPathName()\n {\n return getString(\"PathName\");\n }", "private String sep(String path) {\n return path == null ? \"\" : \"/\" + path;\n }", "public static String sActivePath() \r\n\t{\r\n\t\tString activePath = null;\r\n\t\t\r\n\t\ttry \r\n\t\t{\r\n\t\t\tactivePath = new java.io.File(\"\").getCanonicalPath();\r\n\t\t} \r\n\t\tcatch (IOException e) \r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\treturn activePath;\r\n\t}", "public String getPath();", "public String getPath();", "public String getPath();", "Path getPath(String name) throws IOException;", "public static void main(String[] args) {\n\t\tchar separatorChar = System.getProperty(\"file.separator\").charAt(0);\r\n\t\tSystem.out.println(\"Pfadtrenner: \" + separatorChar);\r\n\t\t\r\n\t\t// windows Pfad:\r\n\t\tString pfad1 = \"D:\\\\Daten\\\\Musik\\\\Falco – Rock Me Amadeus.mp\";\r\n\t\tString pfadNeu = pfad1;\r\n\t\t// unter Linux -> \"/D/Daten/Musik/Falco - Rock Me Amadeus.mp\";\r\n\t\t\r\n\t\t// 1. Teilaufgabe: suche nach Laufwerksbezeichnung \"D:\"\r\n\t\tif (pfad1.length() >= 2) {\r\n\t\t\tchar zeichen1 = pfad1.charAt(0);\r\n\t\t\tchar zeichen2 = pfad1.charAt(1);\r\n\t\t\t\r\n\t\t\t// Muster: Buchstabe (gross oder klein) + \":\"\r\n\t\t\tchar zeichen1Klein = Character.toLowerCase(zeichen1); // 1. Zeichen in Kleinbuchstabe wandeln\r\n\t\t\tif (('a' <= zeichen1Klein && zeichen1Klein <= 'z')\r\n\t\t\t\t\t&& zeichen2 == ':') {\r\n\t\t\t\tSystem.out.println(\"Laufwerk: \" + zeichen1);\r\n\t\t\t\tif (!isWindows()) {\r\n\t\t\t\t\t// unter Linux\r\n\t\t\t\t\t// D: \\Daten\\Musik\\Falco – Rock Me Amadeus.mp\r\n\t\t\t\t\t// 1. String: D:\r\n\t\t\t\t\t// 2. String: \\Daten\\Musik\\Falco – Rock Me Amadeus.mp\r\n\t\t\t\t\t// Ergebnis: /D + \\Daten\\Musik\\Falco – Rock Me Amadeus.mp\r\n\t\t\t\t\tpfadNeu = \"/\" + zeichen1 + pfad1.substring(2); // alles ab 2. Index (ab 3. Zeichen)\r\n\t\t\t\t\tSystem.out.println(pfadNeu);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// 2. Teilaufgabe: Pfadtrenner korrigieren - pfadneu soll die \"richtigen\" Pfadtrenner enthalten\r\n\t\tString pfadErgebnis = \"\";\r\n\t\tfor (int i = 0; i < pfadNeu.length(); ++i) {\r\n\t\t\tchar zeichen = pfadNeu.charAt(i);\r\n\t\t\t\r\n\t\t\tif (isWindows()) {\r\n\t\t\t\tif (zeichen == '/') {\r\n\t\t\t\t\tpfadErgebnis += '\\\\';\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpfadErgebnis += zeichen;\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\t// Linux/Mac\r\n\t\t\t\tif (zeichen == '\\\\') {\r\n\t\t\t\t\tpfadErgebnis += '/';\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpfadErgebnis += zeichen;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(pfadErgebnis);\r\n\t\t\r\n\t\t/* weitere Methoden:\r\n\t\t * - s.indexOf(str): sucht in s nach str, liefert Position von str oder -1\r\n\t\t * - s.lastIndexOf(str): sucht in s nach str (von rechts nach links), liefert Position von str oder -1\r\n\t\t * - s.trim: entfernt Leerzeichen vorne und hinten \r\n\t\t * - s.replace(char1, char2): ersetzt alle Zeichen char1 durch char2\r\n\t\t */\r\n\t\t// 3. Teilaufgabe: Dateierweiterung (Extension) ermitteln\r\n\t\tint letzterPunktPosition = pfadErgebnis.lastIndexOf(\".\");\r\n\t\tif (letzterPunktPosition == -1) {\r\n\t\t\tSystem.out.println(\"keine Extension vorhanden!\");\r\n\t\t} else {\r\n\t\t\tSystem.out.printf(\"Name ohne Extension: %s, Extension: %s%n\",\r\n\t\t\t\t\tpfadErgebnis.substring(0, letzterPunktPosition), pfadErgebnis.substring(letzterPunktPosition+1));\t\t\t\r\n\t\t}\r\n\t}", "public String resolvePath();", "private String getPath() {\r\n\t\t\treturn context.getRealPath(\"WEB-INF/ConnectionData\");\r\n\t\t}", "@Test\n public void testSetFolderNamePath() {\n System.out.println(\"setFolderNamePath\");\n String folderNamePath = \"c:\\\\relytest\\\\test\\\\test\";\n CharterDto instance = new CharterDto(\"Test name\");\n instance.setFolderNamePath(folderNamePath);\n\n String expResult = folderNamePath;\n String result = instance.getFolderNamePath();\n assertEquals(expResult, result);\n }", "public static String getFileName(String file_path)\n {\n String file_separator = System.getProperty(\"file.separator\"); //Bug Id 81741\n if (file_path == null)\n return null;\n else if (file_path.substring(file_path.length() - 1).equals(file_separator)) //Bug Id 81741, substitute file_separator to System.getProperty(\"file.separator\")\n return null;\n else\n {\n\t //Bug Id 81741, Start \n\t if (\"/\".equals(file_separator) && (file_path.indexOf(file_separator) == -1))\n\t {\n\t file_path = file_path.replaceAll(\"\\\\\\\\\", \"/\");\n\t }\n\t //Bug Id 81741, End\n\t return (new File(file_path)).getName();\n }\n \n }", "public String getPath() \r\n\t{\r\n\t\tStringBuilder pathBuilder = new StringBuilder();\r\n\t\tfor(Cell c: path)\r\n\t\t\tpathBuilder.append(\" (\" + c.getRow() + ',' + c.getColumn() + ')');\r\n\t\t\r\n\t\treturn pathBuilder.toString();\r\n\t}", "public static String getDataDir(String path) {\n\t\tFile dir = new File(System.getProperty(\"user.dir\"));\n\t\tif (!(dir.toString().endsWith(\"samples\")))\n\t\t\tdir = dir.getParentFile();\n\t\tdir = new File(dir, \"resources\");\n\t\tdir = new File(dir, path);\n\t\tif (dir.isDirectory() == false)\n\t\t\tdir.mkdir();\n\t\treturn dir.toString();\n\t}", "java.lang.String getMountPath();", "private static String returnDiretorioPai(Path a){\n return a.getParent().toString();\n }", "public void backSlash() {\n text.append(\"\\\\\");\n }", "public static String formatFilePath(String path) {\n return StringUtils.replace(path, \"\\\\\", StaticValue.FILE_SEPARATOR);\n }", "protected Path createDataPath(Path metaPath) {\n UUID uuid = UUID.randomUUID();\n long mostSigBits = uuid.getMostSignificantBits();\n long leastSigBits = uuid.getLeastSignificantBits();\n String path = digits(mostSigBits >> 32, 8) + \"-\" + digits(mostSigBits >> 16, 4) + \"-\" + digits(mostSigBits, 4) + \"-\"\n + digits(leastSigBits >> 48, 4) + \"-\" + digits(leastSigBits, 12);\n return new Path(_dataPath, path);\n }", "static String toDirectoryPath(String path) {\n return isNullOrEmpty(path) || isDirectoryPath(path) ? path : path + PATH_DELIMITER;\n }", "public String pathToSave() {\n String path;\n File folder;\n do {\n System.out.print(\"Introduce la ruta en la que quieres guardar el fichero(separando directorios por guiones: directorio1-directorio2-directorio3): \");\n path = Utils.getString();\n path = String.valueOf(System.getProperty(\"user.dir\")).substring(0, 2) + \"\\\\\" + path.replace('-', '\\\\');\n folder = new File(path);\n if (!folder.exists()) {\n System.out.println(\"El directorio introducido no existe intentalo de nuevo...\");\n } else {\n if (!folder.isDirectory()) {\n System.out.println(\"Eso no es un directorio intentalo de nuevo...\");\n }\n }\n } while (!folder.exists() && !folder.isDirectory());\n return path;\n }", "public String path(File f) {\r\n int sep = f.toString().lastIndexOf(\"\\\\\");\r\n return f.toString().substring(0, sep);\r\n }", "public static String getNewPath() {\n return homePath + Integer.toString(++elementCounter) + \".ser\";\n }", "public static String chooseFileLocation(){\n String fileLoc = new String();\n\n JFileChooser fc = new JFileChooser(\".\");\n fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);\n fc.showOpenDialog(null);\n fileLoc = fc.getSelectedFile().getAbsolutePath() + \"\\\\\";\n\n return fileLoc;\n }", "String rootPath();", "public String getPathName()\n \t{\n \t\tif ( arcname!=null )\n \t\t\treturn arcname + ARC_SEPARATOR + pathname;\n \t\treturn pathname;\n \t}", "protected StringBuilder convertPath(final String path) {\n\t\tStringBuilder pathBuffer = new StringBuilder(\"/app:company_home\");\n\t\tString[] parts = path.split(\"/\");\n\n\t\tString subpath;\n\n\t\tfor(String part : parts) {\n\t\t\tsubpath = part.trim();\n\n\t\t\tif(subpath.length() > 0) {\n\t\t\t\tpathBuffer.append(\"/cm:\").append(ISO9075.encode(subpath));\n\t\t\t}\n\t\t}\n\n\t\treturn pathBuffer;\n\t}", "public static String m19635c() {\n String str;\n try {\n str = Environment.getDataDirectory().getPath();\n } catch (Throwable unused) {\n str = null;\n }\n return str == null ? \"\" : str.trim();\n }" ]
[ "0.6629474", "0.6554542", "0.6337752", "0.59358436", "0.5809077", "0.57989424", "0.57965845", "0.5734364", "0.56846595", "0.56716263", "0.5605511", "0.5518588", "0.5518588", "0.5513919", "0.5510107", "0.55034274", "0.5481944", "0.54777175", "0.5470794", "0.54691195", "0.54307055", "0.54139936", "0.53971934", "0.53971934", "0.53971934", "0.53971934", "0.53971934", "0.5362798", "0.53575504", "0.5348756", "0.5340363", "0.5325701", "0.52964056", "0.5290029", "0.5288005", "0.52706456", "0.527024", "0.519133", "0.5176702", "0.5171309", "0.51706016", "0.51695156", "0.5141599", "0.5134323", "0.5130921", "0.5125936", "0.5124016", "0.51159465", "0.5098228", "0.50770295", "0.5060726", "0.5056601", "0.5055534", "0.50457954", "0.5042312", "0.50330013", "0.5032518", "0.50302523", "0.5027894", "0.5020019", "0.5019379", "0.49965763", "0.49899688", "0.49899688", "0.49899688", "0.49899688", "0.49767688", "0.49746808", "0.49746808", "0.49703303", "0.49664617", "0.49633428", "0.49599722", "0.49578664", "0.49524477", "0.49501765", "0.49444693", "0.49444693", "0.49444693", "0.49357626", "0.4928785", "0.4928503", "0.49275336", "0.49245247", "0.492153", "0.49196073", "0.49171278", "0.49132457", "0.49118388", "0.49116567", "0.49110547", "0.48965716", "0.48915842", "0.48806462", "0.48742136", "0.48730665", "0.48723644", "0.4872117", "0.4862812", "0.48598388", "0.48579034" ]
0.0
-1
/ Always read the file and sort the values for good measure
public HighScore(){ readFile(); sortHighscores(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void sortFile(String fileName, PrintStream pOstream, boolean pReverse, int pCol, boolean pIncludesHeader) throws IOException {\n ArrayList lineLengthsList = new ArrayList(); \n ArrayList ordering = new ArrayList();\n BufferedReader reader = new BufferedReader(new FileReader(fileName)); \n if (pIncludesHeader) {\n String header = reader.readLine();\n pOstream.println(header); \n } \n String line = reader.readLine();\n int lineNum = 0;\n while (line!=null) {\n // dbgMsg(\"read line: \"+line);\n lineLengthsList.add(new Integer(line.length()));\n String[] cols = StringUtils.split(line); \n double d = Double.parseDouble(cols[pCol]);\n IntDoublePair orderingObject = new IntDoublePair(lineNum, d);\n ordering.add(orderingObject);\n \n // proceed to next line\n line = reader.readLine();\n lineNum++;\n }\n reader.close();\n Collections.sort(ordering);\n if (pReverse) {\n Collections.reverse(ordering);\n } \n \n int[] lineLengths = ConversionUtils.integerCollectionToIntArray(lineLengthsList);\n int[] linePositions = new int[lineLengths.length];\n int numLines = lineLengths.length;\n linePositions[0]=0;\n for(int i=1; i<numLines; i++) { \n linePositions[i]=linePositions[i-1]+lineLengths[i-1]+1;\n }\n // pOstream.println(\"line lengths: \"+StringUtils.arrayToString(lineLengths, \" \"));\n // pOstream.println(\"line positions: \"+StringUtils.arrayToString(linePositions, \" \"));\n try (RandomAccessFile file = new RandomAccessFile(fileName, \"r\")) { \n\t for (int i=0; i<numLines; i++) {\n\t IntDoublePair orderingObject = (IntDoublePair)ordering.get(i);\n\t lineNum = orderingObject.mInt;\n\t file.seek(linePositions[lineNum]); \n\t byte[] buf = new byte[lineLengths[lineNum]];\n\t file.read(buf, 0, lineLengths[lineNum]); \n\t // String s = new String(buf);\n\t pOstream.write(buf, 0, buf.length);\n\t pOstream.println();\n\t }\n }\n }", "public void sort() throws IOException {\n for(int i = 0; i < 32; i++)\n {\n if(i%2 == 0){\n filePointer = file;\n onePointer = one;\n }else{\n filePointer = one;\n onePointer = file;\n }\n filePointer.seek(0);\n onePointer.seek(0);\n zero.seek(0);\n zeroCount = oneCount = 0;\n for(int j = 0; j < totalNumbers; j++){\n int n = filePointer.readInt();\n sortN(n,i);\n }\n //Merging\n onePointer.seek(oneCount*4);\n zero.seek(0L);\n for(int j = 0; j < zeroCount; j++){\n int x = zero.readInt();\n onePointer.writeInt(x);\n }\n //One is merged\n }\n }", "public static void sortInputBuiltIn() {\r\n\t\t\tEtmPoint point = monitor.createPoint(\"1.sortInputBuiltIn\");\r\n\r\n\t\t\tInput input = new Input(inputFile, BUFFERSIZE);\r\n\t\t\tList<Integer> integers = new ArrayList<Integer>();\r\n\r\n\t\t\ttry {\r\n\t\t\t\tinput.open();\r\n\t\t\t\t\r\n\t\t\t\twhile (!input.end_of_stream()) {\r\n\t\t\t\t\t// read the value\r\n\t\t\t\t\tint value = input.read_next();\r\n\t\t\t\t\tintegers.add(value);\r\n\t\t\t\t}\t\r\n\t\t\t\t\r\n\t\t\t\tCollections.sort(integers);\r\n\t\t\t\t\r\n\t\t\t\t// write the data to a file\r\n\t\t\t\tOutput output = new Output(outputFile, BUFFERSIZE);\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfor (int i = 0; i < integers.size(); i++) {\r\n\t\t\t\t\t\toutput.write(integers.get(i));\r\n\t\t\t\t\t}\r\n\t\t\t\t\toutput.close();\r\n\t\t\t\t} catch (IOException 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} catch (FileNotFoundException e) {\r\n\t\t\t\tSystem.out.println(\"File cannot be found.\");\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\tpoint.collect();\r\n\t\t}", "private void sortFileToScreen() throws FileNotFoundException {\n Scanner file = new Scanner(new File(FILE_NAME));\n while (file.hasNext()) {\n addToOrderedList(file.nextInt());\n }\n file.close();\n printList();\n }", "public void sortByName(String file) throws FileNotFoundException, IOException, ParseException {\n\t\tarrayList = pareseFile(file);\n\t\tFile file1 = new File(file);\n\t\t/*\n\t\t * for (int i = 0; i < arrayList.size(); i++) { JSONObject\n\t\t * person1=(JSONObject)arrayList.get(i); //person1.get(\"lastName\");\n\t\t * arrayList.sort((Person.CompareByName)person1); }\n\t\t */\n\t\t// mapper.writeValue(file1, arrayList);\n\t\tfor (int i = 0; i < arrayList.size() - 1; i++) {\n\t\t\tfor (int j = 0; j < arrayList.size() - i - 1; j++) {\n\n\t\t\t\tJSONObject person1 = (JSONObject) arrayList.get(j);\n\t\t\t\tJSONObject person2 = (JSONObject) arrayList.get(j + 1);\n\t\t\t\tif ((person1.get(\"lastName\").toString()).compareToIgnoreCase(person2.get(\"lastName\").toString()) > 0) {\n\t\t\t\t\tJSONObject temp = person1;\n\t\t\t\t\tarrayList.set(j, person2);\n\t\t\t\t\tarrayList.set(j + 1, temp);\n\t\t\t\t}\n\t\t\t}\n\t\t\tmapper.writeValue(file1, arrayList);\n\n\t\t}\n\t}", "static List<String> readDataFile(String filePath) throws Exception {\n\t\t// System.out.println(filePath);\n\t\tList<String> sortList = new ArrayList<String>();\n\n\t\tFileReader file = new FileReader(new File(filePath));\n\n\t\tBufferedReader bufRead = new BufferedReader(file);\n\n\t\tfor (long line = 0; line < linesPerFile; line++) {\n\n\t\t\tsortList.add((bufRead.readLine().toString()));\n\t\t}\n\n\t\tbufRead.close();\n\t\treturn sortList;\n\t}", "private static void readFileIntoArray (String inputFileName) {\n Path path = Paths.get(inputFileName);\n array = new int[countLines(inputFileName)];\n try {\n Scanner sc = new Scanner(path);\n int i = 0;\n while (sc.hasNextLine()) {\n array[i] = Integer.parseInt(sc.nextLine());\n i++;\n }\n sc.close();\n //sort the array\n MergeSort.mergeSort(array);\n }\n catch(FileNotFoundException e) {\n System.out.println(\"File Error\");\n e.printStackTrace();\n }\n catch(IOException e) {\n System.out.println(\"File Error\");\n e.printStackTrace();\n }\n }", "private void get_values(File f1){\n String line;\n Scanner read_file=null;\n try{\n read_file= new Scanner(f1);\n }catch(FileNotFoundException e){\n System.out.println(\"The specified file of the Student cannot be found.\");\n return;\n }\n line=read_file.nextLine();\n while(!(line.contains(\"OOP\"))){\n line=read_file.nextLine();\n }\n line=read_file.nextLine();\n while(!(line.contains(\"Chap_1\"))){\n line=read_file.nextLine();\n }\n //System.out.println(line.substring(8));\n OOP[0]=Float.parseFloat(line.substring(8));\n line=read_file.nextLine();\n OOP[1]=Float.parseFloat(line.substring(8));\n line=read_file.nextLine();\n OOP[2]=Float.parseFloat(line.substring(8));\n line=read_file.nextLine();\n OOP[3]=Float.parseFloat(line.substring(8));\n\n line=read_file.nextLine();\n while(!(line.contains(\"DE\"))){\n line=read_file.nextLine();\n }\n line=read_file.nextLine();\n while(!(line.contains(\"Chap_1\"))){\n line=read_file.nextLine();\n }\n DE[0]=Float.parseFloat(line.substring(8));\n line=read_file.nextLine();\n DE[1]=Float.parseFloat(line.substring(8));\n line=read_file.nextLine();\n DE[2]=Float.parseFloat(line.substring(8));\n\n line=read_file.nextLine();\n while(!(line.contains(\"DSA\"))){\n line=read_file.nextLine();\n }\n line=read_file.nextLine();\n while(!(line.contains(\"Chap_1\"))){\n line=read_file.nextLine();\n }\n DSA[0]=Float.parseFloat(line.substring(8));\n line=read_file.nextLine();\n DSA[1]=Float.parseFloat(line.substring(8));\n line=read_file.nextLine();\n DSA[2]=Float.parseFloat(line.substring(8));\n\n line=read_file.nextLine();\n line=read_file.nextLine();\n total_marks=Float.parseFloat(line.substring(13));\n average=total_marks/10;\n\n read_file.close();\n }", "private void readFiles(File fileDir) {\n \t\n\t\tif(!fileDir.exists() || !fileDir.isDirectory()) {\n\t\t\treturn;\n\t\t}\n\t\tBufferedReader reader = null;\n\t\tString command = \"cat \";\n\t\tFile[] files = fileDir.listFiles();\n\t\tfor(File file : files) {\n\t\t\tcommand += file.getAbsolutePath();\n\t\t\tcommand += \" \";\n\t\t}\n\t\tcommand += \" | sort\";\n\t\tString[] cmd = {\n\t\t\t\t\"sh\",\n\t\t\t\t\"-c\",\n\t\t\t\tcommand\n\t\t\t\t};\n\t\tProcess p;\n\t\ttry {\n\t\t\tp = Runtime.getRuntime().exec(cmd);\n\t\t\treader = new BufferedReader(new InputStreamReader(p.getInputStream()));\n\t\t\tString line = null;\n\t\t\tString lastKey = null;\n\t\t\tList<String> values = new ArrayList<String>();\n\t\t\twhile((line = reader.readLine()) != null) {\n\t\t\t\tString[] parts = line.split(\"\\\\t\");\n\t\t\t\tif (parts.length < 2) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tString thisKey = parts[0].trim();\n\t\t\t\tString value = parts[1].trim();\n\t\t\t\thandler.onKVPairRead();\n\t\t\t\tif (lastKey != null && !thisKey.equals(lastKey)) {\n\t\t\t\t\tlines.add(new KVPair(lastKey, new ArrayList<String>(values)));\n\t\t\t\t\tvalues.clear();\n\t\t\t\t}\n\t\t\t\tlastKey = thisKey;\n\t\t\t\tvalues.add(value);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\treduceComplete = true;\n }", "@Override\n \tpublic void sort() {\n \t\tArrays.sort(data);\n \t}", "public void sortMarc()\r\n {\r\n\t/* Make sure each element in marc_out is a complete string with more than 4 characters */\r\n\tfor(int a = 0; a < marc_out.size(); a++)\r\n\t {\r\n\t\tif(marc_out.get(a).length() < 5){\r\n\t\t System.out.println(\"Warning (sortMarc): marc line \" + marc_out.get(a) + \" too short, must have least 4 characters.\");\r\n\t\t return;\r\n\t\t}\r\n\t }\r\n\r\n\tfor(int a = 0; a < (marc_out.size() - 1); a++)\r\n\t {\r\n\t\tint field_a = 0;\r\n\t\tString value_a = (marc_out.get(a)).substring(1, 4);\r\n\t\ttry{\r\n\t\t field_a = (Integer.valueOf(value_a)).intValue();\r\n\t\t}\r\n\t\tcatch(NumberFormatException nfe) { }\r\n\r\n\t\tfor(int b = a + 1; b < marc_out.size(); b++)\r\n\t\t {\r\n\t\t\tint field_b = 0;\r\n\t\t\tString value_b = (marc_out.get(b)).substring(1, 4);\r\n\t\t\ttry{\r\n\t\t\t field_b = (Integer.valueOf(value_b)).intValue();\r\n\t\t\t}\r\n\t\t\tcatch(NumberFormatException nfe){ }\r\n\r\n\t\t\tif(field_b < field_a)\r\n\t\t\t {\r\n\t\t\t\tString temp_field = marc_out.get(b);\r\n\t\t\t\tmarc_out.set(b, marc_out.get(a));\r\n\t\t\t\tmarc_out.set(a, temp_field);\r\n\r\n\t\t\t\tfield_a = field_b;\r\n\t\t\t }\r\n\t\t }\r\n \t }\r\n }", "protected void parseValues(File file){\r\n\t\ttry {\r\n\t\t\tScanner scanner = new Scanner(file);\r\n\t\t\tString line;\r\n\t\t\tif(scanner.hasNext()) \r\n\t\t\t\tline = scanner.nextLine();\r\n\t\t\twhile (scanner.hasNextLine()) {\r\n\t\t\t\tline = scanner.nextLine();\r\n\t\t\t\taddToSupplyValues(line);\r\n\t\t\t}\r\n\t\t\tscanner.close();\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void sort() {\r\n // sort the process variables\r\n Arrays.sort(pvValues, categoryComparator);\r\n fireTableDataChanged();\r\n }", "private void sort() {\n setFiles(getFileStreamFromView());\n }", "private void readScores() {\n final List<Pair<String, Integer>> list = new LinkedList<>();\n try (DataInputStream in = new DataInputStream(new FileInputStream(this.file))) {\n while (true) {\n /* reads the name of the player */\n final String name = in.readUTF();\n /* reads the score of the relative player */\n final Integer score = Integer.valueOf(in.readInt());\n list.add(new Pair<String, Integer>(name, score));\n }\n } catch (final Exception ex) {\n }\n this.sortScores(list);\n /* if the list was modified by the cutting method i need to save it */\n if (this.cutScores(list)) {\n this.toSave = true;\n }\n this.list = Optional.of(list);\n\n }", "private void setUp(String file) {\n unorderedList = new LinkedList<>();\n orderedList = new SortedLinkedList<>();\n\n try {\n input = new Scanner(new BufferedReader(new FileReader(file)));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }", "@Override\n public void sort() throws IOException {\n long i = 0;\n // j represents the turn of writing the numbers either to g1 or g2 (or viceversa)\n long j = 0;\n long runSize = (long) Math.pow(2, i);\n long size;\n\n long startTime = System.currentTimeMillis();\n\n System.out.println(\"Strart sorting \"+ this.inputFileName);\n\n while(i <= Math.ceil(Math.log(this.n) / Math.log(2))){\n j = 0;\n do{\n size = merge(runSize, destinationFiles[(int)j % 2]);\n j += 1;\n }while (size/2 == runSize);\n\n System.out.println(\"iteration: \" + i + \", Run Size:\" + runSize + \", Total time elapsed: \" + (System.currentTimeMillis() - startTime));\n i += 1;\n runSize = (long) Math.pow(2, i);\n swipe();\n }\n System.out.println(\"The file has been sorted! Total time elapsed: \"+(System.currentTimeMillis() - startTime));\n\n destinationFiles[0].close();\n destinationFiles[1].close();\n originFiles[0].close();\n originFiles[1].close();\n\n createFile(OUT_PATH +inputFileName);\n copyFile(new File(originFileNames[0]), new File(\"out/TwoWayMergesort/OUT_\"+inputFileName));\n\n }", "public DateSortingUsingAlgorithm() throws IOException {\n\t\t//initialize the classes local variables\n\t\tmap = new HashMap<LocalDate, Integer>();\n\t\tString[] mapData = new String[3];\n\t\t\n\t\t//using a BufferedReader to read in data from the SortingDates.txt file\n\t\tBufferedReader br = new BufferedReader(new FileReader(\"SortingDates.txt\"));\n\t\t\n\t\t//begin reading in the data from the file\n\t\tString dataLine = br.readLine().trim();\n\t\t\n\t\t//the format of the SortingDates.txt dates\n\t\tDateTimeFormatter format = DateTimeFormatter.ofPattern(\"yyyy-MM-dd\");\n\t\tInteger value = 0;\n\t\t/*\n\t\t * this while loop continues to read from the file while there is still data to read in. it \n\t\t * takes the data as a String and parses it into a LocalDate date using the formatter above. Lastly,\n\t\t * it adds the LocalDate to the HashMap to be sorted later\n\t\t */\n\t\twhile (dataLine != null) {\n\t\t\tString result = \"\";\n\t\t\tmapData = dataLine.trim().split(\"-\");\n\t\t\t\n\t\t\t//using a for loop to trim any whitespace in the yyyy-dd-MM format\n\t\t\tfor (int index = 0; index < mapData.length; ++index) {\n\t\t\t\tmapData[index] = mapData[index].trim(); //trimming any white spaces in the yyyyddMM format\n\t\t\t\tif (index == 2) {\n\t\t\t\t\tresult += mapData[index];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tresult += mapData[index] + \"-\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tLocalDate mapDataLDT = LocalDate.parse(result, format);\n\t\t\tmap.put(mapDataLDT, value++);\n\t\t\tdataLine = br.readLine();\n\t\t}\n\t\tbr.close();\n\t}", "public void readIn(String fileName) throws FileNotFoundException {\n\t\tScanner scanner = new Scanner(new FileInputStream(fileName));\n\t\ttry {\n\t\t\tscanner.nextLine(); // Skip line 1 (header)\n\t\t\tscanner.nextLine(); // Skip line 2 (header)\n\t\t\twhile (scanner.hasNextLine()){\n\t\t\t\tprocess(scanner.nextLine());\n\t\t\t}\n\t\t\tCollections.sort(allCoords); //Sort allCoords by z-value\n\t\t}\n\t\tfinally{\n\t\t\tscanner.close();\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\t\r\n\t\tArrayList <Person> employee_list = new ArrayList <>();\r\n\r\n//taking input for the file name\r\n\t\tSystem.out.println(\"Please enter the name of the file (with the extension) that you want to process: \");\r\n\t\tScanner sc= new Scanner(System.in);\r\n\t\tString file_name=sc.nextLine();\r\n\t\t\r\n//opening and reading the file\r\n\t\t\r\n\t\ttry {\r\n List<String> empl_Lines = Files.readAllLines(java.nio.file.Paths.get(file_name), StandardCharsets.UTF_8);\r\n for (String line: empl_Lines) {\r\n \t String[] tokens = line.split(\",\");\r\n \temployee_list.add((Person)Employee.parse(line));\r\n }\r\n }\r\n\t\tcatch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n\t\t\r\n System.out.println(\"Showing the data in the unsorted format\");\r\n System.out.println();\r\n for(Person emp: employee_list) {\r\n \tSystem.out.println(emp);\r\n }\r\n System.out.println();\r\n\r\n//sorting the employee list based on their IDs in ascending order\r\n \r\n Object[] person_array = employee_list.toArray();\r\n Arrays.sort(person_array, (a,b) -> (\"\"+((Person) a).getID()).compareTo(((Person) b).getID()));\r\n System.out.println(\"Sorting the array by the people's ID:\");\r\n System.out.println();\r\n Stream<Object> stream1 = Arrays.stream(person_array);\r\n stream1.forEach(System.out::println);\r\n System.out.println();\r\n \r\n\t\t\r\n//sorting the employee list alphabetically based on their first name\r\n System.out.println(\"Sorting based on First names: \");\r\n System.out.println();\r\n Arrays.sort(person_array, (a,b) -> (\"\"+((Person) a).getFirstName()).compareTo(\"\"+((Person) b).getFirstName())); \r\n Stream<Object> stream2 = Arrays.stream(person_array);\r\n stream2.forEach(System.out::println);\r\n System.out.println();\r\n \r\n//sorting the employee list alphabetically based on their last name, if same last name, then sorting based on first name\r\n System.out.println(\"Sorting based on Last names: \");\r\n System.out.println();\r\n Arrays.sort(person_array, (a,b) -> (\"\"+((Person) a).getLastName()).compareTo(\"\"+((Person) b).getLastName())); \r\n Arrays.sort(person_array, (a, b) -> {\r\n \tint ck = (\"\" + ((Person) a).getLastName()).compareTo(\"\" + ((Person) b).getLastName()); // lastName\r\n \treturn ck != 0? ck:\r\n \t(\"\" + ((Person) a).getFirstName()).compareTo(\"\" + ((Person) b).getFirstName()); // then firstFame\r\n \t});\r\n\r\n Stream<Object> stream3 = Arrays.stream(person_array);\r\n stream3.forEach(System.out::println);\r\n System.out.println(); \r\n\t\t\r\n//showing the total average and the number of the total employees using a stream\r\n\t\t\t\tObject[] empl_array= employee_list.toArray();\r\n\t\t\t\tStream<Object> stream = Arrays.stream(empl_array);\r\n\t\t\t\tdouble avg= stream.mapToDouble(e->((Employee) e).getSalary().doubleValue()).average().getAsDouble();\r\n\t\t\t\tBigDecimal avg_sal= new BigDecimal(avg);\r\n\t\t\t\tSystem.out.print(\"The average salary is: \");\r\n\t\t\t\tSystem.out.printf(\"%.2f\", avg_sal);\r\n\t\t\t\tSystem.out.println();\r\n\t\t\t\tSystem.out.println(\"The total number of employees is: \"+ empl_array.length);\r\n\t\t\t\tSystem.out.println();\r\n \t\t \r\n//grouping the employees based on their salary range\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\tMap<Object, DoubleSummaryStatistics> result = employee_list.stream()\r\n\t\t\t\t\t\t\t.collect(Collectors.groupingBy(emp -> \r\n\t\t\t\t\t\t\t\t\t ((Employee) emp).getSalary().doubleValue() < 25000 ? \"<25000\" :\r\n\t\t\t\t\t\t\t\t ((Employee) emp).getSalary().doubleValue() < 40000 ? \"25000-40000\" :\r\n\t\t\t\t\t\t\t\t ((Employee) emp).getSalary().doubleValue() < 70000 ? \"40000-70000\" :\r\n\t\t\t\t\t\t\t\t\t ((Employee) emp).getSalary().doubleValue() > 70000 ? \">70000\" : \">70000\",\r\n\t\t\t\t\t\t\t\t Collectors.summarizingDouble(emp -> ((Employee) emp).getSalary().doubleValue())));\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\tDoubleSummaryStatistics sal_25 = result.get(\"<25000\");\r\n\t\t\t\tdouble avg_25 = sal_25 == null ? 0.0 : sal_25.getAverage();\r\n\t\t\t\tSystem.out.println(\"<25000 --> employee count: \" + sal_25.getCount() + \" --> avg salary: \" + String.format(\"%.2f\",avg_25));\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\tDoubleSummaryStatistics sal_25_40 = result.get(\"25000-40000\");\r\n\t\t\t\tdouble avg_25_40 = sal_25_40 == null ? 0.0 : sal_25_40.getAverage();\r\n\t\t\t\tSystem.out.println(\"25000-40000 --> employee count: \" + sal_25_40.getCount() + \" --> avg salary: \" + String.format(\"%.2f\",avg_25_40));\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\tDoubleSummaryStatistics sal_40_70 = result.get(\"40000-70000\");\r\n\t\t\t\tdouble avg_40_70 = sal_40_70 == null ? 0.0 : sal_40_70.getAverage();\r\n\t\t\t\tSystem.out.println(\"40000-70000 --> employee count: \" + sal_40_70.getCount() + \" --> avg salary: \" + String.format(\"%.2f\",avg_40_70));\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\tDoubleSummaryStatistics sal_70 = result.get(\">70000\");\r\n\t\t\t\tdouble avg_70 = sal_70 == null ? 0.0 : sal_70.getAverage();\r\n\t\t\t\tSystem.out.println(\">70000 --> employee count: \" + sal_70.getCount() + \" --> avg salary: \" + String.format(\"%.2f\",avg_70));\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t \r\n\t}", "public static void Externalexp2Sort(ArrayList<String> source)\n throws IOException {\n PriorityQueue<KVPair> heap = new PriorityQueue<KVPair>(20,\n new UserPrio());\n ArrayList<CsvReader> readers = new ArrayList<CsvReader>();\n // user_tweets output\n PrintWriter writer = new PrintWriter(new FileWriter(user_retweet));\n\n // open files\n for (String fileName : source) {\n // get read csv files\n CsvReader reader = new CsvReader(new InputStreamReader(\n new FileInputStream(fileName), \"UTF-8\"));\n reader.setHeaders(Merge.fields);\n // read a line and put into heap\n if (reader.readRecord()) {\n heap.offer(new KVPair(Merge.readRecord(reader), readers.size()));\n }\n readers.add(reader);\n }\n\n // get same key\n KVPair last = null;\n HashSet<Long> sameRecord = new HashSet<Long>();\n\n while (heap.size() > 0) {\n KVPair tmp = heap.poll();\n\n // no retweet directly read the next\n if (tmp.record.retweet != -1) {\n if (last != null && last.record.retweet != -1\n && last.record.retweet != tmp.record.retweet) {\n StringBuilder builder = new StringBuilder(\n last.record.retweet + \",\");\n\n for (Long userid : sameRecord) {\n builder.append(userid);\n builder.append(\" \");\n }\n writer.println(builder);\n sameRecord = new HashSet<Long>();\n }\n sameRecord.add(tmp.record.userid);\n }\n\n // read next record in the same file\n if (readers.get(tmp.file).readRecord()) {\n heap.offer(new KVPair(Merge.readRecord(readers.get(tmp.file)),\n tmp.file));\n } else {\n readers.get(tmp.file).close();\n }\n last = tmp;\n }\n\n // last part of external sort\n if (sameRecord.size() != 0) {\n StringBuilder builder = new StringBuilder(last.record.retweet + \",\");\n\n for (Long userid : sameRecord) {\n builder.append(userid);\n builder.append(\" \");\n }\n writer.println(builder);\n }\n\n writer.close();\n }", "public static void main(String[] args) throws IOException {\n BufferedReader file = new BufferedReader(new FileReader(args[0]));\n// bufferedReader.close();\n Map<String, Double> map = new TreeMap<String, Double>();\n String str = file.readLine();\n while (str != null)\n {\n String[] lines = str.split(\" \");\n if (!map.containsKey(lines[0]))\n map.put(lines[0], Double.parseDouble(lines[1]));\n else\n map.replace(lines[0], Double.parseDouble(lines[1]) + map.get(lines[0]));\n str = file.readLine();\n }\n file.close();\n double max = -1;\n for (Map.Entry<String, Double> entry : map.entrySet())\n {\n if (max < entry.getValue())\n max = entry.getValue();\n }\n for (Map.Entry<String, Double> entry : map.entrySet())\n {\n if (max == entry.getValue())\n System.out.println(entry.getKey());\n }\n }", "private static void stepSorter(String file, DataOutputStream d, int size) throws FileNotFoundException, IOException {\n\t\tDataInputStream inputA = new DataInputStream(new BufferedInputStream(new FileInputStream(new File(file))));\n\t\tDataInputStream inputB = new DataInputStream(new BufferedInputStream(new FileInputStream(new File(file))));\n\t\tint numDivisions = (int) Math.ceil(fileSize/((double) size));\n\t\tinputB.skip(size*4);\n\t\tfor (int j = 0; j < numDivisions/2; j++){\t\n\t\t\tint counterA = size;\n\t\t\tint counterB = Math.min(fileSize - j*size*2 - size, size);\n\t\t\tInteger a = inputA.readInt();\n\t\t\tInteger b = inputB.readInt();\n\t\t\twhile (counterA > 0 && counterB > 0){\n\t\t\t\tif (a < b){\n\t\t\t\t\td.writeInt(a);\n\t\t\t\t\tif (counterA > 1){\n\t\t\t\t\t\ta = inputA.readInt();\n\t\t\t\t\t}\n\t\t\t\t\tcounterA--;\n\t\t\t\t} else {\n\t\t\t\t\td.writeInt(b);\n\t\t\t\t\tif (counterB > 1){\n\t\t\t\t\t\tb = inputB.readInt();\n\t\t\t\t\t}\n\t\t\t\t\tcounterB--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (counterA == 0){\n\t\t\t\td.writeInt(b);\n\t\t\t\tcounterB--;\n\t\t\t\tfor (int i =0; i < counterB; i++){\n\t\t\t\t\td.writeInt(inputB.readInt());\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\td.writeInt(a);\n\t\t\t\tcounterA--;\n\t\t\t\tfor (int i =0; i < counterA; i++){\n\t\t\t\t\td.writeInt(inputA.readInt());\n\t\t\t\t}\n\t\t\t}\n\t\t\tinputA.skip(size*4);\n\t\t\tinputB.skip(size*4);\n\t\t}\n\t\t\n\t\t//copy the excess\n\t\twhile (inputA.available()>0){\n\t\t\td.writeInt(inputA.readInt());\n\t\t}\n\t\tinputA.close();\n\t\tinputB.close();\n\t\td.flush();\n\t}", "public static void main(String[] args) throws FileNotFoundException {\n\t\tint listArr[] = new int[70];\r\n\t\tString filename = \"MyList.txt\";\r\n\t\tFile file = new File(filename);\r\n\t\tScanner input = new Scanner(file);\r\n\t\tint i = 0;\r\n\t\twhile (input.hasNextLine()) {\r\n\t\t\tlistArr[i] = input.nextInt();\r\n\t\t\ti++;\r\n\t\t}\r\n\t\t\r\n\t\tmergeSort(listArr, 70);\r\n\t\tfor(i = 0; i < 70; i++) {\r\n\t\t\tSystem.out.println(listArr[i]);\r\n\t\t}\r\n\t}", "public static ArrayList<String> Externalexp1Sort(ArrayList<String> source)\n throws Exception {\n // file\n // ArrayList<Long> k = new ArrayList<Long>();\n // k.add(0L);\n // k.add(0L);\n // k.add(0L);\n // Long repeat = 0L;\n\n PriorityQueue<KVPair> heap = new PriorityQueue<KVPair>(20,\n new UserPrio());\n ArrayList<CsvReader> readers = new ArrayList<CsvReader>();\n // user_tweets output\n PrintWriter writer = new PrintWriter(new FileWriter(user_tweets));\n\n writer2 = new CsvWriter(new OutputStreamWriter(new FileOutputStream(\n SORT_USER_FN + fileNum + \".csv\"), \"UTF-8\"), ',');\n\n // open files\n for (String fileName : source) {\n // get read csv files\n CsvReader reader = new CsvReader(new InputStreamReader(\n new FileInputStream(fileName), \"UTF-8\"));\n reader.setHeaders(Merge.fields);\n // read a line and put into heap\n if (reader.readRecord()) {\n heap.offer(new KVPair(Merge.readRecord(reader), readers.size()));\n }\n readers.add(reader);\n }\n\n // get same key\n KVPair last = null;\n HashMap<Long, Record> sameRecord = new HashMap<Long, Record>();\n\n while (heap.size() > 0) {\n KVPair tmp = heap.poll();\n\n if (last != null && last.record.userid != tmp.record.userid) {\n writer.println(last.record.userid + \",\" + sameRecord.size());\n\n // print records to file\n writeRecords(sameRecord.values());\n\n sameRecord = new HashMap<Long, Record>();\n\n }\n\n // if (sameRecord.containsKey(tmp.record.tweetid)) {\n // repeat ++;\n // System.out.println(tmp.record.tweetid +\" : \" + repeat);\n // }\n\n sameRecord.put(tmp.record.tweetid, tmp.record);\n\n // read next record in the same file\n if (readers.get(tmp.file).readRecord()) {\n\n // k.set(tmp.file, k.get(tmp.file)+1);\n // System.out.println(k);\n\n heap.offer(new KVPair(Merge.readRecord(readers.get(tmp.file)),\n tmp.file));\n } else {\n readers.get(tmp.file).close();\n }\n last = tmp;\n }\n\n // last part of external sort\n if (sameRecord.size() != 0) {\n writer.println(last.record.userid + \",\" + sameRecord.size());\n\n // print records to file\n writeRecords(sameRecord.values());\n }\n\n writer.close();\n\n writer2.flush();\n writer2.close();\n\n return source;\n }", "public CharTest (String filename) {\n\t\ttable = new Hashtable<>();\n\t\ttry {\n\t\t\tReader reader = new FileReader(filename);\n\t\t\tScanner s = new Scanner(reader);\n\t\t\t//sortTable = new String[s.];\n\t\t\tint count = 1; \n\t\t\twhile (s.hasNextLine()) {\n\t\t\t\tString str = s.nextLine();\n\t\t\t\ttable.put(count,str);\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\ts.close();\n\t\t\tsortAlphabetical();\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.out.println(\"failed file import\");\n\t\t}\n\t}", "public void readKey(File file) throws FileNotFoundException {\n key = new double[CHAR_SET_SIZE][CHAR_SET_SIZE];\n Scanner in = new Scanner(file);\n int i = 0;\n while (in.hasNextLine()) {\n String line = in.nextLine();\n String [] vals = line.split(\" \");\n for (int j = 0; j < vals.length; j++) {\n key[i][j] = Double.parseDouble(vals[j]);\n }\n i++;\n }\n }", "@Override\n protected void read(){\n try(BufferedReader bufferedReader = new BufferedReader(new FileReader(getPath()));) {\n\n String frequencyString;\n\n String frequencyFileFormat = \"([a-z]\\\\s\\\\d+\\\\.\\\\d+)\";\n Pattern pattern = Pattern.compile(frequencyFileFormat);\n Matcher matcher;\n\n String[] frequency;\n\n // Read in each line of the frequencies file\n while ((frequencyString = bufferedReader.readLine()) != null) {\n // Match the frequency format to a individual frequency\n matcher = pattern.matcher(frequencyString);\n if(matcher.find()){\n\n // Split the string into the character and its frequency\n frequency = matcher.group(1).split(\" \");\n\n // Add the string and its corresponding frequency to the frequencies hash map\n frequencies.put(frequency[0], Double.parseDouble(frequency[1]));\n \n }\n }\n\n // Only set to true if it successfully reads the whole file\n setFileRead();\n }\n catch(FileNotFoundException e){\n e.printStackTrace();\n }\n catch(IOException e){\n e.printStackTrace();\n }\n }", "public static void sortInputExternalMerge() {\r\n\t\tExternalMultiwayMerge merge = new ExternalMultiwayMerge();\r\n\t\tmerge.sort(inputFile, M, d);\r\n\t}", "public boolean isSorted() throws IOException{\n file.seek(0);\n int prev = file.readInt();\n for(int i = 0; i < totalNumbers-1; i++){\n int cur = file.readInt();\n if(prev < cur){\n return false;\n }\n prev = cur;\n }\n return true;\n }", "@Test\n public void testScan() throws IOException {\n Reader reader = new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);\n Assert.assertFalse(reader.isSorted());\n Assert.assertEquals(((int) (reader.getEntryCount())), 4);\n Scanner scanner = reader.createScanner();\n try {\n // read key and value\n byte[] kbuf = new byte[TestTFileUnsortedByteArrays.BUF_SIZE];\n int klen = scanner.entry().getKeyLength();\n scanner.entry().getKey(kbuf);\n Assert.assertEquals(new String(kbuf, 0, klen), \"keyZ\");\n byte[] vbuf = new byte[TestTFileUnsortedByteArrays.BUF_SIZE];\n int vlen = scanner.entry().getValueLength();\n scanner.entry().getValue(vbuf);\n Assert.assertEquals(new String(vbuf, 0, vlen), \"valueZ\");\n scanner.advance();\n // now try get value first\n vbuf = new byte[TestTFileUnsortedByteArrays.BUF_SIZE];\n vlen = scanner.entry().getValueLength();\n scanner.entry().getValue(vbuf);\n Assert.assertEquals(new String(vbuf, 0, vlen), \"valueM\");\n kbuf = new byte[TestTFileUnsortedByteArrays.BUF_SIZE];\n klen = scanner.entry().getKeyLength();\n scanner.entry().getKey(kbuf);\n Assert.assertEquals(new String(kbuf, 0, klen), \"keyM\");\n } finally {\n scanner.close();\n reader.close();\n }\n }", "public static void userSort(ArrayList<String>list) throws FileNotFoundException{\r\n\t\tCollections.sort(list, new Comparator<String>(){\r\n\t\t\t@Override\r\n\t\t\tpublic int compare(String o1, String o2) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\t//Take the first string, split according to \";\", and store in an arraylist\r\n\t\t\t\tString[] values = o1.split(\";\");\r\n\t\t\t\t//Take the second string and do the same thing\r\n\t\t\t\tString[] values2 = o2.split(\";\");\r\n\t\t\t\t//Compare strings according to their integer values\r\n\t\t\t\treturn Integer.valueOf(values[0].replace(\"\\\"\", \"\")).compareTo(Integer.valueOf(values2[0].replace(\"\\\"\", \"\")));\r\n\t\t\t}\r\n\t\t});\r\n\t\t//Output sorted ArrayList to a text file\r\n\t\t@SuppressWarnings(\"resource\")\r\n\t\tPrintStream out = new PrintStream(new FileOutputStream(\"SortedUsers.txt\"));\r\n\t\t\tfor(int i = 0; i < list.size(); i++){\r\n\t\t\t\tout.println(list.get(i));\r\n\t\t\t}\r\n\t}", "public void readFile(String filename){\n\t\ttry{\n\t\t\tBufferedReader bf = new BufferedReader(new FileReader(filename));\n\t\t\tString line;\n\t\t\tString[] categories = new String[5];\n\t\t\tline = bf.readLine();\n\t\t\tint[] pointValues = new int[5];\n\t\t\tboolean FJ = false;\n\t\t\t\n\t\t\t// Read the first line\n\t\t\tint index = 0;\n\t\t\tint catnum = 0;\n\t\t\twhile(catnum < 5){\n\t\t\t\tcategories[catnum] = readWord(line, index);\n\t\t\t\tindex += categories[catnum].length();\n\t\t\t\tif(index == line.length()-1){\n\t\t\t\t\tSystem.out.println(\"Error: Too few categories.\");\n\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t}\n\t\t\t\tfor(int i = 0; i < catnum; i++){\n\t\t\t\t\tif(categories[i].equals(categories[catnum])){\n\t\t\t\t\t\tSystem.out.println(\"Error: Duplicate categories.\");\n\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(catnum < 4)\n\t\t\t\t\tindex += 2;\n\t\t\t\tcatnum++;\n\t\t\t}\n\t\t\tif(index < line.length()-1){\n\t\t\t\tSystem.out.println(\"Error: Too many categories.\");\n\t\t\t\tSystem.exit(-1);\n\t\t\t}\n\t\t\t\n\t\t\tCategory cat1, cat2, cat3, cat4, cat5, cat6;\n\t\t\tcat1 = new Category(categories[0]);\n\t\t\tcat2 = new Category(categories[1]);\n\t\t\tcat3 = new Category(categories[2]);\n\t\t\tcat4 = new Category(categories[3]);\n\t\t\tcat5 = new Category(categories[4]);\n\t\t\tcat6 = new Category(\"FJ\");\n\n\t\t\t// Read the second line\n\t\t\tline = bf.readLine();\n\t\t\t//System.out.println(line);\n\t\t\tindex = 0;\n\t\t\tint pointnum = 0;\n\t\t\twhile(pointnum < 5){\n\t\t\t\tint point = 0;\n\t\t\t\ttry{\n\t\t\t\t\tpoint = Integer.parseInt(readWord(line, index));\n\t\t\t\t\tindex += (readWord(line, index)).length();\n\t\t\t\t}\n\t\t\t\tcatch(Exception e){\n\t\t\t\t\tSystem.out.println(e);\n\t\t\t\t\tSystem.out.println(\"Error: point value not integer.\");\n\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tpointValues[pointnum] = point;\n\t\t\t\tfor(int i = 0; i < pointnum; i++){\n\t\t\t\t\tif(pointValues[pointnum] == pointValues[i]){\n\t\t\t\t\t\tSystem.out.println(\"Error: Duplicate point values\");\n\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(pointnum <4)\n\t\t\t\t\tindex += 2;\n\t\t\t\tpointnum++;\n\t\t\t}\n\t\t\tif(index < line.length()-1){\n\t\t\t\tSystem.out.println(\"Error: Too many point values.\");\n\t\t\t\tSystem.exit(-1);\n\t\t\t}\n\t\t\t\n\t\t\t// Read in the questions\n\t\t\tString q=\"\";\n\t\t\tString a=\"\";\n\t\t\tString category=\"\";\n\t\t\tint point=0;\n\t\t\tint colonNumber = 0;\n\t\t\tQuestion question = new Question(0, \"\", \"\");\n\t\t\t\n\t\t\twhile((line = bf.readLine())!= null && line.length() != 0){\n\t\t\t\tindex = 0;\n\t\t\t\t// New question, initialize all vars\n\t\t\t\tif(line.substring(0,2).equals(\"::\")){\n\t\t\t\t\t// Add the previous question\n\t\t\t\t\tif(question.getPoint() != 0){\n\t\t\t\t\t\tif(category.equals(cat1.getName())){\n\t\t\t\t\t\t\tcat1.addQuestion(question);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(category.equals(cat2.getName())){\n\t\t\t\t\t\t\tcat2.addQuestion(question);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(category.equals(cat3.getName())){\n\t\t\t\t\t\t\tcat3.addQuestion(question);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(category.equals(cat4.getName())){\n\t\t\t\t\t\t\tcat4.addQuestion(question);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(category.equals(cat5.getName())){\n\t\t\t\t\t\t\tcat5.addQuestion(question);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(category.equals(\"FJ\")){\n\t\t\t\t\t\t\tcat6.addQuestion(question);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tSystem.out.println(\"Error: Wrong category name.\");\n\t\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ta=\"\";\n\t\t\t\t\tq=\"\";\n\t\t\t\t\tcategory=\"\";\n\t\t\t\t\tpoint = 0;\n\t\t\t\t\tindex += 2;\n\t\t\t\t\tcolonNumber = 1;\n\t\t\t\t\tquestion = new Question(0, \"\", \"\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// If FJ cont'd\n\t\t\t\telse{\n\t\t\t\t\tif(category.equals(\"FJ\")){\n\t\t\t\t\t\twhile(index < line.length()){\n\t\t\t\t\t\t\tswitch(colonNumber){\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tq += readWord(line, index);\n\t\t\t\t\t\t\t\tindex += readWord(line, index).length();\n\t\t\t\t\t\t\t\tquestion.setQuestion(q);\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\ta += readWord(line, index);\n\t\t\t\t\t\t\t\tindex += readWord(line, index).length();\n\t\t\t\t\t\t\t\tquestion.setAnswer(a);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tSystem.out.println(\"Error: Format error.\");\n\t\t\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(colonNumber < 3 && index < line.length()-1 && line.substring(index, index+2).equals(\"::\")){\n\t\t\t\t\t\t\t\tindex+=2;\n\t\t\t\t\t\t\t\tcolonNumber++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// FJ starts\n\t\t\t\tif(readWord(line, index).equals(\"FJ\")){\n\t\t\t\t\tif(FJ){\n\t\t\t\t\t\tSystem.out.println(\"Error: Multiple final jeopardy questions.\");\n\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t}\n\t\t\t\t\tFJ = true;\n\t\t\t\t\tpoint = -100;\n\t\t\t\t\tcategory = \"FJ\";\n\t\t\t\t\tindex += 4;\n\t\t\t\t\tcolonNumber++;\n\t\t\t\t\tif(index < line.length()-1)\n\t\t\t\t\t\tq += readWord(line, index);\n\t\t\t\t\tindex += q.length();\n\t\t\t\t\tindex += 2;\n\t\t\t\t\tif(index < line.length()-1)\n\t\t\t\t\t\ta += readWord(line, index);\n\t\t\t\t\tquestion.setPoint(point);\n\t\t\t\t\tquestion.setAnswer(a);\n\t\t\t\t\tquestion.setQuestion(q);\n\t\t\t\t}\n\t\t\t\t// Other questions\n\t\t\t\telse{\n\t\t\t\t\twhile(index < line.length()){\n\t\t\t\t\t\t//System.out.println(colonNumber);\n\t\t\t\t\t\tswitch(colonNumber){\n\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\tcategory = category + readWord(line, index);\n\t\t\t\t\t\t\tboolean right = false;\n\t\t\t\t\t\t\tfor(int i = 0; i < 5; i++){\n\t\t\t\t\t\t\t\tif(categories[i].equals(category))\n\t\t\t\t\t\t\t\t\tright = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(!right){\n\t\t\t\t\t\t\t\tSystem.out.println(\"Error: Wrong category.\");\n\t\t\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tindex += category.length();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\tpoint = Integer.parseInt(readWord(line, index));\n\t\t\t\t\t\t\tright = false;\n\t\t\t\t\t\t\tfor(int i = 0; i < 5; i++){\n\t\t\t\t\t\t\t\tif(pointValues[i] == point)\n\t\t\t\t\t\t\t\t\tright = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(!right){\n\t\t\t\t\t\t\t\tSystem.out.println(\"Error: Wrong point value.\");\n\t\t\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tindex += readWord(line, index).length();\n\t\t\t\t\t\t\tquestion.setPoint(point);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\tq = q + readWord(line, index);\n\t\t\t\t\t\t\tindex += readWord(line, index).length();\n\t\t\t\t\t\t\tquestion.setQuestion(q);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\ta = a+ readWord(line, index);\n\t\t\t\t\t\t\tindex += readWord(line, index).length();\n\t\t\t\t\t\t\tquestion.setAnswer(a);\n\t\t\t\t\t\t\tif(index < line.length()){\n\t\t\t\t\t\t\t\tSystem.out.println(\"Error: Format error.\");\n\t\t\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tSystem.out.println(\"Error: Format error.\");\n\t\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(colonNumber < 4 && index < line.length()-1 && line.substring(index, index+2).equals(\"::\")){\n\t\t\t\t\t\t\tindex += 2;\n\t\t\t\t\t\t\tcolonNumber++;\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// Add the last question\n\t\t\tif(category.equals(cat1.getName())){\n\t\t\t\tcat1.addQuestion(question);\n\t\t\t}\n\t\t\telse if(category.equals(cat2.getName())){\n\t\t\t\tcat2.addQuestion(question);\n\t\t\t}\n\t\t\telse if(category.equals(cat3.getName())){\n\t\t\t\tcat3.addQuestion(question);\n\t\t\t}\n\t\t\telse if(category.equals(cat4.getName())){\n\t\t\t\tcat4.addQuestion(question);\n\t\t\t}\n\t\t\telse if(category.equals(cat5.getName())){\n\t\t\t\tcat5.addQuestion(question);\n\t\t\t}\n\t\t\telse if(category.equals(\"FJ\")){\n\t\t\t\tcat6.addQuestion(question);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(\"Error: Wrong category name.\");\n\t\t\t\tSystem.exit(-1);\n\t\t\t}\n\t\t\t\n\t\t\tmCategories.add(cat1);\n\t\t\tmCategories.add(cat2);\n\t\t\tmCategories.add(cat3);\n\t\t\tmCategories.add(cat4);\n\t\t\tmCategories.add(cat5);\n\t\t\tmCategories.add(cat6);\n\t\t\t\n\t\t\tbf.close();\n\t\t}\n\t\t\n\t\tcatch(IOException ioe){\n\t\t\tSystem.out.println(ioe);\n\t\t\tSystem.exit(-1);\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.out.println(e);\n\t\t}\n\t\t\n\t}", "public static void sort(String f1, String f2) throws FileNotFoundException, IOException {\n\t\tDataInputStream input = new DataInputStream(new BufferedInputStream(new FileInputStream(new File(f1))));\n\t\tfileSize = (int) input.available()/4;\n\t\tif (fileSize == 0){ input.close(); return;} //file is empty\t\n\t\t\n\t\tRandomAccessFile f1a = new RandomAccessFile(f1,\"rw\");\n\t\tRandomAccessFile f2a = new RandomAccessFile(f2,\"rw\");\n\t\tDataOutputStream f1d = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(f1a.getFD())));\n\t\tDataOutputStream f2d = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(f2a.getFD())));\n\t\t\n\t\t//perform quicksort on partitions of quickSortSize\n\t\tquickSortSize = (int) (Math.min(quickSortSize, fileSize)); \n\t\tint numDivisions = (int) (Math.floor(fileSize/quickSortSize));\n\t\tint excess = (int) (fileSize%(numDivisions*quickSortSize));\n\t\tint[] tmp = new int[quickSortSize];\n\t\tfor (int j = 0; j < numDivisions; j++){\n\t\t\tfor (int i = 0; i< quickSortSize; i++){\n\t\t\t\ttmp[i] = input.readInt();\n\t\t\t}\n\t\t\tquickSort(tmp);\n\t\t\tfor (int i: tmp){\n\t\t\t\tf2d.writeInt(i);\n\t\t\t}\n\t\t}\n\t\ttmp = new int[excess];\n\t\tfor (int i = 0; i< excess; i++){\n\t\t\ttmp[i] = input.readInt();\n\t\t}\n\t\tquickSort(tmp);\n\t\tfor (int i: tmp){\n\t\t\tf2d.writeInt(i);\n\t\t}\n\t\tf2d.flush();\n\t\tinput.close();\n\t\t\n\t\t//Perform Merge sort on the larger partitions\n\t\tint iteration = (int) Math.ceil(Math.log(fileSize/(quickSortSize))/Math.log(2));\n\t\tfor (int i = 0; i < iteration; i++){\n\t\t\tint size = (int) Math.pow(2, i)*quickSortSize;\n\t\t\tif (i%2 == 0){ \n\t\t\t\tf1a.seek(0);\n\t\t\t\tstepSorter(f2, f1d, size);\n\t\t\t} else {\n\t\t\t\tf2a.seek(0);\n\t\t\t\tstepSorter(f1, f2d, size);\n\t\t\t}\n\t\t}\n\n\t\t//Copies f2 to f1 if the iteration ends with f2\n\t\tif (iteration%2==0){\n\t\t\tFileChannel source = null;\n\t\t\tFileChannel destination = null;\n\t\t\ttry {\n\t\t\t\tsource = new FileInputStream(f2).getChannel();\n\t\t\t\tdestination = new FileOutputStream(f1).getChannel();\n\t\t destination.transferFrom(source, 0, source.size());\n\t\t }\n\t\t finally {\n\t\t if(source != null) {\n\t\t source.close();\n\t\t }\n\t\t if(destination != null) {\n\t\t destination.close();\n\t\t }\n\t\t }\n\t\t}\n\t\tf1a.close();\n\t\tf2a.close();\n\t\tf1d.close();\n\t\tf2d.close();\n\t}", "public void getFichierOrder(String fileName)\n {\n try{\n\n for (String line : Files.readAllLines(Paths.get(fileName), StandardCharsets.UTF_8)) {\n String[] champs = line.split(\";\");\n String chp1 = champs[0];\n int chp2 = Integer.parseInt(champs[1]);\n int champ3 = Integer.parseInt(champs[2]);\n double chp4 = Double.parseDouble(champs[3]);\n Order order = new Order(chp1, chp2, champ3, chp4);\n listOrder.add(order);\n\n }\n }\n catch (IOException e)\n {\n System.out.println(\"FICHIER ORDRES.CSV NON TROUVE. CREATION FICHIER.\");\n writeOrdres(fileName);\n }\n }", "public static void main(String[] args) throws IOException{\n BufferedReader in = new BufferedReader(new FileReader(args[0]));\n //sc.close();\n\n SortedMap<String, Double> map = new TreeMap<String, Double>();\n String s = null;\n while ((s = in.readLine()) != null) {\n String key = s.split(\" \")[0];\n Double value = Double.parseDouble(s.split(\" \")[1]);\n Double currentValue = map.get(key);\n if (currentValue == null) currentValue = 0.0;\n map.put(key, value + currentValue);\n }\n in.close();\n\n Iterator<SortedMap.Entry<String, Double>> iterator = map.entrySet().iterator();\n while (iterator.hasNext()) {\n SortedMap.Entry<String, Double> entry = iterator.next();\n System.out.println(entry.getKey() + \" \" + entry.getValue());\n }\n }", "ArrayList<String> sortFiles(String[] allFiles){\n\n ArrayList<String> tempArrayList = new ArrayList<String>();\n ArrayList<String> returnArrayList = new ArrayList<String>();\n String[] tempArray = allFiles;\n String[] returnArray;\n\n int numOfFiles = tempArray.length;\n\n //delete nonneeded files\n for(int k = 0; k < numOfFiles; k++){\n if (tempArray[k].startsWith(\"G-\") || tempArray[k].startsWith(\"M-\") || tempArray[k].startsWith(\"I-\")){\n tempArrayList.add(tempArray[k]);\n }\n }\n\n returnArray = new String[tempArrayList.size()];\n for(int i = 0; i < tempArrayList.size(); i++){\n returnArray[i] = tempArrayList.get(i);\n }\n\n //if 0 return empty array\n if (returnArray.length < 2){\n return returnArrayList;\n }\n\n //bubble sort\n for (int i = 0; i < returnArray.length-1; i++){\n for (int j = 0; j < returnArray.length-i-1; j++){\n //get string of full number from file\n String tempFirst = returnArray[j].split(\"_\")[2] + returnArray[j].split(\"_\")[3];\n String tempSecond = returnArray[j+1].split(\"_\")[2] + returnArray[j+1].split(\"_\")[3];\n //take out csv if it is not a subgraph\n if (!tempFirst.contains(\"_subgraph_\")){\n tempFirst = tempFirst.substring(0,14);\n }\n if (!tempSecond.contains(\"_subgraph_\")){\n tempSecond = tempSecond.substring(0,14);\n }\n //get int of string\n long tempFirstNum = Long.parseLong(tempFirst);\n long tempSecondNum = Long.parseLong(tempSecond);\n //compare and swap if bigger\n if (tempFirstNum >= tempSecondNum)\n {\n String temp = returnArray[j];\n returnArray[j] = returnArray[j+1];\n returnArray[j+1] = temp;\n }\n }\n }\n\n //add elements to arraylist with newest date being first\n for(int k = returnArray.length-1; k >= 0; k--){\n returnArrayList.add(returnArray[k]);\n System.out.println(allFiles[k]);\n }\n\n return returnArrayList;\n }", "private void readFile() {\r\n\t\tScanner sc = null; \r\n\t\ttry {\r\n\t\t\tsc = new Scanner(inputFile);\t\r\n\t\t\twhile(sc.hasNextLine()){\r\n\t\t\t\tgrade.add(sc.nextLine());\r\n\t } \r\n\t\t}\r\n\t\tcatch (FileNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tfinally {\r\n\t\t\tsc.close();\r\n\t\t}\t\t\r\n\t}", "public ArrayList<String> getSortedNames() throws Exception {\n FileReader fileReader = new FileReader();\n // Tell FileReader the file path\n fileReader.setFilePath(\"src/main/java/ex41/base/exercise41_input.txt\");\n // use FileReader to get an Arraylist and store it\n ArrayList<String> names = fileReader.getStrings();\n // call sort method to sort arraylist and return that\n return sort(names);\n }", "private void read(String filename) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(filename));\n\t\t\n\t\t//a variable that will increase by one each time another element is added to the array\n\t\t//to ensure array size is correct\n\t\tint numStation = 0;\n\t\t\n\t\t//ignores first 6 lines\n\t\tfor(int i = 0; i < 3; ++i){\n\t\t\tbr.readLine();\n\t\t}\n\t\t\n\t\t//sets String equal readline\n\t\tString lineOfData = br.readLine();\n\n\t\twhile(lineOfData != null)\n\t\t{\n\t\t\tString station = new String();\n\t\t\tstation = lineOfData.substring(10,14);\n\t\t\tMesoAsciiCal asciiAverage = new MesoAsciiCal(new MesoStation(station));\n\t\t\tint asciiAvg = asciiAverage.calAverage();\t\t\n\n\t\t\tHashMap<String, Integer> asciiVal = new HashMap<String, Integer>();\n\t\t\t//put the keys and values into the hashmap\n\t\t\tasciiVal.put(station, asciiAvg);\n\t\t\t//get ascii interger avg value\n\t\t\tInteger avg = asciiVal.get(station);\n\t\t\t\n\t\t\thashmap.put(station,avg);\n\t\t\t\n\t\t\tlineOfData = br.readLine();\n\t\t\t\n\t\t}\n\t\t\n\t\tbr.close();\n\t}", "public static void userSort(ArrayList<FileData> fromFile, int primary_sort, int secondary_sort, int primary_order, int secondary_order)\n {\n \n // user wants to sort by primary = state code and secondary = county code\n if(primary_sort == 1 && secondary_sort == 2) \n {\n if(primary_order == 1 && secondary_order == 1){// user wants both primary and secondary in ascending order\n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n }\n }\n else if(primary_order == 2 && secondary_order == 2){ // user wants both primary and secondary in decending order\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){// primary is ascending\n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_County_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){//primary is descending\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n Collections.sort(fromFile,new Sort_County_Code()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n // user wants to sort by primary = county code and secondary = state code\n if(primary_sort == 2 && secondary_sort == 1){\n if(primary_order == 1 && secondary_order == 1){\n //primary and seconary is ascending\n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order == 2 && secondary_order == 2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n Collections.sort(fromFile,new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){//primary is ascending\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n Collections.sort(fromFile,new Sort_County_Code()); // primary sort\n \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){//primary is descending\n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_County_Code().reversed()); // primary sort\n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==1&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new Sort_State_Code()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new Sort_State_Name()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new Sort_State_Name().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==1&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new Sort_State_Code()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_County_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new Sort_County_Name()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new Sort_County_Name().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n if(primary_sort==1&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortFirstConfirmCount());\n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information \n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information \n } \n } \n }\n \n \n if(primary_sort==1&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); \n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); \n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n } \n } \n }\n \n if(primary_sort==6&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==1&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==7&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==1&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n \n if(primary_sort==8&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==2&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new Sort_County_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new Sort_State_Name().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==2&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new Sort_County_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new Sort_County_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new Sort_County_Name().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==2&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n \n if(primary_sort==2&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n if(primary_sort==6&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n \n if(primary_sort==2&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n if(primary_sort==7&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==2&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n if(primary_sort==8&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n \n if(primary_sort==3&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==4&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==5&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==6&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==7&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==8&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==6&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==7&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==8&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==6&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==7&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==8&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==6&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==7&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==6&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==8&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==7&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==8&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order == 2){\n //primary is descending\n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n }", "public void readFile(){\n try {\n highscores = new ArrayList<>();\n BufferedReader br = new BufferedReader(new FileReader(\"Highscores.txt\"));\n String line = br.readLine();\n while (line != null){\n try{\n highscores.add(Integer.parseInt(line));\n } catch (NumberFormatException e){}\n line = br.readLine();\n }\n br.close();\n } catch (FileNotFoundException e) {\n System.out.println(\"No file found\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private static void sortNoun() throws Exception{\r\n\t\tBufferedReader[] brArray = new BufferedReader[ actionNumber ];\r\n\t\tBufferedWriter[] bwArray = new BufferedWriter[ actionNumber ];\r\n\t\tString line = null;\r\n\t\tfor(int i = 0; i < actionNameArray.length; ++i){\r\n\t\t\tSystem.out.println(\"sorting for \" + actionNameArray[ i ]);\r\n\t\t\tbrArray[ i ] = new BufferedReader( new FileReader(TFIDF_URL + actionNameArray[ i ] + \".tfidf\"));\r\n\t\t\tHashMap<String, Double> nounTFIDFMap = new HashMap<String, Double>();\r\n\t\t\tint k = 0;\r\n\t\t\t// 1. Read tfidf data\r\n\t\t\twhile((line = brArray[ i ].readLine())!=null){\r\n\t\t\t\tnounTFIDFMap.put(nounList.get(k), Double.parseDouble(line));\r\n\t\t\t\tk++;\r\n\t\t\t}\r\n\t\t\tbrArray[ i ].close();\r\n\t\t\t// 2. Rank according to tfidf\r\n\t\t\tValueComparator bvc = new ValueComparator(nounTFIDFMap);\r\n\t\t\tTreeMap<String, Double> sortedMap = new TreeMap<String, Double>(bvc);\r\n\t\t\tsortedMap.putAll(nounTFIDFMap);\r\n\t\t\t\r\n\t\t\t// 3. Write to disk\r\n\t\t\tbwArray[ i ] = new BufferedWriter(new FileWriter( SORTED_URL + actionNameArray[ i ] + \".sorted\"));\r\n\t\t\tfor(String nounKey : sortedMap.keySet()){\r\n\t\t\t\tbwArray[ i ].append(nounKey + \"\\t\" + nounTFIDFMap.get(nounKey) + \"\\n\");\r\n\t\t\t}\r\n\t\t\tbwArray[ i ].close();\r\n\t\t}\r\n\t}", "private void readFromFile() {\n\t\tPath filePath = Paths.get(inputFile);\n\n\t\ttry (BufferedReader reader = Files.newBufferedReader(filePath,\n\t\t\t\tCharset.forName(\"UTF-8\"));) {\n\t\t\tString line = null;\n\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tString[] splitLine = line.split(\",\");\n\t\t\t\tcurrentGen.setValue(Integer.parseInt(splitLine[0]),\n\t\t\t\t\t\tInteger.parseInt(splitLine[1]), true);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"Could not find file provided.\");\n\t\t}\n\t}", "public List<Double> processFile() throws AggregateFileInitializationException {\n \t\t \n \t\tint maxTime = 0;\n \t\tHashMap<String, List<Double>> data = new HashMap<String,List<Double>>();\n \t\ttry {\n \t String record; \n \t String header;\n \t int recCount = 0;\n \t List<String> headerElements = new ArrayList<String>();\n \t FileInputStream fis = new FileInputStream(scenarioData); \n \t BufferedReader d = new BufferedReader(new InputStreamReader(fis));\n \t \n \t //\n \t // Read the file header\n \t //\n \t if ( (header=d.readLine()) != null ) { \n \t \t\n \t\t StringTokenizer st = new StringTokenizer(header );\n \t\t \n \t\t while (st.hasMoreTokens()) {\n \t\t \t String val = st.nextToken(\",\");\n \t\t \t headerElements.add(val.trim());\n \t\t }\n \t } // read the header\n \t /////////////////////\n \t \n \t // set up the empty lists\n \t int numColumns = headerElements.size();\n \t for (int i = 0; i < numColumns; i ++) {\n \t \tString key = headerElements.get(i);\n \t \t if(validate(key)) {\n \t \t\tdata.put(key, new ArrayList<Double>());\n \t\t }\n \t \t\n \t }\n \t \n \t // Here we check the type of the data file\n \t // by checking the header elements\n \t \n \t \n \t \n \t //////////////////////\n // Read the data\n //\n while ( (record=d.readLine()) != null ) { \n recCount++; \n \n StringTokenizer st = new StringTokenizer(record );\n int tcount = 0;\n \t\t\t\twhile (st.hasMoreTokens()) {\n \t\t\t\t\tString val = st.nextToken(\",\");\n \t\t\t\t\tString key = headerElements.get(tcount);\n \t\t\t\t\tif(validate(key)) {\n \t\t\t\t\t\tidSet.add(key);\n \t\t\t\t\t\tList<Double> dataList = data.get(key);\n \t\t\t\t\t\ttry {\n \t\t\t\t\t\t\tDouble dVal = new Double(val.trim());\n \t\t\t\t\t\t\tdataList.add(dVal);\n \t\t\t\t\t\t\tif (dataList.size() >= maxTime) maxTime = dataList.size();\n \t\t\t\t\t\t\tdata.put(key,dataList);\n \t\t\t\t\t\t} catch(NumberFormatException nfe) {\n \t\t\t\t\t\t\tdata.remove(key);\n \t\t\t\t\t\t\tidSet.remove(key);\n \t\t\t\t\t\t\tActivator.logInformation(\"Not a valid number (\"+val+\") ... Removing key \"+key, null);\n \t\t\t\t\t\t}\n \t\t\t\t\t}\t\t\t\n \t\t\t\t\ttcount ++;\n \t\t\t\t}\n \t\t\t} // while file has data\n } catch (IOException e) { \n // catch io errors from FileInputStream or readLine()\n \t Activator.logError(\" IOException error!\", e);\n \t throw new AggregateFileInitializationException(e);\n }\n \n List<Double> aggregate = new ArrayList<Double>();\n for (int i = 0; i < maxTime; i ++) {\n \t aggregate.add(i, new Double(0.0));\n }\n // loop over all location ids\n Iterator<String> iter = idSet.iterator();\n while((iter!=null)&&(iter.hasNext())) {\n \t String key = iter.next();\n \t List<Double> dataList = data.get(key);\n \t for (int i = 0; i < maxTime; i ++) {\n \t\t double val = aggregate.get(i).doubleValue();\n \t\t val += dataList.get(i).doubleValue();\n \t aggregate.set(i,new Double(val));\n }\n }\n \n return aggregate;\n \t }", "private void sort() {\n Collections.sort(mEntries, new Comparator<BarEntry>() {\n @Override\n public int compare(BarEntry o1, BarEntry o2) {\n return o1.getX() > o2.getX() ? 1 : o1.getX() < o2.getX() ? -1 : 0;\n }\n });\n }", "public void readPairs(String fileName) {\n BufferedReader r = null;\n try {\n r = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n while (true) {\n String line = null;\n try {\n line = r.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (line == null) {\n break;\n }\n assert line.length() == 11; // indatakoll, om man kör med assertions på\n String start = line.substring(0, 5);\n String goal = line.substring(6, 11);\n\n int s = words.indexOf(start);\n int v = words.indexOf(goal);\n\n shortestPathPairs(s, v);\n }\n\n }", "static List sort(String[] file){\n\t\tList main = new List();\n\t\t// appends the first item to the new list\n\t\tif(file.length > 0){\n\t\t\tmain.append(0);\t\n\t\t}\n\t\t// loops through input array\n\t\tfor(int i = 1; i<file.length; i++){\n\t\t\tString word = file[i];\n\t\t\tint cursor = i-1;\n\t\t\tmain.moveTo(cursor);\n\t\t\t// loops through each list and checks to see if the value is similar\n\t\t\twhile(cursor>-1 && word.compareTo(file[main.getElement()])<1){\n\t\t\t\tcursor--;\n\t\t\t\tmain.movePrev();\n\t\t\t}\n\t\t\t// if it makes it to the end of the list prepend it to the list, \n\t\t\t// but if it isn't insert it after the current element\n\t\t\tif(main.getIndex() == -1){\n\t\t\t\tmain.prepend(i);\n\t\t\t}else {\n\t\t\t\tmain.insertAfter(i);\n\t\t\t}\n\t\t}\n\t\t// returns the finished list\n\t\treturn main;\n\t}", "public void read_file() throws FileNotFoundException, IOException {\n FileReader fw;\r\n BufferedReader rw;\r\n fw = new FileReader(\"dat.txt\");\r\n rw = new BufferedReader(fw);\r\n\r\n String s;\r\n Boy b;\r\n int i, at, intl, bud;\r\n nb = Integer.parseInt(rw.readLine());\r\n for (i = 1; i <= nb; i++) {\r\n s = rw.readLine();\r\n StringTokenizer st = new StringTokenizer(s, \",\");\r\n String name = st.nextToken();\r\n at = Integer.parseInt(st.nextToken());\r\n intl = Integer.parseInt(st.nextToken());\r\n bud = Integer.parseInt(st.nextToken());\r\n String type = st.nextToken();\r\n b = new Boy(name, at, intl, bud, type);\r\n boy_arr.add(b);\r\n }\r\n ng = Integer.parseInt(rw.readLine());\r\n Girl g;\r\n for (i = 1; i <= ng; i++) {\r\n s = rw.readLine();\r\n StringTokenizer st = new StringTokenizer(s, \",\");\r\n String name = st.nextToken();\r\n at = Integer.parseInt(st.nextToken());\r\n intl = Integer.parseInt(st.nextToken());\r\n bud = Integer.parseInt(st.nextToken());\r\n String type = st.nextToken();\r\n g = new Girl(name, at, intl, bud, type);\r\n girl_arr.add(g);\r\n }\r\n fw = new FileReader(\"gift.txt\");\r\n rw = new BufferedReader(fw);\r\n String ty, gid;\r\n int cs, vl,ngg;\r\n ngg = Integer.parseInt(rw.readLine());\r\n for (i = 1; i <= ngg; i++) {\r\n s = rw.readLine();\r\n StringTokenizer st = new StringTokenizer(s, \",\");\r\n gid = st.nextToken();\r\n cs = Integer.parseInt(st.nextToken());\r\n vl = Integer.parseInt(st.nextToken());\r\n ty = st.nextToken();\r\n Gift gf = new Gift(ty, cs, vl, gid);\r\n gift_arr.add(gf);\r\n }\r\n Collections.sort(gift_arr, new Compare());\r\n}", "private static void fileRead(String file) {\n\t\ttry {\n\t\t\tBufferedReader br = new BufferedReader(new FileReader(file));\n\t\t\tString line = \"\";\n\t\t\twhile((line=br.readLine())!=null) {\n\t\t\t\tString data[] = line.split(\"\\\\t\");\n\t\t\t\tint id = Integer.parseInt(data[0]);\n\t\t\t\tint groundTruth = Integer.parseInt(data[1]);\n\t\t\t\tactualClusters.put(id, groundTruth);\n\t\t\t\tArrayList<Double> temp = new ArrayList<>();\n\t\t\t\tfor(int i=2;i<data.length;i++) {\n\t\t\t\t\ttemp.add(Double.parseDouble(data[i]));\n\t\t\t\t}\n\t\t\t\tcols = data.length-2;\n\t\t\t\tgeneAttributes.put(id, temp);\n\t\t\t\tallClusters.add(id+\"\");\n\t\t\t\ttotalGenes++;\n\t\t\t}\n\t\t\ttotalCluster = totalGenes;\n\t\t\tbr.close();\n\t\t} catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void readDirectory(String dir){\n\t\tMap<Integer,Integer> catemap = new HashMap<Integer, Integer>();\r\n\t\tFile[] names = null;\r\n\t\tFile file = new File(dir);\r\n\t\tif(file.isFile())\r\n\t\t\tnames = new File[]{file};\r\n\t\telse\r\n\t\t\tnames = new File(dir).listFiles();\r\n\t\tList<String> lines = null;\r\n\t\tList<String> strs = null;\r\n\t\tList<Integer> keys = new ArrayList<Integer>();\r\n\t\tList<Integer> values = new ArrayList<Integer>();\r\n\t\tint v = 0;\r\n\t\tif(null!=names&&names.length>0){\r\n\t\t\tfor(File f:names){\r\n\t\t\t\tif(null!=lines)\r\n\t\t\t\t\tlines.clear();\r\n\t\t\t\tlines = readFile(f,\"utf-8\");\r\n\t\t\t\tif(null!=lines){\r\n\t\t\t\t\tint j = 0;\r\n\t\t\t\t\tint k=0;\r\n\t\t\t\t\tfor(String line:lines){\r\n\t\t\t\t\t\tstrs = parseStr2List(line, \"\\\\t\");\r\n//\t\t\t\t\t\tif(null!=strs&&strs.size()==7){\r\n//\t\t\t\t\t\t\tv = getPerValue(strs.get(3));\r\n//\t\t\t\t\t\t\tmaxmap.put(v, 1+DataFormat.parseInt(maxmap.get(v)));\r\n//\t\t\t\t\t\t\tv = getPerValue(strs.get(5));\r\n//\t\t\t\t\t\t\tcatemap.put(v, 1+DataFormat.parseInt(catemap.get(v)));\r\n//\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(null!=strs&&strs.size()==2){\r\n\t\t\t\t\t\t\tv = DataFormat.parseInt(strs.get(0));\r\n//\t\t\t\t\t\t\tif(v<=500){\r\n//\t\t\t\t\t\t\t\tv = j/5+1;\r\n//\t\t\t\t\t\t\t\tj = j+1;\r\n//\t\t\t\t\t\t\t}else{\r\n//\t\t\t\t\t\t\t\tv = 101;\r\n//\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif(k>500) break;\r\n\t\t\t\t\t\t\tk++;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif(j<20){\r\n\t\t\t\t\t\t\t\tkeys.add(v);\r\n\t\t\t\t\t\t\t\tvalues.add(DataFormat.parseInt(strs.get(1)));\r\n\t\t\t\t\t\t\t\tj++;\r\n\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\tj=0;\r\n\t\t\t\t\t\t\t\tSystem.out.println(Arrays.toString(keys.toArray(new Integer[]{})));\r\n\t\t\t\t\t\t\t\tSystem.out.println(Arrays.toString(values.toArray(new Integer[]{})));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n//\t\t\t\t\t\t\tcatemap.put(v, DataFormat.parseInt(strs.get(1))+DataFormat.parseInt(catemap.get(v)));\r\n\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}\r\n\t\t}\r\n\t\t\r\n//\t\tfor(Entry<Integer, Integer> entry:maxmap.entrySet()){\r\n//\t\t\tUtils.appendToFile(\"/vol/user_log/maxmap.txt\", entry.getKey()+\"\\t\"+entry.getValue());\r\n//\t\t}\r\n//\t\tfor(Entry<Integer, Integer> entry:catemap.entrySet()){\r\n//\t\t\tUtils.appendToFile(\"C:\\\\Program Files\\\\SecureCRT\\\\download\\\\map.txt\", entry.getKey()+\"\\t\"+entry.getValue());\r\n//\t\t}\r\n\t}", "@Override\n\tpublic void load(final String filePath) {\n\t\tsuper.load(filePath);\n\t\ttry {\n\t\t\tfinal JCL_facade jcl = JCL_FacadeImpl.getInstance();\n\t\t\tfinal Object2DoubleMap<String> distances = new Object2DoubleOpenHashMap<>();\n\n\t\t\tBufferedReader in = new BufferedReader(new FileReader(filePath));\n\t\t\tString str = null;\n\n\t\t\tList<String> inputLimpos = new LinkedList<>();\n\n\t\t\tdouble lower = 0;\n\n\t\t\t// ler o arquivo\n\t\t\twhile ((str = in.readLine()) != null) {\n\t\t\t\tif (!str.trim().equals(\"EOF\")) {\n\t\t\t\t\tString[] inputDetalhes = str.split(\" \");\n\t\t\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\t\t\tfor (final String frag : inputDetalhes) {\n\t\t\t\t\t\tif (!frag.equals(\"\")) {\n\t\t\t\t\t\t\tsb.append(frag + \":\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tinputLimpos.add(sb.toString());\n\t\t\t\t\tsb = null;\n\t\t\t\t\tinputDetalhes = null;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tin.close();\n\t\t\tin = null;\n\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tfinal ObjectSet<String> vertices = (ObjectSet<String>) jcl.getValue(\"vertices\").getCorrectResult();\n\n\t\t\tdouble lowest = Double.MAX_VALUE;\n\t\t\t/*\n\t\t\t * transitar todo projeto para DOUBLE tirar todos floats para que aceite o\n\t\t\t * permutation\n\t\t\t */\n\t\t\t// montando distancias\n\t\t\tfor (final String umaEntrada : inputLimpos) {\n\t\t\t\tString[] umaEntradaDetalhe = umaEntrada.split(\":\");\n\t\t\t\tdouble menorD = Double.MAX_VALUE;\n\t\t\t\tdouble maiorD = Double.MIN_VALUE;\n\t\t\t\tvertices.add(\"$\" + umaEntradaDetalhe[0] + \"$\");\n\t\t\t\tfor (final String outraEntrada : inputLimpos) {\n\t\t\t\t\tString[] outraEntradaDetalhe = outraEntrada.split(\":\");\n\t\t\t\t\tif (!umaEntradaDetalhe[0].equals(outraEntradaDetalhe[0])) {\n\t\t\t\t\t\tfinal double dx = (Double.parseDouble(outraEntradaDetalhe[1])\n\t\t\t\t\t\t\t\t- Double.parseDouble(umaEntradaDetalhe[1]));\n\t\t\t\t\t\tfinal double dy = (Double.parseDouble(outraEntradaDetalhe[2])\n\t\t\t\t\t\t\t\t- Double.parseDouble(umaEntradaDetalhe[2]));\n\n\t\t\t\t\t\tfinal double d = Math.hypot(dx, dy);\n\n\t\t\t\t\t\tdistances.put(\"$\" + umaEntradaDetalhe[0] + \"$:$\" + outraEntradaDetalhe[0] + \"$\", d);\n\n\t\t\t\t\t\tif (d < menorD) {\n\t\t\t\t\t\t\tmenorD = d;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (d > maiorD) {\n\t\t\t\t\t\t\tmaiorD = d;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t\toutraEntradaDetalhe = null;\n\t\t\t\t}\n\n\t\t\t\tdistances.put(\"$\" + umaEntradaDetalhe[0] + \"$:$shorterD$\", menorD);\n\t\t\t\tdistances.put(\"$\" + umaEntradaDetalhe[0] + \"$:$longerD$\", maiorD);\n\n\t\t\t\tlower += menorD;\n\t\t\t\tif (lowest > menorD) {\n\t\t\t\t\tlowest = menorD;\n\t\t\t\t}\n\n\t\t\t\tdistances.put(\"$\" + umaEntradaDetalhe[0] + \"$:$X$\", Float.parseFloat(umaEntradaDetalhe[1]));\n\t\t\t\tdistances.put(\"$\" + umaEntradaDetalhe[0] + \"$:$Y$\", Float.parseFloat(umaEntradaDetalhe[2]));\n\t\t\t\tumaEntradaDetalhe = null;\n\t\t\t}\n\n\t\t\tlower += lowest;\n\n\t\t\tinputLimpos.clear();\n\t\t\tinputLimpos = null;\n\n\t\t\tjcl.instantiateGlobalVar(\"numOfVertices\", vertices.size());\n\n\t\t\tjcl.setValueUnlocking(\"vertices\", vertices);\n\n\t\t\tjcl.setValueUnlocking(\"lower\", lower);\n\n\t\t\tJcldataAccess.instantiateVarInJCL(\"distances\", distances);\n\n\t\t\tSystem.out.println(vertices.toString());\n\n\t\t} catch (final Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "private static void splitFileAndSortWord(Path filePath) throws IOException {\n\n try (FileReader inputStream = new FileReader(filePath.toFile().getAbsolutePath())) {\n // Create a buffer to save a batch of word in memory for sorting\n List<TextArray> textArrays = new ArrayList<>(FILE_LINE_THRESHOLD);\n IntStream.range(0, FILE_LINE_THRESHOLD).forEach(i -> textArrays.add(new TextArray(WORD_LENGTH_THRESHOLD)));\n\n int wordCount = 0;\n int charCount = 0;\n\n // Read the words from the given file\n int i;\n while ((i = inputStream.read()) != -1) {\n if (!isWhitespace(i)) { // Read one character of a word and put it to the buffer\n textArrays.get(wordCount).set(charCount, i);\n charCount++;\n } else { // Finish reading a word\n wordCount++;\n\n // If the buffer is filled\n // Sort the words in the buffer\n // Save the sorted words to a new file\n // Reset the buffer\n if (wordCount == FILE_LINE_THRESHOLD) {\n sortWordAndWriteFile(textArrays);\n textArrays.forEach(TextArray::reset);\n wordCount = 0;\n }\n\n charCount = 0;\n }\n }\n\n // Sort the last batch of words\n // Save them to a file\n sortWordAndWriteFile(textArrays);\n }\n }", "public void readVotes(File inFile);", "private void externalSort() throws IOException{\n\t\t/*\n\t\t * Pass 0: internal sort\n\t\t */\n\t\t// Read in from child;Write out runs of B pages;\n\t\t\n\t\tint numPerRun = B * 4096 / (schema.size() * 4); // # of tuples per run given in Pass0\n\t\tboolean buildMore;\n\t\tint numRuns = 0;\n\t\tif(sortAttrsIndex == null) {\n\t\t\tthis.buildAttrsIndex();\n\t\t}\n\t\texComparator myComp = new exComparator();\n\t\tinternal = new PriorityQueue<Tuple>(myComp);\n\t\tdo {\n\t\t\tbuildMore = this.buildHeap(numPerRun);\n\t\t\tnumRuns++;\n\t\t\t\n\t\t\t// write out the (numRuns)th run\n\t\t\tTupleWriter TW;\n\t\t\tif(!buildMore && numRuns == 1) {\n\t\t\t\tTW = new TupleWriter(new FileOutputStream(tempsubdir + \"sortResult\"));\n\t\t\t} else {\n\t\t\t\tTW = new TupleWriter(new FileOutputStream(tempsubdir + \"0_\" + numRuns));\n\t\t\t}\n\t\t\twhile(!internal.isEmpty()) {\n//\t\t\t\tSystem.out.println(internal.peek().data);\n\t\t\t\tTW.setNextTuple(internal.poll()); \n\t\t\t}\n\t\t\t// leftover, fill with zero and write out\n\t\t\tif(!TW.bufferEmpty()) { // TW would never know the end of writing\n\t\t\t\tTW.fillFlush(); \n\t\t\t}\n\t\t\tTW.close();\n\t\t\t// internal must be empty until this point\n\t\t}while (buildMore);\n\t\t\n\t\t/*\n\t\t * Pass 1 and any following\n\t\t */\n\t\tif(numRuns > 1) { // if numRuns generated in Pass 0 is 1 already, file sorted already, no need to merge\n\t\t\tthis.merge(numRuns, myComp);\n\t\t}\n\t\t\n\t}", "public static void main(String[] args) throws FileNotFoundException, IOException {\n BufferedReader br = new BufferedReader(new FileReader(\"D:\\\\name-sorter\\\\unsorted-names-list.txt\"));\n \n // Step 5: Create an ArrayList to hold the Person objects.\n ArrayList<Person> listPersonNames = new ArrayList<Person>();\n \n // Step 6 : Read every person record from input text file. For each person record, \n // create one person object and add that person object into listPersonNames.\n String line = br.readLine();\n \n while(line != null){\n String[] names = line.split(\" \");\n\n String givenNames = \"\";\n for(int a=0; a < names.length-1; a++){\n givenNames += names[a];\n givenNames += \" \";\n }\n \n String lastName = names[names.length-1];\n \n listPersonNames.add(new Person(givenNames, lastName));\n \n line = br.readLine();\n }\n \n // Step 7 : Sort the ArrayList listPersonNames using Collections.sort() method by passing \n // NamesCompare object to sort the text file.\n Collections.sort(listPersonNames, new NamesCompare());\n \n // Step 8 : Create BufferedWriter object to write the records into output text file.\n BufferedWriter writer = new BufferedWriter(new FileWriter(\"D:\\\\name-sorter\\\\sorted-names-list.txt\"));\n \n // Step 9 : Write each listPersonNames into output text file.\n for (Person person : listPersonNames){\n writer.write(person.givenNames);\n writer.write(\" \"+person.lastName);\n writer.newLine();\n \n System.out.println(person.givenNames+\" \"+person.lastName);\n }\n \n // Step 10 : Close the resources.\n br.close();\n writer.close();\n }", "private static int readFromBuffer() throws IOException{\n int n;\n // The number of ints read into the buffer after a read.\n int intsRead;\n // The current position in the byte buffer.\n int pos;\n // The current integer values being processed.\n int x;\n // The current position in the integer array of values to be sorted.\n int index = 0;\n\n // The loop condition reads in the next buffer of bytes from the file, until there are no\n // more bytes to be read in.\n while ((n = fis.read(buf)) != READ_FINISHED) {\n intsRead = n / BYTES_TO_INTS;\n\n // iterate through all the ints currently being held in the byte buffer\n // if they fall in the given bound, add them to the int array to be sorted.\n for (int i = 0; i < intsRead; i++) {\n pos = BYTES_TO_INTS * i;\n\n // Convert the next set of 4 bytes to an integer.\n x = (((int) buf[pos]) & 255) << 24\n | ((((int) buf[pos + 1]) & 255) << 16)\n | ((((int) buf[pos + 2]) & 255) << 8)\n | ((((int) buf[pos + 3]) & 255));\n\n\n // put the current integer into the int array\n ints[index] = x;\n index++;\n }\n }\n\n\n // This returns the number of values selected to be sorted.\n return index;\n }", "public DataShuffling(File file) throws IOException {\n time = System.nanoTime();\n data = new String[7515];\n BufferedReader br = new BufferedReader(new FileReader(\"ErdosCA.txt\"));\n\n // This readLine() is used to skip the first line, which is just metadata\n br.readLine();\n for (int i = 0; i < data.length; i++) {\n data[i] = br.readLine();\n }\n\n br.close();\n time = System.nanoTime() - time;\n System.out.println(\"Time to read from file (in ns): \" + time);\n }", "public static void main(String[] args) {\n \tSystem.out.println(\"This program will sort a random list of numbers \\nread in from a text file, with which ever of the \"\n \t\t\t + \"\\nsorting methods you choose to use and write the \\nsorted file to a file destination of your choice.\"); \t \n \t \n \t// Scanner used to take user input for unsorted numbers file path.\n Scanner pathScanner = new Scanner(System.in);\n System.out.println(\"\\nPlease enter the full path of the file: \");\n String filePath = pathScanner.nextLine(); // Assigns String filePath to user input.\n \n /* \n * Try/Catch statement implemented for scanner file read operation. File is read into an\n * array list.\n */\n \n try {\n \t\n // Declare and create RandomIntegers ArrayList of type Integer.\n List<Integer> RandomIntegers = new ArrayList<Integer>(); \n \n readFile(filePath, RandomIntegers); // call readFile method and read contents into arrayList\n \n /* Declare and create int array RandomNumbers.\n * Call convertIntegersToArray method on RandomIntegers\n * to convert from arraylist to an array fill RandomNumbers array.\n */\n \n // convert arraylist to array to enable passing of array as argument into sorting methods\n int[] RandomNumbers = convertIntegersToArray(RandomIntegers);\n \n System.out.println(\"\\nPlease Select Sorting Method\\n----------------------------\\n1.Bubble Sort\\n2.Selection Sort\\n3.Insertion Sort\\n4.Merge Sort \\n5.Quick Sort \\n6.Exit Program\");\n \t System.out.println(); //Print sorting options followed by blank line.\n \n \t\t /*\n \t\t * Scanner reads user input for sorting selection. sortMethod is assigned\n \t\t * to the int entered by the user.\n \t\t */\n \n \t\t Scanner sortScanner = new Scanner(System.in); // declare and create scanner for reading users sorting method selection\n \t\t int sortMethod; // declare sortMethod variable\n \n // do while loop iterates option of sorting unless sortMethod is < 1 or > 5.\n do{\n \t System.out.print(\"\\nEnter the sort method you wish to use (6 to exit): \\n\"); \n sortMethod = sortScanner.nextInt(); // reads in users selected sort method.\n \n if (sortMethod == 1) {\n System.out.println(\"Bubble sort selected.\");\n\t\t BubbleSort bubbleSort = new BubbleSort(RandomNumbers); // Create BubbleSort object using RandomNumbers as arg \t\n WriteFile myWriteFile = new WriteFile(bubbleSort); // Create WriteFile object with BubbleSort object as arg\n myWriteFile.writeFile(RandomNumbers); // implement writeFile method on WriteFile object\n }\n else if (sortMethod == 2){\n \n \t System.out.println(\"Selection sort selected.\");\n\t\t\t SelectionSort selectionSort = new SelectionSort(RandomNumbers); // Create SelectionSort object using RandomNumbers as arg \n\t\t\t \tWriteFile myWriteFile = new WriteFile(selectionSort); // Create WriteFile object with SelectionSort object as arg\n myWriteFile.writeFile(RandomNumbers); // implement writeFile method on WriteFile object \t \t\n }\n else if (sortMethod == 3){\n \n \t System.out.println(\"Insertion sort selected.\");\n\t\t\t InsertionSort insertionSort = new InsertionSort(RandomNumbers); // Create InsertionSort object using RandomNumbers as arg \n\t\t WriteFile myWriteFile = new WriteFile(insertionSort); // Create WriteFile object with InsertionSort object as arg\n myWriteFile.writeFile(RandomNumbers); // implement writeFile method on WriteFile object\n }\n else if (sortMethod == 4){ \n \n \t System.out.println(\"Merge sort selected.\");\n\t\t\t MergeSort mergeSort = new MergeSort(RandomNumbers); // Create MergeSort object using RandomNumbers as arg \n\t\t\t WriteFile myWriteFile = new WriteFile(mergeSort); // Create WriteFile object with MergeSort object as arg\n myWriteFile.writeFile(RandomNumbers); // implement writeFile method on WriteFile object\n }\n else if (sortMethod == 5){ \t\n \n \t System.out.println(\"Quick sort selected.\");\n\t\t\t QuickSort quickSort = new QuickSort(RandomNumbers); // Create QuickSort object using RandomNumbers as arg \n\t\t WriteFile myWriteFile = new WriteFile(quickSort); // Create WriteFile object with QuickSort object as arg\n myWriteFile.writeFile(RandomNumbers); // implement writeFile method on WriteFile object\t\n }\n \n }while(sortMethod >0 && sortMethod < 6); // end do while\n \n if(sortMethod < 1 || sortMethod >= 6){ // if user selection is less than 1 or greater than 5\n \t System.out.print(\"\\nProgram Terminated!\");\n \t System.exit(0); // terminates program\n } \n \n \n } // End Try. \t\t \n \n catch(IOException e){\n System.out.println(\"Could not find file\"); // Print string if file is not read in successfully.\n } // End catch\n \n }", "public static void sort(File input, File output) throws IOException {\n ExternalSort.mergeSortedFiles(ExternalSort.sortInBatch(input), output);\n }", "public void sortAndSave() {\n\t\tsort();\n\t\tShopIO.writeFile(ShopIO.getDataFile(), ShopIO.getGson().toJson(this));\n\t}", "public static void main(String[] args) throws IOException {\n\t\tInput in = new Input(\"input.txt\", 2 * 1024);\r\n\t\tPrintWriter out = new PrintWriter(\"output.txt\");\r\n\r\n\t\tint n = in.nextInt();\r\n\t\t\r\n\t\tfVal = new int[n];\r\n\t\tfPos = new int[n];\r\n\t\t\r\n\t\tfor (int i = 0; i < n; ++i) {\r\n\t\t\tfVal[i] = in.nextInt();\r\n\t\t\tfPos[i] = i;\r\n\t\t}\r\n\t\t\r\n\t\tsVal = new int[n];\r\n\t\tsPos = new int[n];\r\n\r\n\t\tfor (int i = 0; i < n; ++i) {\r\n\t\t\tsVal[i] = in.nextInt();\r\n\t\t\tsPos[i] = i;\r\n\t\t}\r\n\t\t\r\n\t\tbuf = new int[n / 2 + 1];\r\n\t\ttmp = new int[n / 2 + 1];\r\n\t\t\r\n\t\tsortsVal(0, n - 1);\r\n\t\tsortfVal(0, n - 1);\r\n\t\t\r\n\t\tfor (int i = 0; i < n; ++i)\r\n\t\t\tif (fVal[i] != sVal[i]) {\r\n\t\t\t\tout.println(-1);\r\n\t\t\t\tout.close();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\r\n\t\tfor (int i = 0; i < n; ++i)\r\n\t\t\tfVal[i] = sPos[i];\r\n\t\t\t\r\n\t\tsortfPos(0, n - 1);\r\n\t\t\r\n\t\tanswer = 0;\r\n\t\t\r\n\t\tmerge(fVal, 0, n - 1);\r\n\t\t\t\r\n\t\tout.println(answer);\t\r\n\t\t\r\n\t\tout.close();\r\n\t}", "static void doSort(int location) throws Exception {\n\n\t\tList<String> sortedList = null;\n\n\t\tsortedList = readDataFile(DividedfileList.get(location));\n\t\tCollections.sort(sortedList);\n\t\twriteFile(sortedList, location);\n\t\tsortedList.clear();\n\n\t}", "public void ArtistAndSource() throws IOException{\r\n List<String> ArrangersAndTheirSongs=new ArrayList<>();\r\n HashMap <String,Integer> SongCountMap= new HashMap<>();\r\n String allsongs=\"\";\r\n String sourcesong=\"\";\r\n for(int id: ArrangersMap.keySet()){\r\n String ArrangerName=ArrangersMap.get(id);\r\n for(String song:ArrangerLinesList){\r\n String perform[];\r\n perform=song.split(\"/\");\r\n int arrangeid=Integer.parseInt(perform[1]);\r\n if(id==arrangeid){\r\n int songid= Integer.parseInt(perform[0]);\r\n String songname=test.getsongName(songid);\r\n sourcesong=test.SongToSource(songname);\r\n allsongs+=sourcesong+\",\";\r\n if (SongCountMap.get(sourcesong) !=null){ \r\n SongCountMap.put(sourcesong, SongCountMap.get(sourcesong)+1);\r\n }\r\n else{\r\n SongCountMap.put(sourcesong, 1);\r\n }\r\n } \r\n }\r\n for(String song:SongCountMap.keySet()){\r\n //System.out.println(song);\r\n }\r\n HashMap <String,Integer> SortedMap= sortByValues(SongCountMap);\r\n SongCountMap.clear();\r\n String allsongs2=\"\";\r\n for(String song:SortedMap.keySet()){\r\n //System.out.println(\"Number\"+SortedMap.get(song)+\"The song is\"+song);\r\n allsongs2+=\"#occurences:\"+SortedMap.get(song)+\"The song is\"+song+\"\\n\";\r\n //System.out.println(\"Number of times:\"+SortedMap.get(song)+\"The song is\"+song);\r\n }\r\n //System.out.println(allsongs2);\r\n // ArrangersAndTheirSongs.add(\"The Arrangers Name is:\"+ArrangerName+ \" Their songs are:\"+allsongs);\r\n ArrangersAndTheirSongs.add(\"The Arrangers Name is:\"+ArrangerName+ \" Their songs are: \"\r\n + \"\"+allsongs2);\r\n allsongs=\"\";\r\n SortedMap.clear();\r\n allsongs2=\"\";\r\n }\r\n //method is broken\r\n writeListToTextFile(\"d:\\\\documents\\\\textfiles\\\\ArrangersAndTheirSources.txt\",ArrangersAndTheirSongs);\r\n System.out.println(\"The size of the list is:\"+ArrangersAndTheirSongs.size());\r\n System.out.println(\"Artist and Their Source Complete\");\r\n }", "static void parseData(String filename) {\n\t\ttry (BufferedReader br = new BufferedReader(new FileReader(filename))) {\n\t\t \n\t\t\tString line;\n\t\t String[] tokens;\n\t\t ArrayList<Double> temp;\n\t\t \n\t\t while ((line = br.readLine()) != null) {\n\t\t \ttemp = new ArrayList<Double>();\n\t\t \ttokens = line.split(\",\");\n\t\t \tfor(String s : tokens) {\n\t\t \t\ttemp.add(Double.parseDouble(s));\n\t\t \t}\n\t\t \tData.add(new Vector(temp));\n\t\t }\n\t\t} catch (FileNotFoundException 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\t}", "protected void sort() {\n\n\t\tCollections.sort(this.myRRList);\n\t}", "public void readFile(File file) {\n\ttry (BufferedReader br = new BufferedReader(new FileReader(file)))\n\t{\n\n\t\tString sCurrentLine;\n\t\tString [] lineElements;\n\t\t\n\t\t// read the headlines\n\t\tsCurrentLine = br.readLine();\n\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\tnumVertices = Integer.parseInt(lineElements[1]);\n\t\tsCurrentLine = br.readLine();\n\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\tnumPaths = Integer.parseInt(lineElements[1]);\n\t\tsCurrentLine = br.readLine();\n\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\ttmax = Double.parseDouble(lineElements[1]);\n\t\t\n//\t\tSystem.out.println(numVertices + \", \" + numPaths + \", \" + tmax);\n\n\t\t/* read benefits1 */\n\t\tint index = 0;\n\t\twhile ((sCurrentLine = br.readLine()) != null) {\n//\t\t\t\tSystem.out.println(sCurrentLine);\n\t\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\t\tdouble x = Double.parseDouble(lineElements[0]);\n\t\t\tdouble y = Double.parseDouble(lineElements[1]);\n\t\t\tList<Double> scores = new ArrayList<Double>();\n\t\t\tfor (int i = 2; i < lineElements.length; i++) {\n\t\t\t\tdouble score = Double.parseDouble(lineElements[i]);\n\t\t\t\tscores.add(new Double(score));\n\t\t\t}\n\t\t\tPOI POI = new POI(index, x, y, scores);\n\t\t\t//POI.printMe();\n\t\t\t\n\t\t\tvertices.add(POI);\n\t\t\tindex ++;\n\t\t}\n\t\t\n\t\t// create the arcs and the graph\n\t\tfor (int i = 0; i < vertices.size(); i++) {\n\t\t\tfor (int j = 0; j < vertices.size(); j++) {\n\t\t\t\tArc arc = new Arc(vertices.get(i), vertices.get(j));\n\t\t\t\tarcs.add(arc);\n\t\t\t\tgraph.put(new Tuple2<POI, POI>(vertices.get(i), vertices.get(j)), arc);\n\t\t\t}\n\t\t}\n\t} catch (IOException e) {\n\t\te.printStackTrace();\n\t}\n}", "public File sort(String path){\n try {\r\n File file = new File(path);\r\n BufferedReader readStream = new BufferedReader(new FileReader(file));\r\n String currentLine;\r\n int index = 0;\r\n int fileNumber = 1;\r\n while((currentLine = readStream.readLine()) != null){\r\n tempArray[index++] = currentLine;//read next line into the temporary array\r\n if(index >= limit){//check whether the number of lines stored in the temp has reached the maximum allowed\r\n Arrays.sort(tempArray);//sort tempArray\r\n Writer writeStream = null;//create a writer\r\n String currentFileName = \"temp\" + fileNumber + \".txt\";//this name is passed to the buffered writer\r\n writeStream = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(currentFileName)));//create a new temporary file to be written to\r\n fileArrayList.add(new File(currentFileName));//add file to list\r\n for(String line : tempArray){// write the lines currently stored in the array into the newly created file\r\n writeStream.write(line);\r\n writeStream.write(\"\\n\");\r\n }\r\n writeStream.close();//close the output stream\r\n index = 0;//reset\r\n ++fileNumber;//increment the file number so that the next block of lines is written to a different file name\r\n }\r\n\r\n\r\n }\r\n readStream.close();\r\n }catch(Exception e){\r\n System.out.println(e.getMessage() + \" occurred during split\");\r\n }\r\n\r\n //merge temporary files and write to output file\r\n try {\r\n System.out.println(Arrays.toString(fileArrayList.toArray()));\r\n fileArrayList.trimToSize();\r\n int sortedFileID = 0;//used to differentiate between temporary files while merging\r\n int head = 0;//used to access file names stored in array list from the start\r\n int tail = fileArrayList.size() - 1;//used to access file names stored in array list from the end\r\n while(fileArrayList.size() > 1) {\r\n sortedFileID++;//increment to create a unique file name\r\n String mergedFileName = \"sorted\"+sortedFileID+\".txt\";\r\n File firstFile = fileArrayList.get(head);\r\n File secondFile = fileArrayList.get(tail);\r\n System.out.println(head + \" + \" + tail);\r\n //merge first and second\r\n File combinedFile = mergeFiles(firstFile, secondFile, mergedFileName);\r\n //delete both temporary files once they are merged\r\n\r\n if(!secondFile.delete()){\r\n System.out.println(\"warning file could not be deleted\");\r\n }\r\n if(!firstFile.delete()){\r\n System.out.println(\"warning file could not be deleted\");\r\n }\r\n fileArrayList.set(head, combinedFile);//replace the first of the two merged files with the new combined file\r\n fileArrayList.remove(tail);//remove the second of the two merged files\r\n head++;//increment both indexes one position closer towards the center of the array list\r\n tail--;\r\n if(head >= tail){//check if there are no remaining files between the head and the tail\r\n head = 0;//reset to the beginning of the array list\r\n fileArrayList.trimToSize();\r\n tail = fileArrayList.size() - 1;//reset to the end of the array list\r\n }\r\n }\r\n }catch(Exception e){\r\n System.out.println(e.getMessage() + \" occurred during merge\");\r\n }\r\n //after iteratively merging head and tail, and storing the result at the head index\r\n //the final resulting file that combines all temporary files will be stored at index (0)\r\n return fileArrayList.get(0);//return the final combined file\r\n }", "@Override\n\tpublic double sort() {\n\t\tlong startTime = System.nanoTime();\n\t\tArrayList<Offender> offenders = Offender.readArrayListCSV();\n\t\tCollections.sort(offenders, (a, b) -> ((Offender) a).getAge() < ((Offender) b).getAge() ? -1 : ((Offender) a).getAge() == ((Offender) b).getAge() ? 0 : 1);\n\t\tlong endTime = System.nanoTime();\n\t\tlong duration = (endTime - startTime); \n\t\tdouble seconds = (double)duration / 1_000_000_000.0;\n\t\t\n\t\treturn seconds;\n\t}", "public static Lender[] fileTransformer(String fileName) throws IOException {\r\n Lender[] lenderList = new Lender[7];\r\n CSVReader reader = null;\r\n try {\r\n reader = new CSVReader(new FileReader(path + fileName), SEPARATOR);\r\n String[] nextLine = null;\r\n int count = 0;\r\n while ((nextLine = reader.readNext()) != null) {\r\n if (!nextLine[0].toString().equals(\"Lender\")) {\r\n lenderList[count] = new Lender(nextLine[0].toString(), BigDecimal.valueOf(Float.parseFloat(nextLine[1])).setScale(3, RoundingMode.CEILING),\r\n BigDecimal.valueOf(Float.parseFloat(nextLine[2])).setScale(3, RoundingMode.CEILING));\r\n count++;\r\n }\r\n }\r\n Arrays.sort(lenderList);\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n } finally {\r\n if (null != reader) {\r\n reader.close();\r\n }\r\n }\r\n return lenderList;\r\n }", "public void loadFromSortedFile(String file) throws Exception{\n if(file == null){\n throw new Exception(\"file is null\");\n }\n try{\n FileReader fr = new FileReader(file);\n BufferedReader br = new BufferedReader(fr);\n\n String s = null;\n while((s = br.readLine()) != null) {\n QueryItem qi = null;\n try{\n qi = new QueryItem(s);\n }catch(Exception e){\n System.out.println(\"[\"+s+\"] load error\");\n continue;\n }\n updateMobile(qi);\n }\n\n br.close();\n fr.close();\n }catch(IOException e){\n e.printStackTrace();\n }\n System.out.println(\"load finished\");\n }", "public void sortByZip(String file) throws FileNotFoundException, IOException, ParseException {\n\t\tarrayList = pareseFile(file);\n\t\tFile file1 = new File(file);\n\t\tfor (int i = 0; i < arrayList.size() - 1; i++) {\n\t\t\tfor (int j = 0; j < arrayList.size() - i - 1; j++) {\n\n\t\t\t\tJSONObject person1 = (JSONObject) arrayList.get(j);\n\t\t\t\tJSONObject person2 = (JSONObject) arrayList.get(j + 1);\n\t\t\t\tif ((person1.get(\"zip\").toString()).compareToIgnoreCase(person2.get(\"zip\").toString()) > 0) {\n\t\t\t\t\tJSONObject temp = person1;\n\t\t\t\t\tarrayList.set(j, person2);\n\t\t\t\t\tarrayList.set(j + 1, temp);\n\t\t\t\t}\n\t\t\t}\n\t\t\tmapper.writeValue(file1, arrayList);\n\n\t\t}\n\t}", "@Override\n public LinkedList<Double> call() {\n for (int string = 0; string < line.length; string++) {\n String numberString = super.cleanTextContent(line[string]);\n try {\n double number = Double.parseDouble(numberString);\n values.add(number);\n } catch (NumberFormatException numberFormatException) {\n numberFormatException.printStackTrace();\n }\n }\n Collections.sort(values);\n while (values.size() > valuesToKeep) {\n values.removeLast();\n }\n return values;\n }", "public static void main(String[] args) {\n String linesReadFileName = \"\"; // Input file name\n String MSWriteFileName = \"\"; // Output file name for the sorted data obtained using mergesort\n String QSWriteFileName = \"\"; // Output file name for the sorted data obtained using quicksort\n File linesReadFile; // Input file of unsorted lines used for both sorts\n File MSWriteFile; // Mergesort write file\n File QSWriteFile; // Quicksort write file\n linesReadFile = new File(linesReadFileName);\n String[] mergeSortLines = new String[MAX_LINES]; // List of lines to be sorted using mergesort\n String[] quickSortLines = new String[MAX_LINES]; // List of lines to be sorted using quicksort\n String[] temp = new String[MAX_LINES]; // Temporary array used in mergesort\n\n // Read the input file name from the console\n System.out.println(\"What is the name of your input file?\");\n Scanner consoleReader = new Scanner(System.in);\n linesReadFileName = consoleReader.nextLine();\n\n // Open the input file for reading and read in all of the lines\n try\n {\n linesReadFile = new File(linesReadFileName);\n Scanner linesScanner = new Scanner(linesReadFile);\n\n int i = 0; // Index used to add elements to the lines array in the loop\n while (linesScanner.hasNextLine() && i < MAX_LINES) // Either stop reading when the file runs out of lines or when we reach MAX_LINES lines\n {\n mergeSortLines[i] = linesScanner.nextLine();\n i++;\n }\n\n linesScanner.close();\n }\n catch (FileNotFoundException e)\n {\n System.out.println(\"Error opening input file.\");\n e.printStackTrace();\n }\n\n quickSortLines = mergeSortLines.clone(); // Copy the unsorted string list to be used for merge sort into the array to be used for quick sort\n\n // Read the output file names from the console\n System.out.println(\"What is the name of your output file for the data obtained using mergesort?\");\n consoleReader = new Scanner(System.in);\n MSWriteFileName = consoleReader.nextLine();\n\n System.out.println(\"What is the name of your output file for the data obtained using quicksort?\");\n consoleReader = new Scanner(System.in);\n QSWriteFileName = consoleReader.nextLine();\n\n // Perform the mergesort, obtain the start and end time of the algorithm\n long mergeSortBegin = System.nanoTime();\n mergeSort(mergeSortLines, 0, mergeSortLines.length - 1, temp);\n long mergeSortEnd = System.nanoTime();\n\n long mergeSortDuration = (mergeSortEnd - mergeSortBegin);\n System.out.println(\"Mergesort duration: \" + mergeSortDuration + \" nanoseconds\");\n\n // Perform the quicksort, obtain the start and end time of the algorithm\n long quickSortBegin = System.nanoTime();\n quickSort(quickSortLines, 0, quickSortLines.length - 1);\n long quickSortEnd = System.nanoTime();\n\n long quickSortDuration = (quickSortEnd - quickSortBegin);\n System.out.println(\"Quicksort Duration: \" + quickSortDuration + \" nanoseconds\");\n\n // Write the sorted data to separate text files\n writeSortedArrayToFile(mergeSortLines, mergeSortLines.length, MSWriteFileName);\n writeSortedArrayToFile(quickSortLines, quickSortLines.length, QSWriteFileName);\n\n }", "@Override\n public void sort() {\n for (int i = 0; i < size; i++) {\n for (int j = i + 1; j < size; j++) {\n if (((Comparable) data[i]).compareTo(data[j]) > 0) {\n E c = data[i];\n data[i] = data[j];\n data[j] = c;\n\n }\n }\n }\n }", "public static void readCVS(String filename){\n try {\n BufferedReader reader = new BufferedReader(new FileReader(filename));\n String line;\n while((line=reader.readLine())!=null){\n String item[] = line.split(\",\");\n String name = item[0];\n String value = item[1];\n switch (name){\n case \"useMaxTick\":{\n if(value.toLowerCase().equals(\"true\")){\n Params.useMaxTick = true;\n }else{\n Params.useMaxTick = false;\n }\n break;\n }\n case \"maxTick\":{\n Params.maxTick = Integer.parseInt(value);\n break;\n }\n case \"startPctWhites\":{\n Params.startPctWhites = Float.parseFloat(value);\n break;\n }\n case \"startPctBlacks\":{\n Params.startPctBlacks = Float.parseFloat(value);\n break;\n }\n case \"startPctGreys\":{\n Params.startPctGreys = Float.parseFloat(value);\n break;\n }\n case \"albedoOfWhites\":{\n Params.albedoOfWhites = Float.parseFloat(value);\n break;\n }\n case \"albedoOfBlacks\":{\n Params.albedoOfBlacks = Float.parseFloat(value);\n break;\n }\n case \"albedoOfGreys\":{\n Params.albedoOfGreys = Float.parseFloat(value);\n break;\n }\n case \"solarLuminosity\":{\n Params.solarLuminosity = Float.parseFloat(value);\n break;\n }\n case \"albedoOfSurface\":{\n Params.albedoOfSurface = Float.parseFloat(value);\n break;\n }\n case \"diffusePct\":{\n Params.diffusePct = Float.parseFloat(value);\n break;\n }\n case \"maxAge\":{\n Params.maxAge = Integer.parseInt(value);\n break;\n }\n case \"scenario\":{\n switch (Integer.parseInt(value)){\n case 0: {\n Params.scenario = Scenario.RAMP;\n break;\n }\n case 1: {\n Params.scenario = Scenario.LOW;\n break;\n }\n case 2: {\n Params.scenario = Scenario.OUR;\n break;\n }\n case 3: {\n Params.scenario = Scenario.HIGH;\n break;\n }\n case 4: {\n Params.scenario = Scenario.MAINTAIN;\n break;\n }\n default:\n break;\n }\n }\n default:\n break;\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "static void mergeSortedFiles() throws IOException {\n\n\t\tBufferedReader[] bufReaderArray = new BufferedReader[noOfFiles];\n\t\tList<String> intermediateList = new ArrayList<String>();\n\t\tList<String> lineDataList = new ArrayList<String>();\n\n\t\tfor (int file = 0; file < noOfFiles; file++) {\n\t\t\tbufReaderArray[file] = new BufferedReader(new FileReader(DividedfileList.get(file)));\n\n\t\t\tString fileLine = bufReaderArray[file].readLine();\n\n\t\t\tif (fileLine != null) {\n\t\t\t\tintermediateList.add(fileLine.substring(0, 10));\n\t\t\t\tlineDataList.add(fileLine);\n\t\t\t}\n\t\t}\n\n\t\tBufferedWriter bufw = new BufferedWriter(new FileWriter(Outputfilepath));\n\n\t\t// Merge files into one file\n\n\t\tfor (long lineNumber = 0; lineNumber < totalLinesInMainFile; lineNumber++) {\n\t\t\tString sortString = intermediateList.get(0);\n\t\t\tint sortFile = 0;\n\n\t\t\tfor (int iter = 0; iter < noOfFiles; iter++) {\n\t\t\t\tif (sortString.compareTo(intermediateList.get(iter)) > 0) {\n\t\t\t\t\tsortString = intermediateList.get(iter);\n\t\t\t\t\tsortFile = iter;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbufw.write(lineDataList.get(sortFile) + \"\\r\\n\");\n\t\t\tintermediateList.set(sortFile, \"-1\");\n\t\t\tlineDataList.set(sortFile, \"-1\");\n\n\t\t\tString nextString = bufReaderArray[sortFile].readLine();\n\n\t\t\tif (nextString != null) {\n\t\t\t\tintermediateList.set(sortFile, nextString.substring(0, 10));\n\t\t\t\tlineDataList.set(sortFile, nextString);\n\t\t\t} else {\n\t\t\t\tlineNumber = totalLinesInMainFile;\n\n\t\t\t\tList<String> ListToWrite = new ArrayList<String>();\n\n\t\t\t\tfor (int file = 0; file < intermediateList.size(); file++) {\n\t\t\t\t\tif (lineDataList.get(file) != \"-1\")\n\t\t\t\t\t\tListToWrite.add(lineDataList.get(file));\n\n\t\t\t\t\twhile ((sortString = bufReaderArray[file].readLine()) != null) {\n\t\t\t\t\t\tListToWrite.add(sortString);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tCollections.sort(ListToWrite);\n\t\t\t\tint index = 0;\n\t\t\t\twhile (index < ListToWrite.size()) {\n\t\t\t\t\tbufw.write(ListToWrite.get(index) + \"\\r\\n\");\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tbufw.close();\n\t\tfor (int file = 0; file < noOfFiles; file++)\n\t\t\tbufReaderArray[file].close();\n\t}", "private void mapSortedFiles(String file1, String file2) {\n\t\tString file1Copy = tempPath + tempFileName.getTempFileName(sourcePath1, \"Mapper\");\r\n\t\tString file2Copy = tempPath + tempFileName.getTempFileName(sourcePath2, \"Mapper\");\r\n\r\n\t\tcreateFileCopy(new File(file1).toPath(), file1Copy);\r\n\t\tcreateFileCopy(new File(file2).toPath(), file2Copy);\r\n\r\n\t\ttry {\r\n\t\t\tLineIterator file1Iterator = FileUtils.lineIterator(new File(file1));\r\n\r\n\t\t\tLineIterator file2Iterator = FileUtils.lineIterator(new File(file2));\r\n\r\n\t\t\tint leftIndex = 0;\r\n\t\t\tint rightIndex = 0;\r\n\r\n\t\t\twhile (file1Iterator.hasNext()) {\r\n\r\n\t\t\t\tString left = file1Iterator.nextLine();\r\n\t\t\t\tString right = file2Iterator.nextLine();\r\n\r\n\t\t\t\tString leftSortKey = getSortKey(left);\r\n\t\t\t\tString rightSortKey = getSortKey(right);\r\n\t\t\t\t\r\n\t\t\t\tleftIndex++;\r\n\t\t\t\trightIndex++;\r\n\t\t\t\t\r\n\r\n\t\t\t\twhile (leftSortKey.compareTo(rightSortKey) > 0) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t//System.out.println(leftSortKey +\", \" + rightSortKey);\r\n\r\n\t\t\t\t\tList<String> lines = Files.readAllLines(Paths.get(file1Copy));\r\n\t\t\t\t\tlines.add(leftIndex-1, getEmptyLine());\r\n\t\t\t\t\tFiles.write(Paths.get(file1Copy), lines);\r\n\r\n\t\t\t\t\trightIndex++;\r\n\t\t\t\t\tright = file2Iterator.nextLine();\r\n\t\t\t\t\trightSortKey = getSortKey(right);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\twhile (leftSortKey.compareTo(rightSortKey) < 0) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t//System.out.println(leftSortKey +\", \" + rightSortKey);\r\n\r\n\t\t\t\t\tList<String> lines = Files.readAllLines(Paths.get(file2Copy));\r\n\t\t\t\t\tlines.add(rightIndex-1, getEmptyLine());\r\n\t\t\t\t\tFiles.write(Paths.get(file2Copy), lines);\r\n\r\n\t\t\t\t\tleftIndex++;\r\n\t\t\t\t\tleft = file1Iterator.nextLine();\r\n\t\t\t\t\tleftSortKey = getSortKey(left);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} catch (IOException e) {\r\n\t\t\tSystem.out.println(\"Temp file was not found: \" + e.getMessage());\r\n\t\t}\r\n\r\n\t}", "private static void readArff(String fileName) {\r\n\t\ttry {\r\n\t\t\tFileInputStream stream = new FileInputStream(fileName);\r\n\t\t\tInputStreamReader reader = new InputStreamReader(stream);\r\n\t\t\tBufferedReader buffer = new BufferedReader(reader);\r\n\t\t\t\r\n\t\t\tArrayList<String> tmpColumnName = new ArrayList<String>();\r\n\t\t\t\r\n\t\t\tString line;\r\n\t\t\tint userNo = 0; // sequence number of each user\r\n\t\t\tint attributeCount = 0;\r\n\t\t\t\r\n\t\t\tmaxValue = -1;\r\n\t\t\tminValue = 99999;\r\n\t\t\t\r\n\t\t\t// Read attributes:\r\n\t\t\twhile((line = buffer.readLine()) != null && !line.equals(\"TT_EOF\")) {\r\n\t\t\t\tif (line.contains(\"@ATTRIBUTE\")) {\r\n\t\t\t\t\tString name;\r\n\t\t\t\t\t\r\n\t\t\t\t\tline = line.substring(10).trim();\r\n\t\t\t\t\tif (line.charAt(0) == '\\'') {\r\n\t\t\t\t\t\tint idx = line.substring(1).indexOf('\\'');\r\n\t\t\t\t\t\tname = line.substring(1, idx+1);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tint idx = line.substring(1).indexOf(' ');\r\n\t\t\t\t\t\tname = line.substring(0, idx+1).trim();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\ttmpColumnName.add(name);\r\n\t\t\t\t\tattributeCount++;\r\n\t\t\t\t}\r\n\t\t\t\telse if (line.contains(\"@RELATION\")) {\r\n\t\t\t\t\t// do nothing\r\n\t\t\t\t}\r\n\t\t\t\telse if (line.contains(\"@DATA\")) {\r\n\t\t\t\t\t// This is the end of attribute section!\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\telse if (line.length() <= 0) {\r\n\t\t\t\t\t// do nothing\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Set item count to data structures:\r\n\t\t\titemCount = (attributeCount - 1)/2;\r\n\t\t\tcolumnName = new String[attributeCount];\r\n\t\t\ttmpColumnName.toArray(columnName);\r\n\t\t\t\r\n\t\t\tint[] itemRateCount = new int[itemCount+1];\r\n\t\t\trateMatrix = new SparseMatrix(500000, itemCount+1); // Netflix: [480189, 17770]\r\n\t\t\t\r\n\t\t\t// Read data:\r\n\t\t\twhile((line = buffer.readLine()) != null && !line.equals(\"TT_EOF\")) {\r\n\t\t\t\tif (line.length() > 0) {\r\n\t\t\t\t\tline = line.substring(1, line.length() - 1);\r\n\t\t\t\t\t\r\n\t\t\t\t\tStringTokenizer st = new StringTokenizer (line, \",\");\r\n\t\t\t\t\t\r\n\t\t\t\t\twhile (st.hasMoreTokens()) {\r\n\t\t\t\t\t\tString token = st.nextToken().trim();\r\n\t\t\t\t\t\tint i = token.indexOf(\" \");\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tint movieID, rate;\r\n\t\t\t\t\t\tint index = Integer.parseInt(token.substring(0, i));\r\n\t\t\t\t\t\tString data = token.substring(i+1);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (index == 0) { // User ID\r\n\t\t\t\t\t\t\t//int userID = Integer.parseInt(data);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tuserNo++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if (data.length() == 1) { // Rate\r\n\t\t\t\t\t\t\tmovieID = index;\r\n\t\t\t\t\t\t\trate = Integer.parseInt(data);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif (rate > maxValue) {\r\n\t\t\t\t\t\t\t\tmaxValue = rate;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse if (rate < minValue) {\r\n\t\t\t\t\t\t\t\tminValue = rate;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t(itemRateCount[movieID])++;\r\n\t\t\t\t\t\t\trateMatrix.setValue(userNo, movieID, rate);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse { // Date\r\n\t\t\t\t\t\t\t// Do not use\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\tuserCount = userNo;\r\n\t\t\t\r\n\t\t\t// Reset user vector length:\r\n\t\t\trateMatrix.setSize(userCount+1, itemCount+1);\r\n\t\t\tfor (int i = 1; i <= itemCount; i++) {\r\n\t\t\t\trateMatrix.getColRef(i).setLength(userCount+1);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tSystem.out.println (\"Data File\\t\" + dataFileName);\r\n\t\t\tSystem.out.println (\"User Count\\t\" + userCount);\r\n\t\t\tSystem.out.println (\"Item Count\\t\" + itemCount);\r\n\t\t\tSystem.out.println (\"Rating Count\\t\" + rateMatrix.itemCount());\r\n\t\t\tSystem.out.println (\"Rating Density\\t\" + String.format(\"%.2f\", ((double) rateMatrix.itemCount() / (double) userCount / (double) itemCount * 100.0)) + \"%\");\r\n\t\t\t\r\n\t\t\tstream.close();\r\n\t\t}\r\n\t\tcatch (IOException ioe) {\r\n\t\t\tSystem.out.println (\"No such file: \" + ioe);\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t}", "public static void main(String[] args) throws FileNotFoundException { \n \t\n In in = new In(args[0]);\n \n\t\t // Storing file input in an array\n int[] a = in.readAllInts();\n\n // b contains sorted integers from a (You can use Java Arrays.sort() method)\n int[] b = new int[a.length];\n for(int i = 0; i < a.length; i++) {\n \tb[i] = a[i];\n }\n Arrays.sort(b);\n // c contains all integers stored in reverse order \n int[] c = new int[b.length];\n for(int i = 0; i < b.length; i++) {\n \tc[i] = b[b.length - 1 - i];\n }\n // (you can have your own O(n) solution to get c from b\n \n // d contains almost sorted array \n int[] d = new int[b.length];\n\t\tfor(int i = 0 ; i < b.length; i++) {\n\t\t\td[i] = b[i];\n\t\t}\n\t\tfor(int i = 0; i < d.length * 0.1; i++) {\n\t\t\tint temp = d[i];\n\t\t\td[i] = d[d.length - 1 - i];\n\t\t\td[d.length - 1 - i] = temp;\n\t\t}\n //(You can copy b to a and then perform (0.1 * d.length) many swaps to acheive this. \n \n //TODO: \n // Read the second argument and based on input select the sorting algorithm\n // * 0 = Arrays.sort() (Java Default)\n // Perform sorting on a,b,c,d. Pring runtime for each case along with timestamp and record those. \n // For runtime and priting, you can use the same code from Lab 4 as follows:\n \n // * 1 = Bubble Sort\n // * 3 = Insertion Sort \n // * 4 = Mergesort\n // * 5 = Quicksort\n\t\t\n\t\t//performs the default java sort on each array\n if(args[1].equals(\"0\")) {\n \t\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(Calendar.getInstance().getTime());\n //TODO: Replace with your own netid\n String netID = \"amusaa\";\n //TODO: Replace with the algorithm used \n String algorithmUsed = \"Java default (Arrays.sort())\";\n //starts the clock \n Stopwatch timer = new Stopwatch();\n //sorts the array\n Arrays.sort(a);\n //gets the time when done sorting\n double time = timer.elapsedTimeMillis();\n String arrayUsed = \"a\";\n //prints to the terminal all the relevant information\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out1 = new PrintStream(new FileOutputStream(\"a.txt\"));\n System.setOut(out1);\n //prints the now sorted array to a text file\n \tfor(int i = 0; i < a.length; i++) {\n \t\tSystem.out.print(a[i] + \" \");\n }\n \n // Write the resultant array to a file (Each time you run a program 4 output files should be generated. (one for each a,b,c, and d)\n Stopwatch timer2 = new Stopwatch(); \n Arrays.sort(b);\n time = timer2.elapsedTimeMillis();\n arrayUsed = \"b\";\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out2 = new PrintStream(new FileOutputStream(\"b.txt\"));\n System.setOut(out2);\n \tfor(int i = 0; i < b.length; i++) {\n \t\tSystem.out.print(b[i] + \" \");\n }\n \n Stopwatch timer3 = new Stopwatch();\n Arrays.sort(c);\n time = timer3.elapsedTimeMillis();\n arrayUsed = \"c\";\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out3 = new PrintStream(new FileOutputStream(\"c.txt\"));\n System.setOut(out3);\n \tfor(int i = 0; i < c.length; i++) {\n \t\tSystem.out.print(c[i] + \" \");\n }\n \n Stopwatch timer4 = new Stopwatch();\n Arrays.sort(d);\n time = timer4.elapsedTimeMillis();\n arrayUsed = \"d\";\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out4 = new PrintStream(new FileOutputStream(\"d.txt\"));\n System.setOut(out4);\n \tfor(int i = 0; i < d.length; i++) {\n \t\tSystem.out.print(d[i] + \" \");\n }\n }\n if(args[1].equals(\"1\")) {\n \tString timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(Calendar.getInstance().getTime());\n //TODO: Replace with your own netid\n String netID = \"amusaa\";\n \n String algorithmUsed = \"Bubble sort\";\n Stopwatch timer1 = new Stopwatch();\n for(int i = 0; i < a.length; i++) {\n \tfor(int j = a.length-1; j > i; j--) {\n \t\tif(a[j] < a[j-1]) {\n \t\t\tint temp = a[j];\n \t\t\ta[j] = a[j-1];\n \t\t\ta[j-1] = temp;\n \t\t}\n \t}\n }\n double time = timer1.elapsedTimeMillis();\n String arrayUsed = \"a\";\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n\n arrayUsed = \"b\";\n Stopwatch timer2 = new Stopwatch();\n for(int i = 0; i < b.length; i++) {\n \tfor(int j = b.length - 1; j > 1; j--) {\n \t\tif(b[j] < b[j-1]) {\n \t\t\tint temp = b[j];\n \t\t\tb[j] = b[j-1];\n \t\t\tb[j-1] = temp;\n \t\t}\n \t}\n }\n time = timer2.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n \n arrayUsed = \"c\";\n Stopwatch timer3 = new Stopwatch();\n \tfor(int i = 0; i < c.length; i++) {\n \t\tfor(int j = c.length -1; j > 0; j--) {\n \t\t\tif(c[j] < c[j-1]) {\n \t\t\t\tint temp = c[j];\n \t\t\t\t\tc[j] = c[j-1];\n \t\t\t\t\t\tc[i] = temp;\n \t\t}\n \t}\n }\n time = timer3.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n \n arrayUsed = \"d\";\n Stopwatch timer4 = new Stopwatch();\n \tfor(int i = 0; i < d.length; i++) {\n \t\tfor(int j = d.length -1; j > 1; j--) {\n \t\t\tif(d[j] < d[j-1]) {\n \t\t\t\tint temp = d[j];\n \t\t\t\t\td[j] = d[j-1];\n \t\t\t\t\t\td[j-1] = temp;\n \t\t}\n \t}\n }\n time = timer4.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n }\n if(args[1].equals(\"2\")) {\n \tString timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(Calendar.getInstance().getTime());\n String netID = \"amusaa\";\n String algorithmUsed = \"Selection sort\";\n \n String arrayUsed = \"a\";\n Stopwatch timer5 = new Stopwatch();\n \tfor(int i = 0; i < a.length; i ++) {\n \t\tint minIndex = i;\n \t\t\tfor(int j = a.length - 1; j > i; j--) {\n \t\t\t\tif(a[minIndex] > a[j])\n \t\t\t\t\tminIndex = j;\n \t}\n \tint temp = a[minIndex];\n \ta[minIndex] = a[i];\n \ta[i] = temp;\n }\n double time = timer5.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out = new PrintStream(new FileOutputStream(\"a.txt\"));\n System.setOut(out);\n for(int i = 0; i < a.length; i++) {\n \tSystem.out.print(a[i] + \" \");\n }\n arrayUsed = \"b\";\n Stopwatch timer6 = new Stopwatch();\n \tfor(int i = 0; i < b.length; i ++) {\n \t\tint minIndex = i;\n \t\t\tfor(int j = b.length - 1; j > i; j--) {\n \t\t\t\tif(a[minIndex] > b[j])\n \t\t\tminIndex = j;\n \t}\n \tint temp = b[minIndex];\n \tb[minIndex] = b[i];\n \tb[i] = temp;\n }\n time = timer6.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out1 = new PrintStream(new FileOutputStream(\"b.txt\"));\n System.setOut(out1);\n \tfor(int i = 0; i < b.length; i++) {\n \t\tSystem.out.print(b[i] + \" \");\n }\n \t\n arrayUsed = \"c\";\n Stopwatch timer7 = new Stopwatch();\n \tfor(int i = 0; i < c.length; i ++) {\n \t\tint minIndex = i;\n \t\t\tfor(int j = c.length - 1; j > i; j--) {\n \t\t\t\tif(c[minIndex] > c[j])\n \t\t\t\t\tminIndex = j;\n \t}\n \tint temp = c[minIndex];\n \tc[minIndex] = c[i];\n \tc[i] = temp;\n }\n time = timer7.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out2 = new PrintStream(new FileOutputStream(\"c.txt\"));\n System.setOut(out2);\n for(int i = 0; i < c.length; i++) {\n \tSystem.out.print(c[i] + \" \");\n }\n arrayUsed = \"d\";\n Stopwatch timer8 = new Stopwatch();\n \tfor(int i = 0; i < d.length; i ++) {\n \t\tint minIndex = i;\n \t\t\tfor(int j = d.length - 1; j > i; j--) {\n \t\t\t\tif(d[minIndex] > d[j])\n \t\t\t\t\tminIndex = j;\n \t}\n \tint temp = d[minIndex];\n \t\td[minIndex] = d[i];\n \t\td[i] = temp;\n }\n time = timer8.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out3 = new PrintStream(new FileOutputStream(\"d.txt\"));\n System.setOut(out3);\n \tfor(int i = 0; i < d.length; i++) {\n \t\tSystem.out.print(d[i] + \" \");\n }\n }\n if(args[1].equals(\"3\")) {\n \tString timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(Calendar.getInstance().getTime());\n //TODO: Replace with your own netid\n String netID = \"amusaa\";\n \n String algorithmUsed = \"Insertion sort\";\n \n String arrayUsed = \"a\";\n Stopwatch timer9 = new Stopwatch();\n \tfor(int i = 0; i < a.length; i++) {\n \t\tfor(int j = i; (j > 0) && (a[j] < a[j-1]); j--) {\n \t\t\tint temp = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\t\ta[j-1] = temp;\n \t}\n }\n double time = timer9.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out1 = new PrintStream(new FileOutputStream(\"a.txt\"));\n System.setOut(out1);\n \tfor(int i = 0; i < a.length; i++) {\n \t\tSystem.out.print(a[i] + \" \");\n }\n \n arrayUsed = \"b\";\n Stopwatch timer10 = new Stopwatch();\n \tfor(int i = 0; i < b.length; i++) {\n \t\tfor(int j = i; (j>0) && (b[j] < b[j-1]); j--) {\n \t\t\tint temp = b[j];\n \t\t\tb[j] = b[j-1];\n \t\t\t\tb[j-1] = temp;\n \t}\n }\n time = timer10.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out2 = new PrintStream(new FileOutputStream(\"b.txt\"));\n System.setOut(out2);\n \tfor(int i = 0; i < b.length; i++) {\n \t\tSystem.out.print(b[i] + \" \");\n }\n \n arrayUsed = \"c\";\n Stopwatch timer11 = new Stopwatch();\n \tfor(int i = 0; i < c.length; i++) {\n \t\tfor(int j = i; (j>0) && (c[j] < c[j-1]); j--) {\n \t\t\tint temp = c[j];\n \t\t\tc[j] = c[j-1];\n \t\t\t\tc[j-1] = temp;\n \t}\n }\n time = timer11.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out3 = new PrintStream(new FileOutputStream(\"c.txt\"));\n System.setOut(out3);\n \tfor(int i = 0; i < c.length; i++) {\n \t\tSystem.out.print(c[i] + \" \");\n }\n \n arrayUsed = \"d\";\n Stopwatch timer12 = new Stopwatch();\n \tfor(int i = 0; i < d.length; i++) {\n \t\tfor(int j = i; (j > 0) && (d[j] < d[j-1]); j--) {\n \t\t\tint temp = d[j];\n \t\t\t\td[j] = d[j-1];\n \t\t\t\t\td[j-1] = temp;\n \t}\n }\n time = timer12.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out4 = new PrintStream(new FileOutputStream(\"d.txt\"));\n System.setOut(out4);\n \tfor(int i = 0; i < d.length; i++) {\n \t\tSystem.out.print(d[i] + \" \");\n }\n }\n if(args[1].equals(\"4\")) {\n \tString timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(Calendar.getInstance().getTime());\n String netID = \"amusaa\";\n String algorithmUsed = \"Merge sort\";\n \n String arrayUsed = \"a\";\n int[] temp1 = new int[a.length];\n Stopwatch timer13 = new Stopwatch();\n mergeSort(a, temp1, 0, a.length-1);\n double time = timer13.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out1 = new PrintStream(new FileOutputStream(\"a.txt\"));\n System.setOut(out1);\n \tfor(int i = 0 ; i < a.length; i++) {\n \t\tSystem.out.print(a[i] + \" \");\n }\n \n arrayUsed = \"b\";\n int[] temp2 = new int[b.length];\n Stopwatch timer14 = new Stopwatch();\n mergeSort(b, temp2, 0, b.length -1);\n time = timer14.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out2 = new PrintStream(new FileOutputStream(\"b.txt\"));\n System.setOut(out2);\n \tfor(int i = 0; i < b.length; i++) {\n \t\tSystem.out.print(b[i] + \" \");\n }\n \n arrayUsed = \"c\";\n int[] temp3 = new int[c.length];\n Stopwatch timer15 = new Stopwatch();\n mergeSort(c, temp3, 0, c.length-1);\n time = timer15.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out3 = new PrintStream(new FileOutputStream(\"c.txt\"));\n System.setOut(out3);\n \tfor(int i = 0; i < c.length; i++) {\n \t\tSystem.out.print(c[i] + \" \");\n }\n \n arrayUsed = \"d\";\n int[] temp4 = new int[d.length];\n Stopwatch timer16 = new Stopwatch();\n mergeSort(d, temp4, 0, d.length -1);\n time = timer16.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out4 = new PrintStream(new FileOutputStream(\"d.txt\"));\n System.setOut(out4);\n \tfor(int i = 0; i < d.length; i++) {\n \t\tSystem.out.print(d[i] + \" \");\n }\n }\n if(args[1].equals(\"5\")) {\n \tString timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(Calendar.getInstance().getTime());\n String netID = \"amusaa\";\n String algorithmUsed = \"Quick sort\";\n \n String arrayUsed = \"a\";\n Stopwatch timer17 = new Stopwatch();\n quickSort(a, 0, a.length-1);\n double time = timer17.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out1 = new PrintStream(new FileOutputStream(\"a.txt\"));\n System.setOut(out1);\n \tfor(int i = 0; i < a.length; i++) {\n \t\tSystem.out.print(a[i] + \" \");\n }\n \n arrayUsed = \"b\";\n Stopwatch timer18 = new Stopwatch();\n quickSort(b, 0, b.length-1);\n time = timer18.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out2 = new PrintStream(new FileOutputStream(\"b.txt\"));\n System.setOut(out2);\n \tfor(int i = 0; i < b.length; i++) {\n \t\tSystem.out.print(b[i] + \" \");\n }\n \n arrayUsed = \"c\";\n Stopwatch timer19 = new Stopwatch();\n quickSort(c, 0, c.length-1);\n time = timer19.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out3 = new PrintStream(new FileOutputStream(\"c.txt\"));\n System.setOut(out3);\n \tfor(int i = 0; i < c.length; i++)\n \t\tSystem.out.print(c[i] + \" \");\n \n arrayUsed = \"d\";\n Stopwatch timer20 = new Stopwatch();\n quickSort(d, 0, d.length -1);\n time = timer20.elapsedTimeMillis();\n StdOut.printf(\"%s %s %8.1f %s %s %s\\n\", algorithmUsed, arrayUsed, time, timeStamp, netID, args[0]);\n PrintStream out4 = new PrintStream(new FileOutputStream(\"d.txt\"));\n System.setOut(out4);\n \tfor(int i = 0; i < d.length; i++)\n \t\tSystem.out.print(d[i] + \" \");\n }\n \n }", "public static List<String> parseValues(String fileName)\n throws CLIException\n {\n BufferedReader in = null;\n List<String> values = new ArrayList<String>();\n \n try {\n in = new BufferedReader(new FileReader(fileName));\n String line = in.readLine();\n while (line != null) {\n line = line.trim();\n if (line.length() > 0) {\n values.add(line);\n }\n line = in.readLine();\n }\n } catch (IOException e) {\n throw new CLIException(e, ExitCodes.IO_EXCEPTION);\n } finally {\n if (in !=null ) {\n try {\n in.close();\n } catch (IOException e) {\n //ignore cannot close input stream\n }\n }\n }\n return values;\n }", "public static void sortedData(int size) {\n\t\t\tCollections.sort(values);\n\n\t\t// display the data, one per line\n\t\tfor (final int i : values)\n\t\t\tSystem.out.println(i);\n\t}", "public void mergefiles()\n {\n LinkedHashMap<String, Integer> count = new LinkedHashMap<>();\n for(int i=0;i<files_temp.size();i++)\n {\n \t\t\n //System.out.println(\"here in merge files for\");\n \t//int index = files_temp.get(i).lastIndexOf(\"\\\\\");\n\t\t\t//System.out.println(index);\n \tSystem.out.println(files_temp.get(i));\n File file = new File(files_temp.get(i)+\"op.txt\");\n Scanner sc;\n try {\n //System.out.println(\"here in merge files inside try\");\n sc = new Scanner(file);\n sc.useDelimiter(\" \");\n while(sc.hasNextLine())\n {\n //System.out.println(\"Inwhile \");\n List<String> arr = new ArrayList<String>();\n arr=Arrays.asList(sc.nextLine().replaceAll(\"[{} ]\", \"\").replaceAll(\"[=,]\", \" \").split(\" \"));\n //System.out.println(arr.get(0));\n for(int j=0;j<arr.size()-1;j=j+2) \n {\n System.out.println(arr.get(j));\n if(arr.get(j).length()!=0 && arr.get(j+1).length()!=0)\n {\n if (count.containsKey(arr.get(j))) \n {\n int c = count.get(arr.get(j));\n count.remove(arr.get(j));\n count.put(arr.get(j),c + Integer.valueOf(arr.get(j+1)));\n }\n else \n {\n count.put(arr.get(j),Integer.valueOf(arr.get(j+1)));\n }\n }\n }\n }\n }\n catch(Exception E) \n {\n System.out.println(E);\n }\n }\n //System.out.println(count);\n count.entrySet()\n .stream()\n .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))\n .forEachOrdered(x -> sorted.put(x.getKey(), x.getValue()));\n System.out.println(sorted);\n PrintWriter writer;\n\t\ttry {\n\t\t\twriter = new PrintWriter(\"results.txt\", \"UTF-8\");\n\t\t\tIterator it = sorted.entrySet().iterator();\n\t\t\twhile (it.hasNext()) {\n\t\t\t\tMap.Entry pairs = (Map.Entry) it.next();\n\t\t\t\t\twriter.println(pairs.getValue() + \" : \" + pairs.getKey());\n\t\t\t\t\tthis.result.println(pairs.getValue() + \" : \" + pairs.getKey());\n\t\t\t}\n\t\t writer.close();\n\t\t}\n catch(Exception e)\n\t\t{\n\t\t\tSystem.out.println(e);\n\t\t}\n }", "protected int getFilePriority(File file) {\n \treturn 1;\n }", "public void jsort() {\n\tArrays.sort(data);\n }", "@Test\n public void testScanRange() throws IOException {\n Reader reader = new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);\n Assert.assertFalse(reader.isSorted());\n Assert.assertEquals(((int) (reader.getEntryCount())), 4);\n Scanner scanner = reader.createScanner();\n try {\n // read key and value\n byte[] kbuf = new byte[TestTFileUnsortedByteArrays.BUF_SIZE];\n int klen = scanner.entry().getKeyLength();\n scanner.entry().getKey(kbuf);\n Assert.assertEquals(new String(kbuf, 0, klen), \"keyZ\");\n byte[] vbuf = new byte[TestTFileUnsortedByteArrays.BUF_SIZE];\n int vlen = scanner.entry().getValueLength();\n scanner.entry().getValue(vbuf);\n Assert.assertEquals(new String(vbuf, 0, vlen), \"valueZ\");\n scanner.advance();\n // now try get value first\n vbuf = new byte[TestTFileUnsortedByteArrays.BUF_SIZE];\n vlen = scanner.entry().getValueLength();\n scanner.entry().getValue(vbuf);\n Assert.assertEquals(new String(vbuf, 0, vlen), \"valueM\");\n kbuf = new byte[TestTFileUnsortedByteArrays.BUF_SIZE];\n klen = scanner.entry().getKeyLength();\n scanner.entry().getKey(kbuf);\n Assert.assertEquals(new String(kbuf, 0, klen), \"keyM\");\n } finally {\n scanner.close();\n reader.close();\n }\n }", "public void loadScores() {\n try {\n File f = new File(filePath, highScores);\n if(!f.isFile()){\n createSaveData();\n }\n BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f)));\n\n topScores.clear();\n topName.clear();\n\n String[] scores = reader.readLine().split(\"-\");\n String[] names = reader.readLine().split(\"-\");\n\n for (int i =0; i < scores.length; i++){\n topScores.add(Integer.parseInt(scores[i]));\n topName.add(names[i]);\n }\n reader.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public static void readfile(String FILENAME) {\n\t\tString[] parts = null;\n\t\t// Initialising s as 9100 since the cardinality for a src is 9060\n\t\tint s = 2500;\n\t\t// Choosing m\n\t\tint m = 500000000;\n\t\tArrayList<ArrayList<Integer>> UniversalHashList = new ArrayList<ArrayList<Integer>>();\n\t\tArrayList<ArrayList<Integer>> XsrcMasterList = new ArrayList<ArrayList<Integer>>();\n\t\tList masterDstList = new ArrayList<ArrayList<String>>();\n\t\tString[] BitArray = new String[m];\n\t\tPrintStream out = null;\n\t\ttry {\n\t\t\tout = new PrintStream(new FileOutputStream(\"output_virbitmap.csv\"));\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tString src = null;\n\t\tHashMap<String, List> srcDstMap = new HashMap<String, List>();\n\t\tArrayList<Integer> R = new ArrayList<Integer>();\n\t\tR = genRandomArray(s);\n\t\t// initializing bit array\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tBitArray[i] = \"False\";\n\t\t}\n\t\t// reading input file and writing to HashMap<src,dstlist>\n\t\ttry (BufferedReader br = new BufferedReader(new FileReader(FILENAME))) {\n\n\t\t\tString sCurrentLine;\n\t\t\twhile ((sCurrentLine = br.readLine()) != null) {\n\t\t\t\tparts = sCurrentLine.trim().split(\"\\\\s+\");\n\t\t\t\tsrc = parts[0];\n\t\t\t\tString dst = parts[1];\n\t\t\t\tif (!srcDstMap.containsKey(src)) {\n\t\t\t\t\tArrayList<String> dstList = new ArrayList<String>();\n\t\t\t\t\tdstList.add(dst);\n\t\t\t\t\tsrcDstMap.put(src, dstList);\n\t\t\t\t\t// hashing(B,convertIPAddress(tokens[0]));\n\t\t\t\t} else\n\t\t\t\t\tsrcDstMap.get(src).add(dst);\n\n\t\t\t}\n\t\t} catch (FileNotFoundException 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\t\tfor (int i = 0; i < srcDstMap.size(); i++) {\n\t\t\tArrayList<Integer> masterHashList = new ArrayList<Integer>();\n\t\t\tArrayList<Integer> XsrcList = new ArrayList<Integer>();\n\t\t\tUniversalHashList.add(masterHashList);\n\t\t\tXsrcMasterList.add(XsrcList);\n\t\t\t// System.out.println(\"XsrcmasterList\" + XsrcList);\n\n\t\t}\n\t\tIterator srcDstMapIt = srcDstMap.entrySet().iterator();\n\t\tfor (int i = 0; i < srcDstMap.size(); i++) {\n\t\t\tArrayList<Integer> XsrcList = XsrcMasterList.get(i);\n\t\t\tArrayList<Integer> masterHashList = UniversalHashList.get(i);\n\t\t\twhile (srcDstMapIt.hasNext()) {\n\t\t\t\tMap.Entry pair = (Map.Entry) srcDstMapIt.next();\n\t\t\t\tsrc = pair.getKey().toString();\n\t\t\t\tList dstList = (List) pair.getValue();\n\t\t\t\tmasterDstList.add(dstList);\n\t\t\t\tIterator dstListIt = dstList.iterator();\n\t\t\t\twhile (dstListIt.hasNext()) {\n\t\t\t\t\tint hashedSrc = masterHashSetGen(src, dstListIt.next().toString(), s, R);\n\t\t\t\t\t// String[] partsGeneratedStuff =\n\t\t\t\t\t// generatedStuff.trim().split(\":\");\n\t\t\t\t\t// String generatedIndex = partsGeneratedStuff[0];\n\t\t\t\t\t// String hashedSrc = partsGeneratedStuff[1];\n\t\t\t\t\tmasterHashList.add(hashedSrc % BitArray.length);\n\t\t\t\t\t// System.out.println(masterHashList);\n\t\t\t\t\tXsrcList.add(hashedSrc);\n\t\t\t\t\t// System.out.println(XsrcList);\n\t\t\t\t\tBitArray[Math.abs(hashedSrc % (BitArray.length))] = \"True\";\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tdouble bitMapCount = BitMapCount(BitArray, BitArray.length, s);\n\t\t// System.out.println(\"bitMapCount\"+bitMapCount);\n\n\t\tint XsrcIndexperDst = 0;\n\t\tIterator srcDstMapItrecons = srcDstMap.entrySet().iterator();\n\t\twhile (srcDstMapItrecons.hasNext()) {\n\t\t\tdouble XsrcRatio;\n\t\t\tMap.Entry pair = (Map.Entry) srcDstMapItrecons.next();\n\t\t\tsrc = pair.getKey().toString();\n\t\t\t// System.out.println(\"src\" + src);\n\t\t\tList dstList = (List) pair.getValue();\n\t\t\tmasterDstList.add(dstList);\n\t\t\tIterator dstListIt = dstList.iterator();\n\t\t\tString[] srcArray = new String[s];\n\t\t\tdouble count = 0;\n\t\t\t\twhile(dstListIt.hasNext()) {\n\t\t\t\t\tXsrcIndexperDst = XsrcIndexperDst(XsrcMasterList, masterDstList, s, BitArray, src,dstListIt.next().toString(), R) % m;\n\t\t\t\t\t// System.out.println(\"Value\"+BitArray[XsrcIndexperDst]);\n\t\t\t\t\tif (BitArray[XsrcIndexperDst] == \"True\") {\n\t\t\t\t\t\tcount++;\n\t\t\t}\n\t\t\t\t}\n\t\t\t//System.out.println(\"count per source\" + count + \",\" + (s - count));\n\t\t\tXsrcRatio = -s * Math.log((s-count)/s);\n\t\t\tdouble estimatedSpread = -bitMapCount + XsrcRatio;\n\t\t\tif(estimatedSpread<=0)\n\t\t\t{\n\t\t\t\testimatedSpread=0;\n\t\t\t}\n\t\t\tout.println(dstList.size() + \",\" + estimatedSpread);\n\t\t}\n\n\t}", "private static void sortingMemo() {\n\t\t\n\t}", "public static void getProblem(String filename){\r\n String line = \"\";\r\n try {\r\n //Get the problem instance\r\n reader = new BufferedReader(new FileReader(filename));\r\n line = reader.readLine();\r\n\r\n //Assume the first line contains the Universe\r\n inString = line.split(\",\");\r\n\r\n for (int i = 0; i < inString.length; i++) {\r\n universe.add(Integer.parseInt(inString[i]));\r\n }\r\n Collections.sort(universe);\r\n System.out.println(\"Universe:\" + universe);\r\n\r\n //Gather in the sets\r\n line = reader.readLine();\r\n while (line != null){\r\n inString = line.split(\",\");\r\n for (int i = 0; i < inString.length; i++) {\r\n set.add(Integer.parseInt(inString[i]));\r\n }\r\n //System.out.println(\"Set: \" + set);\r\n sets.add(set);\r\n set = new ArrayList<Integer>();\r\n line = reader.readLine();\r\n\r\n //Create a blank pheromone\r\n pheremones.add(0);\r\n visited.add(0);\r\n }\r\n System.out.println(\"Sets: \" + sets);\r\n\r\n //Create the pheremones\r\n //System.out.println(\"PheremoneSize: \" + pheremones.size());\r\n\r\n //Set the degradation\r\n //degrade = generationSize/2;\r\n\r\n }catch(FileNotFoundException e){System.out.println(\"File Not Found : \" + filename);}\r\n catch(Exception e){\r\n System.out.println(\"ERROR in getProblem\");\r\n System.out.println(\"File Name: \" + filename);\r\n System.out.println(\"Universe: \" + universe);\r\n System.out.println(\"Line: \" + line);\r\n System.out.println(\"InString: \" + inString.toString());\r\n System.out.println();\r\n System.out.println(e.toString());\r\n }\r\n }", "void readWriteFile() throws IOException{\n\t\t\t\t\n\t\t// Sorting before writing it to the file\n\t Map<String, Double> sortedRank = sortByValues(PageRank); \n\t\t\n // below code is used for finding the inlinks count, Comment the probablity sum in below iterator if uncommenting this line\n\t\t//Map<String, Integer> sortedRank = sortByinlinks(inlinks_count);\n\t\t\n\n\t\t//Writing it to the file\n\t\tFile file = new File(\"C:/output.txt\");\n\t\tBufferedWriter output = new BufferedWriter(new FileWriter(file,true));\n\t\tIterator iterator = sortedRank.entrySet().iterator();\n\t\tdouble s = 0.0;\n\t\t\twhile(iterator.hasNext()){\n\t\t\t\tMap.Entry val = (Map.Entry)iterator.next();\n\t\t\t\toutput.write(val.getKey() +\"\\t\"+ val.getValue()+ \"\\n\");\t\t\t\t\n\t\t\t\ts= s+ (double)val.getValue(); //Adding the Probablity ; Comment this line if using Inlink calculation\n\t\t\t}\n\t\t\tSystem.out.println(\"Probablity Sum : \"+s); //After convergence should be 1; ; Comment this line if using Inlink calculation\n\t\t\toutput.flush();\n\t\t\toutput.close();\n\t}", "public void readFile(String filename) throws IOException {\n BufferedReader buffer = new BufferedReader(new FileReader(filename));\n\n String line;\n int row = 0;\n isFirstLine = true;\n\n while ((line = buffer.readLine()) != null) {\n String[] vals = line.trim().split(\"\\\\s+\");\n int length = vals.length;\n \n if(isFirstLine) {\n \tfor(int col = 0; col < 2; col++) {\n \t\tif(col == 0)\n \t\t\trowSize = Integer.parseInt(vals[col]);\n \t\telse\n \t\t\tcolSize = Integer.parseInt(vals[col]);\n \t}\n \tskiMap = new int[rowSize][colSize];\n \tisFirstLine = false;\n }\n else {\n \tfor (int col = 0; col < length; col++) {\n \tskiMap[row][col] = Integer.parseInt(vals[col]);\n }\n \t row++;\n }\n }\n \n if(buffer != null)\n \tbuffer.close();\n }", "public int readSurvivabilityRateByCauseFromFile (int numberOfLines) {\n survivabilityByCause = new SurvivabilityByCause[numberOfLines]; \n StdIn.readLine();\n for(int i = 0 ; i < numberOfLines ; i ++){\n String data = StdIn.readLine().trim();\n String[] dataValues = data.split(\" \");\n int count = 0;\n for(int j = 0; j < dataValues.length; j++){\n if(dataValues[j].equals(\"\")){\n continue;\n }\n // System.out.println(\" \"+dataValues[j]);\n dataValues[count] = dataValues[j].trim();\n count++;\n }\n SurvivabilityByCause s = new SurvivabilityByCause(Integer.parseInt(dataValues[0]), Integer.parseInt(dataValues[1]), Double.parseDouble(dataValues[2]));\n survivabilityByCause[i] = s;\n }\n\n return numberOfLines;\n }", "private void refreshList() {\n setTitle(this.path.get(this.path.size() - 1));\n\n // Read all files sorted into the values-array\n values.clear();\n File dir = new File(this.path.get(this.path.size() - 1));\n if (!dir.canRead()) {\n setTitle(getTitle() + \" (inaccessible)\");\n }\n String[] list = dir.list();\n if (list != null) {\n for (String file : list) {\n if (!file.startsWith(\".\")) {\n values.add(file);\n }\n }\n }\n Collections.sort(values);\n }", "private void sortEScores() {\n LinkedHashMap<String, Double> sorted = eScores\n .entrySet()\n .stream()\n .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))\n .collect(\n toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2,\n LinkedHashMap::new));\n eScores = sorted;\n }", "public Index[] readIndexes(File file){\t\t\n\t\ttry{\n\t\t\tFileReader reader = new FileReader(file);\n\t\t\tBufferedReader buff = new BufferedReader(reader);\n\n\t\t\tboolean eof = false;\t\t//stores if the end of the file (eof) has been reached\n\t\t\tint numberOfRecords = 0;\n\n\t\t\t/**\n\t\t\t * @mastery achieves SL mastery factor 6 with the while loop\n\t\t\t */\n\t\t\twhile(!eof){\n\t\t\t\tString line = buff.readLine();\n\n\t\t\t\t/**\n\t\t\t\t * @mastery achieves SL mastery factor 4 with the if/else selection block\n\t\t\t\t */\n\t\t\t\tif(line == null){\n\t\t\t\t\teof = true;\t\t//the end of the file has been reached\n\t\t\t\t} else {\n\t\t\t\t\tnumberOfRecords++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbuff.close();\n\n\t\t\tIndex[] indexes = new Index[numberOfRecords];\n\n\t\t\tFileReader reader2 = new FileReader(file);\n\t\t\tBufferedReader buff2 = new BufferedReader(reader2);\n\n\t\t\tfor(int i=0;i<numberOfRecords;i++){\n\t\t\t\tString line = buff2.readLine();\n\t\t\t\tindexes[i] = new Index(line);\n\t\t\t}\n\n\t\t\tArrays.sort(indexes);\n\t\t\tbuff.close();\n\t\t\treader.close();\n\t\t\tbuff2.close();\n\t\t\treader2.close();\n\t\t\t\n\t\t\treturn indexes;\n\n\t\t} catch (Exception e){\n\t\t\treturn null;\n\t\t}\n\t}", "public void externalSort(String inputFile, String outputFile, int n, int k) throws IOException {\n HybridSort hSort = new HybridSort();\n Path input = Paths.get(inputFile);\n\n int amtFiles = (int) Math.ceil((double) n / k); // calculates the amount of arrays in the function\n int fileNUM = 1; // counts the amount of tempFiles\n int tempSize = k;\n\n double[] mainArray = new double[k];\n double[] tempBigArray = new double[n];\n double[] temp = new double[k];\n\n boolean isOdd = amtFiles % 2 == 1;\n\n try (Scanner read = new Scanner(input).useDelimiter(\"(\\\\[ )|(, )|(\\\\])\");) {\n int index = 0;\n while (read.hasNext()) {\n double value = Double.parseDouble(read.next().strip());\n tempBigArray[index++] = value;\n } // end of while\n } // close the Scanner\n\n // Write to temp files\n for (int i = 0; i < n; i++) {\n // Check temp size\n if (i % k == 0) {\n if (n - i < k) {\n tempSize = n % k;\n } else {\n tempSize = k;\n }\n }\n\n temp[i % k] = tempBigArray[i];\n System.out.println(Arrays.toString(temp));\n\n if (i != 0 && ((i + 1) % k == 0) || (i == (n - 1))) {\n // Sort the array\n hSort.hybridsort(temp, 0, tempSize - 1);\n\n // get names for outputfileTemp\n Path outputTemp = Paths.get(outputFile + fileNUM++ + \".txt\");\n\n // Write to the temp file\n try (BufferedWriter writer = Files.newBufferedWriter(outputTemp, StandardCharsets.UTF_8);) {\n for (int j = 0; j < tempSize; j++) {\n writer.write(temp[j] + \" \");\n } // end of for\n } // close the BufferedWriter\n } // end of if\n } // end of for\n\n // Add all values in the first file to the main array\n try (Scanner scan = new Scanner(Paths.get(outputFile + 1 + \".txt\"));) {\n int index = 0;\n\n while (scan.hasNextDouble()) {\n double value = scan.nextDouble();\n mainArray[index++] = value;\n } // end of while\n } // close first file\n\n // Merge all the files\n mainMergeSort(amtFiles, outputFile, isOdd);\n }", "public void populateList(){\n\t\tfor (int i = 0; i < 10; i++){\n\t\t\tscoreList.add(-1);\t\t\t\n\t\t\tnameList.add(\"\");\n\t\t}\n\t\tint i=0; \n\t\ttry {\n\t\t\tScanner results = new Scanner(new File(\"results.txt\"));\n\t\t\twhile (results.hasNext()){\n\t\t\t\tnameList.set(i, results.next());\n\t\t\t\tscoreList.set(i, results.nextInt());\n\t\t\t\ti++;\n\t\t\t}\n\t\t} catch (FileNotFoundException e1){\n\t\t\te1.printStackTrace();\n\t\t}\n\t}", "protected static void compareIn(Path p, HashMap<String, Double> myMap, FileSystem fs, Double tolerance) throws IOException {\n\t FSDataInputStream inputStream = fs.open(p);\n\t BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));\n\t // Read in all the lines and push into hash-map\n\t String line;\n\t while((line = br.readLine()) != null) {\n\t \tString[] sectors = line.trim().split(\"\\t\");\n\t \tif (sectors.length != 2)\n\t \t\tthrow new Error(\"Parsing of file does not match specified input -- readIn\");\n\t \tif (myMap.containsKey(sectors[0]) == false)\n\t \t\tthrow new Error(\"Node doesn't exist that is said ot exist: \" + sectors[0]);\n\t \t\n\t \tif (Math.abs(myMap.get(sectors[0]).compareTo(Double.parseDouble(sectors[1]))) < tolerance) {\n\t \t\tmyMap.remove(sectors[0]);\n\t \t} else {\n\t \t\tthrow new Error(\"One of the keys has two very different values: {\" + sectors[0] + \"| val1: \" + myMap.get(sectors[0]) + \", val2: \" + sectors[1]);\n\t \t}\n\t }\n\t br.close();\n\t fs.close();\n\t}", "public void readCategoryFile(File file) {\n\ttry (BufferedReader br = new BufferedReader(new FileReader(file)))\n\t{\n\t\tString sCurrentLine;\n\t\tString [] lineElements;\n\t\t\n\t\tint row = 0;\n\t\twhile ((sCurrentLine = br.readLine()) != null) {\n\t\t\t//System.out.println(sCurrentLine);\n\t\t\t\n\t\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\t\t//System.out.println(lineElements.length);\n\t\t\tfor (int column = 0; column < lineElements.length; column++) {\t\t\n\t\t\t\t//System.out.println(column);\n\t\t\t\tint category = Integer.parseInt(lineElements[column]);\n\t\t\t\t//System.out.println(vertices.size());\n\t\t\t\tPOI v1 = vertices.get(row);\n\t\t\t\tPOI v2 = vertices.get(column);\n\t\t\t\t\n\t\t\t\tArc arc = getArc(v1, v2);\n\t\t\t\tif (!distMtx) {\n\t\t\t\t\tdouble distance = v1.distanceTo(v2);\n\t\t\t\t\tif (data == Dataset.VERBEECK) {\n\t\t\t\t\t\tdistance = distance / 5.0;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tdistance = distance / 10.0;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tarc.setLength(distance);\n\t\t\t\t}\n\t\t\t\tarc.setCategory(category);\n\t\t\t\tif (distConstraint) {\n\t\t\t\t\tarc.setSpeedTable(allOneSpeedTable);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tarc.setSpeedTable(speedTables.get(category));\n\t\t\t\t}\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\trow ++;\n\t\t}\n\t} catch (IOException e) {\n\t\te.printStackTrace();\n\t}\n}", "public static void main(String[] args) throws Exception{\n String path = \"src\\\\main\\\\resources\\\\empData.csv\"; \r\n\r\n //Check file path is correct - throws file exception and terminates the program if not - otherwise continues with program\r\n CheckFile checkFile = new CheckFile();\r\n try{\r\n \r\n checkFile.CheckFileDetails(path);\r\n \r\n }catch(FileException fe){\r\n System.out.println(fe.getMessage());\r\n System.exit(0);\r\n }\r\n \r\n \r\n //create list of employees \r\n //invoke readFromFile and pass in the path of the file\r\n // Read from csv file & create list of employees\r\n List<Employee> arrList = new ArrayList<Employee>();\r\n\r\n ReadFromFile rFF = new ReadFromFile(); \r\n rFF.FileReaderNew(path);\r\n arrList = rFF.getArrList();\r\n\r\n /*---------------------------------------------------------------------------------------------------------------------------------------\r\n * \t\t\t\t\t\t\tPRINT UNSORTED ARRAYLIST OF EMPLOYEES\r\n -------------------------------------------------------------------------------------------------------------------------------------*/\r\n\r\n DisplayEmployees ds = new DisplayEmployees();\r\n System.out.println(\"UNSORTED EMPLOYEE LIST\");\r\n ds.displayEmployees(arrList);\r\n System.out.println(\" -------------------------------------------------------------- \");\r\n\r\n /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n * \t\t\t\t\t\t\t\t\tSORTING TESTING\r\n ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/\t\t\r\n \r\n\r\n \r\n SortAlgorithmQ1 sorting = new SortAlgorithmQ1();\r\n List<Employee> sortedArray = new ArrayList<Employee>(arrList);\r\n\r\n long startTime = System.nanoTime();\r\n \r\n sortedArray = sorting.mergeSort(sortedArray);\r\n \r\n long endTime = System.nanoTime();\r\n long elapsedTime = (endTime-startTime);\r\n\r\n int counter2 = 0;\r\n System.out.println(\"SORTED EMPLOYEE LIST\");\r\n for(Employee e : sortedArray) {\r\n System.out.println(counter2 + \" \" + \"EmpNo: \" + e.getEmpNo()+\" \"+ \"BirthDate: \" + e.getBirthDate()+ \" \"\r\n +\"First Name: \" + e.getfName()+ \" \" +\"Last Name: \" +e.getlName()+\" \" +\"Gender: \" +e.getGender()+\" \" + \"Hire Date: \" +e.getHireDate());\r\n counter2++; //for testing - to delete\r\n }\r\n System.out.println(\"ELAPSED TIME: \" + elapsedTime);\r\n System.out.println(\" -------------------------------------------------------------- \");\r\n /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n * \t\t\t\t\t\t\tSEARCHING TESTING\r\n ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/\t\t\t\r\n \r\n //Must call sort algorithm before using this searching method.\r\n \r\n SearchingAlgorithmQ3 search = new SearchingAlgorithmQ3();\r\n \r\n \r\n //ENTER FIRST NAME TO SEARCH FOR IT:\r\n String searchKey = \"zVoNkO\";\r\n\r\n long startTime2 = System.nanoTime();\r\n //call binarySearch method and pass in the sortedArray and search key and upperbound.\r\n search.binarySearch2(sortedArray, searchKey, sortedArray.size()-1);\r\n\r\n long endTime2 = System.nanoTime();\r\n long elapsedTime2 = (endTime2-startTime2);\r\n \r\n // get start index and end index of the search key\r\n int endIndex = search.getEndIndex();\r\n int startIndex = search.getStartIndex();\r\n \r\n //if start index is not equal to -1 and end index is not = to -1 -- employee record has been found\r\n //if equal to minus 1 - employee record has not been found.\r\n //traverse through the arraylist while start Index is less than or equal to end index\r\n //print out employee record located between start index and end index.\r\n if(startIndex != -1 && endIndex != -1) {\r\n System.out.println(\"Employee with first name \" + searchKey + \" \" + \"found : \");\r\n System.out.println(\"\");\r\n for(int i=0; i+startIndex <= endIndex; i++) {\r\n if(i>0)\r\n System.out.println(\"\");\r\n System.out.print(\"@ Index : \"); \r\n System.out.println(i+startIndex);\r\n System.out.println(sortedArray.get(i+startIndex));\r\n }\r\n }else {\r\n System.out.println(searchKey + \" is Not an employee!\");\r\n }\r\n System.out.println(\" \");\r\n System.out.println(\"ELAPSED TIME: \" + elapsedTime2);\r\n System.out.println(\" -------------------------------------------------------------- \");\r\n /*---------------------------------------------------------------------------------------------------------------------------------------\r\n * CREATE NEW EMPLOYEE, ADD TO UNSORTED ARRAYLIST & WRITE TO CSV FILE\r\n -------------------------------------------------------------------------------------------------------------------------------------*/\t\t\r\n int addEmps = 1;\r\n\r\n String birthDate = null; \r\n String fName, lName, gender, hireDate;\r\n\r\n try {\r\n //while addEmps = 1 continue adding employees. When user inputs another number other than 1 the program will terminate\r\n while (addEmps == 1) {\r\n Scanner input = new Scanner(System.in);\r\n Employee newEmp = new Employee();\r\n\r\n //automatically adds employee number to UNSORTED arraylist\r\n int lastEmpNo = 0;\r\n for(Employee e : arrList) {\r\n lastEmpNo = e.getEmpNo();\r\n }\r\n int nextEmpNo = lastEmpNo + 1;\r\n int empNo = nextEmpNo;\r\n newEmp.setEmpNo(empNo);\r\n\r\n int dateValidate = -1;\r\n \r\n //Accept date of birth from user. \r\n //Validate input (setter in Employee class)\r\n do {\r\n\r\n System.out.println(\"Enter date of birth in format dd/mm/yyyy: \");\r\n if(input.hasNextLine()) {\r\n birthDate = input.nextLine();\r\n newEmp.setBirthDate(birthDate);\r\n //update dateValidate variable from Employee class using getter \r\n dateValidate = newEmp.getValidate();\r\n if(dateValidate == 1) {\r\n System.out.println(\"Error:\");\r\n System.out.println(\"A birth date must be supplied. Please enter a valid birth date\");\r\n }else if(dateValidate == 2) {\r\n System.out.println(\"Invalid date format:\");\r\n System.out.println(\"Please enter a date in the following format - dd/mm/yyyy --- dates in mm/dd/yyyy not accepted\");\r\n }else if(dateValidate == 3) {\r\n System.out.println(\"Invalid:\");\r\n System.out.println(\"Employee's age cannot be under 18. Please enter a correct birth date to continue: \");\t\t\t\t\t\t\t\t\r\n } else if(dateValidate == 4) {\r\n System.out.println(\"Invalid:\");\r\n System.out.println(\"Employee is over retirement age. Please enter a correct birth date to continue: \");\r\n } else if (dateValidate == 0) {\r\n break;\r\n }\r\n }\r\n }while (dateValidate != -1 || dateValidate != 0); //continue asking for input while date variable is not equal to -1 or 0\r\n \r\n //Accept first name from user\r\n //Validate input (setter in Employee class)\r\n int nameValid = -1;\r\n \r\n do {\r\n try {\r\n System.out.println(\"Enter First Name: \");\r\n fName = input.nextLine();\r\n newEmp.setfName(fName);\r\n nameValid = newEmp.getNameValid();\r\n //catch input exception\r\n }catch(InputException ee) {\r\n System.out.println(ee.getMessage());\r\n //catch SQL injection exception\r\n }catch(SQLInjectionException sql){\r\n System.out.println(sql.getMessage());\r\n System.exit(0);\r\n }\r\n }while(nameValid != 0); //continue asking for input while nameValid is not = 0.\r\n\r\n //Accept surname from user\r\n //Validate input (setter in Employee class)\r\n System.out.println(\"Enter Surname: \");\r\n lName = input.nextLine();\r\n newEmp.setlName(lName);\r\n \r\n //Accept gender from user\r\n //Validate input (setter in Employee class)\r\n System.out.println(\"Is employee M or F? \");\r\n gender = input.nextLine();\r\n newEmp.setGender(gender.toUpperCase());\r\n \r\n //Accept hiredate from user\r\n //Validate input (Setter in Employee class)\r\n int hireValidate = -1;\r\n do {\r\n System.out.println(\"Enter hire date: \");\r\n hireDate = input.nextLine();\r\n newEmp.setHireDate(hireDate);\r\n hireValidate = newEmp.getHireValidate();\r\n if(hireValidate == 1) {\r\n System.out.println(\"Error : \");\r\n System.out.println(\"Hire date cannot be left blank. Please enter a hire date : \");\r\n }else if(hireValidate == 2) {\r\n System.out.println(\"Error this is not a valid date: \");\r\n System.out.println(\"Please enter a date in the following format - dd/mm/yyyy --- dates in mm/dd/yyyy not accepted\");\r\n }else {\r\n\r\n }\r\n\r\n }while(hireValidate != 0);\r\n \r\n //create a temp list of new employees to be added to the csv file. \r\n //invoke writeToFile method in AddNewEmployee class and pass in the temp list\r\n List<Employee> tempArr = new ArrayList<Employee>();\r\n tempArr.add(newEmp);\r\n AddNewEmployee addNewEmployee = new AddNewEmployee();\r\n addNewEmployee.setPath(path);\r\n addNewEmployee.writeToFile(tempArr);\r\n \r\n //add the new employee to the list that was created when reading the file earlier in the program\r\n arrList.add(newEmp);\r\n \r\n //check if user wants to add another employee or quit\r\n Scanner in = new Scanner(System.in);\r\n System.out.println(\"Press 0 to finish or 1 to add more employees\");\r\n addEmps = in.nextInt();\r\n }\r\n System.out.println(\" -------------------------------------------------------------- \"); \r\n System.out.println(\"New employees have been added to the system!\");\t\r\n System.out.println(\" -------------------------------------------------------------- \");\r\n //catch any other input exceptions\r\n }catch(InputException ex) {\r\n System.out.println(ex.getMessage());\r\n }\r\n //print to screen updated employee list\r\n\t//ds.displayEmployees(arrList);\t\r\n \r\n }" ]
[ "0.67161965", "0.65382373", "0.626227", "0.62506396", "0.6187152", "0.6148476", "0.6121453", "0.609715", "0.6063729", "0.59647095", "0.589351", "0.5870288", "0.5867338", "0.58461124", "0.58427775", "0.5805457", "0.57936996", "0.5785942", "0.577847", "0.5755041", "0.5752329", "0.5737467", "0.573705", "0.57100564", "0.57067394", "0.56971717", "0.5693737", "0.5663463", "0.5651984", "0.5631356", "0.56307644", "0.5624182", "0.56239194", "0.5618553", "0.56176585", "0.56145424", "0.5609458", "0.5608822", "0.5594232", "0.5591857", "0.55784553", "0.55772126", "0.5576224", "0.55665016", "0.5551619", "0.55428797", "0.55423635", "0.5540513", "0.55402154", "0.5532724", "0.5523494", "0.55225927", "0.5510462", "0.55022", "0.5501023", "0.54850394", "0.54671866", "0.5466254", "0.5453334", "0.5447659", "0.5447233", "0.5436511", "0.54275405", "0.5425608", "0.5423822", "0.5417489", "0.54164004", "0.54070675", "0.54057837", "0.53975654", "0.5367854", "0.53674436", "0.53607845", "0.5354219", "0.53304195", "0.532537", "0.53237957", "0.5323275", "0.5321863", "0.5315117", "0.5306876", "0.5301165", "0.5293997", "0.52938086", "0.5292465", "0.5286387", "0.52862775", "0.52860874", "0.5276192", "0.5271343", "0.5269893", "0.52526826", "0.5252354", "0.5251102", "0.52312654", "0.5227949", "0.5223704", "0.52141213", "0.5212015", "0.5210609", "0.5207213" ]
0.0
-1
/ The highscores.txt file is read line by line it will try to convert the line to an integer and add it to an ArrayList if it fails to convert then it will skip this line
public void readFile(){ try { highscores = new ArrayList<>(); BufferedReader br = new BufferedReader(new FileReader("Highscores.txt")); String line = br.readLine(); while (line != null){ try{ highscores.add(Integer.parseInt(line)); } catch (NumberFormatException e){} line = br.readLine(); } br.close(); } catch (FileNotFoundException e) { System.out.println("No file found"); } catch (IOException e) { e.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private ArrayList<Score> getScoreFromFile() {\n ArrayList<Score> scores = new ArrayList<>();\n\n // Read line by line.\n try (Stream<String> stream = Files.lines(Paths.get(\"src/main/resources/score-file.txt\"))) {\n stream.forEach(s -> {\n String[] line = s.split(\" \");\n Score score = new Score(Integer.parseInt(line[0]), line[1]);\n scores.add(score);\n });\n } catch (IOException e) {\n System.err.println(\"Cannot open the score file : \" + e.getMessage());\n }\n\n return scores;\n }", "public void loadScores() {\n try {\n File f = new File(filePath, highScores);\n if(!f.isFile()){\n createSaveData();\n }\n BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f)));\n\n topScores.clear();\n topName.clear();\n\n String[] scores = reader.readLine().split(\"-\");\n String[] names = reader.readLine().split(\"-\");\n\n for (int i =0; i < scores.length; i++){\n topScores.add(Integer.parseInt(scores[i]));\n topName.add(names[i]);\n }\n reader.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "private ArrayList<Person> getScores() {\n ArrayList<Person> persons = new ArrayList<>(); \n\n try {\n \t//The file is selected and then a reader is created to read the file\n File myObj = new File(\"highscores.txt\");\n Scanner myReader = new Scanner(myObj);\n\n //This constraint checks for a next available line and adds the variable data to this line. Data contains the name and score of the person. \n //The splitter is used to separate the name and score of the person, which is then added to the person Array. Then the reader is closed.\n while (myReader.hasNextLine()) {\n String data = myReader.nextLine();\n int splitterIndex = data.indexOf(\"-\");\n persons.add(new Person(data.substring(0, splitterIndex), parseInt((data.substring(splitterIndex + 1)))));\n }\n myReader.close();\n } catch (FileNotFoundException e) {\n System.out.println(\"An error occurred.\");\n e.printStackTrace();\n }\n return persons;\n }", "private void readScores() {\n final List<Pair<String, Integer>> list = new LinkedList<>();\n try (DataInputStream in = new DataInputStream(new FileInputStream(this.file))) {\n while (true) {\n /* reads the name of the player */\n final String name = in.readUTF();\n /* reads the score of the relative player */\n final Integer score = Integer.valueOf(in.readInt());\n list.add(new Pair<String, Integer>(name, score));\n }\n } catch (final Exception ex) {\n }\n this.sortScores(list);\n /* if the list was modified by the cutting method i need to save it */\n if (this.cutScores(list)) {\n this.toSave = true;\n }\n this.list = Optional.of(list);\n\n }", "public boolean loadHighscores() {\n this.fileName = \"HS\" + this.gameMode + this.difficultyLevel + \".txt\";\n File file = new File(context.getFilesDir(), fileName);\n Scanner input;\n try{\n if(!file.exists()) {\n return false;\n }\n input = new Scanner(file);\n String line;\n highScoreList.clear();\n while(input.hasNextLine()) {\n line = input.nextLine();\n String[] parts = line.split(\"\\\\~\\\\$\\\\~\");\n if(parts.length != 2) {\n //File is corrupt.\n System.out.println (\"File \" + this.fileName + \" is corrupt\");\n return false;\n }\n String name = parts[0];\n int score = Integer.parseInt(parts[1]);\n User user = new User(name, score);\n highScoreList.add(user);\n }\n input.close();\n }catch (IOException ex) {\n System.out.println(ex.toString());\n return false;\n }\n\n return true;\n }", "public void readScoreFromFile(){\n\t\tString line;\n\t\tString[] temp;\n\t\ttry{\n\t\t\tFileReader f = new FileReader(\"conversation_file.txt\");\n\t\t\tBufferedReader b = new BufferedReader(f);\n\t\t\tif((line = b.readLine()) != null){\n\t\t\t\ttemp = line.split(\" \", -1);\n\t\t\t\thighScore = Integer.parseInt(temp[1]);\n\t\t\t\thighScorer = temp[0];\n\t\t\t}\n\t\t} catch (IOException e){\n\t\t\tSystem.out.println(\"File Not Found.\");\n\t\t}\n\t\tSystem.out.println(\"File read, highScore \" + highScore + \" saved.\");\n\t}", "public static void readFile() {\n\t\tbufferedReader = null;\n\t\ttry {\n\t\t\tFileReader fileReader = new FileReader(\"/home/bridgeit/Desktop/number.txt\");\n\t\t\tbufferedReader = new BufferedReader(fileReader);\n\n\t\t\tString line;\n\t\t\twhile ((line = bufferedReader.readLine()) != null) {\n\t\t\t\tString[] strings = line.split(\" \");\n\t\t\t\tfor (String integers : strings) {\n\t\t\t\t\thl.add(Integer.parseInt(integers));\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.out.println(\"File Not Found...\");\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\ttry {\n\t\t\tbufferedReader.close();\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}", "public HighScore() {\n try {\n BufferedReader a = new BufferedReader(new FileReader(\"points.txt\"));\n BufferedReader b = new BufferedReader(new FileReader(\"names.txt\"));\n ArrayList<String> temp = new ArrayList(0);\n temp = createArray(a);\n names = createArray(b);\n a.close();\n b.close();\n for (String x : temp) {\n points.add(Integer.valueOf(x));\n }\n\n\n }catch (IOException e)\n {}\n\n }", "private void readFile() {\r\n\t\tScanner sc = null; \r\n\t\ttry {\r\n\t\t\tsc = new Scanner(inputFile);\t\r\n\t\t\twhile(sc.hasNextLine()){\r\n\t\t\t\tgrade.add(sc.nextLine());\r\n\t } \r\n\t\t}\r\n\t\tcatch (FileNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tfinally {\r\n\t\t\tsc.close();\r\n\t\t}\t\t\r\n\t}", "public void loadScoreFile() {\n try {\n inputStream = new ObjectInputStream(new FileInputStream(HIGHSCORE_FILE));\n scores = (ArrayList<Score>) inputStream.readObject();\n } catch (FileNotFoundException e) {\n } catch (IOException e) {\n } catch (ClassNotFoundException e) {\n } finally {\n try {\n if (outputStream != null) {\n outputStream.flush();\n outputStream.close();\n }\n } catch (IOException e) {\n }\n }\n }", "public void readScoresFromFile(File f) throws IOException, FileNotFoundException{\r\n\t\tBufferedReader br = null;\r\n\t\ttry{\r\n\t\t\tFileReader fr = new FileReader(f);\r\n\t\t\tbr = new BufferedReader(fr);\r\n\t\t\t\r\n\t\t\tString str = br.readLine();\r\n\t\t\t\r\n\t\t\tfor (int count = 0; count < scores.length; count++){\r\n\t\t\t\tscores[9-count] = new HighScore(str, SEPARATOR);\r\n\t\t\t\tstr = br.readLine();\r\n\t\t\t}\r\n\t\t} catch (Exception ex){\r\n\t\t\tSystem.err.println(\"Trouble with file: \"+ex.getMessage());\r\n\t\t} finally {\r\n\t\t\ttry{\r\n\t\t\t\tif (br != null){\r\n\t\t\t\t\tbr.close();\r\n\t\t\t\t}\r\n\t\t\t} catch (Exception ex1){\r\n\t\t\t\tex1.printStackTrace();\r\n\t\t\t\tSystem.exit(-1);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void loadHighScore() {\n this.myHighScoreInt = 0;\n \n final String userHomeFolder = System.getProperty(USER_HOME); \n final Path higheScoreFilePath = Paths.get(userHomeFolder, HIGH_SCORE_FILE);\n \n final File f = new File(higheScoreFilePath.toString());\n if (f.exists() && !f.isDirectory()) { \n FileReader in = null;\n BufferedReader br = null;\n try {\n in = new FileReader(higheScoreFilePath.toString());\n br = new BufferedReader(in);\n String scoreAsString = br.readLine();\n if (scoreAsString != null) {\n scoreAsString = scoreAsString.trim();\n this.myHighScoreInt = Integer.parseInt(scoreAsString);\n }\n } catch (final FileNotFoundException e) {\n emptyFunc();\n } catch (final IOException e) {\n emptyFunc();\n } \n \n try {\n if (in != null) {\n in.close();\n }\n if (br != null) {\n br.close();\n }\n } catch (final IOException e) { \n emptyFunc();\n } \n } else {\n try {\n f.createNewFile();\n } catch (final IOException e) {\n return;\n }\n }\n }", "public static void updateScores(BattleGrid player) {\n\t String fileName = SCORE_FILE_NAME;\n\t ArrayList<String> listOfScores = new ArrayList<String>(); //Also contains player names\n\t \n\t //First read old content of file and place in string ArrayList\n\t try {\n\t FileReader readerStream = new FileReader(fileName);\n\t BufferedReader bufferedReader = new BufferedReader(readerStream);\n\t \n\t //Read First Line\n\t String readLine = bufferedReader.readLine();\n\t \n\t while(readLine != null) {\n\t listOfScores.add(readLine);\n\t readLine = bufferedReader.readLine();\n\t }\n\t \n\t readerStream.close();\n\t }\n\t catch (IOException e) {\n\t //Situation where file was not able to be read, in which case we ignore assuming we create a new file.\n\t System.out.println(\"Failed to create stream for reading scores. May be ok if its the first time we set scores to this file.\");\n\t \n\t }\n\t \n\t //Determine location of new player (if same score then first in has higher ranking)\n\t int playerScore = player.getPlayerScore();\n\t int storedPlayerScore;\n\t ArrayList<String> lineFields = new ArrayList<String>();\n\t \n\t //Run code only if there are scores previously in file and the name of the user is not null\n\t if (!listOfScores.isEmpty() && (player.name != null)) {\n\t for (int index = 0; index < listOfScores.size(); index++) {\n\t //Retrieve String array of fields in line\n\t lineFields = (returnFieldsInLine(listOfScores.get(index)));\n\t \n\t //Convert score from string to int (2nd element)\n\t storedPlayerScore = Integer.parseInt(lineFields.get(1));\n\t lineFields.clear(); //Clear out for next set\n\t \n\t //Compare with new score to be added and inserts, shifting old element right\n\t if (storedPlayerScore < playerScore) {\t \n\t listOfScores.add(index, player.name + DELIMITER + playerScore);\t \n\t\t break; //Once we found the correct location we end the loop\n\t } \n\t }\n\t }\n\t //When it's the first code to be entered\n\t else\n\t listOfScores.add(player.name + DELIMITER + playerScore);\n\t \n\t //Delete old content from file and add scores again with new one.\n\t try {\n\t FileWriter writerStream = new FileWriter(fileName);\n\t PrintWriter fileWriter = new PrintWriter(writerStream);\n\t \n\t for (String index : listOfScores) {\n\t fileWriter.println(index);\n\t }\n\t \n\t writerStream.close(); //Resource Leaks are Bad! :(\n\t }\n\t catch (IOException e) {\n\t System.out.println(\"Failed to create stream for writing scores.\");\n\t } \n\t \n\t }", "private void readFile() {\n\t\tint newPlayerScore = level.animal.getPoints();\n\t\t\n\t\tlevel.worDim = 30;\n\t\tlevel.wordShift = 25;\n\t\tlevel.digDim = 30;\n\t\tlevel.digShift = 25;\n\t\t\n\t\tfor( int y =0; y<10; y++ ) { //display placeholder numbers\n\t\t\tfor( int x=0; x<4; x++ ) {\n\t\t\t\tbackground.add(new Digit( 0, 30, 470 - (25*x), 200 + (35*y) ) );\n\t\t\t}\n\t\t}\n\t\t\n\t\ttry { //display highscores from highscores.txt\n\t\t\tScanner fileReader = new Scanner(new File( System.getProperty(\"user.dir\") + \"\\\\highscores.txt\"));\n\t\t\t\n\t\t\tint loopCount = 0;\n\t\t\twhile( loopCount < 10 ) {\n\t\t\t\tString playerName = fileReader.next() ;\n\t\t\t\tString playerScore = fileReader.next() ;\n\t\t\t\tint score=Integer.parseInt(playerScore);\n\t\t\t\t\n\t\t\t\tif( newPlayerScore >= score && newHighScore == false ) {\n\t\t\t\t\tstopAt = loopCount;\n\t\t\t\t\tnewHighScore = true;\n\t\t\t\t\tlevel.wordY = 200 + (35*loopCount);\n\t\t\t\t\t\n\t\t\t\t\tpointer = new Icon(\"pointer.png\", 30, 75, 200 + (35*loopCount) );// add pointer indicator\n\t\t\t\t\tbackground.add( pointer ); \n\t\t\t\t\tlevel.setNumber(newPlayerScore, 470, 200 + (35*loopCount));\n\t\t\t\t\tloopCount += 1;\n\t\t\t\t\tlevel.setWord(playerName, 10, 100, 200 + (35*loopCount));\n\t\t\t\t\tlevel.setNumber(score, 470, 200 + (35*loopCount));\n\t\t\t\t\tloopCount += 1;\n\t\t\t\t}else {\n\t\t\t\t\tlevel.setWord(playerName, 10, 100, 200 + (35*loopCount));\n\t\t\t\t\tlevel.setNumber(score, 470, 200 + (35*loopCount));\n\t\t\t\t\tloopCount += 1;\n\t\t\t\t}\n\t\t\t}//end while\n\t\t\tfileReader.close();\n\t\t\tif( newHighScore ) {\n\t\t\t\tnewHighScoreAlert();\n\t\t\t}else {\n\t\t\t\tgameOverAlert();\n\t\t\t}\n } catch (Exception e) {\n \tSystem.out.print(\"ERROR: Line 168: Unable to read file\");\n //e.printStackTrace();\n }\n\t}", "public void updateScores() {\n ArrayList<String> temp = new ArrayList<>();\n File f = new File(Const.SCORE_FILE);\n if (!f.exists())\n try {\n f.createNewFile();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n FileReader reader = null;\n try {\n reader = new FileReader(Const.SCORE_FILE);\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n BufferedReader bufferedReader = new BufferedReader(reader);\n String line = null;\n\n try {\n while ((line = bufferedReader.readLine()) != null) {\n temp.add(line);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n String[][] res = new String[temp.size()][];\n\n for (int i = 0; i < temp.size() ; i++) {\n res[i] = temp.get(i).split(\":\");\n }\n try {\n bufferedReader.close();\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n scores = res;\n }", "public void populateList(){\n\t\tfor (int i = 0; i < 10; i++){\n\t\t\tscoreList.add(-1);\t\t\t\n\t\t\tnameList.add(\"\");\n\t\t}\n\t\tint i=0; \n\t\ttry {\n\t\t\tScanner results = new Scanner(new File(\"results.txt\"));\n\t\t\twhile (results.hasNext()){\n\t\t\t\tnameList.set(i, results.next());\n\t\t\t\tscoreList.set(i, results.nextInt());\n\t\t\t\ti++;\n\t\t\t}\n\t\t} catch (FileNotFoundException e1){\n\t\t\te1.printStackTrace();\n\t\t}\n\t}", "public static ArrayList<String> getAllScores() throws FileNotFoundException, IOException {\n File file = new File(SCORE_FILE_NAME);\n FileInputStream fis = new FileInputStream(file);\n BufferedInputStream bis = new BufferedInputStream(fis);\n BufferedReader reader = new BufferedReader(new InputStreamReader(bis));\n \n ArrayList<String> listOfScores = new ArrayList<>();\n boolean keepReading = true;\n while (keepReading) {\n String line = reader.readLine();\n if (line == null)\n keepReading = false;\n else\n listOfScores.add(line); \n }\n\n fis.close();\n bis.close();\n reader.close();\n \n return listOfScores;\n }", "private ArrayList<Integer> fileReader() {\n ArrayList<Integer> data = new ArrayList<>();\n try {\n Scanner scanner = new Scanner(new File(\"andmed.txt\"));\n while (scanner.hasNextLine()) {\n data.add(Integer.valueOf(scanner.nextLine()));\n }\n scanner.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n return data;\n }", "private static void readFileIntoArray (String inputFileName) {\n Path path = Paths.get(inputFileName);\n array = new int[countLines(inputFileName)];\n try {\n Scanner sc = new Scanner(path);\n int i = 0;\n while (sc.hasNextLine()) {\n array[i] = Integer.parseInt(sc.nextLine());\n i++;\n }\n sc.close();\n //sort the array\n MergeSort.mergeSort(array);\n }\n catch(FileNotFoundException e) {\n System.out.println(\"File Error\");\n e.printStackTrace();\n }\n catch(IOException e) {\n System.out.println(\"File Error\");\n e.printStackTrace();\n }\n }", "private static ArrayList<ArrayList<Integer>> populateListOfInputs() {\n\t\t\n\t\tArrayList<ArrayList<Integer>> listOflist = new ArrayList<ArrayList<Integer>>();\n\t\ttry {\n\t\t\tFileReader fr = new FileReader(filePath);\n\t\t\tBufferedReader br = new BufferedReader(fr);\t\t\n\t\t\t\n\t\t\tString line;\n\t\t\twhile ((line = br.readLine()) != null) {\n\t\t\t\t// Remove all spaces, '[' and ']'\n\t\t\t\tString numbers = line.replace(\" \", \"\");\n\t\t\t\tnumbers = numbers.replace(\"[\", \"\");\n\t\t\t\tnumbers = numbers.replace(\"]\", \"\");\n\t\t\t\t\n\t\t\t\tif(line.equals(\"\")) {\n\t\t\t\t\t//if empty line leave it and continue the loop\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\t\t\n\t\t\t\tString[] individualnums = numbers.split(\",\");\n\t\t\t\tfor (int i = 0; i < individualnums.length; i++) {\t\t\t\t\t\n\t\t\t\t\tlist.add(Integer.parseInt(individualnums[i]));\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tlistOflist.add(list);\t\t\t\t\n\t\t\t}\t\t\n\t\t\t\n\t\t\tbr.close();\n\t\t\tfr.close();\n\t\t}\n\t\tcatch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn listOflist;\n\t}", "public void getscores() {\n\t\tInputStream in = null;\n\t\t//String externalStoragePath= Environment.getExternalStorageDirectory()\n // .getAbsolutePath() + File.separator;\n\t\t\n try {\n \tAssetManager assetManager = this.getAssets();\n in = assetManager.open(\"score.txt\");\n \tSystem.out.println(\"getting score\");\n //in = new BufferedReader(new InputStreamReader(new FileInputStream(externalStoragePath + \"score.txt\")));\n \n \tGlobalVariables.topScore = Integer.parseInt(new BufferedReader(new InputStreamReader(in)).readLine());\n System.out.println(\"topscore:\"+GlobalVariables.topScore);\n \n\n } catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}catch (NumberFormatException e) {\n // :/ It's ok, defaults save our day\n \tSystem.out.println(\"numberformatexception score\");\n } finally {\n try {\n if (in != null)\n in.close();\n } catch (IOException e) {\n }\n }\n\t}", "public void loadDataFromFile(String name) throws FileNotFoundException {\n\t\tFileReader reader = new FileReader(name);\n\t\tScanner in = new Scanner(reader);\n\t\twhile(in.hasNextLine()) {\n\t\t\tString readName = \"\";\n\t\t\tString readScore = \"\";\n\t\t\tint intScore = 0;\n\t\t\treadName = in.nextLine();\n\t\t\treadScore = in.nextLine();\n\t\t\ttry {\n\t\t\tintScore = Integer.parseInt(readScore);\n\t\t\t}\n\t\t\tcatch(NumberFormatException e){\n\t\t\t\tSystem.out.println(\"Incorrect format for \" + readName + \" not a valid score: \" + readScore);\n\t\t\t\tSystem.out.println();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tstudents.add(new Student(readName,intScore));\n\t\t}\n\t}", "private void readItems() {\n // open file\n File file = getFilesDir();\n File todoFile = new File(file, \"scores.txt\");\n // try to find items to add\n try {\n items = new ArrayList<>(FileUtils.readLines(todoFile));\n } catch (IOException e) {\n items = new ArrayList<>();\n }\n }", "static int [] readFile() throws IOException {\n\n // Scanner used to get name of file from user\n Scanner in = new Scanner(System.in);\n System.out.println(\"Please enter the name of your file: \");\n String name = in.nextLine();\n\n File file = new File(name); \n \n // Scanner used to read file\n Scanner inputFile = new Scanner(file); \n // reads first line of file for length of array\n int x = inputFile.nextInt();\n\n //Creates array \n int [] scores = new int[x]; \n\n for (int i=0; i<x; i++) {\n int value = inputFile.nextInt();\n scores[i] = value;\n }\n inputFile.close();\n in.close();\n return scores; \n }", "public static int[] readMysteriousNumbers(String filename) throws Exception {\n File file = new File(filename);\n Scanner counter = new Scanner(file);\n int numLines = 0;\n while(counter.hasNextLine()){\n counter.nextLine();\n numLines++;\n }\n int[] arr = new int[numLines];\n\n\n\n Scanner reader = new Scanner(file);\n int index = 0;\n while(reader.hasNextLine()){\n arr[index] = Integer.parseInt(reader.nextLine());\n index++;\n }\n\n\n\n\n return arr;\n /*\n List<Integer> nums = new ArrayList<>();\n while (scanner.hasNextInt()) {\n nums.add(scanner.nextInt());\n }\n int[] ret = new int[nums.size()];\n for(int i = 0;i < ret.length;i++) {\n ret[i] = nums.get(i);\n }\n return ret*/\n }", "public static int readScore() {\n try {\n Scanner diskScanner = new Scanner(new File(\"input.txt\"));\n while (diskScanner.hasNextLine()) {\n System.out.println(diskScanner.nextLine());\n }\n diskScanner.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n return 0;\n }", "public static void readFile(String myFile, List <Integer> myList) throws FileNotFoundException{\n \t \n Scanner fileScanner = new Scanner(new File(myFile)); // Reads in from filePath.\n \n while (fileScanner.hasNextInt()){ // Loops while there is still a next integer in the list.\n \t myList.add(fileScanner.nextInt()); // Adds all integers to RandomIntegers arraylist.\n }\n \n System.out.println(\"\\nFile read in successfully.\"); \n }", "public HighScores(){\r\n\t\tHighScores objRead = null;\r\n\t\t\r\n\t\ttry {\r\n\t\t\t// lendo o arquivo de melhores pontuacoes\r\n\t\t\tFileInputStream fis = new FileInputStream(highScoresFilename);\r\n\t\t\tObjectInputStream ois = new ObjectInputStream(fis);\r\n\t\t\tobjRead = (HighScores) ois.readObject();\r\n\t\t\tois.close();\r\n\t\t} catch (Exception e){\r\n\t\t\t// caso o arquivo nao possa ser lido\r\n\t\t\tobjRead = null;\r\n\t\t} finally {\r\n\t\t\tif (objRead != null){\r\n\t\t\t\tthis.scoreNumber = objRead.scoreNumber;\r\n\t\t\t\tthis.highScores = objRead.highScores;\r\n\t\t\t} else {\r\n\t\t\t\tthis.highScores = new Score[scoreNumber];\r\n\t\t\t\tfor (int i = 0; i < scoreNumber; i++)\r\n\t\t\t\t\thighScores[i] = new Score(\"\", Integer.MIN_VALUE);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void fileReadGameHistory(String filename)\n {\n \t//ArrayList<GameObject> gameObject = new ArrayList<>();\n\t\tFileReader file = null;\n\t\ttry {\n\t\t\tfile = new FileReader(filename);\n\t\t} catch (FileNotFoundException e) {\n\n\t\t\te.printStackTrace();\n\t\t}\n\t\tSystem.out.println(filename);\n\t\tBufferedReader br = new BufferedReader(file);\n\t\tString s = \"\";\n\t\ttry\n\t\t{\n\t\t\twhile((s = br.readLine()) != null )\n\t\t\t{\n\t\t\t\tString[] prop1 = s.split(\"#\");\n\t\t\t\tSystem.out.println(prop1[0] + \" fgdfsgfds \" + prop1[1]);\n\t\t\t\tString indexOfList = prop1[0];\n\t\t\t\tString[] prop2 = prop1[1].split(\",\");\n\t\t\t\tString[] prop3;\n\t\t\t\tString[] prop4 = indexOfList.split(\";\");\n\t\t\t\t//gameObject.add(new GameObject(indexOfList));\n\t\t\t\tcount = count +1;\n\t\t\t\texistCount = existCount + 1;\n\t\t\t\tif (indexOfList.charAt(0) == 's')//when this line is data of a swimming game\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(prop4[0]);\n\t\t\t\t\tgames.add(new Swimming(prop4[1],\"Swimming\",prop4[0]));\n\t\t\t\t\tfor(int i = 0; i < Array.getLength(prop2); i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tprop3 = prop2[i].split(\":\");\n\t\t\t\t\t\tgames.get(count - 1).addParticipant(prop3[0], Integer.parseInt(prop3[1]), 0);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setId(prop3[0]);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setRe(Integer.parseInt(prop3[1]));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (indexOfList.charAt(0) == 'c')//when this line is data of a cycling game\n\t\t\t\t{\n\t\t\t\t\tgames.add(new Cycling(prop4[1],\"Cycling\",prop4[0]));\n\t\t\t\t\tfor(int i = 0; i < Array.getLength(prop2); i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tprop3 = prop2[i].split(\":\");\n\t\t\t\t\t\tgames.get(count - 1).addParticipant(prop3[0], Integer.parseInt(prop3[1]), 0);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setId(prop3[0]);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setRe(Integer.parseInt(prop3[1]));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (indexOfList.charAt(0) == 'r')//when this line is data of a running game\n\t\t\t\t{\n\t\t\t\t\tgames.add(new Running(prop4[1],\"Running\",prop4[0]));\n\t\t\t\t\tfor(int i = 0; i < Array.getLength(prop2); i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tprop3 = prop2[i].split(\":\");\n\t\t\t\t\t\tgames.get(count - 1).addParticipant(prop3[0], Integer.parseInt(prop3[1]), 0);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setId(prop3[0]);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setRe(Integer.parseInt(prop3[1]));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}catch (NumberFormatException | IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n }", "private static void calculateLeaderboardScores (Level level) {\r\n\r\n ArrayList<Integer> userScores = new ArrayList<>();\r\n ArrayList<String> userNames = new ArrayList<>();\r\n\r\n File path = new File(\"Users/\");\r\n\r\n File[] files = path.listFiles();\r\n assert files != null;\r\n\r\n for (File file : files) {\r\n File scoresFile = new File(file + \"/scores.txt\");\r\n\r\n userNames.add(file.getPath().substring(6));\r\n userScores.add(returnLevelScore(level, scoresFile));\r\n }\r\n\r\n leaderboardUsers = userNames;\r\n leaderboardScores = userScores;\r\n }", "private List<Score> readScoreList(JsonReader reader) throws IOException {\n\t\tList<Score> scores = new ArrayList<Score>();\n\t\treader.beginArray();\n\t\twhile (reader.hasNext()) {\n\t\t\tScore score = readScore(reader);\n\t\t\tscores.add(score);\n\t\t}\n\t\treader.endArray();\n\t\treturn scores;\n\t}", "private HashMap<Integer, ScoreList> readRanking() throws Exception {\n\n HashMap<Integer, ScoreList> output = new HashMap<>();\n ScoreList scores = new ScoreList();\n File rankingFile = new File(this.fbInitialRankingFile);\n int prevId = -1;\n\n if(!rankingFile.canRead())\n throw new IllegalArgumentException(\"Can't read \" + this.fbInitialRankingFile);\n\n Scanner scan = new Scanner(rankingFile);\n String line = null;\n do {\n line = scan.nextLine();\n String[] tuple = line.split(\" \");\n int qid = Integer.parseInt(tuple[0]);\n\n // initialize a ScoreList for a new query\n if(qid != prevId) {\n\n if(scores.size() != 0)\n output.put(prevId, scores);\n\n scores = new ScoreList();\n prevId = qid;\n }\n// System.out.println(String.format(\"qid: %d, docid: %d, score: %.11f\", qid, Idx.getInternalDocid(tuple[2]), Double.parseDouble(tuple[4])));\n scores.add(Idx.getInternalDocid(tuple[2]), Double.parseDouble(tuple[4]));\n } while(scan.hasNext());\n\n scan.close();\n output.put(prevId, scores);\n return output;\n }", "private static int readScore() {\n try {\n fis = activity.openFileInput(scoreFileName);\n BufferedReader br = new BufferedReader(new InputStreamReader(fis));\n String readLine = br.readLine();\n fis.close();\n br.close();\n Log.v(\"Setting score to: \", readLine);\n return Integer.parseInt(readLine);\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return 0;\n }", "public HighScore[] getHighScores()\n\t{\n\t\tif (!new File(\"HighScores.dat\").exists())\n\t\t\tinitializeFile();\n\t\ttry \n\t\t{\n\t\t\tObjectInputStream o=new ObjectInputStream(new FileInputStream(\"HighScores.dat\"));\n\t\t\tHighScore[] h=(HighScore[]) o.readObject();\n\t\t\treturn h;\n\t\t} catch (IOException e) {e.printStackTrace();} \n\t\tcatch (ClassNotFoundException e) {e.printStackTrace();}\n\t\treturn null;\n\t}", "public List<Grade> importGrade(String filename) throws FileNotFoundException {\n List<Grade> grades = new ArrayList<>();\n FileReader fileReader = new FileReader(DATA_PATH + filename);\n Scanner scanner = new Scanner(fileReader);\n //skip first line\n String firstLine = scanner.nextLine();\n Log.i(\"first line: \" + firstLine);\n\n while (scanner.hasNextLine()) {\n String[] s = scanner.nextLine().split(\",\");\n String degree = s[0];\n String knowledge = s[1];\n String skill = s[2];\n Grade grade = new Grade(degree, knowledge, skill);\n grades.add(grade);\n }\n\n scanner.close();\n return grades;\n }", "public static List<List<Integer>> convertMMLVtoInt(String mmlvFile) {\n\t\tFile mmlv = new File(mmlvFile);\n//\t\tString oldString = \"Hello my name is kec\";\n//\t\tString newString = oldString.replace(\"k\", \"d\").trim();\n//\t\tSystem.out.println(newString);\n\t\tHashSet<Point> activatedScreen = new HashSet<>();\n\t\tScanner scan = null;\n\t\ttry {\n\t\t\tscan = new Scanner(mmlv);\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t//int k = scan.nextInt();\n\t\tList<List<Integer>> blockxyIDList = new ArrayList<>();\n\t\twhile(scan.hasNext()) {\n\t\t\tString l = scan.next();\n\t\t\t//IntStream intStr = l.chars();\n\t\t//\tSystem.out.println(l);\n\t\t\tif(!l.startsWith(\"2\")&&!l.startsWith(\"1\")&&!l.startsWith(\"4\")&&!l.startsWith(\"0\")\n\t\t\t\t\t&&!l.startsWith(\"o\")&&!l.startsWith(\"b\")\n\t\t\t\t\t&&!l.startsWith(\"f\")&&!l.startsWith(\"g\")&&!l.startsWith(\"h\")&&\n\t\t\t\t\t!l.startsWith(\"j\")&&!l.startsWith(\"k\")&&!l.startsWith(\"l\")&&!l.startsWith(\"m\")&&\n\t\t\t\t\t!l.startsWith(\"n\")&&!l.startsWith(\"[\")&&!l.startsWith(\"1t\")&&!l.startsWith(\"1a\")\n\t\t\t\t\t) { //shows us all blocks (solid, spike, ladder), enemies, player\n\t\t\t\tboolean isEnemy = false;\n\t\t\t\t\n\t\t\t\t//boolean isBoss = false;\n\t\t\t\tif(l.startsWith(\"i\")) {\n\t\t\t\t\t\n\t\t\t\t\tString k = l;\n\t\t\t\t\tk=k.replace(\"i\", \"i \");\n\t\t\t\t\tk=k.replace(\",\", \" \");\n\t\t\t\t\tk=k.replace(\"\\\"\", \"\");\n\t\t\t\t\tk=k.replace(\"=\", \" \");\n\t\t\t\t\tk=k.replace(\".000000\", \"\");\n\t\t\t\t\tdocumentxyAndAddToListi(activatedScreen, blockxyIDList, k);\n\t\t\t\t}else if(l.startsWith(\"e\")) { //ex,y=177 water, e 45 breakable\n\t\t\t\t\tString k = l;\n\t\t\t\t\tk=k.replace(\"e\", \"e \");\n\t\t\t\t\tk=k.replace(\",\", \" \");\n\t\t\t\t\tk=k.replace(\"\\\"\", \"\");\n\t\t\t\t\tk=k.replace(\"=\", \" \");\n\t\t\t\t\tk=k.replace(\".000000\", \"\");\n\t\t\t\t\tenemyString = k;\n\t\t\t\t\tbossString = k;\n\t\t\t\t\t//System.out.println(k);\n\t\t\t\t\tdocumentxyAndAddToListe(activatedScreen, blockxyIDList, k);\n\n\t\t\t\t\t\n\t\t\t\t} //ex,y=177 water, e 45 breakable\n\t\t\t\telse if(l.startsWith(\"d\")) { //TODO add else/if for MegaMan, bosses, enemies, doors, etc d - 6 = breakable\n\t\t\t\t\tString k = l;\n\t\t\t\t\tk=k.replace(\"d\", \"d \");\n\t\t\t\t\tk=k.replace(\",\", \" \");\n\t\t\t\t\tk=k.replace(\"\\\"\", \"\");\n\t\t\t\t\tk=k.replace(\"=\", \" \");\n\t\t\t\t\tk=k.replace(\".000000\", \"\");\n\t\t\t\t\t//System.out.println(k);\n\t\t\t\t\tif(k.endsWith(\"5\")) {\n\t\t\t\t\t\tisEnemy=true;\n\t\t\t\t\t\tif(enemyString==null) {\n\t\t\t\t\t\t\tenemyString = k;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else if(k.endsWith(\" 8\")) {\n\t\t\t\t\t\t//isBoss=true;\n\t\t\t\t\t//\tif(bossString==null) {\n\t\t\t\t\t\t\t//bossString = k;\n\t\t\t\t\t\t\t//addBoss(activatedScreen, blockxyIDList, bossString);\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\t\n\t\t\t\t\tif(!k.endsWith(\"6\"))\n\t\t\t\t\tdocumentxyAndAddToListi(activatedScreen, blockxyIDList, k);\n\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tif (l.startsWith(\"a\")) {\n\t\t\t\t\tenemyString = null;\n\t\t\t\t}\n\t\t\t\tif(isEnemy&&enemyString!=null) {\n//\t\t\t\t\tSystem.out.println(\"not a failure case\");\n//\t\t\t\t\tMiscUtil.waitForReadStringAndEnterKeyPress();\n\t\t\t\t\tdocumentxyAndAddToListenemy(activatedScreen, blockxyIDList, enemyString);\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tList<List<Integer>> complete = new ArrayList<>();\t\t\n\t\tfor(int y = 0;y<=maxY;y++) {\n\t\t\tList<Integer> row = new ArrayList<>();\n\t\t\tfor(int x = 0;x<=maxX;x++) {\n\t\t\t\trow.add(9);\n\t\t\t}\n\t\t\tcomplete.add(row);\n\t\t}\n\t\tfor(int i = 0;i<blockxyIDList.size();i++) {\n\t\t\tif(blockxyIDList.get(i).get(2)!=4) //if not breakable\n\t\t\tcomplete.get(blockxyIDList.get(i).get(1)).set(blockxyIDList.get(i).get(0), blockxyIDList.get(i).get(2));\n\t\t\telse { //breakable needs 4 blocks to be considered\n\t\t\t\tcomplete.get(blockxyIDList.get(i).get(1)).set(blockxyIDList.get(i).get(0), blockxyIDList.get(i).get(2));\n\t\t\t\tcomplete.get(blockxyIDList.get(i).get(1)-1).set(blockxyIDList.get(i).get(0), blockxyIDList.get(i).get(2));\n\t\t\t\tcomplete.get(blockxyIDList.get(i).get(1)).set(blockxyIDList.get(i).get(0)-1, blockxyIDList.get(i).get(2));\n\t\t\t\tcomplete.get(blockxyIDList.get(i).get(1)-1).set(blockxyIDList.get(i).get(0)-1, blockxyIDList.get(i).get(2));\n\t\t\t}\n\t\t}\n\t\t\n\t\t//System.out.println(activatedScreen.size());\n\t\tfor(Point p : activatedScreen) {\n\t\t\t//System.out.println(\"(\"+p.getX()+\", \"+p.getY()+\")\");\n\t\t\tfor(int x = 0;x<16;x++) {\n\t\t\t\tfor(int y = 0;y<14;y++) {\n\t\t\t\t\tif(p.getY()+y<complete.size()&&p.getX()+x<complete.get(0).size()&&complete.get((int) (p.getY()+y)).get((int) (p.getX()+x))==9) {\n\t\t\t\t\t\tcomplete.get((int) (p.getY()+y)).set((int) (p.getX()+x), 0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn complete;\n\t\t\n\t\t\n\t\t\n\t}", "public void loadScore() {\n for (int i = 0; i < 4; i++) {\n int[] enemyTankNum = CollisionUtility.getEnemyTankNum();\n tankNumList[i] = enemyTankNum[i];\n }\n for (int i = 0; i < 4; i++) {\n tankScoreList[i] = tankNumList[i] * 100 * (i + 1);\n }\n for (Integer score : tankScoreList) {\n totalScore += score;\n }\n for (Integer num : tankNumList) {\n totalTankNum += num;\n }\n }", "public static void highScore(int score){\r\n\t\tString newName =\"\";\r\n\t\tif( score <11){\r\n\t\t\tScanner keyboard = new Scanner(System.in);\r\n\t\t\tSystem.out.println(\"Congratulations! You got a high score!\");\r\n\t\t\tSystem.out.println(\"Enter your Name!\");\r\n\t\t\tnewName = keyboard.nextLine();\r\n\t\t\t\r\n\t\t\ttry{\r\n\t\t\t\tString line = \"\";\r\n\t\t\t\tPrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(\"scoreList.temp\")));\r\n\t\t\t\tBufferedReader in = new BufferedReader(new FileReader(new File(\"scoreList.txt\")));\r\n\t\t\t\tint lineNum = 1;\r\n\t\t\t\tString temp = \"\";\r\n\t\t\t\twhile((line = in.readLine()) != null && lineNum <11){\r\n\t\t\t\t\t//replace the line with the new high score\r\n\t\t\t\t\t if (lineNum == score) {\r\n\t\t\t\t\t\t temp = line;\r\n\t\t\t\t\t\t line = newName;\r\n\t\t\t\t\t\t writer.println(line);\r\n\t\t\t\t\t\t lineNum++;\r\n\t\t\t\t\t\t //push the rest of the names down one\r\n\t\t\t\t\t\t while((line = in.readLine()) != null && lineNum <11){\r\n\t\t\t\t\t\t writer.println(temp);\r\n\t\t\t\t\t\t temp=line;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }else{\r\n\t\t\t\t\t writer.println(line);\r\n\t\t\t\t\t lineNum++;\r\n\t\t\t\t\t }\r\n\t\t\t\t}\r\n\t\t\t\t\twriter.close();\r\n\t\t\t\t\tin.close();\r\n\t\t\t\t\t// ... and finally ...\r\n\t\t\t\t\tFile realName = new File(\"scoreList.txt\");\r\n\t\t\t\t\trealName.delete(); // remove the old file\r\n\t\t\t\t\t// Rename temp file\r\n\t\t\t\t\tnew File(\"scoreList.temp\").renameTo(realName); // Rename temp file\r\n\t\t\t}catch(IOException e){\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\ttry{\r\n\t\t BufferedReader in = new BufferedReader(new FileReader(new File(\"scoreList.txt\")));\r\n\t\t System.out.println(\"The High Scores are: \");\r\n\t\t for(int i = 1; i < 11; i++){\r\n\t\t\t String data = in.readLine();\r\n\t\t\t System.out.println(\"#\" +i+\" \" + data);\r\n\t\t }\r\n\t\t in.close();\r\n\t\t}catch(IOException e){\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public static void writeScoreToFile(ArrayList<String> sArrayList,int score, Context context,String userName){\n\n int[] temp = new int[sArrayList.size()];\n Scanner in = null;\n\n //get the score part from the txt file\n for(int i=0;i<sArrayList.size();i++){\n\n in = new Scanner(sArrayList.get(i)).useDelimiter(\"[^0-9]+\");\n int integer = in.nextInt();\n temp[i]=integer;\n Log.d(\"array temp[]\", \"writeScoreToFile: \"+temp[i]+\"\\n\");\n in.close();\n\n }\n\n int tempVal=0;\n String tempString=null;\n if(score>temp[4]) {\n\n temp[4]=score;\n sArrayList.set(4,String.format(\"%-10s%d\",userName,score));\n for(int j=0;j<sArrayList.size()-1;j++){\n for(int k=1;k<sArrayList.size()-j;k++){\n if(temp[k-1]<temp[k]){\n tempVal = temp[k-1];\n temp[k-1]=temp[k];\n temp[k]=tempVal;\n tempString = sArrayList.get(k-1);\n sArrayList.set(k-1,sArrayList.get(k));\n sArrayList.set(k,tempString);\n }\n }\n }\n\n\n //print arraylist\n for(int i=0;i<sArrayList.size();i++){\n Log.d(\"Arraylistcontent\", \"writeScoreToFile: \"+sArrayList.get(i));\n //Log.d(\"sizeArrayList\", \"writeScoreToFile: \"+sArrayList.size());\n }\n\n\n try {\n OutputStreamWriter outputStreamWriter = new OutputStreamWriter(context.openFileOutput(\"score.txt\", Context.MODE_PRIVATE));\n for(int i=0;i<sArrayList.size();i++){\n //use each line for one score\n outputStreamWriter.write(sArrayList.get(i)+\"\\n\");\n }\n outputStreamWriter.close();\n\n } catch (FileNotFoundException e) {\n Log.e(\"FileNotFoundException\", \"File write failed: \" + e.toString());\n } catch (IOException e) {\n Log.e(\"IOException\", \"File write failed: \" + e.toString());\n }\n Log.d(\"end of the log\", \"writeScoreToFile: \"+\".......\");\n }\n }", "public ArrayList<BigInteger> read(String fileName) {\n String line = null; // current line from text file\n String[] numbers = null;\n try {\n BufferedReader lineReader = new BufferedReader\n ( (fileName == null || fileName.length() <= 0 || fileName.equals(\"-\"))\n ? new InputStreamReader(System.in)\n : new FileReader(fileName)\n );\n while ((line = lineReader.readLine()) != null) { // read and process lines\n if (! line.matches(\"\\\\s*#.*\") && ! line.matches(\"\\\\s*\")) { // no comment line, no empty line\n numbers = line.trim().split(\"\\\\s+\");\n int last = numbers.length - 1;\n /*\n try {\n int index = Integer.parseInt(numbers[0]);\n } catch (Exception exc) {\n }\n */\n sequence.add(new BigInteger(numbers[last]));\n } else {\n // ignore comment line\n }\n } // while ! eof\n lineReader.close();\n } catch (Exception exc) {\n log.error(exc.getMessage(), exc);\n } // try\n return sequence;\n }", "private static ArrayList read() throws IOException, ClassNotFoundException {\n FileInputStream file = new FileInputStream(\"scores.ser\"); \n ObjectInputStream in = new ObjectInputStream(file); \n \n // Method for deserialization of object \n ArrayList scores = (ArrayList)in.readObject(); \n \n in.close(); \n file.close(); \n \n\t\treturn scores;\n\t}", "public void importFile() {\n \ttry {\n\t File account_file = new File(\"accounts/CarerAccounts.txt\");\n\n\t FileReader file_reader = new FileReader(account_file);\n\t BufferedReader buff_reader = new BufferedReader(file_reader);\n\n\t String row;\n\t while ((row = buff_reader.readLine()) != null) {\n\t String[] account = row.split(\",\"); //implementing comma seperated value (CSV)\n\t String[] users = account[6].split(\"-\");\n\t int[] usersNew = new int[users.length];\n\t for (int i = 0; i < users.length; i++) {\n\t \tusersNew[i] = Integer.parseInt(users[i].trim());\n\t }\n\t this.add(Integer.parseInt(account[0]), account[1], account[2], account[3], account[4], account[5], usersNew);\n\t }\n\t buff_reader.close();\n } catch (IOException e) {\n System.out.println(\"Unable to read text file this time.\");\n \t}\n\t}", "public ArrayList<Integer> readNumbersFromFile() throws FileNotFoundException {\r\n ArrayList<Integer> arrayList = new ArrayList<>();\r\n File file = new File(readFilename);\r\n Scanner scanner = new Scanner(file);\r\n while(scanner.hasNextInt())\r\n {\r\n arrayList.add(scanner.nextInt());\r\n }\r\n return arrayList;\r\n }", "public ArrayList<quizImpl> readFile() {\n\n // The name of the file to open.\n String fileName = \"Quizzes.txt\";\n\n // This will reference one line at a time\n String line;\n\n try {\n //reads file twice the first time adding contacts the second adding meetings\n // FileReader reads text files in the default encoding.\n FileReader fileReader = new FileReader(fileName);\n\n // Wrap FileReader in BufferedReader.\n BufferedReader bufferedReader = new BufferedReader(fileReader);\n\n while ((line = bufferedReader.readLine()) != null) {\n quizzes.add(line);\n }\n bufferedReader.close();\n for (String s : quizzes) {\n if (s.startsWith(\"quizName\")) {\n //splits the line into an array of strings\n String[] stringArray = s.split(\",\");\n //If game already has a highScore\n if (stringArray.length > 3) {\n if (stringArray[stringArray.length - 3].equals(\"highScore\")) {\n quizImpl q = new quizImpl(stringArray[1], stringArray[stringArray.length - 2], Integer.parseInt(stringArray[stringArray.length - 1]));\n for (int i = 2; i < stringArray.length - 3; i = i + 6) {\n q.addQuestion(stringArray[i], stringArray[i + 1], stringArray[i + 2], stringArray[i + 3], stringArray[i + 4], Integer.parseInt(stringArray[i + 5]));\n }\n quizArray.add(q);\n } else {\n quizImpl q = new quizImpl(stringArray[1]);\n for (int i = 2; i < stringArray.length; i = i + 6) {\n q.addQuestion(stringArray[i], stringArray[i + 1], stringArray[i + 2], stringArray[i + 3], stringArray[i + 4], Integer.parseInt(stringArray[i + 5]));\n }\n quizArray.add(q);\n }\n } else {\n quizImpl q = new quizImpl(stringArray[1]);\n for (int i = 2; i < stringArray.length; i = i + 6) {\n q.addQuestion(stringArray[i], stringArray[i + 1], stringArray[i + 2], stringArray[i + 3], stringArray[i + 4], Integer.parseInt(stringArray[i + 5]));\n }\n quizArray.add(q);\n }\n }\n }\n } catch (FileNotFoundException ex) {\n System.out.println(\"Unable to open file '\" + fileName + \"'\");\n } catch (IOException ex) {\n System.out.println(\"Error reading file '\" + fileName + \"'\");\n }\n return quizArray;\n }", "private static List<Integer> parse_line(String line, int d) throws Exception {\n\t List<Integer> ans = new ArrayList<Integer>();\n\t StringTokenizer st = new StringTokenizer(line, \" \");\n\t if (st.countTokens() != d) {\n\t throw new Exception(\"Bad line: [\" + line + \"]\");\n\t }\n\t while (st.hasMoreElements()) {\n\t String s = st.nextToken();\n\t try {\n\t ans.add(Integer.parseInt(s));\n\t } catch (Exception ex) {\n\t throw new Exception(\"Bad Integer in \" + \"[\" + line + \"]. \" + ex.getMessage());\n\t }\n\t }\n\t return ans;\n\t }", "public static void main(String[] args) throws FileNotFoundException {\n\t\tint listArr[] = new int[70];\r\n\t\tString filename = \"MyList.txt\";\r\n\t\tFile file = new File(filename);\r\n\t\tScanner input = new Scanner(file);\r\n\t\tint i = 0;\r\n\t\twhile (input.hasNextLine()) {\r\n\t\t\tlistArr[i] = input.nextInt();\r\n\t\t\ti++;\r\n\t\t}\r\n\t\t\r\n\t\tmergeSort(listArr, 70);\r\n\t\tfor(i = 0; i < 70; i++) {\r\n\t\t\tSystem.out.println(listArr[i]);\r\n\t\t}\r\n\t}", "public void readIn(ArrayList<String> lines, int idx){\n\t\tfor (int i=idx+1;i<lines.size();i++){\n\t\t\tString[] parts = lines.get(i).split(\" \");\n\t\t\tif (parts[0].charAt(0) != '-'){\n\t\t\t\ti = lines.size();\n\t\t\t}\n\t\t\tswitch (parts[0]){\n\t\t\t\tcase \"-TileID:\":\n\t\t\t\t\tthis.setTile(Game.getInstance().getTileContained(Integer.parseInt(parts[1])));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"-Chance:\":\n\t\t\t\t\tthis.chance = Integer.parseInt(parts[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: break;\n\t\t\t}\n\t\t}\n\t}", "public void addHighscore(int i){\n highscores.add(i);\n sortHighscores();\n writeFile();\n }", "private void loadAndProcessInput(){\n transactions_set = new ArrayList<>();\n strItemToInt = new HashMap<>();\n intToStrItem = new HashMap<>();\n \n try{\n BufferedReader br = new BufferedReader(\n new InputStreamReader(\n new FileInputStream(this.inputFilePath)\n ));\n \n String line;\n while((line = br.readLine()) != null){\n String[] tokens = line.split(\" \");\n ArrayList<Integer> itemsId = new ArrayList();\n \n for(String item : tokens){\n if( ! strItemToInt.containsKey(item)){\n strItemToInt.put(item, strItemToInt.size()+1);\n intToStrItem.put(strItemToInt.size(), item);\n }\n itemsId.add(strItemToInt.get(item));\n }\n transactions_set.add(itemsId);\n }\n }\n catch(IOException fnfEx){\n System.err.println(\"Input Error\");\n fnfEx.printStackTrace();\n }\n \n }", "private void loadFromFile(ArrayList<Question> questionsList) {\n String tempString = \"\"; // Holds the \"identifier\" of the line\n String question = \"\"; // text containing actual question\n ArrayList<Integer> scoreList = new ArrayList<>(); // contains scores of questions\n ArrayList<String> answers = new ArrayList<>(); // contains answers of questions\n ArrayList<String> nextQuestions = new ArrayList<>(); // contains next question of current question\n int specialCase = 0; // special case of question\n boolean backExists = false; // boolean indicating if back button does(n't) exist\n Question tempQuestion; // temporary question which is later added to the list\n\n // Attempt to open a the question_data file and read its contents\n try {\n InputStream in = getClass().getResourceAsStream(\"question_data\");\n Scanner sc = new Scanner(in);\n\n while (sc.hasNextLine()) {\n tempString = sc.nextLine();\n if (tempString.equals(\"\")) {\n continue;\n }\n\n switch (tempString.charAt(0)) {\n case '#':\n // Anything beginning with '#' is ignored.\n break;\n case 'Q':\n // 'Q' indicated the text of the question\n question = tempString.substring(3);\n break;\n case 'A':\n // 'A' indicates an answer\n answers.add(tempString.substring(3));\n break;\n case 'B':\n // 'B' indicates if a back button exists or not\n backExists = Boolean.parseBoolean(tempString.substring(3));\n break;\n case 'N':\n // 'N' indicates the next question of every answer\n nextQuestions.add(tempString.substring(3));\n break;\n case 'S':\n // 'S' indicates the score of every answer, can be set to -1 if no score is needed\n scoreList.add(Integer.parseInt(tempString.substring(3)));\n break;\n case 'C':\n // Special case. Every special case (number other than 0) has to be accounted for...\n specialCase = Integer.parseInt(tempString.substring(3));\n break;\n case 'T':\n // 'T' stands for terminate and create. A 'T' should be placed at the end of a\n // question and all of its answers. This indicated the creation of the question.\n\n // Create new question, set its answer, reset all lists, etc.\n tempQuestion = new Question(question, backExists);\n tempQuestion.setSpecialCase(specialCase);\n for (int i = 0; i < answers.size(); i++) {\n tempQuestion\n .addAnswer(answers.get(i), nextQuestions.get(i), scoreList.get(i));\n tempQuestion.setBackAvailable(backExists);\n }\n questionsList.add(tempQuestion);\n answers.clear();\n scoreList.clear();\n nextQuestions.clear();\n specialCase = 0;\n break;\n default:\n break;\n }\n\n }\n } catch (Exception e){\n System.out.println(System.getProperty(\"user.dir\"));\n System.out.println(\"An error occurred while parsing the file, make sure the file exists.\"\n + \"and/or has the correct filename (question_data)\");\n\n }\n }", "public ArrayList<Integer> readFile(File file) {\n\t\tArrayList<Integer> fileData = new ArrayList<Integer>();\n\t\t// read the file\n\t\ttry {\n\t\t\tScanner sc = new Scanner(file);\n\t\t\twhile (sc.hasNextInt()) {\n\t\t\t\tfileData.add(sc.nextInt());\n\t\t\t}\n\t\t\tsc.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.out.println(\"An error occurred.\");\n\t\t e.printStackTrace();\n\t\t}\n\t\treturn fileData;\n\t}", "public int[] scanGrades(String filepath) {\n Scanner scanner = null;\n try {\n scanner = new Scanner(new File(filepath));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n ArrayList<Integer> grades = new ArrayList<Integer>();\n while (scanner.hasNextInt()) {\n grades.add(scanner.nextInt());\n }\n int[] gradeArray = new int[grades.size()];\n for (int i = 0; i < grades.size(); i++) {\n gradeArray[i] = grades.get(i);\n }\n return gradeArray;\n }", "private void saveScore() {\n\t\tif (Serializer.deserialize(Main.SCORES_FILE)) {\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tArrayList<Integer> scores = (ArrayList<Integer>) Serializer\n\t\t\t\t\t.getRecovered();\n\n\t\t\tif (this.score > 0) {\n\t\t\t\tscores.add(this.score);\n\n\t\t\t\tSerializer.serialize(Main.SCORES_FILE, scores);\n\t\t\t}\n\t\t}\n\t}", "private int generatorAnswersList() throws IOException {\n File answerFile = new File(this.getClass().getResource(\"/answers.txt\").getPath());\n if (!answerFile.exists()) {\n System.out.println(\"The file answers not found!\");\n }\n try (RandomAccessFile raf = new RandomAccessFile(answerFile, \"r\")) {\n int countLine = 0;\n String line;\n while ((line = raf.readLine()) != null) {\n if (!\"\".equals(line)) {\n this.answersList.add(line);\n countLine++;\n }\n }\n return countLine;\n }\n }", "public static boolean checkAndWriteHighScore() {\n\t\tString file = \"file:highScore.txt\";\n\t int highScore = 0;\n\t try {\n\t BufferedReader reader = new BufferedReader(new FileReader(file));\n\t String line = reader.readLine();\n\t while (line != null) // read the score file line by line\n\t {\n\t try {\n\t int oldScore = Integer.parseInt(line.trim()); // parse each line as an int\n\t if (oldScore > highScore){ \n\t highScore = oldScore; \n\t }\n\t } catch (NumberFormatException e1) {\n\t // ignore invalid scores\n\t //System.err.println(\"ignoring invalid score: \" + line);\n\t }\n\t line = reader.readLine();\n\t }\n\t reader.close();\n\n\t } catch (IOException ex) {\n\t System.err.println(\"ERROR reading scores from file\");\n\t }\n\t \n\t \n\t FileWriter myWriter;\n\t\ttry {\n\t\t\tmyWriter = new FileWriter(file);\n\t\t\tmyWriter.write(\"\" + points.get());\n\t\t\tmyWriter.close();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tif (points.get() > highScore) {\n\t\t\treturn true;\n\t\t}\n\t return false;\n\t}", "@SuppressWarnings(\"unchecked\")\n\tprivate void loadScores(final String worldName) {\n\t\tFile file = Hello.getPlugin().getServer().getWorldContainer();\n\t\tFile worldFolder = new File(file, worldName);\n\t\tFile path = new File(worldFolder, PERSISTANCE_FILE);\n\t\t\n\t\t//if Highscore doesn't exist, don't try loading it \n\t\tif (!path.exists()) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\ttry {\n\t\t\tReader reader = Files.newReader(path, Charset.defaultCharset());\n\t\t\n\t\t\n\t\t\tYaml yaml = new Yaml(YamlSerializable.YAML_OPTIONS);\t\n\t\t\t\n\t\t\tMap<String, Object> values = (Map<String, Object>) yaml.load(reader);\n\t\t\t\n\t\t\tList<Map<String, Object>> entries = (List<Map<String, Object>>) values.get(KEY_SCORES);\n\t\t\tfor (Map<String, Object> scoreMap : entries) {\n\t\t\t\tHighscoreEntry entry = new HighscoreEntry();\n\t\t\t\ttry {\n\t\t\t\t\tentry.setup(new PersistenceMap(scoreMap));\n\t\t\t\t} catch (PersistenceException e) {\n\t\t\t\t\tSystem.out.println(\"persistance exception in highscore\");\n\t\t\t\t}\n\t\t\t\tscores.add(entry);\n\t\t\t}\n\t\t\tCollections.sort(scores);\n\t\t\tSystem.out.println(\"sort\");\n\t\t\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public List<int[]> readCSVint() {\n\t\tCSVReader reader;\n\t\t// The strings pulled from file\n\t\tList<String[]> storedEntries = new ArrayList<String[]>();\n\t\t// Each string converted to int.\n\t\tList<int[]> convertedEntries = new ArrayList<int[]>();\n\n\t\t// Read the entire file into a List.\n\t\ttry {\n\t\t\treader = new CSVReader(new FileReader(getCSVFolder() + File.separator + getFileName() + \".csv\"));\n\t\t\tstoredEntries = reader.readAll();\n\t\t\treader.close();\t\t\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t// The current list contains strings, so we convert them.\n\t\tint size = storedEntries.get(0).length;\n\t\tfor (String[] row : storedEntries) {\n\t\t\tint[] convertedRow = new int[size];\n\t\t\tfor (int i = 0; i < size; i++) {\n\t\t\t\tconvertedRow[i] = Integer.parseInt(row[i]);\n\t\t\t}\n\t\t\tconvertedEntries.add(convertedRow);\n\t\t}\n\n\t\treturn convertedEntries;\n\t}", "private void readObject(java.io.ObjectInputStream stream)\r\n throws IOException, ClassNotFoundException {\r\n scoreNumber = stream.readInt();\r\n highScores = new Score[scoreNumber];\r\n \r\n for (int i = 0; i < scoreNumber; i++)\r\n \thighScores[i] = (Score) stream.readObject();\r\n }", "public HighScore(){\n readFile();\n sortHighscores();\n }", "public void testWithScoreFile(String testFile, String scoreFile) {\n/* 1108 */ try (BufferedReader in = FileUtils.smartReader(scoreFile)) {\n/* 1109 */ List<RankList> test = readInput(testFile);\n/* 1110 */ String content = \"\";\n/* */ \n/* 1112 */ List<Double> scores = new ArrayList<>();\n/* 1113 */ while ((content = in.readLine()) != null) {\n/* */ \n/* 1115 */ content = content.trim();\n/* 1116 */ if (content.compareTo(\"\") == 0)\n/* */ continue; \n/* 1118 */ scores.add(Double.valueOf(Double.parseDouble(content)));\n/* */ } \n/* 1120 */ in.close();\n/* 1121 */ int k = 0;\n/* 1122 */ for (int i = 0; i < test.size(); i++) {\n/* */ \n/* 1124 */ RankList rl = test.get(i);\n/* 1125 */ double[] s = new double[rl.size()];\n/* 1126 */ for (int j = 0; j < rl.size(); j++)\n/* 1127 */ s[j] = ((Double)scores.get(k++)).doubleValue(); \n/* 1128 */ rl = new RankList(rl, MergeSorter.sort(s, false));\n/* 1129 */ test.set(i, rl);\n/* */ } \n/* */ \n/* 1132 */ double rankScore = evaluate(null, test);\n/* 1133 */ System.out.println(this.testScorer.name() + \" on test data: \" + SimpleMath.round(rankScore, 4));\n/* 1134 */ } catch (IOException e) {\n/* 1135 */ throw RankLibError.create(e);\n/* */ } \n/* */ }", "public static ArrayList<Student> loadListOfStudents(String fileName) {\n ArrayList<Student> students = new ArrayList<>();\r\n String str = TextReader.StringFromFile(fileName);//Uses the method that returns a complete string with newlines for each studentline.\r\n if (validateInput(str)) {//Uses the validation method to check that the input is valid.\r\n String[] lines = str.split(\"\\n\");\r\n String[] lineParameters;\r\n int countFor = 0;\r\n for (String line : lines) {\r\n if(countFor > 1){\r\n lineParameters = line.split(\",\");\r\n Vote vote = new Vote(new Subject(lineParameters[1]), new Subject(lineParameters[2]), new Subject(lineParameters[3]), new Subject(lineParameters[4]));\r\n Student newStudent = new Student(lineParameters[0], vote);\r\n students.add(newStudent);\r\n }\r\n countFor++;\r\n }\r\n }\r\n\r\n return students;\r\n }", "public static ArrayList<Point> ReadData(String filePath) throws FileNotFoundException{\n \n ArrayList<Point> points = new ArrayList<>();\n\n Scanner inputStream = new Scanner(new File(filePath));\n\n String[] xs = inputStream.nextLine().split(\" \");\n String[] ys = inputStream.nextLine().split(\" \");\n\n int min = Math.min(xs.length, xs.length);\n\n for(int i = 0 ;i < min; i++){\n double x = Float.parseFloat(xs[i]);\n double y = Float.parseFloat(ys[i]);\n points.add(new Point(x,y));\n }\n\n\n\n return points;\n\n }", "public int lowestHighscore()\n {\n FileReader filereader;\n PrintWriter writer;\n int lowHighScore = 0;\n try{\n \n filereader = new FileReader(getLevel());\n BufferedReader bufferedreader = new BufferedReader(filereader);\n \n \n String finalLine =\"\";\n for(int i = 0;i<5;i++)\n {\n finalLine = bufferedreader.readLine();\n }\n lowHighScore = Integer.parseInt(finalLine.split(\":\")[1]);\n \n }\n catch(IOException e){}\n return lowHighScore;\n }", "private int[] getTotalScore_Negative() throws FileNotFoundException, IOException {\n \n String target_dir = \"src/testing_data/neg\";\n File dir = new File(target_dir);\n File[] files = dir.listFiles();\n String[] negWordList = null;\n ArrayList<String> stopWords = new ArrayList<>();\n int totalReviewScoreAfinn = 0;\n int totalReviewScoreMohan = 0;\n int[] totalScoreNegative = new int[2];\n\n for (File f : files) {\n if(f.isFile()) {\n BufferedReader inputStream = null;\n try {\n inputStream = new BufferedReader(new FileReader(f));\n String line;\n while ((line = inputStream.readLine()) != null) { \n int reviewScore = 0;\n String result = line.replaceAll(\"[\\\\d+|\\\\p{P}\\\\p{S}]\" ,\"\");\n negWordList = result.toLowerCase().split(\" \");\n ArrayList<String> wordList = new ArrayList<>(Arrays.asList(negWordList)); \n for(String word : wordList){\n for(String sWord : stopWordList){\n if(word.equals(sWord)){\n stopWords.add(sWord);\n }\n }\n } \n wordList.removeAll(stopWords); \n \n \n for(String word: wordList){\n for (String key : afinnEnglishLibrary.keySet())\n {\n if(word.equals(key)){\n reviewScore += afinnEnglishLibrary.get(key);\n }\n }\n }\n if(reviewScore<0){\n totalReviewScoreAfinn++;\n }\n \n reviewScore = 0; \n for(String word: wordList){\n for (String key : mohanLibrary.keySet())\n {\n if(word.equals(key)){\n reviewScore += mohanLibrary.get(key);\n }\n }\n }\n if(reviewScore<0){\n totalReviewScoreMohan++;\n }\n }\n }\n finally {\n if (inputStream != null) {\n inputStream.close();\n }\n }\n } \n }\n totalScoreNegative[0] = totalReviewScoreAfinn;\n totalScoreNegative[1] = totalReviewScoreMohan;\n return totalScoreNegative;\n }", "private int[][] readPuzzle(File f) throws NumberFormatException, IOException {\n\t\tint[][] out = new int[N + 1][N + 1];\n\t\tBufferedReader br = new BufferedReader(new FileReader(f));\n\t\tString line = null;\n\t\tint row = 1;\n\t\ttry {\n\t\t\twhile ((line = br.readLine()) != null) {\n\t\t\t\tif (line.isBlank() || row > N)\n\t\t\t\t\tcontinue;\n\t\t\t\tString[] vals = line.split(\" \");\n\t\t\t\tif (vals.length != N)\n\t\t\t\t\treturn null;\n\t\t\t\tfor (int j = 0; j < vals.length; j++) {\n\t\t\t\t\tout[row][j + 1] = Integer.parseInt(vals[j]);\n\t\t\t\t}\n\t\t\t\trow++;\n\t\t\t}\n\t\t} finally {\n\t\t\tbr.close();\n\t\t}\n\t\treturn out;\n\t}", "public static List<Sentence> readFile(String filename) {\n\t\t/* IMPLEMENT THIS METHOD! */\n\t\tList<Sentence> sentences = new ArrayList<>(); \n\t\ttry {\n//\t\t\tBufferedReader reviews = new BufferedReader(new FileReader(filename));\n\t\t\tFile reviews = new File(filename);\n\t Scanner scnr = new Scanner(reviews);\n\t while(scnr.hasNextLine()){\n\t String line = scnr.nextLine();\n\t //split line on score and text\n\t int score = Integer.parseInt(line.substring(0, 2).trim());//converting to int\n\t String text = line.substring(2).trim();\n//\t System.out.println(\"Score: \" + score + \" text: \" + text);\n\t if(score >= -2 && score <= 2) {\n\t \tsentences.add(new Sentence(score, text));\n\t }\n\t }\n\t scnr.close();//close scanner\n\t\t}catch(Exception ex) {\n\t\t\tSystem.out.println(\"Ooops: \" + ex.getMessage());\n\t\t}\n\t\treturn sentences; // this line is here only so this code will compile if you don't modify it\n\n\t}", "@Override\r\n\tpublic ScoresByPlayer read(File file, LeaguePosition leaguePosition) throws IOException {\r\n\r\n\t\tfinal ScoresByPlayer scoresByPlayer = new ScoresByPlayer();\r\n\r\n\t\t// Open file\r\n\t\tfinal CSVReader reader = new CSVReader(new FileReader(file));\r\n\r\n\t\t// Read first line\r\n\t\tfinal String[] firstLine = reader.readNext();\r\n\t\tLOGGER.debug(\"Read first line: \" + Arrays.asList(firstLine));\r\n\r\n\t\tString[] line;\r\n\t\twhile ((line = reader.readNext()) != null) {\r\n\r\n if ((line[0] == null) || \"\".equals(line[0])) {\r\n LOGGER.debug(\"Read (and ignored) line: \" + Arrays.asList(line));\r\n continue; // empty line so ignore it.\r\n }\r\n\r\n LOGGER.debug(\"Read line: \" + Arrays.asList(line));\r\n\r\n final Athlete athlete = new Athlete(transformer.getAthleteName(line));\r\n final Collection<Integer> scores = transformer.getScores(line);\r\n\t\t\tfinal PlayerScores playerPositionScores = new PlayerScores(athlete, leaguePosition, scores);\r\n\r\n\t\t\t// Exception if already exists\r\n\t\t\tif (scoresByPlayer.hasScoresFor(playerPositionScores.getAthlete(), playerPositionScores.getLeaguePosition())) {\r\n\t\t\t\tthrow new IOException(\"Duplicate set of averages for Athlete : \" + playerPositionScores.getAthlete());\r\n\t\t\t}\r\n\r\n\t\t\tLOGGER.debug(\" transformed to : \" + playerPositionScores);\r\n\t\t\tscoresByPlayer.addPlayerScores(playerPositionScores);\r\n\t\t}\r\n\t\treader.close();\r\n\r\n\t\treturn scoresByPlayer;\r\n\t}", "private void readInFile()\n {\n try\n {\n file = new File(fileAddress);//Create new file from the given file name\n fileScanner = new Scanner(file);//Create a file scanner to scan for all the integers\n }\n catch(FileNotFoundException e) //Throws a FileNotFountException if the given file name doesn't exist\n {\n System.out.println(\"The file \" + fileAddress + \" could not be found\");\n }\n\n int i = 0;\n\n for(int j = 0; j < 1000; j++)\n {\n integerList[j] = fileScanner.nextInt();//Store the next integer from the file in to the integerList\n\n //Check to see if the index is at the end of the array and the file still has more integers,\n //then we reallocate more space for the array.\n\n /* if(i > (integerList.length - 1) && fileScanner.hasNextInt())\n resizeArray();\n i++;*/\n }\n\n /*while(fileScanner.hasNextInt())//Iterate through the file until there are no more integers\n {\n integerList[i] = fileScanner.nextInt();//Store the next integer from the file in to the integerList\n\n //Check to see if the index is at the end of the array and the file still has more integers,\n //then we reallocate more space for the array.\n\n if(i >= (integerList.length - 1) && fileScanner.hasNextInt())\n resizeArray();\n i++;\n }*/\n\n fileScanner.close();//close the scanner\n }", "public static void main(String[] args) throws FileNotFoundException {\nint zbir=0;\n\n\t\tFileReader file=new FileReader(\"maraton.txt\");\n\nArrayList<Integer> lista = new ArrayList<>();\nScanner input=new Scanner(file);\n\nwhile (input.hasNext()) {\n\t\nString ime = input.next();\n\nlista.add(input.nextInt());\n}\nfor(int i=0; i<lista.size();i++) {\n\n\t zbir += lista.get(i);\n\t \n\t\n}\nSystem.out.println(\"Zbir je :\" +zbir);\n\t System.out.println(\"Prosjek je :\" + (zbir/lista.size()));\n\n}", "public static void main( String args[] ) throws Exception\n\t{\n\t\t\tBufferedReader infile = new BufferedReader( new FileReader( \"ExamScores.txt\" ) );\n\n\t\t\t// you declare all needed ArrayLists and other variables from here on.\n\t\t\tArrayList<String> lines = new ArrayList<String>();\n\n\t\t\tSystem.out.println(\"\\nSTEP #1: 50%\"); // 50%\n\t\t\twhile (infile.ready()) {\n\t\t\t\tString line = infile.readLine();\n\t\t\t\tSystem.out.println(line);\n\t\t\t\tlines.add(line);\n\t\t\t}\n\t\t\tinfile.close();\n\n\n\t\t\tSystem.out.println(\"\\nSTEP #2: 25%\"); // 75 %\n\t\t\tCollections.sort(lines);\n\t\t\tfor (String s: lines)\n\t\t\t\tSystem.out.println(s);\n\n\t\t\tSystem.out.println(\"\\nSTEP #3: 10%\"); // 85%\n\n\t\t\tTreeMap<String, ArrayList<Integer>> st2sc = new TreeMap<String, ArrayList<Integer>>();\n\t\t\tTreeMap<Double, String> ave2st = new TreeMap<Double, String>();\n\t\t\tint[] sum = new int[lines.get(0).split(\"\\\\s+\").length-1];\n\t\t\t\n\t\t\tinfile = new BufferedReader ( new FileReader(\"query.txt\") );\n\t\t\tString[] queryS= infile.readLine().split(\" \");\n\t\t\tint[] query = new int[queryS.length];\n\t\t\tfor (int i=0; i<queryS.length; i++)\n\t\t\t\tquery[i]=Integer.parseInt(queryS[i]);\n\t\t\tfor (String s: lines)\n\t\t\t{\t\n\t\t\t\tdouble sumq = 0;\n\t\t\t\tdouble aveq = 0;\n\t\t\t\tString[] tokens = s.split(\"\\\\s+\");\n\t\t\t\tArrayList<Integer> scores = new ArrayList<Integer>();\n\t\t\t\tfor (int t=1; t<tokens.length; t++){\n\t\t\t\t\tscores.add(Integer.parseInt(tokens[t]));\n\t\t\t\t}\n\t\t\t\tst2sc.put(tokens[0], scores);\n\t\t\t\tfor (int q: query)\n\t\t\t\t\tsumq += Integer.parseInt(tokens[q]);\n\t\t\t\tfor (int nth = 0; nth<sum.length; nth++){\n\t\t\t\t\tsum[nth]+= Integer.parseInt(tokens[nth+1]);\n\t\t\t\t}\n\t\t\t\taveq = sumq/3;\n\t\t\t\tave2st.put(aveq, tokens[0]);\n\t\t\t}\n\t\t\tfor (double f: ave2st.keySet())\n\t\t\t\tSystem.out.printf(ave2st.get(f)+\" \"+\"%.2f\\n\", f);\n\n\t\t\tSystem.out.println(\"\\nSTEP #4: 15%\"); // 100%\n\t\t\t\n\t\t\tint lowest = sum[0];\n\t\t\tint which = 0;\n\t\t\tfor (int i=1; i<sum.length; i++)\n\t\t\t{\n\t\t\t\tif (sum[i]<lowest)\n\t\t\t\t{\n\t\t\t\t\tlowest = sum[i];\n\t\t\t\t\twhich = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(\"exam\"+(which+1)+\" had the lowest average\");\n\n\n\t}", "private int[] getTotalScore_Positive() throws FileNotFoundException, IOException {\n \n String target_dir = \"src/testing_data/pos\";\n File dir = new File(target_dir);\n File[] files = dir.listFiles();\n String[] posWordList = null;\n ArrayList<String> stopWords = new ArrayList<>();\n int totalReviewScoreAfinn = 0;\n int totalReviewScoreMohan = 0;\n int[] totalScorePositive = new int[2];\n\n for (File f : files) {\n if(f.isFile()) {\n BufferedReader inputStream = null;\n\n try {\n inputStream = new BufferedReader(new FileReader(f));\n String line;\n\n while ((line = inputStream.readLine()) != null) {\n \n int reviewScore = 0;\n\n String result = line.replaceAll(\"[\\\\d+|\\\\p{P}\\\\p{S}]\" ,\"\");\n posWordList = result.toLowerCase().split(\" \");\n \n ArrayList<String> wordList = new ArrayList<>(Arrays.asList(posWordList)); \n\n for(String word : wordList){\n for(String sWord : stopWordList){\n if(word.equals(sWord)){\n stopWords.add(sWord);\n }\n }\n }\n \n wordList.removeAll(stopWords); \n \n for(String word: wordList){\n for(String key : afinnEnglishLibrary.keySet())\n {\n if(word.equals(key)){ \n reviewScore += afinnEnglishLibrary.get(key);\n }\n }\n }\n\n if(reviewScore>0){ \n totalReviewScoreAfinn++;\n }\n \n reviewScore = 0; \n for(String word: wordList){\n for (String key : mohanLibrary.keySet())\n {\n if(word.equals(key)){\n reviewScore += mohanLibrary.get(key);\n }\n }\n }\n\n if(reviewScore>0){\n totalReviewScoreMohan++;\n }\n }\n }\n finally {\n if (inputStream != null) {\n inputStream.close();\n }\n }\n } \n }\n totalScorePositive[0] = totalReviewScoreAfinn;\n totalScorePositive[1] = totalReviewScoreMohan;\n return totalScorePositive;\n }", "public void checkHighScore() {\n\t\t//start only if inserting highscore is needed\n\t\tlevel.animal.gamePaused = true;\n\t\tlevel.createTimer();\n\t\tlevel.timer.start();\n\t\t\t\t\n\t\tlevel.setWord(\"hiscores\", 7, 175, 130);\n\t\t\n\t\treadFile();\n\t}", "public void addHighScore(HighScore h)\n\t{\n\t\tHighScore[] highScores=getHighScores();\n\t\thighScores[highScores.length-1]=h;\n\t\tfor (int i=highScores.length-2; i>=0; i--)\n\t\t{\n\t\t\tif (highScores[i+1].compareTo(highScores[i])>0)\n\t\t\t{\n\t\t\t\tHighScore temp=highScores[i];\n\t\t\t\thighScores[i]=highScores[i+1];\n\t\t\t\thighScores[i+1]=temp;\n\t\t\t}\n\t\t}\n\t\ttry \n\t\t{\n\t\t\tObjectOutputStream o=new ObjectOutputStream(new FileOutputStream(\"HighScores.dat\"));\n\t\t\to.writeObject(highScores);\n\t\t\to.close();\n\t\t} catch (FileNotFoundException e) {e.printStackTrace();} \n\t\tcatch (IOException e) {e.printStackTrace();}\n\t}", "public Scoreboard() {\n try {\n\n Scanner reader = new Scanner(new File(\"data/scores.txt\"));\n\n while (reader.hasNext()) {\n String name = reader.next();\n int score = reader.nextInt();\n\n QuizTaker taker = new QuizTaker(name, score);\n allQuizTakers.add(taker); //Add this new QuizTaker to the ArrayList of QuizTakers *NOTE1\n\n //If the QuizTaker's name already exists in the ArrayList of QuizTakers, then their new score is added to that QuizTaker\n for (int i = 0; i < allQuizTakers.size() - 1; i++) {\n if (allQuizTakers.get(i).getName().equals(taker.getName())) { //If name is found\n allQuizTakers.get(i).addScore(score); //Add this new score to the pre-existing QuizTaker's ArrayList of scores\n Sorter.quickSort(allQuizTakers.get(i).getMyScores(), 0, //Sort all the scores of the QuizTaker\n allQuizTakers.get(i).getMyScores().size() - 1);\n allQuizTakers.remove(allQuizTakers.size() - 1); //Remove the new QuizTaker object made at NOTE1 to prevent duplicates\n }\n }\n\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public ArrayList<Double> readFile(String m){\n ArrayList<Double> a = new ArrayList<Double>();\n Scanner r = null;\n try {\n File f = new File(m);\n r = new Scanner(f);\n String scan;\n while(r.hasNextLine()) {\n scan = r.nextLine();\n //System.out.println(scan);\n // look for comma because our price starts after comma\n int commaPosition = scan.indexOf(',');\n //go to next index of the string in one line\n int nextIndex = commaPosition + 1;\n // make a string named price to keep the price from one line\n //substring method takes two parameters- start point and end point(which is integers)\n //price = smaller string = \"2.50\", scan = bigger string = \"bananas,2.50\"\n String price = scan.substring(nextIndex,scan.length());\n double doublePrice = Double.parseDouble(price);\n //System.out.println(doublePrice);\n a.add(doublePrice);\n }\n } catch (FileNotFoundException ex) {\n\n } catch (IOException ex) {\n\n } finally {\n if(r!=null) r.close();\n }\n return a;\n\n }", "public List<Integer> readLineAsIntegers() throws IOException {\n List<Integer> ret = new ArrayList<>();\n int idx = 0;\n byte c = read();\n while (c != -1) {\n if (c == '\\n' || c == '\\r')\n break;\n\n // next integer\n int i = 0;\n while (c <= ' ') {\n c = read();\n }\n boolean negative = (c == '-');\n if (negative) {\n c = read();\n }\n\n do {\n i = i * 10 + (c - '0');\n c = read();\n } while (c >= '0' && c <= '9');\n// ret[idx++] = (negative) ? -i : i;\n ret.add((negative) ? -i : i);\n }\n return ret;\n }", "private void readFile(File fp)throws IOException{\n Scanner in=new Scanner(fp);\n String line,s[];\n while(in.hasNext()){\n line=in.nextLine();\n s=line.split(\"[ ]+\");\n if(s.length<3){\n payroll.addLast(new ObjectListNode(new Employee(s[1],s[0])));\n }\n else{\n payroll.addLast(new ObjectListNode(new Employee(s[1],s[0],s[2].charAt(0),s[4].charAt(0),\n Integer.parseInt(s[3]),Double.parseDouble(s[5]))));\n }\n }\n }", "public void readVotes(File inFile)\r\n\t{\r\n\t\tArrayList<String> data = new ArrayList<>(); // Declares a String ArrayList to hold the contents of the file being read. \r\n\t\t\r\n\t\tteams.clear();\r\n\t\t\r\n\t\tScanner inputFile;\r\n\t\t\r\n\t\ttry {\r\n\t\t\tinputFile = new Scanner(inFile);\r\n\t\t\t\r\n\t\t\t// Read each content, line by line from the .txt file into a String ArrayList\r\n\t\t\twhile (inputFile.hasNext())\r\n\t\t\t{\t\r\n\t\t\t\tdata.add(inputFile.nextLine());\r\n\t\t\t}\r\n\t\t\r\n\t\t\t// Splits the first line of the file, containing all the teams names, and place them into the teamNames String array. \r\n\t\t\tteamNames = data.get(0).split(\",\");\r\n\t \r\n\t\t\t// Splits the second line of the file, containing the name of each teams conference, and place them into the teamConferences String array. \r\n\t teamConferences = data.get(1).split(\",\");\r\n\t \r\n\t \r\n\t for(int row = 0; row < NUM_VOTERS; row++)\r\n\t {\t\r\n\t \t// Beginning from the third line of the file that was read in, split the numbers in each line and place them into the rows of the String[][] array\r\n\t \tv[row] = data.get(row+2).split(\",\");\r\n\t \t\r\n\t \tfor(int col = 0; col < NUM_TEAMS; col++)\r\n\t \t{\r\n\t \t\t// Parse the String values from the String[][] array into integers, and place them into the int[][] array\r\n\t \t\tvoteRecord[row][col] = Integer.parseInt(v[row][col]);\r\n\t\t }\r\n\t }\r\n\t \r\n\t\t for(int i = 0; i < NUM_TEAMS; i++)\r\n\t\t {\r\n\t\t \t// Declares an int array to hold the votes for each individual team.\r\n\t\t int[] teamsVotes = new int[NUM_VOTERS]; \r\n\t\t \r\n\t\t \t// Adding the votes for each individual team into an int[] array, from the 12 voters. \r\n\t\t \tfor(int j=0; j<NUM_VOTERS; j++)\r\n\t\t \t{\r\n\t\t \t\t// Places the int votes from each of the 12 voters for a team, from the int[][] array, into an int[] array for each individual team. \r\n\t\t \t\tteamsVotes[j] = voteRecord[j][i];\r\n\t\t \t\t//System.out.print(teamsVotes[j] + \",\");\r\n\t\t \t}\r\n\t\t \t//System.out.println();\r\n\t\t \t\r\n\t\t \t// Creates a CollegeFootbalTeam object, which will store the information from each individual team and then add it into an ArrayList.\r\n\t\t \t// It will repeat this 10 times, to add all 10 teams information into the ArrayList. \r\n\t\t \tCollegeFootballTeam t = new CollegeFootballTeam(teamNames[i], teamConferences[i],teamsVotes);\r\n\t\t \t\r\n\t\t \t//Sums the votes for each team being added into the ArrayList\r\n\t\t \tt.setSumOfVotes();\r\n\t\t \t//t.setVotes(teamsVotes);\r\n\t\t \r\n\t\t \t// Add the team into the teams ArrayList.\r\n\t\t \tteams.add(t);\t\r\n\t\t }\t \r\n\t\t}\r\n\t\tcatch (FileNotFoundException e)\r\n\t\t{\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 load() throws CityException{\r\n \r\n allRanks = new ArrayList<Rank>();\r\n File file = new File(RANK_DATA_DIRECTORY);\r\n Scanner rankDataReader = null;\r\n Scanner lineReader = null;\r\n\r\n try {\r\n\r\n rankDataReader = new Scanner(file);\r\n\r\n ArrayList<String> rankDataArray = new ArrayList<String>();\r\n int count = 0;\r\n\r\n while (rankDataReader.hasNext()) {\r\n\r\n String rankDataLine = rankDataReader.nextLine();\r\n\r\n if (count > 0) {\r\n\r\n String[] rankData = rankDataLine.split(\",\");\r\n\r\n String rankName = rankData[0];\r\n int xp = Integer.parseInt(rankData[1]);\r\n int plotAvailable = Integer.parseInt(rankData[2]);\r\n\r\n allRanks.add(new Rank(rankName, xp, plotAvailable));\r\n }\r\n\r\n count++;\r\n }\r\n\r\n } catch (FileNotFoundException e) {\r\n throw new CityException(\"InvalidFile\");\r\n } finally {\r\n rankDataReader.close();\r\n }\r\n }", "public static HighScoresTable loadFromFile(File filename) {\n HighScoresTable newScoresTable = new HighScoresTable(4);\n ObjectInputStream inputStream = null;\n try {\n inputStream = new ObjectInputStream(new FileInputStream(filename));\n List<ScoreInfo> scoreFromFile = (List<ScoreInfo>) inputStream.readObject();\n if (scoreFromFile != null) {\n //scoreFromFile.clear();\n newScoresTable.scoreInfoList.addAll(scoreFromFile);\n }\n } catch (FileNotFoundException e) { // Can't find file to open\n System.err.println(\"Unable to find file: \" + filename);\n //return scoresTable;\n } catch (ClassNotFoundException e) { // The class in the stream is unknown to the JVM\n System.err.println(\"Unable to find class for object in file: \" + filename);\n //return scoresTable;\n } catch (IOException e) { // Some other problem\n System.err.println(\"Failed reading object\");\n e.printStackTrace(System.err);\n //return scoresTable;\n } finally {\n try {\n if (inputStream != null) {\n inputStream.close();\n }\n } catch (IOException e) {\n System.err.println(\"Failed closing file: \" + filename);\n }\n }\n return newScoresTable;\n\n\n }", "public static void main(String[] args) throws IOException {\n\n int scoresCount = scanner.nextInt();\n scanner.skip(\"(\\r\\n|[\\n\\r\\u2028\\u2029\\u0085])?\");\n\n int[] scores = new int[scoresCount];\n\n String[] scoresItems = scanner.nextLine().split(\" \");\n scanner.skip(\"(\\r\\n|[\\n\\r\\u2028\\u2029\\u0085])?\");\n\n for (int i = 0; i < scoresCount; i++) {\n int scoresItem = Integer.parseInt(scoresItems[i]);\n scores[i] = scoresItem;\n }\n\n int aliceCount = scanner.nextInt();\n scanner.skip(\"(\\r\\n|[\\n\\r\\u2028\\u2029\\u0085])?\");\n\n int[] alice = new int[aliceCount];\n\n String[] aliceItems = scanner.nextLine().split(\" \");\n scanner.skip(\"(\\r\\n|[\\n\\r\\u2028\\u2029\\u0085])?\");\n\n for (int i = 0; i < aliceCount; i++) {\n int aliceItem = Integer.parseInt(aliceItems[i]);\n alice[i] = aliceItem;\n }\n\n int[] result = climbingLeaderboard(scores, alice);\n for (int i = 0; i < result.length; i++) {\n \tSystem.out.print(result[i]+\" \");\n }\n\n// for (int i = 0; i < result.length; i++) {\n// bufferedWriter.write(String.valueOf(result[i]));\n//\n// if (i != result.length - 1) {\n// bufferedWriter.write(\"\\n\");\n// }\n// }\n//\n// bufferedWriter.newLine();\n//\n// bufferedWriter.close();\n\n scanner.close();\n }", "public void readFile(String filename) throws IOException {\n BufferedReader buffer = new BufferedReader(new FileReader(filename));\n\n String line;\n int row = 0;\n isFirstLine = true;\n\n while ((line = buffer.readLine()) != null) {\n String[] vals = line.trim().split(\"\\\\s+\");\n int length = vals.length;\n \n if(isFirstLine) {\n \tfor(int col = 0; col < 2; col++) {\n \t\tif(col == 0)\n \t\t\trowSize = Integer.parseInt(vals[col]);\n \t\telse\n \t\t\tcolSize = Integer.parseInt(vals[col]);\n \t}\n \tskiMap = new int[rowSize][colSize];\n \tisFirstLine = false;\n }\n else {\n \tfor (int col = 0; col < length; col++) {\n \tskiMap[row][col] = Integer.parseInt(vals[col]);\n }\n \t row++;\n }\n }\n \n if(buffer != null)\n \tbuffer.close();\n }", "String readScore(){\n try\n {\n char[] allAtOnce = new char[(int)scores.length()];\n int charsRead = fr.read(allAtOnce);\n currentScores = String.valueOf(allAtOnce);\n fr.close();//close the file\n fr = new BufferedReader(new FileReader(scores));\n }\n \n catch(IOException e)\n {\n e.printStackTrace();\n }\n return (String.valueOf(currentScores));\n }", "@Override\n public ArrayList<Pair<String, Integer>> getLeaderBoard() throws IOException {\n ArrayList<Pair<String, Integer>> leaderboard = new ArrayList<>();\n\n String sql = \"SELECT playernick, max(score) AS score FROM sep2_schema.player_scores GROUP BY playernick ORDER BY score DESC;\";\n ArrayList<Object[]> result;\n String playernick = \"\";\n int score = 0;\n\n try {\n result = db.query(sql);\n\n for (int i = 0; i < result.size(); i++) {\n Object[] row = result.get(i);\n playernick = row[0].toString();\n score = (int) row[1];\n leaderboard.add(new Pair<>(playernick, score));\n }\n } catch (SQLException e) {\n e.printStackTrace();\n }\n\n return leaderboard;\n }", "private void extractNewScoreBoard(){\n if (FileStorage.getInstance().fileNotExist(this, \"FinalScore1.ser\")){\n score = new Score();\n score.addScoreUser(user);\n FileStorage.getInstance().saveToFile(this.getApplicationContext(), score, \"FinalScore1.ser\");\n } else {\n score = (Score) FileStorage.getInstance().readFromFile(this, \"FinalScore1.ser\");\n score.insertTopFive(user);\n FileStorage.getInstance().saveToFile(this, score, \"FinalScore1.ser\");\n }\n }", "public static ArrayList<BoardPair> readFile(String inFileName, String format) {\n ArrayList<BoardPair> boardPairs = new ArrayList<BoardPair>();\n try { \n File inFile = new File(inFileName); \n BufferedReader reader = new BufferedReader(new FileReader(inFile));\n String line = null;\n while ((line=reader.readLine()) != null) { // loop as long as there are input lines \n if(line.contains(\"id,delta\")) \n continue; // skip header\n String str = line.trim(); \n // line fields are: id, delta, start1..400, stop1..400\n String[] tokens = str.split(\",\"); \n int row_id = Integer.parseInt( tokens[0] );\n int delta = Integer.parseInt( tokens[1] );\n int[][] startBoard = new int[Consts.BOARD_SIDE][Consts.BOARD_SIDE]; \n int[][] stopBoard = new int[Consts.BOARD_SIDE][Consts.BOARD_SIDE]; \n for(int col=0; col<Consts.BOARD_SIDE; col++) { \n for(int row=0; row<Consts.BOARD_SIDE; row++) {\n if(format==\"train\") { \n // train format: id, delta, start.1-start.400, stop.1-stop.400\n // note column major order!\n int startIndex = col*Consts.BOARD_SIDE + row + 2; \n int stopIndex = startIndex + Consts.BOARD_SIDE*Consts.BOARD_SIDE;\n startBoard[row][col]= Integer.parseInt( tokens[startIndex] );\n stopBoard[ row][col]= Integer.parseInt( tokens[stopIndex ] );\n } \n if(format==\"test\") {\n // test format is: id, delta, stop.1-stop.400\n // note column major order!\n int stopIndex = col*Consts.BOARD_SIDE + row + 2; \n startBoard = null; \n stopBoard[ row][col]= Integer.parseInt( tokens[stopIndex ] );\n }\n }\n }\n boardPairs.add( new BoardPair(row_id, delta, startBoard, stopBoard) );\n } \n reader.close(); \n } catch (IOException e) {\n System.out.println(\"ERROR reading: \" + inFileName);\n }\n return boardPairs;\n }", "public void loadTrollPiece(HashMap<Integer, TrollPiece> TrollPiece_HASH){\r\n \r\n try {\r\n Scanner scanner = new Scanner(new File(file_position+\"TrollPiece.csv\"));\r\n Scanner dataScanner = null;\r\n int index = 0;\r\n \r\n while (scanner.hasNextLine()) {\r\n dataScanner = new Scanner(scanner.nextLine());\r\n \r\n if(TrollPiece_HASH.size() == 0){\r\n dataScanner = new Scanner(scanner.nextLine());\r\n }\r\n \r\n dataScanner.useDelimiter(\",\");\r\n TrollPiece trollPiece = new TrollPiece(-1, -1);\r\n \r\n while (dataScanner.hasNext()) {\r\n String data = dataScanner.next();\r\n if (index == 0) {\r\n trollPiece.setId(Integer.parseInt(data));\r\n } else if (index == 1) {\r\n trollPiece.setAreaNumber(Integer.parseInt(data));\r\n } else {\r\n System.out.println(\"invalid data::\" + data);\r\n }\r\n index++;\r\n }\r\n \r\n TrollPiece_HASH.put(trollPiece.getId(), trollPiece);\r\n index = 0;\r\n }\r\n \r\n scanner.close();\r\n \r\n } catch (FileNotFoundException ex) {\r\n System.out.println(\"Error: FileNotFound - loadTrollPiece\");\r\n }\r\n \r\n }", "public static Map readMap(File f)\n {\n Map map = new Map(1);\n try\n {\n MapReader run = new MapReader();\n Scanner mapReader = new Scanner(f);\n ArrayList<String[]> numberLines = new ArrayList<String[]>();\n int dim = mapReader.nextInt();\n mapReader.nextLine();\n for(int gh = 0 ; gh < dim; gh++)\n {\n String[] nums = mapReader.nextLine().split(\" \");\n numberLines.add(nums);\n }\n int[][] newMap = new int[numberLines.size()][numberLines.size()];\n \n for(int i = 0; i < numberLines.size();i++)\n {\n for(int h = 0; h < numberLines.get(i).length;h++)\n {\n newMap[i][h] = Integer.parseInt(numberLines.get(i)[h]);\n }\n }\n map.loadMap(newMap);\n \n TreeMap<Integer,ArrayList<Integer>> spawn1 = map.getSpawn1();\n TreeMap<Integer,ArrayList<Integer>> spawn2 = map.getSpawn2();\n \n String line = \"\";\n while(mapReader.hasNextLine() && (line = mapReader.nextLine()).contains(\"spawn1\"))\n {\n Scanner in = new Scanner(line);\n in.next();\n int x = in.nextInt();\n spawn1.put(x, new ArrayList<Integer>());\n while(in.hasNextInt())\n {\n spawn1.get(x).add(in.nextInt());\n }\n }\n \n if(!line.equals(\"\"))\n {\n Scanner in = new Scanner(line);\n in.next();\n int x = in.nextInt();\n spawn2.put(x, new ArrayList<Integer>());\n while(in.hasNextInt())\n {\n spawn2.get(x).add(in.nextInt());\n }\n }\n while(mapReader.hasNextLine() && (line = mapReader.nextLine()).contains(\"spawn2\"))\n {\n Scanner in = new Scanner(line);\n in.next();\n int x = in.nextInt();\n spawn2.put(x, new ArrayList<Integer>());\n while(in.hasNextInt())\n {\n spawn2.get(x).add(in.nextInt());\n }\n }\n }\n catch (Exception ex)\n {\n JOptionPane.showMessageDialog(null, \"Corrupted file!\");\n }\n return map;\n }", "private void read(String filename) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(filename));\n\t\t\n\t\t//a variable that will increase by one each time another element is added to the array\n\t\t//to ensure array size is correct\n\t\tint numStation = 0;\n\t\t\n\t\t//ignores first 6 lines\n\t\tfor(int i = 0; i < 3; ++i){\n\t\t\tbr.readLine();\n\t\t}\n\t\t\n\t\t//sets String equal readline\n\t\tString lineOfData = br.readLine();\n\n\t\twhile(lineOfData != null)\n\t\t{\n\t\t\tString station = new String();\n\t\t\tstation = lineOfData.substring(10,14);\n\t\t\tMesoAsciiCal asciiAverage = new MesoAsciiCal(new MesoStation(station));\n\t\t\tint asciiAvg = asciiAverage.calAverage();\t\t\n\n\t\t\tHashMap<String, Integer> asciiVal = new HashMap<String, Integer>();\n\t\t\t//put the keys and values into the hashmap\n\t\t\tasciiVal.put(station, asciiAvg);\n\t\t\t//get ascii interger avg value\n\t\t\tInteger avg = asciiVal.get(station);\n\t\t\t\n\t\t\thashmap.put(station,avg);\n\t\t\t\n\t\t\tlineOfData = br.readLine();\n\t\t\t\n\t\t}\n\t\t\n\t\tbr.close();\n\t}", "public static int loadSchools(ArrayList<School> H) {\n\n\t\tboolean isValid = false;\n\n\t\tString values[] = new String[4002];\n\n\t\tString line = \"\";\n\t\tString strLine = \"\";\n\t\tdouble alpha = 0.00;\n\t\tint i = 0;\n\t\tint successfulSchools = 0;\n\t\tschoolsEntered = 0; // as soon as loadSchools is called\n\t\t// schoolsEntered += loadedSchoolsNum;\n\n\t\tString school_file = \"\";\n\n\t\tdo {\n\t\t\tisValid = true;\n\n\t\t\ttry {\n\t\t\t\tSystem.out.print(\"Enter school file name (0 to cancel): \");\n\t\t\t\tschool_file = input.readLine();\n\t\t\t\tif (school_file.equalsIgnoreCase(\"0\")) {\n\t\t\t\t\tSystem.out.println(\"\");\n\t\t\t\t\tSystem.out.println(\"File loading process canceled.\");\n\t\t\t\t\tSystem.out.println(\"\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\tBufferedReader fin = new BufferedReader(new FileReader(\n\t\t\t\t\t\tschool_file));\n\t\t\t\t// After file has been read, we'll start parsing through it and\n\t\t\t\t// populating our School Object with the relevant data.\n\t\t\t\t// get number of schools with a while loop\n\t\t\t\twhile ((line = fin.readLine()) != null) {\n\n\t\t\t\t\tvalues = line.split(\",\");\n\t\t\t\t\tif (values.length == 3) {\n\n\t\t\t\t\t\tif ((Double.parseDouble(values[1]) <= 1.00)\n\t\t\t\t\t\t\t\t&& (Double.parseDouble(values[1]) >= 0.00)) {\n\t\t\t\t\t\t\t// H[schoolsEntered] = new School( values[0],\n\t\t\t\t\t\t\t// Double.parseDouble(values[1]), numStudentsAdded);\n\t\t\t\t\t\t\t// System.out.println(H[schoolsEntered].getName());\n\t\t\t\t\t\t\tif (Integer.parseInt(values[2]) >= 1) {\n\t\t\t\t\t\t\t\t// took out loadedSchoolsNum\n\t\t\t\t\t\t\t\tH.add(new School(values[0], Double\n\t\t\t\t\t\t\t\t\t\t.parseDouble(values[1]),\n\t\t\t\t\t\t\t\t\t\tnumStudentsAdded, Integer\n\t\t\t\t\t\t\t\t\t\t\t\t.parseInt(values[2])));\n\t\t\t\t\t\t\t\tloadedSchoolsNum++;\n\t\t\t\t\t\t\t\tsuccessfulSchools++;\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\tschoolsEntered++;\n\t\t\t\t}\n\n\t\t\t\tfin.close();\n\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tSystem.out.println(\"ERROR: File not found!\");\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tisValid = false;\n\t\t\t} catch (IOException e) {\n\n\t\t\t}\n\n\t\t} while (!isValid);\n\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(successfulSchools + \" of \" + schoolsEntered\n\t\t\t\t+ \" schools loaded!\");\n\t\tSystem.out.println(\"\");\n\n\t\treturn successfulSchools;\n\n\t}", "public static ArrayList<Sprite> readLevel(String currentLevel) throws IOException {\n\n ArrayList<Sprite> spriteList = new ArrayList<>();\n String[] line;\n String text;\n\n try (BufferedReader reader = new BufferedReader(new FileReader(currentLevel))) {\n\n\n while((text = reader.readLine()) != null) {\n\n line = text.split(\",\");\n\n switch (line[0]) {\n case \"water\":\n spriteList.add(Tile.createWaterTile(Float.parseFloat(line[1]), Float.parseFloat(line[2])));\n break;\n\n case \"grass\":\n spriteList.add(Tile.createGrassTile(Float.parseFloat(line[1]), Float.parseFloat(line[2])));\n break;\n\n case \"tree\":\n spriteList.add(Tile.createTreeTile(Float.parseFloat(line[1]), Float.parseFloat(line[2])));\n break;\n\n case \"bus\":\n spriteList.add(new Bus(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Boolean.parseBoolean(line[3])));\n break;\n\n case \"bulldozer\":\n spriteList.add(new Bulldozer(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Boolean.parseBoolean(line[3])));\n break;\n\n case \"log\":\n spriteList.add(new Log(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Boolean.parseBoolean(line[3])));\n break;\n\n case \"longLog\":\n spriteList.add(new LongLog(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Boolean.parseBoolean(line[3])));\n break;\n\n case \"racecar\":\n spriteList.add(new Racecar(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Boolean.parseBoolean(line[3])));\n break;\n\n case \"turtle\":\n spriteList.add(new Turtle(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Boolean.parseBoolean(line[3])));\n break;\n\n case \"bike\":\n spriteList.add(new Bike(Float.parseFloat(line[1]), Float.parseFloat(line[2]), Boolean.parseBoolean(line[3])));\n break;\n }\n }\n }\n return spriteList;\n }", "public List<Student> importStudent(String filename) throws FileNotFoundException {\n List<Student> students = new ArrayList<>();\n FileReader fileReader = new FileReader(DATA_PATH + filename);\n Scanner scanner = new Scanner(fileReader);\n //skip first line\n String firstLine = scanner.nextLine();\n Log.i(\"first line: \" + firstLine);\n\n while (scanner.hasNextLine()) {\n String[] s = scanner.nextLine().split(\",\");\n String fullName = s[0];\n int yearLevel = Integer.parseInt(s[1]);\n Student student = new Student(fullName, yearLevel);\n students.add(student);\n }\n\n scanner.close();\n return students;\n }", "public void loadEPILine(File file)\r\n\t{\r\n\t\tString name=file.getName();\r\n\t\tint [][] result=null;\r\n\t\ttry \r\n\t\t{\r\n\t\t\tScanner scanner=new Scanner(file);\r\n\t\t\tint size=scanner.nextInt();\r\n\t\t\tint width=scanner.nextInt();\t\t\t\r\n\t\t\tresult=new int[size][width];\r\n\t\t\tscanner.useDelimiter(\",\");\r\n\t\t\tString temp;\r\n\t\t\tfor(int i=0;i<size;i++)\r\n\t\t\t\tfor(int j=0;j<width;j++)\r\n\t\t\t\t{\r\n\t\t\t\t\ttemp=scanner.next();\r\n\t\t\t\t\tresult[i][j]=Integer.parseInt(temp.trim());\r\n\t\t\t\t}\r\n\t\t\tscanner.close();\t\r\n\t\t} catch (FileNotFoundException e) \r\n\t\t{\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t_pixels=result;\r\n\t\t\r\n\t\t//That's why I needed to get rid of \"_\" in directory name\r\n\t\tname=name.substring(0,name.lastIndexOf(\".\"));\r\n\t\tString[] split=name.split(\"_\");\r\n\t\t_line=Integer.parseInt(split[1])+1;\r\n\t\t_position=Position.valueOf(split[2]);\r\n\t\t\r\n\t}", "public static int ReadBestScore()\n {\n int best_score = -1;\n try \n {\n BufferedReader file = new BufferedReader(new FileReader(score_file_name));\n best_score = Integer.parseInt(file.readLine());\n file.close();\n } \n catch (Exception e) { SaveBestScore(0); }\n \n currentBestScore = best_score;\n return best_score;\n }", "static void experiment1Day1Part1() {\n\n File file = new File(\"src/main/java/weekone/input01.txt\");\n FileReader fileReader = null;\n BufferedReader bufferedReader = null;\n int sum = 0;\n\n try {\n fileReader = new FileReader(file);\n bufferedReader = new BufferedReader(fileReader);\n\n while ((bufferedReader.read() != -1)) {\n String line = bufferedReader.readLine();\n System.out.println(\"\\nThe string is: \" + line);\n int number = Integer.valueOf(line);\n\n System.out.println(\"The number is: \" + number);\n\n }\n\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n try {\n if (fileReader != null)\n fileReader.close();\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n }\n System.out.println(\"The sum is: \" + sum);\n }", "public void writeFile(){\n try{\n FileWriter writer = new FileWriter(\"Highscores.txt\");\n for (int i = 0; i<10; i++){\n if (i >= this.highscores.size()){\n break;\n }\n writer.write(String.valueOf(this.highscores.get(i)) + \"\\n\");\n }\n writer.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public int parseRulesFile() {\n\t BufferedReader reader = null;\n\t List<String> allLines = new ArrayList<String>();\n\t List<String> allLinesWithLintChecks = new ArrayList<String>();\n\t listOfRules = new ArrayList<String>();\n\t boolean eof = false;\n\t try {\n\t reader = new BufferedReader(new FileReader(pathTextFile));\n\t while (!eof) {\n\t String line = reader.readLine();\n\n\t if (line != null) {\n\t allLines.add(line);\n\t } else {\n\t eof = true;\n\t }\n\t }\n\n\t for (String line : allLines) {\n\t if (line.contains(\":\") && line.contains(\"\\\"\")) {\n\t allLinesWithLintChecks.add(line);\n\t }\n\t }\n\n\t for (String rule : allLinesWithLintChecks) {\n\t int position = rule.indexOf(\":\");\n\t listOfRules.add(rule.substring(1, position - 1));\n\t }\n\t } catch (FileNotFoundException ex) {\n\t System.err.println(\"File not found!\");\n\t ex.printStackTrace();\n\t } catch (IOException ex) {\n\t System.err.println(\"Error!!\");\n\t ex.printStackTrace();\n\t } finally {\n\t try {\n\t reader.close();\n\t } catch (IOException ex1) {\n\t System.out.println(\"Error when closing file !!\");\n\t }\n\t }\n\t return listOfRules.size();\n\t }", "public void saveScores(){\n try {\n File f = new File(filePath, highScores);\n FileWriter output = new FileWriter(f);\n BufferedWriter writer = new BufferedWriter(output);\n\n writer.write(topScores.get(0) + \"-\" + topScores.get(1) + \"-\" + topScores.get(2) + \"-\" + topScores.get(3) + \"-\" + topScores.get(4));\n writer.newLine();\n writer.write(topName.get(0) + \"-\" + topName.get(1) + \"-\" + topName.get(2) + \"-\" + topName.get(3) + \"-\" + topName.get(4));\n writer.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public static void main(String[] args) throws IOException{\n\t\tBufferedReader br=new BufferedReader(new FileReader(\"numbers.txt\"));\r\n\t\tString line=br.readLine();\r\n\t\tString evennum[]=line.split(\",\");\r\n\t\tfor(int i=0;i<evennum.length;i++) {\r\n\t\t\tint num=Integer.parseInt(evennum[i]);\r\n\t\t\t\r\n\t\t\tif(num%2==0)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(num);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}", "private void takeInFile() {\n System.out.println(\"Taking in file...\");\n //Reads the file\n String fileName = \"messages.txt\";\n String line = null;\n try {\n FileReader fileReader = new FileReader(fileName);\n \n BufferedReader bufferedReader = new BufferedReader(fileReader);\n\n //Adds each line to the ArrayList\n int i = 0;\n while ((line = bufferedReader.readLine()) != null) {\n lines.add(line);\n //System.out.println(line);\n i++;\n }\n \n bufferedReader.close();\n } catch (FileNotFoundException ex) {\n System.out.println(\"Unable to open file '\" + fileName + \"'\");\n } catch (IOException ex) {\n System.out.println(\"Error reading file '\" + fileName + \"'\");\n }\n System.out.println(\"Done taking in file...\");\n }" ]
[ "0.71919644", "0.70113355", "0.69262385", "0.6923316", "0.684738", "0.68365353", "0.67341655", "0.6440437", "0.64003456", "0.6366309", "0.6288818", "0.62747437", "0.6197335", "0.6182659", "0.617952", "0.6124673", "0.6124598", "0.6079359", "0.59963274", "0.59680337", "0.5963122", "0.593701", "0.59344995", "0.59160626", "0.59155595", "0.5911834", "0.58943355", "0.58812034", "0.5860673", "0.5857965", "0.58525455", "0.5835944", "0.58051944", "0.57449895", "0.57419074", "0.5740147", "0.5703363", "0.56840783", "0.5672453", "0.56471574", "0.562726", "0.56011724", "0.5598889", "0.55934924", "0.5580008", "0.55711585", "0.5540304", "0.552288", "0.55206335", "0.55035865", "0.54977983", "0.54971945", "0.5485319", "0.5484408", "0.54800326", "0.5478782", "0.54695207", "0.54683083", "0.54670197", "0.54532635", "0.5428466", "0.54280496", "0.5419145", "0.541569", "0.5405741", "0.53989005", "0.5384524", "0.53574735", "0.5332849", "0.53254783", "0.53134596", "0.5311958", "0.53112775", "0.5307665", "0.53071266", "0.5303521", "0.528672", "0.5282953", "0.52824897", "0.5276438", "0.527235", "0.5262613", "0.52619696", "0.5248169", "0.5243855", "0.52341515", "0.5229282", "0.52272975", "0.52266216", "0.52228045", "0.5221827", "0.52174187", "0.5217066", "0.52104676", "0.520746", "0.5201991", "0.5201914", "0.51958144", "0.51913315", "0.5178197" ]
0.8392254
0
/ Whenever the highscores are sorted this should be sorted from highest to lowest collections will sort from lowest to highest by default so the reverse method is called right after
public void sortHighscores(){ Collections.sort(highscores); Collections.reverse(highscores); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void sortScores(){\r\n // TODO: Use a single round of bubble sort to bubble the last entry\r\n // TODO: in the high scores up to the correct location.\r\n \tcount=0;\r\n \tfor(int i=Settings.numScores-1; i>0;i--){\r\n \t\tif(scores[i]>scores[i-1]){\r\n \t\t\tint tempS;\r\n \t\t\ttempS=scores[i];\r\n \t\t\tscores[i]=scores[i-1];\r\n \t\t\tscores[i-1]=tempS;\r\n \t\t\t\r\n \t\t\tString tempN;\r\n \t\t\ttempN=names[i];\r\n \t\t\tnames[i]=names[i-1];\r\n \t\t\tnames[i-1]=tempN;\r\n \t\t\tcount++;\r\n \t\t}\r\n \t}\r\n }", "public void sortHighScores(){\n for(int i=0; i<MAX_SCORES;i++){\n long score = highScores[i];\n String name= names[i];\n int j;\n for(j = i-1; j>= 0 && highScores[j] < score; j--){\n highScores[j+1] = highScores[j];\n names[j+1] = names[j];\n }\n highScores[j+1] = score;\n names[j+1] = name;\n }\n }", "public void sortScoresDescendently(){\n this.langsScores.sort((LangScoreBankUnit o1, LangScoreBankUnit o2) -> {\n return Double.compare(o2.getScore(),o1.getScore());\n });\n }", "private void sortEScores() {\n LinkedHashMap<String, Double> sorted = eScores\n .entrySet()\n .stream()\n .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))\n .collect(\n toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2,\n LinkedHashMap::new));\n eScores = sorted;\n }", "private void sort() {\n ScoreComparator comparator = new ScoreComparator();\n Collections.sort(scores, comparator);\n }", "public void sortDescending()\r\n\t{\r\n\t\tList<Book> oldItems = items;\r\n\t\titems = new ArrayList<Book>(items);\r\n\t\tCollections.sort(items, Collections.reverseOrder());\r\n\t\tfirePropertyChange(\"books\", oldItems, items);\r\n\t}", "private void sortScoreboard() {\n score.setSortType(TableColumn.SortType.DESCENDING);\n this.scoreboard.getSortOrder().add(score);\n score.setSortable(true);\n scoreboard.sort();\n }", "void FlipBook()\r\n\t\t{\r\n\t\t\t Collections.reverse(this);\r\n\t\t}", "public static List<Double> sortScores(List<Double> results) {\n\t\t\n\t\t\n\t\tfor (int i = 0; i < results.size()-1; i++) {\n\t\t\tif (results.get(i)>results.get(i+1)) {\n\t\t\t\t//highScore = results.get(i);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tDouble temp = results.get(i);\n\t\t\t\t\n\t\t\t\tresults.set(i, results.get(i+1));\n\t\t\t\t\n\t\t\tresults.set(i+1, temp);\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\n\t\t\n\t\treturn results;\n\t\t//return null;\n\t}", "private void sortPlayerScores(){\n text=\"<html>\";\n for (int i = 1; i <= Options.getNumberOfPlayers(); i++){\n if(Collections.max(playerScores.entrySet(), (entry1, entry2) -> entry1.getValue() - entry2.getValue()).getKey() != null){\n Integer pl = Collections.max(playerScores.entrySet(), (entry1, entry2) -> entry1.getValue() - entry2.getValue()).getKey();\n if(pl != null && playerScores.containsKey(pl)){\n text += \"<p>Player \" + pl + \" Scored : \" + playerScores.get(pl) + \" points </p></br>\";\n playerScores.remove(pl);\n }\n }\n }\n text += \"</html>\";\n }", "public ArrayList<Question> getQuestionsSortedByScore() {\n \t\tArrayList<Question> sortedQuestions = questions;\n \n \t\tCollections.sort(sortedQuestions, Collections.reverseOrder(new ScoreComparator()));\n \t\t\n \t\treturn sortedQuestions;\n \t}", "public void calculateHighscores(){\n if((newPlayer.getScore() > (getRecord())) && (newPlayer.getScore() > getRecord2()) && (newPlayer.getScore() > getRecord3())){\n setRecord3(getRecord2());\n setRecord2(getRecord());\n setRecord(newPlayer.getScore());\n newPlayer.resetScore();\n }\n if((newPlayer.getScore() > getRecord2()) && (newPlayer.getScore() > getRecord3()) && (newPlayer.getScore() < getRecord())){\n setRecord3(getRecord2());\n setRecord2(newPlayer.getScore());\n newPlayer.resetScore();\n }\n if((newPlayer.getScore() > getRecord3()) && newPlayer.getScore() < getRecord2()){\n setRecord3(newPlayer.getScore());\n newPlayer.resetScore();\n }else{\n newPlayer.resetScore();\n\n }\n }", "@Override\n\tpublic int compareTo(Record record) {\n\t\t// If we reverse this, the order will be descending\n\t\treturn record.score - this.score;\n\t}", "private void updateHighscore() {\n if(getScore() > highscore)\n highscore = getScore();\n }", "public DataSet<T> sortByScoreDesc() {\n return toDS(this.getDataStream().sorted());\n }", "public void sort()\n\t{\n\t\tfor(int i=0;i<bowlers.size()-1;i++)\n\t\t{\n\t\t\tfor(int j=i+1;j<bowlers.size();j++)\n\t\t\t{\n\t\t\t\tif(bowlers.get(i).getBall()<bowlers.get(j).getBall())\n\t\t\t\t{\n\t\t\t\t\tBowler bowler=bowlers.get(i);\n\t\t\t\t\tbowlers.set(i,bowlers.get(j));\n\t\t\t\t\tbowlers.set(j,bowler);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<bowlers.size();i++)\n\t\t{\n\t\tSystem.out.println(bowlers.get(i).getBall());\n\t\t}\n\t}", "@SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n\tprivate static ArrayList<Result> sortByScore(ArrayList<Result> sortThis){\n\t\tArrayList<Result> sorted = sortThis;\n\t\tCollections.sort(sorted, new Comparator(){\n\t\t\t\n\t\t\tpublic int compare(Object o1, Object o2){\n\t\t\t\tResult r1 = (Result) o1;\n\t\t\t\tResult r2 = (Result) o2;\n\n\t\t\t\tDouble Score1 = new Double(r1.getScore());\n\t\t\t\tDouble Score2 = new Double(r2.getScore());\n\t\t\t\treturn Score1.compareTo(Score2);\n\t\t\t}\n\t\t});\n\t\tCollections.reverse(sorted);\n\t\t\n\t\treturn sorted;\n\t}", "private void bubbleSort() {\r\n\r\n int n = leaderboardScores.size();\r\n int intChange;\r\n String stringChange;\r\n\r\n for (int i = 0 ; i < n - 1 ; i ++ ) {\r\n for (int j = 0 ; j < n - i - 1 ; j ++ ) {\r\n\r\n if (leaderboardScores.get(j) > leaderboardScores.get(j + 1)) {\r\n // swap arr[j+1] and arr[i]\r\n intChange = leaderboardScores.get(j);\r\n leaderboardScores.set(j, leaderboardScores.get(j + 1));\r\n leaderboardScores.set(j + 1, intChange);\r\n\r\n stringChange = leaderboardUsers.get(j);\r\n leaderboardUsers.set(j, leaderboardUsers.get(j + 1));\r\n leaderboardUsers.set(j + 1, stringChange);\r\n }\r\n\r\n }\r\n }\r\n }", "private static void compareForReverseArrays() {\n Integer[] reverse1 = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};\n Integer[] reverse2 = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};\n Insertion insertion = new Insertion();\n insertion.analyzeSort(reverse1);\n insertion.getStat().printReport();\n\n Selection selection = new Selection();\n selection.analyzeSort(reverse2);\n selection.getStat().printReport();\n }", "public void triCollection(){\r\n Collections.sort(collection);\r\n }", "public static List<ScoreBean> sortDescending(List<ScoreBean> listScores) {\n Comparator<ScoreBean> comparator = new Comparator<ScoreBean>() {\n @Override\n public int compare(ScoreBean o1, ScoreBean o2) {\n return o2.getScore() - o1.getScore();\n }\n };\n Collections.sort(listScores, comparator);\n return listScores;\n }", "public void oldSort()\n\t{\n\t\tfor (int index = 0; index < arraySize; index++) {\n\t\t\tfor (int secondIndex = index + 1; secondIndex < arraySize; secondIndex++) {\n\t\t\t\tint temp = 0;\n\t\t\t\tif (array[index] > array[secondIndex]) {\n\t\t\t\t\ttemp = array[index];\n\t\t\t\t\tarray[index] = array[secondIndex];\n\t\t\t\t\tarray[secondIndex] = temp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}", "private List<Score> order(List<Score> s)\n {\n Collections.sort(s, new Comparator<Score>()\n {\n\n @Override\n public int compare(Score o1, Score o2) {\n // TODO Auto-generated method stub\n\n return o1.getSentId() - o2.getSentId();\n }\n });\n return s;\n }", "public void sort()\n {\n\tstrack.sort((Node n1, Node n2) ->\n\t{\n\t if (n1.getCost() < n2.getCost()) return -1;\n\t if (n1.getCost() > n2.getCost()) return 1;\n\t return 0;\n\t});\n }", "private void sortOutlines() {\r\n Collections.sort(outlines, reversSizeComparator);\r\n }", "protected void sort() {\n\n\t\tCollections.sort(this.myRRList);\n\t}", "private static void sortFriends() {\n friends.postValue(friends.getValue());\n }", "private void printHistoryReverse()\r\n\t{\r\n\t\tStack temp = new Stack(SIZE);\r\n\t\t\r\n\t\tSystem.out.println(\"\\nBrowsing History (Most Recent to Oldest):\");\r\n\t\tfor (int i = 0; i < siteVisited; i++)\r\n\t\t{\r\n\t\t\tSystem.out.println(chronological.peek());\t\t//print out value currently at the top of stack\r\n\t\t\ttemp.push(chronological.pop());\t\t\t\t\t//pop the top of stack and push to another stack\r\n\t\t}\r\n\t\tfor (int i = 0; i < siteVisited; i++)\r\n\t\t\tchronological.push(temp.pop());\t\t\t\t\t//push all elements of temp back to the original stack\r\n\t}", "public void toggleFurnitureSortOrder() {\n this.home.setFurnitureDescendingSorted(!this.home.isFurnitureDescendingSorted());\n }", "private static double getHighestScore (List<Double> inputScores) {\n\n\t\tCollections.sort(inputScores, Collections.reverseOrder());\n\n\t\treturn inputScores.get(0);\n\n\t}", "public void reverse(int[] nums, int low, int high) {\n while (low < high) {\n\n // swap low and high indices\n int temp = nums[high];\n nums[high--] = nums[low];\n nums[low++] = temp;\n }\n }", "public void scoreSorting(SortingQuiz scoringMethod, SortingSample s) {\r\n for(int i=1; i<=s.answers.size(); i++) {\r\n HourGlass scores = new HourGlass();\r\n scores.weightAnswer(scoringMethod.answers.get(s.getAnswerNum(i)));\r\n System.out.println(scores);\r\n// this.scores.weightAnswer(scoringMethod.answers.get(s.getAnswerNum(i)));\r\n }\r\n }", "public static void main(String[] args) {\n List list = new ArrayList<>();\n list.add(10);\n list.add(50);\n list.add(30);\n list.add(60);\n list.add(20);\n list.add(90);\n list.add(20);\n \n// Iterator i = list.iterator();\n System.out.println(\"Printing Given Array..\");\n// while(i.hasNext())\n// {\n// \t System.out.println(i.next());\n// }\n for(int j=0;j<list.size();j++)\n {\n \t System.out.println(list.get(j));\n }\n \n Comparator cmp = Collections.reverseOrder();\n Collections.sort(list, cmp);\n System.out.println(\"printing list in descending order..\");\n Iterator i2 = list.iterator();\n while(i2.hasNext())\n {\n \t System.out.println(i2.next());\n }\n\t}", "private void sortEntities(){\n for (int i = 1; i < sorted.size; i++) {\n for(int j = i ; j > 0 ; j--){\n \tEntity e1 = sorted.get(j);\n \tEntity e2 = sorted.get(j-1);\n if(getRL(e1) < getRL(e2)){\n sorted.set(j, e2);\n sorted.set(j-1, e1);\n }\n }\n }\n }", "@Override\n\t\t\tpublic int compare(Sentence s1, Sentence s2) {\n\t\t\t\tif(s1.getScore() > s2.getScore()) return -1;\n\t\t\t\telse return 1;\n\t\t\t}", "public void sortByQnNum() {\r\n\t\tfor (int j = 0; j < displayingList.size() - 1; j++) {\r\n\t\t\tfor (int i = 0; i < displayingList.size() - j - 1; i++) {\r\n\t\t\t\tif (displayingList.get(i).getQnNum() > displayingList.get(i + 1).getQnNum()) {\r\n\t\t\t\t\tswapPosition(displayingList, i, i + 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void reverse() {\n\t\tif (!this.isEmpty()) {\n\t\t\tT x = this.peek();\n\t\t\tthis.pop();\n\t\t\treverse();\n\t\t\tinsert_at_bottom(x);\n\t\t} else\n\t\t\treturn;\n\t}", "public void _reverse() {\n\n var prev = first;\n var current = first.next;\n last = first;\n last.next = null;\n while (current != null) {\n var next = current.next;\n current.next = prev;\n prev = current;\n current = next;\n\n }\n first = prev;\n\n }", "public int compareTo(HighScore h) {\n\t\treturn h.score - this.score;\n\t}", "public static void DecOrder(ArrayList<Integer> list)\n{\n // Your code here\n Collections.sort(list, Collections.reverseOrder());\n}", "private void sort() {\n\t\tCollections.sort(this.entities, comparator);\n\t}", "@Test\n public void testSort() {\n initialize();\n var realList = new HighScoreList();\n realList.setList(list);\n realList.sort();\n\n assertEquals(300, realList.getList().get(0).getScore());\n assertEquals(200, realList.getList().get(1).getScore());\n assertEquals(100, realList.getList().get(2).getScore());\n }", "public HighScore(){\n readFile();\n sortHighscores();\n }", "public static void main(String[] args) {\n int[] intArray = {20, 35, -15, 7, 55, 1, -22};\n\n for (int lastUnsortedIndex = intArray.length - 1; lastUnsortedIndex > 0; lastUnsortedIndex--) {\n for (int i = 0; i < lastUnsortedIndex; i++) {\n if (intArray[i] > intArray[i + 1]) {\n swap(intArray, i, i + 1);\n }\n }\n }\n\n for (int i = 0; i < intArray.length; i ++) {\n System.out.println(intArray[i]);\n }\n }", "private void sortResults(){\r\n this.sortedPlayers = new ArrayList<>();\r\n int size = players.size();\r\n while (size > 0) {\r\n Player lowestPointsPlayer = this.players.get(0);\r\n for(int i = 0; i<this.players.size(); i++){\r\n if(lowestPointsPlayer.getPoints() <= this.players.get(i).getPoints()){\r\n lowestPointsPlayer = this.players.get(i);\r\n }\r\n }\r\n this.sortedPlayers.add(lowestPointsPlayer);\r\n this.players.remove(lowestPointsPlayer);\r\n size--;\r\n }\r\n\r\n\r\n }", "public Iterable<Integer> reverseOrder() {\r\n\t\treturn reverseOrder;\r\n\t}", "public LinkedList<int[]> qSortDescending( int[] sortArr, int low, int high ){\n if( low < high ){\n int partitionIndex = DescendingPartition( sortArr, low, high );\n qSortDescending( sortArr, low, partitionIndex - 1 );\n qSortDescending( sortArr, partitionIndex + 1, high );\n this.replayFrames.addLast( Arrays.copyOfRange(sortArr, 0, sortArr.length ) );\n return replayFrames;\n } else return null;\n }", "public static void main(String args[]) {\n LinkedList ll = new LinkedList();\n ll.add(new Integer(-8));\n ll.add(new Integer(20));\n ll.add(new Integer(-20));\n ll.add(new Integer(8));\n\n // Create a reverse order comparator\n Comparator r = Collections.reverseOrder();\n\n // Sort list by using the comparato\n Collections.sort(ll, r);\n\n // Get iterator\n Iterator li = ll.iterator();\n System.out.print(\"List soreted in reverse: \");\n\n while(li.hasNext()) {\n System.out.print(li.next() + \" \");\n }\n System.out.println();\n Collections.shuffle(ll);\n\n // display randomized list\n li = ll.iterator();\n System.out.print(\"List shffled: \");\n\n while(li.hasNext()) {\n System.out.print(li.next() + \" \");\n }\n \n System.out.println();\n System.out.println(\"Minimum: \" + Collections.min(ll));\n System.out.println(\"Maximum: \" + Collections.max(ll));\n }", "private void sort() {\n Collections.sort(mEntries, new Comparator<BarEntry>() {\n @Override\n public int compare(BarEntry o1, BarEntry o2) {\n return o1.getX() > o2.getX() ? 1 : o1.getX() < o2.getX() ? -1 : 0;\n }\n });\n }", "public static List<Double> sortScores(List<Double> results) {\n\t\tfor (int i = 0; i < results.size(); i++) {\n\t\t\tint index = i;\n\t\t\tfor (int j = i + 1; j < results.size(); j++) {\n\t\t\t\tif (results.get(j) < results.get(index)) {\n\t\t\t\t\tindex = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble temp = results.get(index);\n\t\t\tresults.set(index, results.get(i));\n\t\t\tresults.set(i, temp);\n\t\t}\n\t\treturn results;\n\t}", "public void sortHand(){\n\t\thand.sort(PlayingCard.PlayingCardComparator_ACEHIGH);\n\t}", "@Override public LinkedList<int[]> sortDescending(int[] sortArr) {\n return qSortDescending( sortArr, 0, sortArr.length-1 );\n }", "public static void SortPlayers () {\r\n boolean sorted = false;\r\n Player temp;\r\n\r\n while (!sorted) {\r\n sorted = true;\r\n for (int i = 0; i < player.length - 1; i++) {\r\n if (player[i].score > player[i + 1].score) {\r\n\r\n // SWAP THE OBJECTS' POSITION IN THE ARRAY\r\n temp = player[i];\r\n player[i] = player[i + 1];\r\n player[i + 1] = temp;\r\n\r\n sorted = false;\r\n }\r\n\r\n }\r\n }\r\n\r\n }", "public void sort() {\n compares = 0;\n shuttlesort((int[]) indexes.clone(), indexes, 0, indexes.length);\n }", "public final void swap() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(topMostValue);\n\t\t\tpush(secondTopMostValue);\n\t\t}\n\t}", "public ArrayList<Player> getLeaderboard() {\n ArrayList<Player> result = new ArrayList(players);\n for (Player player : players) {\n Collections.sort(result);\n Collections.reverse(result);\n }\n return result;\n}", "void reverse()\n\t{\n\t\tint a;\n\t\tif(isEmpty())\n\t\t\treturn;\n\t\telse\n\t\t{\t\n\t\t\ta = dequeue();\n\t\t\treverse(); \n\t\t\tenqueue(a);\n\t\t}\n\t}", "public void sortGivenArray_popularity() { \n int i, j, k; \n for(i = movieList.size()/2; i > 0; i /= 2) {\n for(j = i; j < movieList.size(); j++) {\n Movie key = movieList.get(j);\n for(k = j; k >= i; k -= i) {\n if(key.rents > movieList.get(k-i).rents) {\n movieList.set(k, movieList.get(k-i));\n } else {\n break; \n }\n }\n movieList.set(k, key);\n }\n } \n }", "public void sort() {\n }", "@Override\n public int compareTo(Highscore other) {\n Integer other_score = Integer.parseInt(other.score);\n Integer compared_score = Integer.parseInt(score);\n int compareInt = compared_score.compareTo(other_score);\n if (compareInt < 0) return 1;\n if (compareInt > 0) return -1;\n return 0;\n }", "void reverseTurnOrder() {\n turnOrder *= -1;\n }", "@Test\n public void testReverseOrderSort() {\n BubbleSort<Integer> testing = new BubbleSort<>();\n\n testing.sort(array, new Comparator<Integer>() {\n @Override\n public int compare(Integer i1, Integer i2) {\n return i2.compareTo(i1);\n }\n });\n\n checkReverseOrder(\"Bubble sort doesn't work with other comparator!\", array);\n }", "public void sort() {\n\t\tdivider(0, array.size() - 1);\n\t}", "@Test\n void descendingSetHigherReturnsCorrectValue() {\n assertNull(reverseSet.higher(0));\n assertNull(reverseSet.higher(1));\n assertEquals(Integer.valueOf(1), reverseSet.higher(2));\n assertEquals(Integer.valueOf(2), reverseSet.higher(3));\n assertEquals(Integer.valueOf(2), reverseSet.higher(4));\n assertEquals(Integer.valueOf(4), reverseSet.higher(5));\n assertEquals(Integer.valueOf(4), reverseSet.higher(6));\n assertEquals(Integer.valueOf(6), reverseSet.higher(7));\n assertEquals(Integer.valueOf(6), reverseSet.higher(8));\n assertEquals(Integer.valueOf(6), reverseSet.higher(9));\n assertEquals(Integer.valueOf(9), reverseSet.higher(10));\n }", "@Test\n\tpublic void testDescendingComparator() {\n\t\tList<MockWorker> mockWorkers = createMockWorkers(10);\n\t\tsetAscendingParallelWorkCapacity(mockWorkers);\n\t\tList<WorkerLoadSnapshot> snapshots = createSnapshots(mockWorkers);\n\t\tRandom rng = new Random(-1L);\n\t\tCollections.shuffle(snapshots, rng);\n\t\tCollections.sort(snapshots, WorkerLoadSnapshot.descendingComparator());\n\t\tfor (PairIterator.Pair<MockWorker, WorkerLoadSnapshot> pair\n\t\t\t\t: PairIterator.iterable(mockWorkers, snapshots)) {\n\t\t\tassertSame(pair.getLeft(), pair.getRight().getWorker());\n\t\t}\n\t\tList<MockWorker> unorderedList = new ArrayList<>(mockWorkers);\n\t\tCollections.shuffle(snapshots);\n\t\tsetAscendingParallelWorkCapacity(unorderedList);\n\t\tCollections.shuffle(snapshots, rng);\n\t\tCollections.sort(snapshots, WorkerLoadSnapshot.descendingComparator());\n\t\tfor (PairIterator.Pair<MockWorker, WorkerLoadSnapshot> pair\n\t\t\t\t: PairIterator.iterable(mockWorkers, snapshots)) {\n\t\t\tassertSame(pair.getLeft(), pair.getRight().getWorker());\n\t\t}\n\t}", "public int compareTo(Object o) {\n if (o instanceof HighScore) {\n if (((HighScore) o).score < score)\n return -1;\n else if (((HighScore) o).score == score)\n return 0;\n else\n return 1;\n }\n return -1;\n }", "@Override\r\n public int compareTo(final QueryResultEntry comparative) {\r\n return (mScore > comparative.mScore ? -1 : (mScore == comparative.mScore ? 0 : 1));\r\n }", "public void sortHand(){\n Arrays.sort(Hand);\n }", "public void sort() {\n\t\t\tCollections.sort(population, new SolutionComparator());\n\t\t}", "void order() {\n for (int i = 0; i < numVertices; i++) {\n if (simp[i][numParams] < simp[best][numParams]) {\n best = i;\n }\n if (simp[i][numParams] > simp[worst][numParams]) {\n worst = i;\n }\n }\n nextWorst = best;\n for (int i = 0; i < numVertices; i++) {\n if (i != worst) {\n if (simp[i][numParams] > simp[nextWorst][numParams]) {\n nextWorst = i;\n }\n }\n }\n }", "private void swapWorst(Habitat habitat)\r\n\t{\r\n\t\t//Use Swap3\r\n\t\tCollections.sort(habitat.getSivs(), Pool.ComparatorCost);\r\n\t\t//Collections.reverseOrder();\r\n\t\t\r\n\t\tfor(int i=0;i<1;i++)\r\n\t\t{\r\n\t\t\tswap3(habitat, habitat.getSivs().get(i));\r\n\t\t}\r\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tEmployee emp1 = new Employee(1,\"Hibachi\",2000000);\n\t\tEmployee emp2 = new Employee(2,\"Budh\",50000000);\n\t\tEmployee emp3 = new Employee(3,\"Som\",1000000);\n\t\tEmployee emp4 = new Employee(4,\"Mangal\",600000);\n\t\tEmployee emp5 = new Employee(5,\"Brihaspati\",7000000);\n\t\t\n\t\tList<Employee> empList = new ArrayList<>();\n\t\tempList.add(emp1);\n\t\tempList.add(emp2);\n\t\tempList.add(emp3);\n\t\tempList.add(emp4);\n\t\tempList.add(emp5);\n\t\t\n\t\t// sorting done using comparable implementation Employee\n\t\tSystem.out.println(\"sorting using comparable. Sorts by default by name\");\n \t\tCollections.sort(empList);\n\t\t\n\t\tempList.forEach(empl -> System.out.println(empl));\n\n\t\t//using comparator in Employee sort the employees by salary\n\t\tCollections.sort(empList, Employee.compareSalary);\n\t\tSystem.out.println(\"*****************************************************\");\n\t\tSystem.out.println(\"sorting using comparator. sorts based on salary\");\n\t\tempList.forEach(emp -> System.out.println(emp));\n\t\t\n\t\t\n\t\t//using comparator in Employee sort the employees by id\n\t\tCollections.sort(empList, Employee.compareId);\n\t\tSystem.out.println(\"*****************************************************\");\n\t\tSystem.out.println(\"sorting using comparator. sorts based on Id\");\n\t\tempList.forEach(emp -> System.out.println(emp));\n\t\t\n\t\t\n\t\t//Now let's say we want to use the comparator to sort in descending order\n\t\tComparator<Employee> reverseSortSalaryDescendingOrder = Collections.reverseOrder(Employee.compareSalary);\n\t\tCollections.sort(empList,reverseSortSalaryDescendingOrder );\n\t\tSystem.out.println(\"*****************************************************\");\n\t\tSystem.out.println(\"Salary soreted in reverse order i.e. descending order using same comparator and Collections reverseOrder()\");\n\t\tempList.forEach(empl -> System.out.println(empl));\n\t\t\n\t\t// Or we can reverse using the comparator's own reversed() method. Internally it calls reverseOrder() \n\t\tCollections.sort(empList, Employee.compareSalary.reversed());\n\t\t\n\t\t\n\t}", "public void sortList() {\n Node3 current = front, index = null;\n student temp;\n\n if(front == null) {\n return;\n }\n else {\n while(current != null) {\n //Node index will point to node next to current\n index = current.getNext();\n\n while(index != null) {\n //If current node's data is greater than index's node data, swap the data between them\n if(current.getData().getRoll()> index.getData().getRoll()) {\n temp = current.getData();\n current.setData(index.getData());\n index.setData(temp);\n }\n index = index.getNext();\n }\n current = current.getNext();\n }\n }\n }", "public static void main(String[] args) {\n int[] array = {5, 35, 75, 25, 95, 55, 45};\n // Arrays.sort(array);\n\n\n int j = array.length-1;\n for (int i = array.length-1; i >= 0; i--){\n array[j] = array[i];\n j--;\n //System.out.println(array[i]);\n }\n\n System.out.println(\"##########################\");\n //int max2 = array[array.length-1];\n\n //System.out.println(max2);\n double[] arr2 = {5.7, 35.0, 75.6, 25.3, 95.15, 55.88, 55.45};\n\n char[] ch = {'A', 'C', 'F', 'G', 'D', 'E', 'H', 'B'};\n\n\n maxNumber(array);\n\n maxNumber(arr2);\n\n System.out.println(\"><><><><><><><><><><><><><><><\");\n\n int[ ] des = Descending(array);\n System.out.println(Arrays.toString(des));\n\n double[] dess = Descending(arr2);\n System.out.println(Arrays.toString(dess));\n\n char[] desss = Descending(ch);\n System.out.println(Arrays.toString(desss));\n\n System.out.println(\"><><><><><><><><><><><><><><><\");\n\n }", "public void dateHashMapSortedDescending() {\n\t\t//array used to store the key values of the unsorted HashMap\n\t\tLocalDate[] unsortedArr = new LocalDate[SORTINGDATES_SIZE];\n\t\t\t\n\t\t//adding all the keys to unsortedArr\n\t\tint i = 0;\n\t\tfor (LocalDate key : map.keySet()) {\n\t\t\tunsortedArr[i++] = key;\n\t\t}\n\t\t\t\t\n\t\tfor (int currIndex = 1; currIndex < unsortedArr.length; currIndex++) {\n\t\t\tLocalDate date = unsortedArr[currIndex];\n\t\t\tint k = currIndex - 1;\n\t\t\t\t\t\t\n\t\t\t/*\n\t\t\t* while the index for the array stays above 0 and the element in the previous\n\t\t\t* index is greater than the element at the currentIndex\n\t\t\t*/\n\t\t\twhile ((k >= 0) && (unsortedArr[k].isBefore(date))) {\n\t\t\t\t//shifting the elements to the right\n\t\t\t\tunsortedArr[k + 1] = unsortedArr[k];\n\t\t\t\t//decrement x to move the other elements over\n\t\t\t\tk--;\t\n\t\t\t}\n\t\t\tunsortedArr[k + 1] = date;\n\t\t}\n\n\t\tfor (i = 0; i < unsortedArr.length; ++i) {\n\t\t\tSystem.out.println(unsortedArr[i]);\n\t\t}\n\t}", "@Override\n public int higherScore() {\n if (!scoresUpToDate) {\n updateScores();\n }\n return higherScore;\n }", "@Override\n protected void runAlgorithm() {\n for (int i = 0; i < getArray().length; i++) {\n for (int j = i + 1; j < getArray().length; j++) {\n if (applySortingOperator(getValue(j), getValue(i))) {\n swap(i, j);\n }\n }\n }\n }", "private void sortDice() {\r\n for (int index = 0; index < dice.size(); index++) {\r\n for (int subIndex = index; subIndex < dice.size(); subIndex++) {\r\n if (dice.get(subIndex).compareTo((dice.get(index))) > 0) {\r\n final Integer temp = dice.get(index);\r\n dice.set(index, dice.get(subIndex));\r\n dice.set(subIndex, temp);\r\n }\r\n }\r\n }\r\n }", "private void bInsertionSort(int lowerIndex, int higherIndex) {\n \t\tArrayList tmpsorted = new ArrayList();\n \t\tint tmp, lowerbound, upperbound;\n \t\t\n \t\tfor(int i = lowerIndex; i <= higherIndex; i++) {\n \t\t\ttmp = (int) unsorted.get(i);\n \t\t\tif(tmpsorted.isEmpty()) {\n \t\t\t\ttmpsorted.add(tmp);\n \t\t\t} else {\n \t\t\t\t\n \t\t\t\t//Every new number we want to insert needs\n \t\t\t\t//to reset the bounds according to the sorted list.\n \t\t\t\tupperbound = tmpsorted.size() - 1;\n \t\t\t\tlowerbound = 0;\n \t\t\t\t\n \t\t\t\twhile (unsorted.size() != 0){\n \t\t\t\t//Note that each \"break;\" throws us out of the while loop.\n \t\t\t\t//Causing our boundaries to be reset for the new number\n \t\t\t\t\t\n \t\t\t\t\tint j = (upperbound + lowerbound) / 2;\t//j points to the middle of the boundaries\n \t\t\t\t\tif (tmp <= (int)tmpsorted.get(j)){\t//is tmp less or equal to the number in j?\n \t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\tif (j == 0){\t\t\t\t\t\t//Are we at the bottom of the list?\n \t\t\t\t\t\t\ttmpsorted.add(0, tmp);\t\t//Add it to the bottom of the list.\n \t\t\t\t\t\t\tbreak;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t\telse if ((int)tmpsorted.get(j-1) > tmp){ \n \t\t\t\t\t\t//Else if the number behind j is bigger than tmp...\n \t\t\t\t\t\t//...we can move the upper bound behind j and repeat the split.\n \t\t\t\t\t\t//NOTE: We do NOT \"break;\" to get thrown out of the while loop.\n \t\t\t\t\t\t\t\n \t\t\t\t\t\t\tupperbound = j - 1;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t\telse{ //Else we just add the number to j\n \t\t\t\t\t\t\ttmpsorted.add(j, tmp);\n \t\t\t\t\t\t\tbreak;\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t\t\n \t\t\t\t\telse{ //If tmp is HIGHER than j\n \t\t\t\t\t\tif (j == tmpsorted.size() - 1){\n \t\t\t\t\t\t//Are we at the end of the list?\n \t\t\t\t\t\t//Just add tmp at the end of the list.\t\n \t\t\t\t\t\t\ttmpsorted.add(j+1, tmp);\n \t\t\t\t\t\t\tbreak;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t\telse if((int)tmpsorted.get(j+1) < tmp){\n \t\t\t\t\t\t//if the next number to j is still less than tmp...\n \t\t\t\t\t\t//we raise the lowerbound past j and repeat the split\n \t\t\t\t\t\t//NOTE: We do NOT \"break;\" to get thrown out of the while loop.\n \t\t\t\t\t\t\tlowerbound = j + 1;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t\telse{ \n \t\t\t\t\t\t//Else we can just add tmp after j since it's higher than j\n \t\t\t\t\t\t\ttmpsorted.add(j+1, tmp);\n \t\t\t\t\t\t\tbreak;\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}\n \t\t}\n \t\t// Replace the unsorted values with tmpsorted.\n \t\tint j = 0;\n \t\tfor(int i = lowerIndex; i <= higherIndex; i++) {\n \t\t\tunsorted.set(i, tmpsorted.get(j));\n \t\t\tj++;\n \t\t}\n\n \t}", "public void addHighScore(HighScore h)\n\t{\n\t\tHighScore[] highScores=getHighScores();\n\t\thighScores[highScores.length-1]=h;\n\t\tfor (int i=highScores.length-2; i>=0; i--)\n\t\t{\n\t\t\tif (highScores[i+1].compareTo(highScores[i])>0)\n\t\t\t{\n\t\t\t\tHighScore temp=highScores[i];\n\t\t\t\thighScores[i]=highScores[i+1];\n\t\t\t\thighScores[i+1]=temp;\n\t\t\t}\n\t\t}\n\t\ttry \n\t\t{\n\t\t\tObjectOutputStream o=new ObjectOutputStream(new FileOutputStream(\"HighScores.dat\"));\n\t\t\to.writeObject(highScores);\n\t\t\to.close();\n\t\t} catch (FileNotFoundException e) {e.printStackTrace();} \n\t\tcatch (IOException e) {e.printStackTrace();}\n\t}", "public void mo2476b() {\n Collections.reverse(mo2625k());\n }", "private void sortRating()\n {\n for(int i = 0; i < movieList.size(); i++){\n for(int j = 1; j < movieList.size() - i; j++)\n {\n Movie a = movieList.get(j-1);\n Movie b = movieList.get(j);\n int result = a.getRating().compareTo(b.getRating());\n if(result < 0)\n {\n movieList.set(j-1, b);\n movieList.set(j, a);\n }\n else if(result == 0)\n {\n result = a.getTitle().compareTo(b.getTitle());\n if(result > 0)\n {\n movieList.set(j-1, b);\n movieList.set(j, a);\n }\n }\n }\n }\n }", "public void SortByPrice() {\n for (int i = 1; i < LastIndex; i++) {\n int x = i;\n while (x >= 1) {\n if (ForChild[x - 1].getPrice() > ForChild[x].getPrice()) {\n Confectionery sweets = ForChild[x - 1];\n ForChild[x - 1] = ForChild[x];\n ForChild[x] = sweets;\n\n }\n x -= 1;\n }\n }\n }", "public static void main(String[] args) {\n\t\t\n\t\tint [] arr= {3,43,2,320,143,4};\n\t\t\n\t\tint temp=0;\n\t\tint lenth=arr.length;\n\t\t\n\t\tfor(int i=0;i<lenth;i++) {\n\t\t\t\n\t\t\tfor(int j=1;j<(lenth-i);j++)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif(arr[j-1]>arr[j]) {\n\t\t\t\t\ttemp=arr[j-1];\n\t\t\t\t\tarr[j-1]=arr[j];\n\t\t\t\t\t\t\tarr[j]=temp;\n\t\t\t\t\tSystem.out.println(arr[j]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t\t\t\n\t\t\n\n\t}", "public List<ScoreInfo> getHighScores() {\n List<ScoreInfo> l = new ArrayList<ScoreInfo>();\n l.addAll(this.highScores); //make a copy;\n return l;\n }", "public void sort() {\n documents.sort();\n }", "private void updateOrder() {\n Arrays.sort(positions);\n }", "public void reverse() {\n\n\t\tif (head == null) {\n\t\t\tSystem.out.println(\"List is empty.\");\n\t\t\treturn;\n\t\t}\n\t\tint nodes = nodeCounter();\n\t\tDLNode t = tail.prev;\n\t\thead = tail;\n\t\tfor (int i = 0; i < nodes - 1; i++) {\n\n\t\t\tif (t.list == null && t.val != Integer.MIN_VALUE) {\n\t\t\t\tthis.reverseHelperVal(t.val);\n\t\t\t\tt = t.prev;\n\t\t\t} else {\n\t\t\t\tthis.reverseHelperList(t.list);\n\t\t\t\tt = t.prev;\n\t\t\t}\n\t\t}\n\t\ttail.next = null;\n\t\thead.prev = null;\n\n\t}", "@Override\n\t\t\tpublic int compare( Entry<Exercice, Integer> o1, Entry<Exercice, Integer> o2 )\n\t\t\t{\n\t\t\t\treturn - o1.getValue().compareTo( o2.getValue() );\n\t\t\t}", "public static Student[] sortScore( Student s[]){\n\t\tStudent temp ;\r\n\t\tfor(int i=0; i<s.length; i++){\r\n\t\t\tfor(int j=i+1; j<s.length;j++)\r\n\t\t\t\tif(s[i].score > s[j].score){\r\n\t\t\t\t\ttemp = s[i];\r\n\t\t\t\t\ts[i] = s[j];\r\n\t\t\t\t\ts[j]= temp;\r\n\t\t\t\t} \t\t\t\r\n\t\t\t}\r\n\t\t\r\n\r\n\r\n\r\n\t\tSystem.out.println(\"Students with score<50 are: \");\r\n\t\tfor(int i=0; i<s.length;i++){\r\n\t\t\tif(s[i].score<50){\r\n\t\t\ts[i].Display();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tSystem.out.println(\"Students with score>=50 and <65 are: \");\r\n\t\tfor(int i=0; i<s.length;i++){\r\n\t\t\tif(s[i].score>=50 && s[i].score<65){\r\n\t\t\ts[i].Display();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tSystem.out.println(\"Students with score>=65 and <80 are: \");\r\n\t\tfor(int i=0; i<s.length;i++){\r\n\t\t\tif(s[i].score>=65 && s[i].score<80){\r\n\t\t\ts[i].Display();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tSystem.out.println(\"Students with score>=80 and <100 are: \");\r\n\t\tfor(int i=0; i<s.length;i++){\r\n\t\t\tif(s[i].score>=80 && s[i].score<=100){\r\n\t\t\ts[i].Display();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn s;\r\n\r\n\r\n\t}", "private void setPreviousHighScores() {\n highScoreSharedPref = this.getSharedPreferences(\"MyPref\", Context.MODE_PRIVATE);\n highScore = highScoreSharedPref.getInt(\"Score\", 0);\n tvHighScore.setText(String.format(\"%d\", highScore));\n }", "public static void s1DescendingTest() {\n int key = 903836722;\n SortingLab<Integer> sli = new SortingLab<Integer>(key);\n int M = 600000;\n int N = 1000;\n double start;\n double elapsedTime;\n System.out.print(\"Sort 1 Descending\\n\");\n for (; N < M; N *= 2) {\n Integer[] ai = getRandomArray(N, Integer.MAX_VALUE);\n Arrays.sort(ai);\n Integer[] bi = new Integer[ai.length];\n int count = 0;\n for (int i = ai.length - 1; i >= 0; i--) {\n bi[count] = ai[i];\n count++;\n }\n start = System.nanoTime();\n sli.sort1(bi);\n elapsedTime = (System.nanoTime() - start) / 1_000_000_000d;\n System.out.print(N + \"\\t\");\n System.out.printf(\"%4.3f\\n\", elapsedTime);\n }\n }", "public LinkedList<HighScore> getHighScores(){\r\n\t\tLinkedList<HighScore> list = new LinkedList<HighScore>();\r\n\t\ttry{\r\n\t\t\t//Sorting by Score column\r\n\t\t ResultSet rs = statement.executeQuery(\"select * from Highscores ORDER BY Score DESC\");\r\n\t\t while(rs.next()){\r\n\t\t String username = rs.getString(\"Nickname\"); \r\n\t\t int userScore = rs.getInt(\"Score\"); \r\n\t\t HighScore userHighScore = new HighScore(username,userScore);\r\n\t\t list.add(userHighScore);\r\n\t\t \r\n\t\t }\r\n\t\t }\r\n\t\t\tcatch (Exception e){\r\n\t\t\t e.printStackTrace();\r\n\t\t\t}\r\n\t\treturn list;\r\n\t}", "public void winner() {\n\t\tList<String> authors = new ArrayList<String>(scores_authors.keySet());\n\t\tCollections.sort(authors, new Comparator<String>() {\n\n\t\t\t@Override\n\t\t\tpublic int compare(String o1, String o2) {\n\t\t\t\treturn scores_authors.get(o1).compareTo(scores_authors.get(o2));\n\t\t\t}\n\t\t});\n\t\tSystem.out.println(\"Score des auteurs :\");\n\t\tfor(String a :authors) {\n\t\t\tSystem.out.println(a.substring(0,5)+\" : \"+scores_authors.get(a));\n\t\t}\n\t\t\n\t\tList<String> politicians = new ArrayList<String>(scores_politicians.keySet());\n\t\tCollections.sort(politicians, new Comparator<String>() {\n\n\t\t\t@Override\n\t\t\tpublic int compare(String o1, String o2) {\n\t\t\t\treturn scores_politicians.get(o1).compareTo(scores_politicians.get(o2));\n\t\t\t}\n\t\t});\n\t\tSystem.out.println(\"Score des politiciens :\");\n\t\tfor(String p :politicians) {\n\t\t\tSystem.out.println(p.substring(0,5)+\" : \"+scores_politicians.get(p));\n\t\t}\n\t}", "@Test\n public void case5SortReversedSequence(){\n //Completely reverse sorted array\n int[] testArray = {1,2,3};\n SortDemoData data3 = new SortDemoData() ;\n data3.initializeArray(\"3 2 1\");\n assertTrue(map.get(algoUnderTest)+\" Before Sort ...First Element\",data3.myArray[2].key == testArray[0]);\n assertTrue(map.get(algoUnderTest)+\" Before Sort ...Second Element\",data3.myArray[1].key == testArray[1]);\n assertTrue(map.get(algoUnderTest)+\" Before Sort ...Third Element\",data3.myArray[0].key == testArray[2]);\n\n data3.runAlgo(algoUnderTest);\n\n if(algoUnderTest != 0)\n {\n assertTrue(map.get(algoUnderTest)+\" After Sort ...First Element\",data3.myArray[0].key == testArray[0]);\n assertTrue(map.get(algoUnderTest)+\" After Sort ...Second Element\",data3.myArray[1].key == testArray[1]);\n assertTrue(map.get(algoUnderTest)+\" After Sort ...Third Element\",data3.myArray[2].key == testArray[2]);\n }\n else {\n \t assertFalse(map.get(algoUnderTest)+\" After Sort ...First Element\",data3.myArray[0].key == testArray[0]);\n assertFalse(map.get(algoUnderTest)+\" After Sort ...Second Element\",data3.myArray[1].key == testArray[1]);\n assertFalse(map.get(algoUnderTest)+\" After Sort ...Third Element\",data3.myArray[2].key == testArray[2]);\n }\n \n }", "public static void main(String[] args)\n {\n Stack<Integer> s=new Stack<Integer>();\n s.push(28);\n s.push(2);\n s.push(16);\n s.push(3);\n s.push(72);\n s.push(19);\n s.push(6);\n System.out.print(\"Before sorting: \");\n for(int e : s)\n System.out.print(e+\" \");\n System.out.println();\n sort(s);\n //the iteration starts from stack bottom\n System.out.print(\"After sorting: \");\n for(int e : s)\n System.out.print(e+\" \");\n System.out.println();\n }", "public void sort() {\n Card.arraySort(this.cards, this.topCard);\n }", "public List<ScoreInfo> getHighScores() {\n List<ScoreInfo> highScoreList = new ArrayList<>();\n if (scoreInfoList.size() <= size) {\n highScoreList = scoreInfoList;\n } else {\n for (int i = 0; i < size; i++) {\n highScoreList.add(scoreInfoList.get(i));\n }\n }\n return highScoreList;\n }", "@Test\n void descendingSetLowerReturnsCorrectValue() {\n assertEquals(Integer.valueOf(1), reverseSet.lower(0));\n assertEquals(Integer.valueOf(2), reverseSet.lower(1));\n assertEquals(Integer.valueOf(4), reverseSet.lower(2));\n assertEquals(Integer.valueOf(4), reverseSet.lower(3));\n assertEquals(Integer.valueOf(6), reverseSet.lower(4));\n assertEquals(Integer.valueOf(6), reverseSet.lower(5));\n assertEquals(Integer.valueOf(9), reverseSet.lower(6));\n assertEquals(Integer.valueOf(9), reverseSet.lower(7));\n assertEquals(Integer.valueOf(9), reverseSet.lower(8));\n assertNull(reverseSet.lower(9));\n assertNull(reverseSet.lower(10));\n }", "public static void main(String[] args) {\r\n\t\t// TODO Auto-generated method stub\r\n\t\t\r\n\t\tint[] intArray = {20, 35, -15, 7, 55, 1, -22};\r\n\t\t\r\n\t\tfor(int firstUnsortedIndex = 1; firstUnsortedIndex< intArray.length; firstUnsortedIndex++) {\r\n\t\t\tint temp = intArray[firstUnsortedIndex];\r\n\t\t\tint index = 0;\r\n\t\t\tfor(int i=firstUnsortedIndex-1; i>=0;i--) {\r\n\t\t\t\tif(intArray[i]> temp) {\r\n\t\t\t\t\tintArray[i+1]=intArray[i];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tindex=i+1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tintArray[index]=temp;\r\n\t\t}\r\n\t\tSystem.out.println(Arrays.toString(intArray));\r\n\r\n\t}" ]
[ "0.7367436", "0.7317204", "0.7272066", "0.71503294", "0.69037753", "0.6812051", "0.6569624", "0.6430025", "0.61927724", "0.61516285", "0.6138847", "0.60787904", "0.6067021", "0.6047913", "0.6015538", "0.5959113", "0.5897824", "0.58853596", "0.5867577", "0.58616716", "0.58428884", "0.58344656", "0.5829392", "0.5801595", "0.57974327", "0.5787747", "0.5778959", "0.57787925", "0.57780623", "0.5776125", "0.5774306", "0.5763862", "0.57549983", "0.5727152", "0.5712864", "0.5706261", "0.57032037", "0.56921566", "0.5667346", "0.5667132", "0.5666696", "0.5662322", "0.5654438", "0.56541", "0.56505346", "0.56488883", "0.56483006", "0.56480455", "0.5637821", "0.5605626", "0.56053716", "0.5595847", "0.55945516", "0.55931634", "0.5582967", "0.55780786", "0.5566561", "0.5563767", "0.55609083", "0.5552599", "0.5552216", "0.55494004", "0.55490637", "0.553311", "0.5529116", "0.552868", "0.5511124", "0.55051005", "0.54993933", "0.54964167", "0.5492156", "0.5491159", "0.54894507", "0.54854834", "0.5485401", "0.54696274", "0.5463065", "0.5457316", "0.54544014", "0.5452003", "0.5450704", "0.544337", "0.5439535", "0.5438367", "0.543569", "0.5435103", "0.54341674", "0.5433988", "0.54295087", "0.54286367", "0.5428351", "0.54279256", "0.54272234", "0.54206395", "0.54197055", "0.54128605", "0.54110026", "0.5403236", "0.5401139", "0.5397335" ]
0.83858997
0
/ Add whatever integer to ArrayList afterwards it is sorted again and written back to the file
public void addHighscore(int i){ highscores.add(i); sortHighscores(); writeFile(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void writeScoreToFile(ArrayList<String> sArrayList,int score, Context context,String userName){\n\n int[] temp = new int[sArrayList.size()];\n Scanner in = null;\n\n //get the score part from the txt file\n for(int i=0;i<sArrayList.size();i++){\n\n in = new Scanner(sArrayList.get(i)).useDelimiter(\"[^0-9]+\");\n int integer = in.nextInt();\n temp[i]=integer;\n Log.d(\"array temp[]\", \"writeScoreToFile: \"+temp[i]+\"\\n\");\n in.close();\n\n }\n\n int tempVal=0;\n String tempString=null;\n if(score>temp[4]) {\n\n temp[4]=score;\n sArrayList.set(4,String.format(\"%-10s%d\",userName,score));\n for(int j=0;j<sArrayList.size()-1;j++){\n for(int k=1;k<sArrayList.size()-j;k++){\n if(temp[k-1]<temp[k]){\n tempVal = temp[k-1];\n temp[k-1]=temp[k];\n temp[k]=tempVal;\n tempString = sArrayList.get(k-1);\n sArrayList.set(k-1,sArrayList.get(k));\n sArrayList.set(k,tempString);\n }\n }\n }\n\n\n //print arraylist\n for(int i=0;i<sArrayList.size();i++){\n Log.d(\"Arraylistcontent\", \"writeScoreToFile: \"+sArrayList.get(i));\n //Log.d(\"sizeArrayList\", \"writeScoreToFile: \"+sArrayList.size());\n }\n\n\n try {\n OutputStreamWriter outputStreamWriter = new OutputStreamWriter(context.openFileOutput(\"score.txt\", Context.MODE_PRIVATE));\n for(int i=0;i<sArrayList.size();i++){\n //use each line for one score\n outputStreamWriter.write(sArrayList.get(i)+\"\\n\");\n }\n outputStreamWriter.close();\n\n } catch (FileNotFoundException e) {\n Log.e(\"FileNotFoundException\", \"File write failed: \" + e.toString());\n } catch (IOException e) {\n Log.e(\"IOException\", \"File write failed: \" + e.toString());\n }\n Log.d(\"end of the log\", \"writeScoreToFile: \"+\".......\");\n }\n }", "public void sort() throws IOException {\n for(int i = 0; i < 32; i++)\n {\n if(i%2 == 0){\n filePointer = file;\n onePointer = one;\n }else{\n filePointer = one;\n onePointer = file;\n }\n filePointer.seek(0);\n onePointer.seek(0);\n zero.seek(0);\n zeroCount = oneCount = 0;\n for(int j = 0; j < totalNumbers; j++){\n int n = filePointer.readInt();\n sortN(n,i);\n }\n //Merging\n onePointer.seek(oneCount*4);\n zero.seek(0L);\n for(int j = 0; j < zeroCount; j++){\n int x = zero.readInt();\n onePointer.writeInt(x);\n }\n //One is merged\n }\n }", "public static void IncOrder(ArrayList<Integer> list)\n{\n // Your code here\n Collections.sort(list);\n}", "public void sortAndSave() {\n\t\tsort();\n\t\tShopIO.writeFile(ShopIO.getDataFile(), ShopIO.getGson().toJson(this));\n\t}", "private void sortFileToScreen() throws FileNotFoundException {\n Scanner file = new Scanner(new File(FILE_NAME));\n while (file.hasNext()) {\n addToOrderedList(file.nextInt());\n }\n file.close();\n printList();\n }", "public void getOrderedList() {\n\n\t\tFile opFile = new File(\"/home/bridgeit/Desktop/newfile.txt\");\n\t\ttry {\n\t\t\topFile.createNewFile();\n\t\t\tFileWriter fwriter = new FileWriter(opFile);\n\n\t\t\tfor (int i = 0; i < olist.size(); i++) {\n\n\t\t\t\tfwriter.append(olist.returnItem(i) + \" \");\n\n\t\t\t}\n\t\t\tfwriter.close();\n\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}", "public void fletteSort(ArrayList<Integer> list) {\n\t\tmergesort(list, 0, list.size() - 1);\n\t}", "public void ArtistAndSource() throws IOException{\r\n List<String> ArrangersAndTheirSongs=new ArrayList<>();\r\n HashMap <String,Integer> SongCountMap= new HashMap<>();\r\n String allsongs=\"\";\r\n String sourcesong=\"\";\r\n for(int id: ArrangersMap.keySet()){\r\n String ArrangerName=ArrangersMap.get(id);\r\n for(String song:ArrangerLinesList){\r\n String perform[];\r\n perform=song.split(\"/\");\r\n int arrangeid=Integer.parseInt(perform[1]);\r\n if(id==arrangeid){\r\n int songid= Integer.parseInt(perform[0]);\r\n String songname=test.getsongName(songid);\r\n sourcesong=test.SongToSource(songname);\r\n allsongs+=sourcesong+\",\";\r\n if (SongCountMap.get(sourcesong) !=null){ \r\n SongCountMap.put(sourcesong, SongCountMap.get(sourcesong)+1);\r\n }\r\n else{\r\n SongCountMap.put(sourcesong, 1);\r\n }\r\n } \r\n }\r\n for(String song:SongCountMap.keySet()){\r\n //System.out.println(song);\r\n }\r\n HashMap <String,Integer> SortedMap= sortByValues(SongCountMap);\r\n SongCountMap.clear();\r\n String allsongs2=\"\";\r\n for(String song:SortedMap.keySet()){\r\n //System.out.println(\"Number\"+SortedMap.get(song)+\"The song is\"+song);\r\n allsongs2+=\"#occurences:\"+SortedMap.get(song)+\"The song is\"+song+\"\\n\";\r\n //System.out.println(\"Number of times:\"+SortedMap.get(song)+\"The song is\"+song);\r\n }\r\n //System.out.println(allsongs2);\r\n // ArrangersAndTheirSongs.add(\"The Arrangers Name is:\"+ArrangerName+ \" Their songs are:\"+allsongs);\r\n ArrangersAndTheirSongs.add(\"The Arrangers Name is:\"+ArrangerName+ \" Their songs are: \"\r\n + \"\"+allsongs2);\r\n allsongs=\"\";\r\n SortedMap.clear();\r\n allsongs2=\"\";\r\n }\r\n //method is broken\r\n writeListToTextFile(\"d:\\\\documents\\\\textfiles\\\\ArrangersAndTheirSources.txt\",ArrangersAndTheirSongs);\r\n System.out.println(\"The size of the list is:\"+ArrangersAndTheirSongs.size());\r\n System.out.println(\"Artist and Their Source Complete\");\r\n }", "public static void writeUnique(String filePath, File outFile ) throws Exception\n\t{\n\t\tBufferedWriter writer = new BufferedWriter(new FileWriter(outFile));\t\t\n\t\tList<FastaSequence> fastaList = FastaSequence.readFastaFile(filePath);\t\n\t\tHashMap<String, Integer> hash_map = new HashMap<String, Integer>();\n\t\t\n\t\t//iterate through lsit object and append to has map value\n\t\tfor( FastaSequence fs : fastaList) \n\t\t{\n\t\t\tif(hash_map.get(fs.getSequence())!= null) {\n\t\t\t\thash_map.put(fs.getSequence(),hash_map.get(fs.getSequence())+1);\n\t\t\t}\n\t\t\telse {\n\t\t\t\thash_map.put(fs.getSequence(),1);\n\t\t\t}\n\t\t}\n\t\t\n\t\tList<fastaOrder> orderArray = new ArrayList<fastaOrder>();\n\t\t//populate objects and file em into an array\n\t\tfor(Map.Entry<String,Integer> entry : hash_map.entrySet()) \n\t\t{\n\t\t\t//orderArray[counter] = new fastaOrder(entry.getValue(), entry.getKey() );\n\t\t\t//fastaOrder objHolder = new fastaOrder((Integer)entry.getValue(), entry.getKey().toString());\n\t\t\tint count = entry.getValue();\n\t\t\tString seq = entry.getKey();\n\t\t\tfastaOrder objHolder = new fastaOrder(count,seq);\n\t\t\torderArray.add(objHolder);\n\t\t}\n\t\t\t//return output as file\n\t\t\tCollections.sort(orderArray);\n\t\t\tfor(fastaOrder i : orderArray) {\n\t\t\t\tSystem.out.println(i.getCount() + \" \" + i.getSeq());\n\t\t\t\twriter.write(i.getCount() + \" \" + i.getSeq()+\"\\n\");\n\t\t\t}\n\t\t\n\t\twriter.close();\n\t}", "public void sort() {\n\t\tfor (int i = 1; i < this.dataModel.getLength(); i++) {\n\t\t\tfinal int x = this.dataModel.get(i);\n\n\t\t\t// Find location to insert using binary search\n\t\t\tfinal int j = Math.abs(this.dataModel.binarySearch(0, i, x) + 1);\n\n\t\t\t// Shifting array to one location right\n\t\t\tthis.dataModel.arrayCopy(j, j + 1, i - j);\n\n\t\t\t// Placing element at its correct location\n\t\t\tthis.dataModel.set(j, x);\n\t\t\tthis.repaint(this.count++);\n\t\t}\n\t}", "public static ArrayList<String> Externalexp1Sort(ArrayList<String> source)\n throws Exception {\n // file\n // ArrayList<Long> k = new ArrayList<Long>();\n // k.add(0L);\n // k.add(0L);\n // k.add(0L);\n // Long repeat = 0L;\n\n PriorityQueue<KVPair> heap = new PriorityQueue<KVPair>(20,\n new UserPrio());\n ArrayList<CsvReader> readers = new ArrayList<CsvReader>();\n // user_tweets output\n PrintWriter writer = new PrintWriter(new FileWriter(user_tweets));\n\n writer2 = new CsvWriter(new OutputStreamWriter(new FileOutputStream(\n SORT_USER_FN + fileNum + \".csv\"), \"UTF-8\"), ',');\n\n // open files\n for (String fileName : source) {\n // get read csv files\n CsvReader reader = new CsvReader(new InputStreamReader(\n new FileInputStream(fileName), \"UTF-8\"));\n reader.setHeaders(Merge.fields);\n // read a line and put into heap\n if (reader.readRecord()) {\n heap.offer(new KVPair(Merge.readRecord(reader), readers.size()));\n }\n readers.add(reader);\n }\n\n // get same key\n KVPair last = null;\n HashMap<Long, Record> sameRecord = new HashMap<Long, Record>();\n\n while (heap.size() > 0) {\n KVPair tmp = heap.poll();\n\n if (last != null && last.record.userid != tmp.record.userid) {\n writer.println(last.record.userid + \",\" + sameRecord.size());\n\n // print records to file\n writeRecords(sameRecord.values());\n\n sameRecord = new HashMap<Long, Record>();\n\n }\n\n // if (sameRecord.containsKey(tmp.record.tweetid)) {\n // repeat ++;\n // System.out.println(tmp.record.tweetid +\" : \" + repeat);\n // }\n\n sameRecord.put(tmp.record.tweetid, tmp.record);\n\n // read next record in the same file\n if (readers.get(tmp.file).readRecord()) {\n\n // k.set(tmp.file, k.get(tmp.file)+1);\n // System.out.println(k);\n\n heap.offer(new KVPair(Merge.readRecord(readers.get(tmp.file)),\n tmp.file));\n } else {\n readers.get(tmp.file).close();\n }\n last = tmp;\n }\n\n // last part of external sort\n if (sameRecord.size() != 0) {\n writer.println(last.record.userid + \",\" + sameRecord.size());\n\n // print records to file\n writeRecords(sameRecord.values());\n }\n\n writer.close();\n\n writer2.flush();\n writer2.close();\n\n return source;\n }", "public void writeList() {\n\n HeapSort heapSort = new HeapSort();\n heapSort.sort(list);\n\n// QuickSort quickSort = new QuickSort();\n// quickSort.sort(list);\n\n// MergeSort mergeSort = new MergeSort();\n// mergeSort.sortNumbers(list);\n\n System.out.println(\"Result of sorting :\");\n list.stream().forEach(s -> System.out.println(s));\n }", "public File sort(String path){\n try {\r\n File file = new File(path);\r\n BufferedReader readStream = new BufferedReader(new FileReader(file));\r\n String currentLine;\r\n int index = 0;\r\n int fileNumber = 1;\r\n while((currentLine = readStream.readLine()) != null){\r\n tempArray[index++] = currentLine;//read next line into the temporary array\r\n if(index >= limit){//check whether the number of lines stored in the temp has reached the maximum allowed\r\n Arrays.sort(tempArray);//sort tempArray\r\n Writer writeStream = null;//create a writer\r\n String currentFileName = \"temp\" + fileNumber + \".txt\";//this name is passed to the buffered writer\r\n writeStream = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(currentFileName)));//create a new temporary file to be written to\r\n fileArrayList.add(new File(currentFileName));//add file to list\r\n for(String line : tempArray){// write the lines currently stored in the array into the newly created file\r\n writeStream.write(line);\r\n writeStream.write(\"\\n\");\r\n }\r\n writeStream.close();//close the output stream\r\n index = 0;//reset\r\n ++fileNumber;//increment the file number so that the next block of lines is written to a different file name\r\n }\r\n\r\n\r\n }\r\n readStream.close();\r\n }catch(Exception e){\r\n System.out.println(e.getMessage() + \" occurred during split\");\r\n }\r\n\r\n //merge temporary files and write to output file\r\n try {\r\n System.out.println(Arrays.toString(fileArrayList.toArray()));\r\n fileArrayList.trimToSize();\r\n int sortedFileID = 0;//used to differentiate between temporary files while merging\r\n int head = 0;//used to access file names stored in array list from the start\r\n int tail = fileArrayList.size() - 1;//used to access file names stored in array list from the end\r\n while(fileArrayList.size() > 1) {\r\n sortedFileID++;//increment to create a unique file name\r\n String mergedFileName = \"sorted\"+sortedFileID+\".txt\";\r\n File firstFile = fileArrayList.get(head);\r\n File secondFile = fileArrayList.get(tail);\r\n System.out.println(head + \" + \" + tail);\r\n //merge first and second\r\n File combinedFile = mergeFiles(firstFile, secondFile, mergedFileName);\r\n //delete both temporary files once they are merged\r\n\r\n if(!secondFile.delete()){\r\n System.out.println(\"warning file could not be deleted\");\r\n }\r\n if(!firstFile.delete()){\r\n System.out.println(\"warning file could not be deleted\");\r\n }\r\n fileArrayList.set(head, combinedFile);//replace the first of the two merged files with the new combined file\r\n fileArrayList.remove(tail);//remove the second of the two merged files\r\n head++;//increment both indexes one position closer towards the center of the array list\r\n tail--;\r\n if(head >= tail){//check if there are no remaining files between the head and the tail\r\n head = 0;//reset to the beginning of the array list\r\n fileArrayList.trimToSize();\r\n tail = fileArrayList.size() - 1;//reset to the end of the array list\r\n }\r\n }\r\n }catch(Exception e){\r\n System.out.println(e.getMessage() + \" occurred during merge\");\r\n }\r\n //after iteratively merging head and tail, and storing the result at the head index\r\n //the final resulting file that combines all temporary files will be stored at index (0)\r\n return fileArrayList.get(0);//return the final combined file\r\n }", "public void sort(ArrayList<Integer> arrayList) {\r\n System.out.println(arrayList.toString());\r\n mergeSort(arrayList, 0, arrayList.size()-1);\r\n System.out.println(arrayList.toString());\r\n }", "public void writeList() {\n try{\n PrintWriter out = new PrintWriter(new FileWriter(\"OutFile.txt\"));\n\n for (int i = 0; i < SIZE; i++) {\n // The get(int) method throws IndexOutOfBoundsException, which must be caught.\n out.println(\"Value at: \" + i + \" = \" + list.get(i));\n }\n out.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "public void addOn(ArrayList array) {\n try {\n PrintWriter writer;\n if (array.get(0) instanceof Integer)\n writer = new PrintWriter(\"points.txt\");\n else writer = new PrintWriter(\"names.txt\");\n\n for (int i=0; i<array.size(); i++)\n writer.println(array.get(i));\n writer.close();\n } catch (IOException e)\n {}\n }", "@Override\n\tpublic void sortList(ArrayList<Integer> list) {\n\t\tint largestNumber = 0;\n\t\tint index = 0;\n\t\t\n\t\tArrayList<ArrayList<Integer>> storageUnit = new ArrayList<ArrayList<Integer>>();\n\t\tArrayList<Integer> sortedList = new ArrayList<Integer>(list.size());\n\t\t\n\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\tsortedList.add(list.get(i));\n\t\t}\n\t\tfor(int i = 0; i < 10; i++){\n\t\t\tstorageUnit.add(new ArrayList<Integer>());\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\tif(list.get(i) > largestNumber){\n\t\t\t\tlargestNumber = list.get(i);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tfor(int i = 0; largestNumber != 0; largestNumber = largestNumber/10, i++){\n\t\t\tfor(int j = 0; j < sortedList.size(); j++){\n\t\t\t\tint key = (int) (sortedList.get(j)/Math.pow(10, i))%10;\n\t\t\t\tstorageUnit.get(key).add(sortedList.get(j));\n\t\t\t}\n\t\t\t\n\t\t\tfor(int k = 0; k < storageUnit.size(); k++){\n\t\t\t\tfor(int l = 0; l < storageUnit.get(k).size(); l++){\n\t\t\t\t\tsortedList.set(index, storageUnit.get(k).get(l));\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t\tstorageUnit.get(k).clear();\n\t\t\t}\n\t\t\tindex = 0;\n\t\t}\n\t\tCollections.copy(list, sortedList);\n\t}", "public static void main(String[] args) {\n ArrayList<Integer> myNumbers = new ArrayList<Integer>();\n // adding items in the list\n myNumbers.add(5);\n myNumbers.add(2);\n myNumbers.add(4);\n myNumbers.set(0, 7);\n // myNumbers.remove(0);\n // Before sorting accessing numbers\n System.out.print(\"Before sorting :\");\n for (int i = 0; i < myNumbers.size(); i++) {\n System.out.print(myNumbers.get(i) + \" \");\n }\n // sorting the list\n Collections.sort(myNumbers);\n System.out.print(\"\\nAfter sorting :\");\n for (Integer keep : myNumbers) {\n System.out.print(keep + \" \");\n }\n }", "@Override\n public void sort() throws IOException {\n long i = 0;\n // j represents the turn of writing the numbers either to g1 or g2 (or viceversa)\n long j = 0;\n long runSize = (long) Math.pow(2, i);\n long size;\n\n long startTime = System.currentTimeMillis();\n\n System.out.println(\"Strart sorting \"+ this.inputFileName);\n\n while(i <= Math.ceil(Math.log(this.n) / Math.log(2))){\n j = 0;\n do{\n size = merge(runSize, destinationFiles[(int)j % 2]);\n j += 1;\n }while (size/2 == runSize);\n\n System.out.println(\"iteration: \" + i + \", Run Size:\" + runSize + \", Total time elapsed: \" + (System.currentTimeMillis() - startTime));\n i += 1;\n runSize = (long) Math.pow(2, i);\n swipe();\n }\n System.out.println(\"The file has been sorted! Total time elapsed: \"+(System.currentTimeMillis() - startTime));\n\n destinationFiles[0].close();\n destinationFiles[1].close();\n originFiles[0].close();\n originFiles[1].close();\n\n createFile(OUT_PATH +inputFileName);\n copyFile(new File(originFileNames[0]), new File(\"out/TwoWayMergesort/OUT_\"+inputFileName));\n\n }", "public void insertionNumberSort()\n {\n\t for(int j=1; j<AL.size(); j++)\n\t {\n\t\t Generics temp = AL.get(j);\n\t\t int possibleIndex = j;\n\t\t \n\t\t while(possibleIndex>0 && Integer.parseInt(AL.get(possibleIndex - 1).toString()) < Integer.parseInt(temp.toString()))\n\t\t {\n\t\t\t AL.set(possibleIndex, AL.get(possibleIndex -1));\n\t\t\t possibleIndex--;\n\t\t\t \n\t\t }\n\t\t \n\t\t AL.set(possibleIndex, temp);\n\t }\n \n }", "private static ArrayList<Integer> sort(ArrayList<Integer> v) {\n\t\tint key, i, j; \n\t\tfor (j = 1; j != v.size(); j++) {\n\t\t\tkey = v.get(j); \n\t\t\ti = j - 1; \n\t\t\twhile ((i >= 0) && (v.get(i) > key)) {\n\t\t\t\tv.set(i+1, v.get(i));\n\t\t\t\ti -= 1; \n\t\t\t}\n\t\t\tv.set(i+1, key); \n\t\t}\n\t\treturn v; \n\t}", "public void output2File(String outputName, ArrayList<Integer> source){\n this.outputContent = new StringBuilder();\n Iterator<Integer> itr = source.iterator();\n\n while(itr.hasNext()){\n this.outputContent.append((itr.next().intValue()));\n this.outputContent.append(\" \");\n }\n\n try {\n FileWriter fileWriter = new FileWriter(outputName, true);\n fileWriter.write(this.outputContent.toString());\n fileWriter.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "public void populateList(){\n\t\tfor (int i = 0; i < 10; i++){\n\t\t\tscoreList.add(-1);\t\t\t\n\t\t\tnameList.add(\"\");\n\t\t}\n\t\tint i=0; \n\t\ttry {\n\t\t\tScanner results = new Scanner(new File(\"results.txt\"));\n\t\t\twhile (results.hasNext()){\n\t\t\t\tnameList.set(i, results.next());\n\t\t\t\tscoreList.set(i, results.nextInt());\n\t\t\t\ti++;\n\t\t\t}\n\t\t} catch (FileNotFoundException e1){\n\t\t\te1.printStackTrace();\n\t\t}\n\t}", "public void addNumSort(int num) {\n\t\tlist.add((double)num);\n\t}", "public static void mySort(ArrayList<Integer> myList)\n {\n\n }", "void writeBack(Comparable[] arr, int list) {\n\n\t\t// Iterate array and put sorted elements in it \n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\t\n\t\t\tarr[i] = this.array[list];\n\t\t\tlist = next[list];\n\t\t}\n\t\t\n\t\t/*\n\t\t * Release resources.\n\t\t */\n\t\t\n\t\tthis.array = null;\n\t\tthis.data = null;\n\t\tthis.next = null;\n\t\tthis.queue = null;\n\t}", "public static void sort(ArrayList<Integer> list) {\n\t\tint temp;\n\t\tfor (int i=0; i < list.size() ; i++) {\n\t\t\tfor (int j=i+1;j<list.size()-1;j++){\n\t\t\t\tif(list.get(i)>list.get(j)){\n\t\t\t\t\ttemp = list.get(i);\n\t\t\t\t\tlist.set(i,list.get(j));\n\t\t\t\t\tlist.set(j, temp);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public static void sort(ArrayList<Number> list) {\r\n\t\t\t\t\tfor (int i = 0; i < list.size(); i++) {\r\n\t\t\t\t\t\tfor (int j = 0; j < list.size(); j++) {\r\n\t\t\t\t\t\t\t// Ako je vrijadnost elementa na idneksu i manja od vrijednosti\r\n\t\t\t\t\t\t\t// elementa na idneksu j, zamijeni im pozicije.\r\n\t\t\t\t\t\t\tif (list.get(i).doubleValue() < list.get(j).doubleValue()) {\r\n\t\t\t\t\t\t\t\t// Cuvamo elemenat sa drugog indeksa u temp varijabli.\r\n\t\t\t\t\t\t\t\tNumber temp = list.get(j);\r\n\t\t\t\t\t\t\t\t// Kopiramo elemenat sa prvog indeksa preko drugog elementa.\r\n\t\t\t\t\t\t\t\tlist.set(j, list.get(i));\r\n\t\t\t\t\t\t\t\t// Kopiramo temp (drugi elemenat) preko prvog elementa.\r\n\t\t\t\t\t\t\t\tlist.set(i, temp);\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}", "static void doSort(int location) throws Exception {\n\n\t\tList<String> sortedList = null;\n\n\t\tsortedList = readDataFile(DividedfileList.get(location));\n\t\tCollections.sort(sortedList);\n\t\twriteFile(sortedList, location);\n\t\tsortedList.clear();\n\n\t}", "@Override\r\n\tpublic void addSort() {\n\t\t\r\n\t}", "@Override\n public void sortCurrentList(FileSortHelper sort) {\n }", "static void writeFile(List<String> sortList, int fileIndex) throws IOException, InterruptedException {\n\t\tFileWriter filewrite = new FileWriter(new File(DividedfileList.get(fileIndex)));\n\t\tBufferedWriter bufw = new BufferedWriter(filewrite);\n\n\t\tint fileLoc = 0;\n\n\t\twhile (fileLoc != sortList.size()) {\n\t\t\tbufw.write(sortList.get(fileLoc) + \"\\r\\n\");\n\t\t\tfileLoc++;\n\t\t}\n\t\tbufw.close();\n\t}", "public static void writeFile(ArrayList<Integer> data, String path) {\n\t\ttry {\n\t\t\tFileOutputStream fos = new FileOutputStream(path);\n\t\t\tOutputStreamWriter osw = new OutputStreamWriter(fos);\n\t\t\tBufferedWriter bw = new BufferedWriter(osw);\n\n//\t\t\tfor (String dt : data) {\n//\t\t\t\tbw.write(dt);\n//\t\t\t\tbw.newLine();\n//\t\t\t}\n\n\t\t\tfor (int i = 0; i < data.size(); i++) {\n\t\t\t\tbw.write(data.get(i).toString());\n\t\t\t\tif (i < data.size() - 1)\n\t\t\t\t\tbw.write(\", \");\n\n\t\t\t\t// bw.newLine();\n\t\t\t}\n\t\t\tbw.newLine();\n\t\t\tbw.close();\n\t\t\tosw.close();\n\t\t\tfos.close();\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void fillSorted()\n {\n for (int i=0; i<list.length; i++)\n list[i] = i + 2;\n }", "public static void main( String[] args )\n {\n OrderedArrayList Franz = new OrderedArrayList();\n\n // testing linear search\n for( int i = 0; i < 15; i++ )\n Franz.add( (int)( 50 * Math.random() ) );\n System.out.println( Franz );\n\n //check for sorted-ness\n //if msg does not appear, list was sorted\n\n // Try inserting 29 binarily\n Franz.addBin(29);\n System.out.println(Franz);\n\n // Try inserting 0 binarily\n Franz.addBin(0);\n System.out.println(Franz);\n\n // Try inserting 50 binarily\n Franz.addBin(50);\n System.out.println(Franz);\n\n }", "private void sort() {\n setFiles(getFileStreamFromView());\n }", "@Override\n\tpublic void complete(int num) {\n\t\ttry {\n\t\t\tFileOutputStream fo = new FileOutputStream(fileName);\n\t\t\tBufferedOutputStream bo = new BufferedOutputStream(fo);\n\t\t\tObjectOutputStream out = new ObjectOutputStream(bo);\n\t\n\t\n\t\t\t\n\t\t\tfor(Order rs : ord) {\n\t\t\t\tif (rs.getNum()==num) {\n\t\t\t\t\t\tord.remove(rs);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\tout.writeObject(ord);\n\t\t\tout.flush();\n\t\t\tout.close();\n\t\t\n\t\t} catch(IOException e) {\n\t\t\t\n\t\t} \n\t\t\n\t}", "static void writeRanking(ArrayList<PlayerInfo> player){\n\t\ttry{\r\n\t\t\tFileOutputStream fos = new FileOutputStream(\"ranking.dat\");\r\n\t\t\tObjectOutputStream oos = new ObjectOutputStream(fos);\r\n\t\t\toos.writeObject(player);\r\n\t\t\toos.flush();\r\n\t\t\toos.close();\r\n\t\t\tfos.close();\r\n\t\t}catch(Exception e){\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t//return player;\r\n\t}", "public static void userSort(ArrayList<String>list) throws FileNotFoundException{\r\n\t\tCollections.sort(list, new Comparator<String>(){\r\n\t\t\t@Override\r\n\t\t\tpublic int compare(String o1, String o2) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\t//Take the first string, split according to \";\", and store in an arraylist\r\n\t\t\t\tString[] values = o1.split(\";\");\r\n\t\t\t\t//Take the second string and do the same thing\r\n\t\t\t\tString[] values2 = o2.split(\";\");\r\n\t\t\t\t//Compare strings according to their integer values\r\n\t\t\t\treturn Integer.valueOf(values[0].replace(\"\\\"\", \"\")).compareTo(Integer.valueOf(values2[0].replace(\"\\\"\", \"\")));\r\n\t\t\t}\r\n\t\t});\r\n\t\t//Output sorted ArrayList to a text file\r\n\t\t@SuppressWarnings(\"resource\")\r\n\t\tPrintStream out = new PrintStream(new FileOutputStream(\"SortedUsers.txt\"));\r\n\t\t\tfor(int i = 0; i < list.size(); i++){\r\n\t\t\t\tout.println(list.get(i));\r\n\t\t\t}\r\n\t}", "@Override\n public int compareTo(ArrayListOfIntsWritable obj)\n {\n ArrayListOfIntsWritable other = (ArrayListOfIntsWritable) obj;\n if (isEmpty())\n {\n if (other.isEmpty())\n {\n return 0;\n }\n else\n {\n return -1;\n }\n }\n\n for (int i = 0; i < size(); i++)\n {\n if (other.size() <= i)\n {\n return 1;\n }\n if (get(i) < other.get(i))\n {\n return -1;\n }\n else if (get(i) > other.get(i))\n {\n return 1;\n }\n }\n\n if (other.size() > size())\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }", "private void bInsertionSort(int lowerIndex, int higherIndex) {\n \t\tArrayList tmpsorted = new ArrayList();\n \t\tint tmp, lowerbound, upperbound;\n \t\t\n \t\tfor(int i = lowerIndex; i <= higherIndex; i++) {\n \t\t\ttmp = (int) unsorted.get(i);\n \t\t\tif(tmpsorted.isEmpty()) {\n \t\t\t\ttmpsorted.add(tmp);\n \t\t\t} else {\n \t\t\t\t\n \t\t\t\t//Every new number we want to insert needs\n \t\t\t\t//to reset the bounds according to the sorted list.\n \t\t\t\tupperbound = tmpsorted.size() - 1;\n \t\t\t\tlowerbound = 0;\n \t\t\t\t\n \t\t\t\twhile (unsorted.size() != 0){\n \t\t\t\t//Note that each \"break;\" throws us out of the while loop.\n \t\t\t\t//Causing our boundaries to be reset for the new number\n \t\t\t\t\t\n \t\t\t\t\tint j = (upperbound + lowerbound) / 2;\t//j points to the middle of the boundaries\n \t\t\t\t\tif (tmp <= (int)tmpsorted.get(j)){\t//is tmp less or equal to the number in j?\n \t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\tif (j == 0){\t\t\t\t\t\t//Are we at the bottom of the list?\n \t\t\t\t\t\t\ttmpsorted.add(0, tmp);\t\t//Add it to the bottom of the list.\n \t\t\t\t\t\t\tbreak;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t\telse if ((int)tmpsorted.get(j-1) > tmp){ \n \t\t\t\t\t\t//Else if the number behind j is bigger than tmp...\n \t\t\t\t\t\t//...we can move the upper bound behind j and repeat the split.\n \t\t\t\t\t\t//NOTE: We do NOT \"break;\" to get thrown out of the while loop.\n \t\t\t\t\t\t\t\n \t\t\t\t\t\t\tupperbound = j - 1;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t\telse{ //Else we just add the number to j\n \t\t\t\t\t\t\ttmpsorted.add(j, tmp);\n \t\t\t\t\t\t\tbreak;\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t\t\n \t\t\t\t\telse{ //If tmp is HIGHER than j\n \t\t\t\t\t\tif (j == tmpsorted.size() - 1){\n \t\t\t\t\t\t//Are we at the end of the list?\n \t\t\t\t\t\t//Just add tmp at the end of the list.\t\n \t\t\t\t\t\t\ttmpsorted.add(j+1, tmp);\n \t\t\t\t\t\t\tbreak;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t\telse if((int)tmpsorted.get(j+1) < tmp){\n \t\t\t\t\t\t//if the next number to j is still less than tmp...\n \t\t\t\t\t\t//we raise the lowerbound past j and repeat the split\n \t\t\t\t\t\t//NOTE: We do NOT \"break;\" to get thrown out of the while loop.\n \t\t\t\t\t\t\tlowerbound = j + 1;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t\telse{ \n \t\t\t\t\t\t//Else we can just add tmp after j since it's higher than j\n \t\t\t\t\t\t\ttmpsorted.add(j+1, tmp);\n \t\t\t\t\t\t\tbreak;\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}\n \t\t}\n \t\t// Replace the unsorted values with tmpsorted.\n \t\tint j = 0;\n \t\tfor(int i = lowerIndex; i <= higherIndex; i++) {\n \t\t\tunsorted.set(i, tmpsorted.get(j));\n \t\t\tj++;\n \t\t}\n\n \t}", "@Override\r\n public void run() {\r\n \r\n while (listsOfSorted.size() > 1) {\r\n \r\n int[] list1 = listsOfSorted.poll();\r\n int[] list2 = listsOfSorted.poll();\r\n int[] newSortedList = new int[list1.length + list2.length];\r\n\r\n int current1 = 0;\r\n int current2 = 0;\r\n int current3 = 0;\r\n\r\n while (current1 < list1.length && current2 < list2.length) {\r\n if (list1[current1] < list2[current2]) {\r\n newSortedList[current3++] = list1[current1++];\r\n } else {\r\n newSortedList[current3++] = list2[current2++];\r\n }\r\n }\r\n\r\n while (current1 < list1.length) {\r\n newSortedList[current3++] = list1[current1++];\r\n }\r\n\r\n while (current2 < list2.length) {\r\n newSortedList[current3++] = list2[current2++];\r\n \r\n }\r\n \r\n listsOfSorted.offer(newSortedList);\r\n \r\n }\r\n System.out.println(Arrays.toString(listsOfSorted.peek()));\r\n \r\n }", "public static void main(String[] args) throws FileNotFoundException {\n\t\tint listArr[] = new int[70];\r\n\t\tString filename = \"MyList.txt\";\r\n\t\tFile file = new File(filename);\r\n\t\tScanner input = new Scanner(file);\r\n\t\tint i = 0;\r\n\t\twhile (input.hasNextLine()) {\r\n\t\t\tlistArr[i] = input.nextInt();\r\n\t\t\ti++;\r\n\t\t}\r\n\t\t\r\n\t\tmergeSort(listArr, 70);\r\n\t\tfor(i = 0; i < 70; i++) {\r\n\t\t\tSystem.out.println(listArr[i]);\r\n\t\t}\r\n\t}", "public void writeScores() throws IOException {\n if (this.list.isPresent() && this.toSave) {\n try (DataOutputStream out = new DataOutputStream(new FileOutputStream(this.file))) {\n for (final Pair<String, Integer> p : this.list.get()) {\n out.writeUTF(p.getX());\n out.writeInt(p.getY().intValue());\n }\n this.toSave = false;\n } catch (IOException e) {\n System.out.println(\"IOException on writing scores\");\n }\n }\n\n }", "public void sortN(int n, int i) throws IOException{\n if((n&(MASK<<i))==0) //We shift our mask to match the position of interes\n {\n zero.writeInt(n);\n zeroCount++;\n }else{\n onePointer.writeInt(n);\n oneCount++;\n }\n }", "public void add(int number) {\n arrayList.add(number);\n isSorted = false;\n }", "public static void main(String[] args) {\n \tSystem.out.println(\"This program will sort a random list of numbers \\nread in from a text file, with which ever of the \"\n \t\t\t + \"\\nsorting methods you choose to use and write the \\nsorted file to a file destination of your choice.\"); \t \n \t \n \t// Scanner used to take user input for unsorted numbers file path.\n Scanner pathScanner = new Scanner(System.in);\n System.out.println(\"\\nPlease enter the full path of the file: \");\n String filePath = pathScanner.nextLine(); // Assigns String filePath to user input.\n \n /* \n * Try/Catch statement implemented for scanner file read operation. File is read into an\n * array list.\n */\n \n try {\n \t\n // Declare and create RandomIntegers ArrayList of type Integer.\n List<Integer> RandomIntegers = new ArrayList<Integer>(); \n \n readFile(filePath, RandomIntegers); // call readFile method and read contents into arrayList\n \n /* Declare and create int array RandomNumbers.\n * Call convertIntegersToArray method on RandomIntegers\n * to convert from arraylist to an array fill RandomNumbers array.\n */\n \n // convert arraylist to array to enable passing of array as argument into sorting methods\n int[] RandomNumbers = convertIntegersToArray(RandomIntegers);\n \n System.out.println(\"\\nPlease Select Sorting Method\\n----------------------------\\n1.Bubble Sort\\n2.Selection Sort\\n3.Insertion Sort\\n4.Merge Sort \\n5.Quick Sort \\n6.Exit Program\");\n \t System.out.println(); //Print sorting options followed by blank line.\n \n \t\t /*\n \t\t * Scanner reads user input for sorting selection. sortMethod is assigned\n \t\t * to the int entered by the user.\n \t\t */\n \n \t\t Scanner sortScanner = new Scanner(System.in); // declare and create scanner for reading users sorting method selection\n \t\t int sortMethod; // declare sortMethod variable\n \n // do while loop iterates option of sorting unless sortMethod is < 1 or > 5.\n do{\n \t System.out.print(\"\\nEnter the sort method you wish to use (6 to exit): \\n\"); \n sortMethod = sortScanner.nextInt(); // reads in users selected sort method.\n \n if (sortMethod == 1) {\n System.out.println(\"Bubble sort selected.\");\n\t\t BubbleSort bubbleSort = new BubbleSort(RandomNumbers); // Create BubbleSort object using RandomNumbers as arg \t\n WriteFile myWriteFile = new WriteFile(bubbleSort); // Create WriteFile object with BubbleSort object as arg\n myWriteFile.writeFile(RandomNumbers); // implement writeFile method on WriteFile object\n }\n else if (sortMethod == 2){\n \n \t System.out.println(\"Selection sort selected.\");\n\t\t\t SelectionSort selectionSort = new SelectionSort(RandomNumbers); // Create SelectionSort object using RandomNumbers as arg \n\t\t\t \tWriteFile myWriteFile = new WriteFile(selectionSort); // Create WriteFile object with SelectionSort object as arg\n myWriteFile.writeFile(RandomNumbers); // implement writeFile method on WriteFile object \t \t\n }\n else if (sortMethod == 3){\n \n \t System.out.println(\"Insertion sort selected.\");\n\t\t\t InsertionSort insertionSort = new InsertionSort(RandomNumbers); // Create InsertionSort object using RandomNumbers as arg \n\t\t WriteFile myWriteFile = new WriteFile(insertionSort); // Create WriteFile object with InsertionSort object as arg\n myWriteFile.writeFile(RandomNumbers); // implement writeFile method on WriteFile object\n }\n else if (sortMethod == 4){ \n \n \t System.out.println(\"Merge sort selected.\");\n\t\t\t MergeSort mergeSort = new MergeSort(RandomNumbers); // Create MergeSort object using RandomNumbers as arg \n\t\t\t WriteFile myWriteFile = new WriteFile(mergeSort); // Create WriteFile object with MergeSort object as arg\n myWriteFile.writeFile(RandomNumbers); // implement writeFile method on WriteFile object\n }\n else if (sortMethod == 5){ \t\n \n \t System.out.println(\"Quick sort selected.\");\n\t\t\t QuickSort quickSort = new QuickSort(RandomNumbers); // Create QuickSort object using RandomNumbers as arg \n\t\t WriteFile myWriteFile = new WriteFile(quickSort); // Create WriteFile object with QuickSort object as arg\n myWriteFile.writeFile(RandomNumbers); // implement writeFile method on WriteFile object\t\n }\n \n }while(sortMethod >0 && sortMethod < 6); // end do while\n \n if(sortMethod < 1 || sortMethod >= 6){ // if user selection is less than 1 or greater than 5\n \t System.out.print(\"\\nProgram Terminated!\");\n \t System.exit(0); // terminates program\n } \n \n \n } // End Try. \t\t \n \n catch(IOException e){\n System.out.println(\"Could not find file\"); // Print string if file is not read in successfully.\n } // End catch\n \n }", "public static void readFile(String myFile, List <Integer> myList) throws FileNotFoundException{\n \t \n Scanner fileScanner = new Scanner(new File(myFile)); // Reads in from filePath.\n \n while (fileScanner.hasNextInt()){ // Loops while there is still a next integer in the list.\n \t myList.add(fileScanner.nextInt()); // Adds all integers to RandomIntegers arraylist.\n }\n \n System.out.println(\"\\nFile read in successfully.\"); \n }", "public static void DecOrder(ArrayList<Integer> list)\n{\n // Your code here\n Collections.sort(list, Collections.reverseOrder());\n}", "public void radixSorting() {\n\t\t\n\t}", "private static void stepSorter(String file, DataOutputStream d, int size) throws FileNotFoundException, IOException {\n\t\tDataInputStream inputA = new DataInputStream(new BufferedInputStream(new FileInputStream(new File(file))));\n\t\tDataInputStream inputB = new DataInputStream(new BufferedInputStream(new FileInputStream(new File(file))));\n\t\tint numDivisions = (int) Math.ceil(fileSize/((double) size));\n\t\tinputB.skip(size*4);\n\t\tfor (int j = 0; j < numDivisions/2; j++){\t\n\t\t\tint counterA = size;\n\t\t\tint counterB = Math.min(fileSize - j*size*2 - size, size);\n\t\t\tInteger a = inputA.readInt();\n\t\t\tInteger b = inputB.readInt();\n\t\t\twhile (counterA > 0 && counterB > 0){\n\t\t\t\tif (a < b){\n\t\t\t\t\td.writeInt(a);\n\t\t\t\t\tif (counterA > 1){\n\t\t\t\t\t\ta = inputA.readInt();\n\t\t\t\t\t}\n\t\t\t\t\tcounterA--;\n\t\t\t\t} else {\n\t\t\t\t\td.writeInt(b);\n\t\t\t\t\tif (counterB > 1){\n\t\t\t\t\t\tb = inputB.readInt();\n\t\t\t\t\t}\n\t\t\t\t\tcounterB--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (counterA == 0){\n\t\t\t\td.writeInt(b);\n\t\t\t\tcounterB--;\n\t\t\t\tfor (int i =0; i < counterB; i++){\n\t\t\t\t\td.writeInt(inputB.readInt());\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\td.writeInt(a);\n\t\t\t\tcounterA--;\n\t\t\t\tfor (int i =0; i < counterA; i++){\n\t\t\t\t\td.writeInt(inputA.readInt());\n\t\t\t\t}\n\t\t\t}\n\t\t\tinputA.skip(size*4);\n\t\t\tinputB.skip(size*4);\n\t\t}\n\t\t\n\t\t//copy the excess\n\t\twhile (inputA.available()>0){\n\t\t\td.writeInt(inputA.readInt());\n\t\t}\n\t\tinputA.close();\n\t\tinputB.close();\n\t\td.flush();\n\t}", "public static void sortInputBuiltIn() {\r\n\t\t\tEtmPoint point = monitor.createPoint(\"1.sortInputBuiltIn\");\r\n\r\n\t\t\tInput input = new Input(inputFile, BUFFERSIZE);\r\n\t\t\tList<Integer> integers = new ArrayList<Integer>();\r\n\r\n\t\t\ttry {\r\n\t\t\t\tinput.open();\r\n\t\t\t\t\r\n\t\t\t\twhile (!input.end_of_stream()) {\r\n\t\t\t\t\t// read the value\r\n\t\t\t\t\tint value = input.read_next();\r\n\t\t\t\t\tintegers.add(value);\r\n\t\t\t\t}\t\r\n\t\t\t\t\r\n\t\t\t\tCollections.sort(integers);\r\n\t\t\t\t\r\n\t\t\t\t// write the data to a file\r\n\t\t\t\tOutput output = new Output(outputFile, BUFFERSIZE);\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfor (int i = 0; i < integers.size(); i++) {\r\n\t\t\t\t\t\toutput.write(integers.get(i));\r\n\t\t\t\t\t}\r\n\t\t\t\t\toutput.close();\r\n\t\t\t\t} catch (IOException 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} catch (FileNotFoundException e) {\r\n\t\t\t\tSystem.out.println(\"File cannot be found.\");\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\tpoint.collect();\r\n\t\t}", "private void writeItems() {\n\n // open file\n File file = getFilesDir();\n File todoFile = new File(file, \"scores.txt\");\n\n // try to add items to file\n try {\n FileUtils.writeLines(todoFile, items);\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public void sort() {\n compares = 0;\n shuttlesort((int[]) indexes.clone(), indexes, 0, indexes.length);\n }", "private void buildUnsortedList(String list)\n\t{\n\t\ttokenBuffer = new StringTokenizer(line);\n\t\tlistSize = Integer.parseInt(tokenBuffer.nextToken());\n\t\tunsortedList = new int[listSize];\n\t\tsortedList = new int[listSize];\n\n\t\t// Grab each integer from the line and throw it in our lists\n\t\tfor(int i = 0; i < listSize; i++) \n\t\t{\n\t\t\tunsortedList[i] = Integer.parseInt(tokenBuffer.nextToken());\n\t\t\tsortedList[i] = unsortedList[i];\n\t\t}\n\t}", "public static void main(String[] args) {\n\n\t\tint number = 32841;\n\t\tint temp = 32841;\n\t\t/*\n\t\t * int number = 32814; int temp = 32814;\n\t\t */\n\t\t// 14823\n\t\t// 12843\n\t\tArrayList<Integer> listOfNumbers = new ArrayList<Integer>();\n\t\tArrayList<Integer> newList = new ArrayList<Integer>();\n\n\t\twhile (temp > 0) {\n\t\t\tint digit = temp % 10;\n\t\t\ttemp = temp / 10;\n\t\t\tlistOfNumbers.add(digit);\n\t\t}\n\n\t\tint i = 0;\n\t\tint j = i + 1;\n\t\t// Checking the asecending order\n\t\tfor (i = 0; i < listOfNumbers.size() - 1; i++) {\n\n\t\t\tif (listOfNumbers.get(j) < listOfNumbers.get(i)) {\n\t\t\t\tSystem.out.println(listOfNumbers.get(i + 1));\n\t\t\t\tSystem.out.println(i + 1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.println(j);\n\t\t\tj++;\n\t\t}\n\n\t\t// j = 0;\n\n\t\t// replacing the 2 and 4\n\t\tfor (int m = 0; m < listOfNumbers.size() - 1; m++) {\n\n\t\t\tif ((Integer) listOfNumbers.get(m) > (Integer) listOfNumbers.get(i + 1)) {\n\t\t\t\tSystem.out.println(\" i = \" + i);\n\t\t\t\tSystem.out.println(\"value at m is \" + listOfNumbers.get(m));\n\t\t\t\tSystem.out.println(\"value at i is \" + listOfNumbers.get(i + 1));\n\t\t\t\tint swap = listOfNumbers.get(m);\n\t\t\t\tlistOfNumbers.set(m, listOfNumbers.get(i + 1));\n\t\t\t\tlistOfNumbers.set(i + 1, swap);\n\t\t\t\tbreak;\n\n\t\t\t}\n\t\t}\n\t\t// getting the sub list and sorting them\n\t\tList<Integer> subList = listOfNumbers.subList(0, i + 1);\n\t\tCollections.sort(subList);\n\t\tCollections.reverse(subList);\n\n\t\t// creating a new list wit the next higher number\n\t\tfor (int k = listOfNumbers.size(); k > i + 1; k--) {\n\t\t\tnewList.add(listOfNumbers.get(k - 1));\n\t\t}\n\n\t\tfor (int k = 0; k < subList.size(); k++) {\n\t\t\tnewList.add(subList.get(k));\n\t\t}\n\n\t\tfor (int k = 0; k < newList.size(); k++) {\n\t\t\tSystem.out.print(newList.get(k));\n\t\t}\n\t}", "public synchronized void addList(int[] list) {\r\n listsOfSorted.offer(list);\r\n }", "private void updateFile() {\n\t\tPrintWriter outfile;\n\t\ttry {\n\t\t\toutfile = new PrintWriter(new BufferedWriter(new FileWriter(\"stats.txt\")));\n\t\t\toutfile.println(\"15\"); // this is the number\n\t\t\tfor (Integer i : storeInfo) {\n\t\t\t\toutfile.println(i); // we overwrite the existing files\n\t\t\t}\n\t\t\tfor (String s : charBought) {\n\t\t\t\toutfile.println(s); // overwrite the character\n\t\t\t}\n\t\t\tfor (String s : miscBought) {\n\t\t\t\toutfile.println(s);\n\t\t\t}\n\t\t\toutfile.close();\n\t\t}\n\t\tcatch (IOException ex) {\n\t\t\tSystem.out.println(ex);\n\t\t}\n\t}", "public void shellSort(){\n int increment = list.size() / 2;\n while (increment > 0) {\n for (int i = increment; i < list.size(); i++) {\n int j = i;\n int temp = list.get(i);\n while (j >= increment && list.get(j - increment) > temp) {\n list.set(j, list.get(j - increment));\n j = j - increment;\n }\n list.set(j, temp);\n }\n if (increment == 2) {\n increment = 1;\n } else {\n increment *= (5.0 / 11);\n }\n }\n }", "public static void customSort(List<Integer> array) {\n Map<Integer, Integer> map = new HashMap<>();\n List<Integer> outputArray = new ArrayList<>();\n int ii = 0;\n for (int current : array) {\n if (ii==0){\n ii++;\n continue;\n }\n int count = map.getOrDefault(current, 0);\n map.put(current, count + 1);\n outputArray.add(current);\n ii++;\n }\n\n Set<Map.Entry<Integer, Integer>> entries = map.entrySet();\n for (Map.Entry<Integer, Integer> entry : entries) {\n entry.getKey();\n }\n\n // Compare the map by value\n SortComparator comp = new SortComparator(map);\n\n // Sort the map using Collections CLass\n Collections.sort(outputArray,comp);\n\n // Final Output\n for (Integer i : outputArray) {\n System.out.print(i + \" \");\n }\n System.out.println();\n\n }", "public void writeFile(){\n try{\n FileWriter writer = new FileWriter(\"Highscores.txt\");\n for (int i = 0; i<10; i++){\n if (i >= this.highscores.size()){\n break;\n }\n writer.write(String.valueOf(this.highscores.get(i)) + \"\\n\");\n }\n writer.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public static void userSort(ArrayList<FileData> fromFile, int primary_sort, int secondary_sort, int primary_order, int secondary_order)\n {\n \n // user wants to sort by primary = state code and secondary = county code\n if(primary_sort == 1 && secondary_sort == 2) \n {\n if(primary_order == 1 && secondary_order == 1){// user wants both primary and secondary in ascending order\n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n }\n }\n else if(primary_order == 2 && secondary_order == 2){ // user wants both primary and secondary in decending order\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){// primary is ascending\n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_County_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){//primary is descending\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n Collections.sort(fromFile,new Sort_County_Code()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n // user wants to sort by primary = county code and secondary = state code\n if(primary_sort == 2 && secondary_sort == 1){\n if(primary_order == 1 && secondary_order == 1){\n //primary and seconary is ascending\n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order == 2 && secondary_order == 2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n Collections.sort(fromFile,new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){//primary is ascending\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n Collections.sort(fromFile,new Sort_County_Code()); // primary sort\n \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){//primary is descending\n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_County_Code().reversed()); // primary sort\n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==1&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new Sort_State_Code()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new Sort_State_Name()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new Sort_State_Name().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==1&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new Sort_State_Code()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile, new Sort_State_Code());\n Collections.sort(fromFile,new Sort_County_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new Sort_County_Name()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new Sort_County_Name().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n if(primary_sort==1&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortFirstConfirmCount());\n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n for(int i=0; i<fromFile.size(); i++){\n System.out.println(fromFile.get(i).printInfo());\n } \n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information \n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information \n } \n } \n }\n \n \n if(primary_sort==1&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); \n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); \n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo()); // print the sorted information by state and county code\n } \n } \n }\n \n if(primary_sort==6&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==1&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==7&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==1&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new Sort_State_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new Sort_State_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n \n if(primary_sort==8&&secondary_sort==1){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile, new Sort_State_Code().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile,new Sort_State_Code().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Code());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==2&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new Sort_County_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new Sort_State_Name().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==2&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new Sort_County_Code().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new Sort_County_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new Sort_County_Name().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==2&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n \n if(primary_sort==2&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n if(primary_sort==6&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n \n if(primary_sort==2&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n if(primary_sort==7&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==2&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new Sort_County_Code());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Code());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n if(primary_sort==8&&secondary_sort==2){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Code());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Code().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Code().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Code());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed()); \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n } \n \n if(primary_sort==3&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==4&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==5&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==6&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==7&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==3&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n \n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new Sort_State_Name());\n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n \n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n \n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_State_Name());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==8&&secondary_sort==3){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_State_Name());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_State_Name().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_State_Name().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_State_Name());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==6&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==7&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==4&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new Sort_County_Name());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new Sort_County_Name());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==8&&secondary_sort==4){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new Sort_County_Name());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new Sort_County_Name().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new Sort_County_Name().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new Sort_County_Name());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==6&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==7&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==5&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new SortFirstConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n \n if(primary_sort==8&&secondary_sort==5){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFirstConfirmCount());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFirstConfirmCount().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFirstConfirmCount());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==6&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==7&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==6&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new SortSecondConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==8&&secondary_sort==6){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortSecondConfirmCount());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortSecondConfirmCount().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortSecondConfirmCount());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==7&&secondary_sort==8){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortFourthConfirmCount());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n Collections.sort(fromFile,new SortThirdConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order==2){\n //primary is descending\n Collections.sort(fromFile,new SortFourthConfirmCount());\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n if(primary_sort==8&&secondary_sort==7){\n if(primary_order==1&&secondary_order==1){\n //primary and second is ascending\n \n Collections.sort(fromFile, new SortThirdConfirmCount());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==2&&secondary_order==2){\n //both descending\n Collections.sort(fromFile,new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n \n for(int i=0; i<fromFile.size(); i++){ \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n \n else if(primary_order==1){\n //secondary is descending\n Collections.sort(fromFile, new SortThirdConfirmCount().reversed());\n Collections.sort(fromFile,new SortFourthConfirmCount());\n \n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n }\n }\n else if(primary_order == 2){\n //primary is descending\n Collections.sort(fromFile,new SortThirdConfirmCount());\n Collections.sort(fromFile, new SortFourthConfirmCount().reversed());\n \n for(int i=0; i<fromFile.size(); i++){\n \n System.out.println(fromFile.get(i).printInfo());\n } \n } \n }\n }", "public boolean addToSortedQueue(ArrayList<Integer> job) throws RemoteException;", "public void sortElements(){\n\t\tgetInput();\n\t\tPeople[] all = countAndSort(people, 0, people.length-1);\n\t\t//PrintArray(all);\n\t\tSystem.out.println(InversionCount);\n\t}", "@Override\n public void sort() {\n for (int i = 0; i < size; i++) {\n for (int j = i + 1; j < size; j++) {\n if (((Comparable) data[i]).compareTo(data[j]) > 0) {\n E c = data[i];\n data[i] = data[j];\n data[j] = c;\n\n }\n }\n }\n }", "public static void toBinFile(ArrayList<Loan> l){\r\n for(int i = 0; i < l.size(); i++){\r\n try{\r\n FileOutputStream fileOut = new FileOutputStream(\"loans.bin\");\r\n ObjectOutputStream objectOut = new ObjectOutputStream(fileOut);\r\n objectOut.write(i);\r\n \r\n }catch(IOException e){\r\n System.out.println(e);\r\n }\r\n }\r\n System.out.println(\"All loans stored to file\\n\");\r\n }", "public void insertionSort(ArrayList <Integer> list){\n System.out.println();\n System.out.println(\"Insertion Sort\");\n System.out.println();\n\n int current = 0;\n int len = list.size();\n for (int n = 1; n < len; n++) {\n current = list.get(n);\n int j = n - 1;\n while (j >= 0 && list.get(j) > current) {\n list.set(j + 1, list.get(j));\n j = j - 1;\n }\n list.set(j + 1, current);\n }\n }", "public static void sortFiles(List<File> files)\r\n\t{\r\n\t\t/*\r\n\t\t * bubblesort algorithm\r\n\t\t */\r\n\t\tboolean changesMade = true;\r\n\t\t\r\n\t\twhile (changesMade)\r\n\t\t{\r\n\t\t\tchangesMade = false;\r\n\t\t\t\r\n\t\t\tfor(int x=1; x<files.size(); x++)\r\n\t\t\t{\r\n\t\t\t\t/*\r\n\t\t\t\t * if file at index x has a lower number than the file\r\n\t\t\t\t * at index x-1\r\n\t\t\t\t */\r\n\t\t\t\tif(getFileNum(files.get(x)) < getFileNum(files.get(x-1)))\r\n\t\t\t\t{\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * put this file in the previous index\r\n\t\t\t\t\t */\r\n\t\t\t\t\tFile tempFile = files.get(x);\r\n\t\t\t\t\tfiles.remove(x);\r\n\t\t\t\t\tfiles.add(x-1, tempFile);\r\n\t\t\t\t\t\r\n\t\t\t\t\t//indicate changes were made\r\n\t\t\t\t\tchangesMade = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t}", "public void mergefiles()\n {\n LinkedHashMap<String, Integer> count = new LinkedHashMap<>();\n for(int i=0;i<files_temp.size();i++)\n {\n \t\t\n //System.out.println(\"here in merge files for\");\n \t//int index = files_temp.get(i).lastIndexOf(\"\\\\\");\n\t\t\t//System.out.println(index);\n \tSystem.out.println(files_temp.get(i));\n File file = new File(files_temp.get(i)+\"op.txt\");\n Scanner sc;\n try {\n //System.out.println(\"here in merge files inside try\");\n sc = new Scanner(file);\n sc.useDelimiter(\" \");\n while(sc.hasNextLine())\n {\n //System.out.println(\"Inwhile \");\n List<String> arr = new ArrayList<String>();\n arr=Arrays.asList(sc.nextLine().replaceAll(\"[{} ]\", \"\").replaceAll(\"[=,]\", \" \").split(\" \"));\n //System.out.println(arr.get(0));\n for(int j=0;j<arr.size()-1;j=j+2) \n {\n System.out.println(arr.get(j));\n if(arr.get(j).length()!=0 && arr.get(j+1).length()!=0)\n {\n if (count.containsKey(arr.get(j))) \n {\n int c = count.get(arr.get(j));\n count.remove(arr.get(j));\n count.put(arr.get(j),c + Integer.valueOf(arr.get(j+1)));\n }\n else \n {\n count.put(arr.get(j),Integer.valueOf(arr.get(j+1)));\n }\n }\n }\n }\n }\n catch(Exception E) \n {\n System.out.println(E);\n }\n }\n //System.out.println(count);\n count.entrySet()\n .stream()\n .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))\n .forEachOrdered(x -> sorted.put(x.getKey(), x.getValue()));\n System.out.println(sorted);\n PrintWriter writer;\n\t\ttry {\n\t\t\twriter = new PrintWriter(\"results.txt\", \"UTF-8\");\n\t\t\tIterator it = sorted.entrySet().iterator();\n\t\t\twhile (it.hasNext()) {\n\t\t\t\tMap.Entry pairs = (Map.Entry) it.next();\n\t\t\t\t\twriter.println(pairs.getValue() + \" : \" + pairs.getKey());\n\t\t\t\t\tthis.result.println(pairs.getValue() + \" : \" + pairs.getKey());\n\t\t\t}\n\t\t writer.close();\n\t\t}\n catch(Exception e)\n\t\t{\n\t\t\tSystem.out.println(e);\n\t\t}\n }", "public static void Externalexp2Sort(ArrayList<String> source)\n throws IOException {\n PriorityQueue<KVPair> heap = new PriorityQueue<KVPair>(20,\n new UserPrio());\n ArrayList<CsvReader> readers = new ArrayList<CsvReader>();\n // user_tweets output\n PrintWriter writer = new PrintWriter(new FileWriter(user_retweet));\n\n // open files\n for (String fileName : source) {\n // get read csv files\n CsvReader reader = new CsvReader(new InputStreamReader(\n new FileInputStream(fileName), \"UTF-8\"));\n reader.setHeaders(Merge.fields);\n // read a line and put into heap\n if (reader.readRecord()) {\n heap.offer(new KVPair(Merge.readRecord(reader), readers.size()));\n }\n readers.add(reader);\n }\n\n // get same key\n KVPair last = null;\n HashSet<Long> sameRecord = new HashSet<Long>();\n\n while (heap.size() > 0) {\n KVPair tmp = heap.poll();\n\n // no retweet directly read the next\n if (tmp.record.retweet != -1) {\n if (last != null && last.record.retweet != -1\n && last.record.retweet != tmp.record.retweet) {\n StringBuilder builder = new StringBuilder(\n last.record.retweet + \",\");\n\n for (Long userid : sameRecord) {\n builder.append(userid);\n builder.append(\" \");\n }\n writer.println(builder);\n sameRecord = new HashSet<Long>();\n }\n sameRecord.add(tmp.record.userid);\n }\n\n // read next record in the same file\n if (readers.get(tmp.file).readRecord()) {\n heap.offer(new KVPair(Merge.readRecord(readers.get(tmp.file)),\n tmp.file));\n } else {\n readers.get(tmp.file).close();\n }\n last = tmp;\n }\n\n // last part of external sort\n if (sameRecord.size() != 0) {\n StringBuilder builder = new StringBuilder(last.record.retweet + \",\");\n\n for (Long userid : sameRecord) {\n builder.append(userid);\n builder.append(\" \");\n }\n writer.println(builder);\n }\n\n writer.close();\n }", "private void externalSort() throws IOException{\n\t\t/*\n\t\t * Pass 0: internal sort\n\t\t */\n\t\t// Read in from child;Write out runs of B pages;\n\t\t\n\t\tint numPerRun = B * 4096 / (schema.size() * 4); // # of tuples per run given in Pass0\n\t\tboolean buildMore;\n\t\tint numRuns = 0;\n\t\tif(sortAttrsIndex == null) {\n\t\t\tthis.buildAttrsIndex();\n\t\t}\n\t\texComparator myComp = new exComparator();\n\t\tinternal = new PriorityQueue<Tuple>(myComp);\n\t\tdo {\n\t\t\tbuildMore = this.buildHeap(numPerRun);\n\t\t\tnumRuns++;\n\t\t\t\n\t\t\t// write out the (numRuns)th run\n\t\t\tTupleWriter TW;\n\t\t\tif(!buildMore && numRuns == 1) {\n\t\t\t\tTW = new TupleWriter(new FileOutputStream(tempsubdir + \"sortResult\"));\n\t\t\t} else {\n\t\t\t\tTW = new TupleWriter(new FileOutputStream(tempsubdir + \"0_\" + numRuns));\n\t\t\t}\n\t\t\twhile(!internal.isEmpty()) {\n//\t\t\t\tSystem.out.println(internal.peek().data);\n\t\t\t\tTW.setNextTuple(internal.poll()); \n\t\t\t}\n\t\t\t// leftover, fill with zero and write out\n\t\t\tif(!TW.bufferEmpty()) { // TW would never know the end of writing\n\t\t\t\tTW.fillFlush(); \n\t\t\t}\n\t\t\tTW.close();\n\t\t\t// internal must be empty until this point\n\t\t}while (buildMore);\n\t\t\n\t\t/*\n\t\t * Pass 1 and any following\n\t\t */\n\t\tif(numRuns > 1) { // if numRuns generated in Pass 0 is 1 already, file sorted already, no need to merge\n\t\t\tthis.merge(numRuns, myComp);\n\t\t}\n\t\t\n\t}", "private void orderList() {\n Iterator<PlanarShape> sort = unorderedList.iterator();\n\n while(sort.hasNext()) {\n orderedList.insertInOrder(sort.next());\n }\n }", "public static void main(String[] args) throws Exception {\n FileOutputStream file = new FileOutputStream(\"randoms.txt\");\n PrintWriter output = new PrintWriter(file);\n\n //write 100 random numbers to the file\n\n\n\n\n //open the file for input\n\n\n\n\n //print the sorted array on the screen\n\n\n\n}", "private static void writeToBuffer(int index, RandomAccessFile fos) {\n\n try {\n\n // x is the current integer value to be written.\n int x;\n // loc is the current location in the buffer to be written.\n int loc = 0;\n\n // iterates through each value in the sorted integer array.\n for (int k = 0; k < index; k++) {\n // gets the current integer.\n x = ints[k];\n\n // checks if the buffer is full.\n if (loc == BUF_SIZE) {\n // if the buffer is full, write its contents out to the file.\n fos.write(buf);\n // the buffer has been emptied, so set its current location back to the start.\n loc = 0;\n }\n\n // convert the current integer value to be written to a byte array.\n buf[loc] = (byte) (x >> 24);\n buf[loc + 1] = (byte) (x >> 16);\n buf[loc + 2] = (byte) (x >> 8);\n buf[loc + 3] = (byte) (x);\n\n // increment the location in the buffer now that a value has been written in.\n loc += BYTES_TO_INTS;\n }\n\n if (loc > 0) {\n // if there are any values left over in the buffer, write them out to the file.\n fos.write(buf, 0, loc);\n\n }\n } catch (IOException e){\n e.printStackTrace();\n }\n }", "private void arrayIncreaaseSize(MyArrayList myArrayList, Results results) {\r\n int old_size = myArrayList.length();\r\n int value;\r\n Random rand = new Random();\r\n \r\n for(int i=0; i<50; i++) {\r\n value = rand.nextInt(10000);\r\n if(value < 0) {\r\n value = value * -1;\r\n }\r\n myArrayList.insertSorted(value);\r\n }\r\n if(myArrayList.length() == old_size + 25) {\r\n results.storeNewResult(\"ArrayIncrease test case: PASSED\");\r\n }\r\n else {\r\n results.storeNewResult(\"ArrayIncrease test case: FAILED\");\r\n }\r\n }", "public BubSortList() {\n\t\tray = new int[MAXSIZE];\n\t\tnowLength = 0;\n\t}", "public static ArrayList<Integer> sortArrayList (ArrayList<Integer> arrList) {\n\t Collections.sort(arrList);\n return arrList;\n}", "public void writeData(ArrayList<Task> orderList) {\n try {\n FileWriter fw = new FileWriter(filePath, false);\n for (Task task : orderList) {\n fw.write(task.fileFormattedString() + \"\\n\");\n }\n fw.close();\n\n } catch (IOException e) {\n System.out.println(e.getMessage());\n }\n }", "private static <File> void merge(ArrayList<File> firstList, ArrayList<File> secondList,\r\n ArrayList<File> wholeList, Comparator<File> usedComparison) {\r\n int i = 0;\r\n int j = 0;\r\n int k = 0;\r\n while (i < firstList.size() && j < secondList.size()) {\r\n if (usedComparison.compare(firstList.get(i), secondList.get(j)) < 0) {\r\n wholeList.set(k++, firstList.get(i++));\r\n } else {\r\n wholeList.set(k++, secondList.get(j++));\r\n }\r\n }\r\n while (i < firstList.size()) {\r\n wholeList.set(k++, firstList.get(i++));\r\n }\r\n while (j < secondList.size()) {\r\n wholeList.set(k++, secondList.get(j++));\r\n }\r\n }", "private void arrayInsertNegativeNumber(MyArrayList myArrayList, Results results, int value) {\r\n myArrayList.insertSorted(value);\r\n if(myArrayList.search(value)) { \r\n results.storeNewResult(\"ArrayInsertNegativeNumber test case: FAILED\");\r\n }\r\n else { \r\n results.storeNewResult(\"ArrayInsertNegativeNumber test case: PASSED\");\r\n }\r\n }", "private static void sortingMemo() {\n\t\t\n\t}", "public void readFile(){\n try {\n highscores = new ArrayList<>();\n BufferedReader br = new BufferedReader(new FileReader(\"Highscores.txt\"));\n String line = br.readLine();\n while (line != null){\n try{\n highscores.add(Integer.parseInt(line));\n } catch (NumberFormatException e){}\n line = br.readLine();\n }\n br.close();\n } catch (FileNotFoundException e) {\n System.out.println(\"No file found\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "void writeTotal(String outDir, String simpleFileName, List<T> items);", "static void mergeSortedFiles() throws IOException {\n\n\t\tBufferedReader[] bufReaderArray = new BufferedReader[noOfFiles];\n\t\tList<String> intermediateList = new ArrayList<String>();\n\t\tList<String> lineDataList = new ArrayList<String>();\n\n\t\tfor (int file = 0; file < noOfFiles; file++) {\n\t\t\tbufReaderArray[file] = new BufferedReader(new FileReader(DividedfileList.get(file)));\n\n\t\t\tString fileLine = bufReaderArray[file].readLine();\n\n\t\t\tif (fileLine != null) {\n\t\t\t\tintermediateList.add(fileLine.substring(0, 10));\n\t\t\t\tlineDataList.add(fileLine);\n\t\t\t}\n\t\t}\n\n\t\tBufferedWriter bufw = new BufferedWriter(new FileWriter(Outputfilepath));\n\n\t\t// Merge files into one file\n\n\t\tfor (long lineNumber = 0; lineNumber < totalLinesInMainFile; lineNumber++) {\n\t\t\tString sortString = intermediateList.get(0);\n\t\t\tint sortFile = 0;\n\n\t\t\tfor (int iter = 0; iter < noOfFiles; iter++) {\n\t\t\t\tif (sortString.compareTo(intermediateList.get(iter)) > 0) {\n\t\t\t\t\tsortString = intermediateList.get(iter);\n\t\t\t\t\tsortFile = iter;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbufw.write(lineDataList.get(sortFile) + \"\\r\\n\");\n\t\t\tintermediateList.set(sortFile, \"-1\");\n\t\t\tlineDataList.set(sortFile, \"-1\");\n\n\t\t\tString nextString = bufReaderArray[sortFile].readLine();\n\n\t\t\tif (nextString != null) {\n\t\t\t\tintermediateList.set(sortFile, nextString.substring(0, 10));\n\t\t\t\tlineDataList.set(sortFile, nextString);\n\t\t\t} else {\n\t\t\t\tlineNumber = totalLinesInMainFile;\n\n\t\t\t\tList<String> ListToWrite = new ArrayList<String>();\n\n\t\t\t\tfor (int file = 0; file < intermediateList.size(); file++) {\n\t\t\t\t\tif (lineDataList.get(file) != \"-1\")\n\t\t\t\t\t\tListToWrite.add(lineDataList.get(file));\n\n\t\t\t\t\twhile ((sortString = bufReaderArray[file].readLine()) != null) {\n\t\t\t\t\t\tListToWrite.add(sortString);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tCollections.sort(ListToWrite);\n\t\t\t\tint index = 0;\n\t\t\t\twhile (index < ListToWrite.size()) {\n\t\t\t\t\tbufw.write(ListToWrite.get(index) + \"\\r\\n\");\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tbufw.close();\n\t\tfor (int file = 0; file < noOfFiles; file++)\n\t\t\tbufReaderArray[file].close();\n\t}", "private void sort() {\n\t\trunPassZero();\n\t\tList<TupleReaderBinary> buffers = new ArrayList<>();\n\t\tList<Tuple> sortStage = new ArrayList<>();\n\t\tassert (readerBucketID == 0);\n\t\tassert (writerBucketID == 0);\n\t\tassert (passNumber == 1);\n\t\tassert (currentGroup == 1);\n\t\toutputBuffer.clear();\n\n\t\t// assign buffers\n\t\tfor (int i = 0; i < numInputBuffers; i++) {\n\t\t\tbuffers.add(null);\n\t\t\tassignBuffer(buffers, i);\n\t\t\tsortStage.add(null);\n\t\t}\n\n\t\tassert (buffers.size() == numInputBuffers);\n\t\tassert (sortStage.size() == numInputBuffers);\n\n\t\t// read from buffers into list of size numInputBuffers\n\t\tfor (int i = 0; i < numInputBuffers; i++) {\n\t\t\tsortStage.set(i, readFromBuffer(buffers, i));\n\t\t}\n\n\t\toutputWriter = new TupleWriterBinary(DatabaseCatalog.getInstance().getTempDirectory() + \"/\" + instanceHashcode\n\t\t\t\t+ \"_\" + passNumber + \"_\" + writerBucketID);\n\n\t\twhile (true) {\n\t\t\tif (!findAndReplaceSmallest(buffers, sortStage)) {\n\t\t\t\tprevPrevTotalBuckets = prevTotalBuckets;\n\t\t\t\tprevTotalBuckets = writerBucketID + 1;\n\t\t\t\tflushOutputBuffer();\n\t\t\t\toutputWriter.close();\n\n\t\t\t\t// We are done! Return\n\t\t\t\tif (prevTotalBuckets == 1) {\n\t\t\t\t\tdeleteTempFiles();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\twriterBucketID = 0;\n\t\t\t\treaderBucketID = 0;\n\t\t\t\twriterFlushes = 0;\n\t\t\t\tdeleteTempFiles();\n\t\t\t\tpassNumber++;\n\t\t\t\tcurrentGroup = 1;\n\n\t\t\t\tfor (int i = 0; i < numInputBuffers; i++) {\n\t\t\t\t\tassignBuffer(buffers, i);\n\t\t\t\t\tsortStage.add(null);\n\t\t\t\t}\n\t\t\t\tfor (int i = 0; i < numInputBuffers; i++) {\n\t\t\t\t\tsortStage.set(i, readFromBuffer(buffers, i));\n\t\t\t\t}\n\n\t\t\t\toutputWriter = new TupleWriterBinary(DatabaseCatalog.getInstance().getTempDirectory() + \"/\"\n\t\t\t\t\t\t+ instanceHashcode + \"_\" + passNumber + \"_\" + writerBucketID);\n\t\t\t}\n\t\t}\n\n\t}", "ArrayList<String> sortFiles(String[] allFiles){\n\n ArrayList<String> tempArrayList = new ArrayList<String>();\n ArrayList<String> returnArrayList = new ArrayList<String>();\n String[] tempArray = allFiles;\n String[] returnArray;\n\n int numOfFiles = tempArray.length;\n\n //delete nonneeded files\n for(int k = 0; k < numOfFiles; k++){\n if (tempArray[k].startsWith(\"G-\") || tempArray[k].startsWith(\"M-\") || tempArray[k].startsWith(\"I-\")){\n tempArrayList.add(tempArray[k]);\n }\n }\n\n returnArray = new String[tempArrayList.size()];\n for(int i = 0; i < tempArrayList.size(); i++){\n returnArray[i] = tempArrayList.get(i);\n }\n\n //if 0 return empty array\n if (returnArray.length < 2){\n return returnArrayList;\n }\n\n //bubble sort\n for (int i = 0; i < returnArray.length-1; i++){\n for (int j = 0; j < returnArray.length-i-1; j++){\n //get string of full number from file\n String tempFirst = returnArray[j].split(\"_\")[2] + returnArray[j].split(\"_\")[3];\n String tempSecond = returnArray[j+1].split(\"_\")[2] + returnArray[j+1].split(\"_\")[3];\n //take out csv if it is not a subgraph\n if (!tempFirst.contains(\"_subgraph_\")){\n tempFirst = tempFirst.substring(0,14);\n }\n if (!tempSecond.contains(\"_subgraph_\")){\n tempSecond = tempSecond.substring(0,14);\n }\n //get int of string\n long tempFirstNum = Long.parseLong(tempFirst);\n long tempSecondNum = Long.parseLong(tempSecond);\n //compare and swap if bigger\n if (tempFirstNum >= tempSecondNum)\n {\n String temp = returnArray[j];\n returnArray[j] = returnArray[j+1];\n returnArray[j+1] = temp;\n }\n }\n }\n\n //add elements to arraylist with newest date being first\n for(int k = returnArray.length-1; k >= 0; k--){\n returnArrayList.add(returnArray[k]);\n System.out.println(allFiles[k]);\n }\n\n return returnArrayList;\n }", "public static void Insertionsort(int a[]) \n\t { \n\t int n = a.length; \n\t for (int i=1; i<n; ++i) \n\t { \n\t int key = a[i]; \n\t int j = i-1;\n\t while (j>=0 && a[j] > key) \n\t { \n\t a[j+1] = a[j]; \n\t j = j-1; \n\t } \n\t a[j+1] = key; \n\t } \n\t }", "public static int addSorted(List<Float> arr, float val)\n\t{\n\t\tint len = arr.size();\n\t\tfor(int i = 0; i < len; i++)\n\t\t{\n\t\t\tfloat v = arr.get(i);\n\t\t\tif (v > val)\n\t\t\t{\n\t\t\t\tarr.add(i, val);\n\t\t\t\treturn(i);\n\t\t\t}\n\t\t\telse\n\t\t\t\tif (v == val)\n\t\t\t\t{\n\t\t\t\t\tarr.set(i, val);\n\t\t\t\t\treturn(-i);\n\t\t\t\t}\n\t\t}\n\t\t\n\t\tarr.add(len, val);\t\t\n\t\treturn(len);\n\t}", "OrderedIntList(int size)\n\t{\n\t\tdata = new int[size];\n\t\tcount = 0;\n\t}", "private void arraySum(MyArrayList myArrayList, Results results) {\r\n int old_sum = myArrayList.sum();\r\n myArrayList.insertSorted(511);\r\n int new_sum = myArrayList.sum();\r\n if(old_sum < new_sum) {\r\n results.storeNewResult(\"ArraySum test case: PASSED\");\r\n }\r\n else { \r\n results.storeNewResult(\"ArraySum test case: FAILED\");\r\n }\r\n }", "public void getList() {\n\n\t\tFile opFile = new File(\"/home/bridgeit/Desktop/newfile.txt\");\n\t\ttry {\n\t\t\topFile.createNewFile();\n\t\t\tFileWriter fwriter = new FileWriter(opFile);\n\n\t\t\tfor (int i = 0; i < slist.size(); i++) {\n\n\t\t\t\tfwriter.append(slist.returnItem(i) + \" \");\n\n\t\t\t}\n\t\t\tfwriter.close();\n\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}", "public static void addtoHashMap (File filename){\n\t\tFileInputStream fin;\n\t\ttry{\n\t\t\tfin = new FileInputStream(filename);\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(fin));\n\t\t\tString n;\n\t\t\ttry{\n\t\t\t\twhile ((n = br.readLine()) != null){\n\t\t\t\t\tif(h.containsKey(n)){\n\t\t\t\t\t\tint i = (Integer) h.get(n);\n\t\t\t\t\t\th.put(n, (i+1));\n\t\t\t\t\t}else{\n\t\t\t\t\t\th.put(n, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}catch(IOException e){\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t\n\t\t}catch(FileNotFoundException e){\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t}", "void sortNumber()\r\n\t{\r\n\t\tCollections.sort(this, this.ContactNumber);\r\n\t}", "public int addOrderedList(int number) {\n\t\tint index;\n\n\t\tif (olist.traverse(number) == 1) {\n\t\t\tindex = olist.returnPos(number);\n\t\t\tSystem.out.println(\"number will be added at\" + index);\n\n\t\t\tolist.insertAt(number, index);\n\n\t\t\tcount++;\n\n\t\t} else if (olist.traverse(number) == 0) {\n\t\t\tolist.deleteElement(number);\n\t\t\tcount--;\n\n\t\t}\n\n\t\treturn count;\n\n\t}", "private void refreshList() {\n setTitle(this.path.get(this.path.size() - 1));\n\n // Read all files sorted into the values-array\n values.clear();\n File dir = new File(this.path.get(this.path.size() - 1));\n if (!dir.canRead()) {\n setTitle(getTitle() + \" (inaccessible)\");\n }\n String[] list = dir.list();\n if (list != null) {\n for (String file : list) {\n if (!file.startsWith(\".\")) {\n values.add(file);\n }\n }\n }\n Collections.sort(values);\n }", "private static void sortList(ArrayList<ArrayList<Integer>> list){\n for (int i = 0; i < list.size(); i++) {\n for (int j = list.size() - 1; j > i; j--) {\n if ( (getCustomerArrivalTime(list.get(i)) == getCustomerArrivalTime(list.get(j)) && getCustomerIndex(list.get(i)) > getCustomerIndex(list.get(j)))\n || getCustomerArrivalTime(list.get(i)) > getCustomerArrivalTime(list.get(j))) {\n\n ArrayList<Integer> tmp = list.get(i);\n list.set(i,list.get(j)) ;\n list.set(j,tmp);\n }\n }\n }\n }", "public void sort() {\n documents.sort();\n }", "public void triCollection(){\r\n Collections.sort(collection);\r\n }", "private void mergeSort(int amtFiles, String outputFile) throws IOException {\n // Base case\n if (amtFiles > 1) {\n for (int i = 1; i <= amtFiles; i += 2) {\n\n if (i <= amtFiles - 1) {\n try (Scanner file1 = new Scanner(Paths.get(outputFile + i + \".txt\"));\n Scanner file2 = new Scanner(Paths.get(outputFile + (i + 1) + \".txt\"));\n BufferedWriter writer = Files.newBufferedWriter(Paths.get(outputFile + \".txt\"),\n StandardCharsets.UTF_8);) {\n merge(file1, file2, writer);\n\n } // close the Scanner and BufferedWriter\n // Replace a file\n Files.move(Paths.get(outputFile + \".txt\"), Paths.get(outputFile + ((i + 1) / 2) + \".txt\"),\n StandardCopyOption.REPLACE_EXISTING);\n } else {\n Files.move(Paths.get(outputFile + i + \".txt\"), Paths.get(outputFile + ((i + 1) / 2) + \".txt\"),\n StandardCopyOption.REPLACE_EXISTING);\n } // end of if\n } // end of for\n\n amtFiles = (amtFiles / 2) + (amtFiles % 2);\n mergeSort(amtFiles, outputFile);\n } // end of if\n }", "public void guardarRanking() throws FileNotFoundException, IOException{\n gest.guardarRanking(clasificacion);\n }" ]
[ "0.64619493", "0.62946665", "0.6290608", "0.62848294", "0.6122426", "0.60620064", "0.6023312", "0.5995982", "0.59636515", "0.5883381", "0.5873295", "0.5869425", "0.58484745", "0.5832453", "0.5827489", "0.5799681", "0.5799078", "0.5796878", "0.5777403", "0.57624376", "0.57479554", "0.57460564", "0.5705576", "0.56955326", "0.5685508", "0.56829447", "0.56826544", "0.5680562", "0.56739044", "0.56498015", "0.56463933", "0.5614887", "0.56029636", "0.5600555", "0.5595722", "0.55880874", "0.55835146", "0.5567586", "0.55487126", "0.553775", "0.5535101", "0.5525892", "0.55227894", "0.5511247", "0.54881376", "0.54767895", "0.5474731", "0.54730535", "0.54614115", "0.5457469", "0.5456469", "0.54501617", "0.540734", "0.5398805", "0.5396796", "0.5386437", "0.5382625", "0.5371546", "0.53691983", "0.53658766", "0.5359675", "0.5357982", "0.53561556", "0.5354909", "0.5338024", "0.53372514", "0.53357726", "0.53333527", "0.5332426", "0.5332258", "0.5329752", "0.53294325", "0.5322763", "0.5313805", "0.5301207", "0.5298295", "0.5282042", "0.5279583", "0.52785987", "0.5278253", "0.52729845", "0.52695453", "0.52655333", "0.52651453", "0.5257209", "0.5256908", "0.5255577", "0.52527976", "0.52462727", "0.52399147", "0.523627", "0.5235737", "0.5225083", "0.52230585", "0.52229244", "0.5222272", "0.5220862", "0.5219915", "0.52176183", "0.52174526" ]
0.5654396
29
/ write the ArrayList highscores to highscores.txt but only do this for the top 10 if the highscores contain less than 10 numbers it will stop after the last number
public void writeFile(){ try{ FileWriter writer = new FileWriter("Highscores.txt"); for (int i = 0; i<10; i++){ if (i >= this.highscores.size()){ break; } writer.write(String.valueOf(this.highscores.get(i)) + "\n"); } writer.close(); } catch (IOException e) { e.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void writeScores(){\r\n // TODO: Write the high scores data to the file name indicated\r\n // TODO: by Settings.highScoresFileName.\r\n \tFile outFile=new File(Settings.highScoresFileName);\r\n \tPrintWriter out=null;\r\n \ttry{\r\n \t\tout=new PrintWriter(outFile);\r\n \t\tfor(int i=0; i<Settings.numScores; i++){\r\n \t\t\tout.println(scores[i]+\" \"+names[i]);\r\n \t\t}\r\n \t}catch(Exception e){} \t\r\n \tfinally{\r\n \t\tif(out!=null) out.close();\r\n }\r\n }", "public void saveScores(){\n try {\n File f = new File(filePath, highScores);\n FileWriter output = new FileWriter(f);\n BufferedWriter writer = new BufferedWriter(output);\n\n writer.write(topScores.get(0) + \"-\" + topScores.get(1) + \"-\" + topScores.get(2) + \"-\" + topScores.get(3) + \"-\" + topScores.get(4));\n writer.newLine();\n writer.write(topName.get(0) + \"-\" + topName.get(1) + \"-\" + topName.get(2) + \"-\" + topName.get(3) + \"-\" + topName.get(4));\n writer.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public static void writeScoreToFile(ArrayList<String> sArrayList,int score, Context context,String userName){\n\n int[] temp = new int[sArrayList.size()];\n Scanner in = null;\n\n //get the score part from the txt file\n for(int i=0;i<sArrayList.size();i++){\n\n in = new Scanner(sArrayList.get(i)).useDelimiter(\"[^0-9]+\");\n int integer = in.nextInt();\n temp[i]=integer;\n Log.d(\"array temp[]\", \"writeScoreToFile: \"+temp[i]+\"\\n\");\n in.close();\n\n }\n\n int tempVal=0;\n String tempString=null;\n if(score>temp[4]) {\n\n temp[4]=score;\n sArrayList.set(4,String.format(\"%-10s%d\",userName,score));\n for(int j=0;j<sArrayList.size()-1;j++){\n for(int k=1;k<sArrayList.size()-j;k++){\n if(temp[k-1]<temp[k]){\n tempVal = temp[k-1];\n temp[k-1]=temp[k];\n temp[k]=tempVal;\n tempString = sArrayList.get(k-1);\n sArrayList.set(k-1,sArrayList.get(k));\n sArrayList.set(k,tempString);\n }\n }\n }\n\n\n //print arraylist\n for(int i=0;i<sArrayList.size();i++){\n Log.d(\"Arraylistcontent\", \"writeScoreToFile: \"+sArrayList.get(i));\n //Log.d(\"sizeArrayList\", \"writeScoreToFile: \"+sArrayList.size());\n }\n\n\n try {\n OutputStreamWriter outputStreamWriter = new OutputStreamWriter(context.openFileOutput(\"score.txt\", Context.MODE_PRIVATE));\n for(int i=0;i<sArrayList.size();i++){\n //use each line for one score\n outputStreamWriter.write(sArrayList.get(i)+\"\\n\");\n }\n outputStreamWriter.close();\n\n } catch (FileNotFoundException e) {\n Log.e(\"FileNotFoundException\", \"File write failed: \" + e.toString());\n } catch (IOException e) {\n Log.e(\"IOException\", \"File write failed: \" + e.toString());\n }\n Log.d(\"end of the log\", \"writeScoreToFile: \"+\".......\");\n }\n }", "public static void highScore(int score){\r\n\t\tString newName =\"\";\r\n\t\tif( score <11){\r\n\t\t\tScanner keyboard = new Scanner(System.in);\r\n\t\t\tSystem.out.println(\"Congratulations! You got a high score!\");\r\n\t\t\tSystem.out.println(\"Enter your Name!\");\r\n\t\t\tnewName = keyboard.nextLine();\r\n\t\t\t\r\n\t\t\ttry{\r\n\t\t\t\tString line = \"\";\r\n\t\t\t\tPrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(\"scoreList.temp\")));\r\n\t\t\t\tBufferedReader in = new BufferedReader(new FileReader(new File(\"scoreList.txt\")));\r\n\t\t\t\tint lineNum = 1;\r\n\t\t\t\tString temp = \"\";\r\n\t\t\t\twhile((line = in.readLine()) != null && lineNum <11){\r\n\t\t\t\t\t//replace the line with the new high score\r\n\t\t\t\t\t if (lineNum == score) {\r\n\t\t\t\t\t\t temp = line;\r\n\t\t\t\t\t\t line = newName;\r\n\t\t\t\t\t\t writer.println(line);\r\n\t\t\t\t\t\t lineNum++;\r\n\t\t\t\t\t\t //push the rest of the names down one\r\n\t\t\t\t\t\t while((line = in.readLine()) != null && lineNum <11){\r\n\t\t\t\t\t\t writer.println(temp);\r\n\t\t\t\t\t\t temp=line;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }else{\r\n\t\t\t\t\t writer.println(line);\r\n\t\t\t\t\t lineNum++;\r\n\t\t\t\t\t }\r\n\t\t\t\t}\r\n\t\t\t\t\twriter.close();\r\n\t\t\t\t\tin.close();\r\n\t\t\t\t\t// ... and finally ...\r\n\t\t\t\t\tFile realName = new File(\"scoreList.txt\");\r\n\t\t\t\t\trealName.delete(); // remove the old file\r\n\t\t\t\t\t// Rename temp file\r\n\t\t\t\t\tnew File(\"scoreList.temp\").renameTo(realName); // Rename temp file\r\n\t\t\t}catch(IOException e){\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\ttry{\r\n\t\t BufferedReader in = new BufferedReader(new FileReader(new File(\"scoreList.txt\")));\r\n\t\t System.out.println(\"The High Scores are: \");\r\n\t\t for(int i = 1; i < 11; i++){\r\n\t\t\t String data = in.readLine();\r\n\t\t\t System.out.println(\"#\" +i+\" \" + data);\r\n\t\t }\r\n\t\t in.close();\r\n\t\t}catch(IOException e){\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void keepBestOne() {\n ArrayList<Score> scores = getScoreFromFile();\n scores.sort(Score::compareTo);\n\n // Rewrite only the first 10 lines to the file.\n try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(scoreFile))) {\n for(int i = 0; i < 10 && i < scores.size(); i++)\n bufferedWriter.write(scores.get(i).VALUE + \" \" + scores.get(i).TIME + \"\\n\");\n } catch (IOException e) {\n System.err.println(\"Cannot open the score file : \" + e.getMessage());\n }\n }", "public void writeScoreToFile(){\n\t\ttry{\n\t\t\tFile file = new File(\"conversation_file.txt\");\n\t\t\tFileWriter f = new FileWriter(file.getAbsoluteFile());\n\t\t\tBufferedWriter b = new BufferedWriter(f);\n\t\t\tif(score > highScore)\n\t\t\t\tb.write(String.valueOf(score));\n\t\t\telse\n\t\t\t\tb.write(String.valueOf(highScore));\n\t\t\tb.close();\n\t\t} catch (IOException e){}\n\t\tSystem.out.println(\"File written, highScore \" + highScore + \" or Score \" + score + \" saved to file.\");\n\t}", "public void addHighscore(int i){\n highscores.add(i);\n sortHighscores();\n writeFile();\n }", "public void writeScores() throws IOException {\n if (this.list.isPresent() && this.toSave) {\n try (DataOutputStream out = new DataOutputStream(new FileOutputStream(this.file))) {\n for (final Pair<String, Integer> p : this.list.get()) {\n out.writeUTF(p.getX());\n out.writeInt(p.getY().intValue());\n }\n this.toSave = false;\n } catch (IOException e) {\n System.out.println(\"IOException on writing scores\");\n }\n }\n\n }", "public static boolean checkAndWriteHighScore() {\n\t\tString file = \"file:highScore.txt\";\n\t int highScore = 0;\n\t try {\n\t BufferedReader reader = new BufferedReader(new FileReader(file));\n\t String line = reader.readLine();\n\t while (line != null) // read the score file line by line\n\t {\n\t try {\n\t int oldScore = Integer.parseInt(line.trim()); // parse each line as an int\n\t if (oldScore > highScore){ \n\t highScore = oldScore; \n\t }\n\t } catch (NumberFormatException e1) {\n\t // ignore invalid scores\n\t //System.err.println(\"ignoring invalid score: \" + line);\n\t }\n\t line = reader.readLine();\n\t }\n\t reader.close();\n\n\t } catch (IOException ex) {\n\t System.err.println(\"ERROR reading scores from file\");\n\t }\n\t \n\t \n\t FileWriter myWriter;\n\t\ttry {\n\t\t\tmyWriter = new FileWriter(file);\n\t\t\tmyWriter.write(\"\" + points.get());\n\t\t\tmyWriter.close();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tif (points.get() > highScore) {\n\t\t\treturn true;\n\t\t}\n\t return false;\n\t}", "private void persistHighScore() {\n final String userHomeFolder = System.getProperty(USER_HOME); \n final Path higheScoreFilePath = Paths.get(userHomeFolder, HIGH_SCORE_FILE);\n \n final File f = new File(higheScoreFilePath.toString());\n if (f.exists() && !f.isDirectory()) {\n PrintWriter writer = null;\n try {\n writer = new PrintWriter(higheScoreFilePath.toString());\n writer.print(\"\");\n writer.close();\n \n } catch (final IOException e) {\n emptyFunc();\n } \n \n try {\n writer = new PrintWriter(higheScoreFilePath.toString());\n writer.print(Integer.toString(this.myHighScoreInt));\n writer.close();\n \n } catch (final IOException e) {\n emptyFunc();\n } \n \n if (writer != null) {\n writer.close();\n } \n }\n }", "public static void maybeAddNewHighScore(String name, double score) throws FileNotFoundException, IOException {\n ArrayList<String> scoresAsStrings = getAllScores();\n ArrayList<HighScore> scoresAsScores = new ArrayList<>();\n \n //if there aren't enough scores, something is wrong - replace the score file with the example scores\n if (scoresAsStrings.size() < NUMBER_OF_SCORES_TO_SAVE) {\n for (String s : EXAMPLE_SCORES) {\n scoresAsStrings.add(s);\n }\n }\n \n //Parse the strings into high score objects\n for (String s : scoresAsStrings) {\n HighScore hs = new HighScore(s);\n scoresAsScores.add(hs);\n }\n \n HighScore userScore = new HighScore(name, score);\n \n //Add the user's score, sort the list of scores, then take the first 10\n scoresAsScores.add(userScore);\n Collections.sort(scoresAsScores);\n \n //Take the first 10 and write them to the file\n HighScore[] listOfScoresToSave = new HighScore[NUMBER_OF_SCORES_TO_SAVE];\n for (int i = 0; i < NUMBER_OF_SCORES_TO_SAVE; i++) {\n listOfScoresToSave[i] = scoresAsScores.get(i);\n }\n \n writeToFile(listOfScoresToSave);\n }", "public String getHighscore() {\n String str = \"\";\n\t int max = 10;\n \n ArrayList<Score> scores;\n scores = getScores();\n \n int i = 0;\n int x = scores.size();\n if (x > max) {\n x = max;\n } \n while (i < x) {\n \t str += (i + 1) + \".\\t \" + scores.get(i).getNaam() + \"\\t\\t \" + scores.get(i).getScore() + \"\\n\";\n i++;\n }\n if(x == 0) str = \"No scores for \"+SlidePuzzleGUI.getRows()+\"x\"+SlidePuzzleGUI.getCols()+ \" puzzle!\";\n return str;\n }", "private static void writeToFile(HighScore[] scoresToSave) throws IOException {\n FileWriter writer = new FileWriter(SCORE_FILE_NAME);\n \n for (int i = 0; i < scoresToSave.length; i++) {\n //Don't write more than the maximum number of scores to save\n if (i > NUMBER_OF_SCORES_TO_SAVE)\n break;\n \n String str = scoresToSave[i].toString();\n writer.write(str);\n writer.write(System.getProperty(\"line.separator\"));\n }\n \n writer.close();\n }", "private void writeHighscore(int highscore) {\n EditText eTName = findViewById(R.id.eTName);\n String name = eTName.getText().toString().trim();\n String name1 = preferences.getString(KEY_NAME+\"1\",\"\");\n String name2 = preferences.getString(KEY_NAME+\"2\",\"\");\n String name3 = preferences.getString(KEY_NAME+\"3\",\"\");\n int topscore1 = preferences.getInt(KEY+\"1\",0);\n int topscore2 = preferences.getInt(KEY+\"2\",0);\n int topscore3 = preferences.getInt(KEY+\"3\",0);\n if (highscore >= topscore1) {\n preferencesEditor.putInt(KEY+\"1\",highscore);\n preferencesEditor.putString(KEY_NAME+\"1\", name);\n preferencesEditor.putInt(KEY+\"2\",topscore1);\n preferencesEditor.putString(KEY_NAME+\"2\", name1);\n preferencesEditor.putInt(KEY+\"3\",topscore2);\n preferencesEditor.putString(KEY_NAME+\"3\", name2);\n } else if (highscore >= topscore2) {\n preferencesEditor.putInt(KEY+\"1\", topscore1);\n preferencesEditor.putString(KEY_NAME+\"1\", name1);\n preferencesEditor.putInt(KEY+\"2\", highscore);\n preferencesEditor.putString(KEY_NAME+\"2\", name);\n preferencesEditor.putInt(KEY+\"3\", topscore2);\n preferencesEditor.putString(KEY_NAME+\"3\", name2);\n } else {\n preferencesEditor.putInt(KEY+\"1\", topscore1);\n preferencesEditor.putString(KEY_NAME+\"1\", name1);\n preferencesEditor.putInt(KEY+\"2\", topscore2);\n preferencesEditor.putString(KEY_NAME+\"2\", name2);\n preferencesEditor.putInt(KEY+\"3\", highscore);\n preferencesEditor.putString(KEY_NAME+\"3\", name);\n }\n preferencesEditor.commit();\n }", "private void saveHighScore() {\n\n\t\tFileOutputStream os;\n\t\n\t\ttry {\n\t\t boolean exists = (new File(this.getFilesDir() + filename).exists());\n\t\t // Create the file and directories if they do not exist\n\t\t if (!exists) {\n\t\t\tnew File(this.getFilesDir() + \"\").mkdirs();\n\t\t\tnew File(this.getFilesDir() + filename);\n\t\t }\n\t\t // Saving the file\n\t\t os = new FileOutputStream(this.getFilesDir() + filename, false);\n\t\t ObjectOutputStream oos = new ObjectOutputStream(os);\n\t\t oos.writeObject(localScores);\n\t\t oos.close();\n\t\t os.close();\n\t\t} catch (Exception e) {\n\t\t e.printStackTrace();\n\t\t}\n }", "void displayScores(int pts)\n\t{\n\t\tString[][] scs = new String[10][2];\n\t\ttry\n\t\t{\n\t\t\tScanner str = new Scanner(new File(\"./scores.log\"));\n\t\t\tfor (int i = 0; i < 10; i++)\n\t\t\t{\n\t\t\t\tscs[i] = str.nextLine().split(\"\\t\");\n\t\t\t}\n\t\t\tstr.close();\n\t\t}\n\t\tcatch (FileNotFoundException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tString scores = \"\";\n\t\tfor (int i = 0; i < 10; i++)\n\t\t\tscores += scs[i][0] + \"\\t\" + scs[i][1] + \"\\n\";\n\t\t\n\t\tint place = 10; // > 9; remains if the new score below the scoreboard\n\t\t\n\t\t// if new highscore\n\t\tif (pts > Integer.parseInt(scs[9][1]))\n\t\t{\n\t\t\t// determine the place\n\t\t\tplace = 9;\n\t\t\twhile (pts > Integer.parseInt(scs[place-1][1])) // place is too low\n\t\t\t{\n\t\t\t\tplace--; // move the \"pointer\" to higher place\n\t\t\t\tif (place == 0) break; // 1st place!\n\t\t\t}\n\t\t\t\n\t\t\t// insert where it should be\n\t\t\tfor (int i = 8; i >= place; i--)\n\t\t\t{\n\t\t\t\tscs[i+1][0] = new String(scs[i][0]); // drop place to lower\n\t\t\t\tscs[i+1][1] = new String(scs[i][1]);\n\t\t\t}\n\t\t\tscs[place][0] = parent.getUsername();\n\t\t\tscs[place][1] = \"\" + pts;\n\t\t}\n\t\t\n\t\t// prepare text for writing to file\n\t\tString textToWrite = \"\";\n\t\tfor (int i = 0; i < 10; i++) // for every place\n\t\t\ttextToWrite += scs[i][0] + \"\\t\" + scs[i][1] + \"\\n\";\n\t\t\n\t\t// write to scores.log\n\t\ttry\n\t\t{\n\t\t\tFileWriter str = new FileWriter(new File(\"./scores.log\"), false);\n\t\t\tstr.write(textToWrite);\n\t\t\tstr.close();\n\t\t}\n\t\tcatch (IOException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t// prepare text for displaying in the scoreboard\n\t\tString textDisplayed = \"<html><style>p{font-size:40px; font-family:\\\"Lucida Console\\\"}</style>\";\n\t\tfor (int i = 0; i < 10; i++) // for every place\n\t\t{\n\t\t\tif (i == place) textDisplayed += \"<font color=\\\"red\\\">\";\n\t\t\ttextDisplayed += \"<p>\" + scs[i][0] + \" \";\n\t\t\t// add dots to fill places up to 30\n\t\t\tfor (int j = 30; j > scs[i][0].length(); j--)\n\t\t\t\ttextDisplayed += \".\";\n\t\t\ttextDisplayed += \" \" + scs[i][1] + \"</p>\";\n\t\t\tif (i == place) textDisplayed += \"</font>\";\n\t\t}\n\t\t\n\t\tscoreboard.setText(textDisplayed);\n\t}", "public String getHighscores(){\r\n\t\tString returnString = \"\";\r\n\t\tList<Score> allScores = database.getAllScores(\"hard\");\r\n\t\t\r\n\t\t//loop through top 4 entries of table as obtained in the allScores list\r\n\t\tfor(int i = allScores.size()-1, j = 3; i>=0 && j>=0; j--, i--){\r\n\t\t\treturnString += String.valueOf(allScores.get(i).score + \" | \" + allScores.get(i).time + \"\\n\");\r\n\t\t}\r\n\t\treturn returnString;\r\n\t}", "public void loadScores() {\n try {\n File f = new File(filePath, highScores);\n if(!f.isFile()){\n createSaveData();\n }\n BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f)));\n\n topScores.clear();\n topName.clear();\n\n String[] scores = reader.readLine().split(\"-\");\n String[] names = reader.readLine().split(\"-\");\n\n for (int i =0; i < scores.length; i++){\n topScores.add(Integer.parseInt(scores[i]));\n topName.add(names[i]);\n }\n reader.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public void readFile(){\n try {\n highscores = new ArrayList<>();\n BufferedReader br = new BufferedReader(new FileReader(\"Highscores.txt\"));\n String line = br.readLine();\n while (line != null){\n try{\n highscores.add(Integer.parseInt(line));\n } catch (NumberFormatException e){}\n line = br.readLine();\n }\n br.close();\n } catch (FileNotFoundException e) {\n System.out.println(\"No file found\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public void deleteAllScore() {\n // Rewrite only the first 10 lines to the file.\n try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(scoreFile))) {\n bufferedWriter.write(\"\");\n } catch (IOException e) {\n System.err.println(\"Cannot open the score file : \" + e.getMessage());\n }\n }", "public void updateScoreFile() {\n try {\n outputStream = new ObjectOutputStream(new FileOutputStream(HIGHSCORE_FILE));\n outputStream.writeObject(scores);\n } catch (FileNotFoundException e) {\n } catch (IOException e) {\n } finally {\n try {\n if (outputStream != null) {\n outputStream.flush();\n outputStream.close();\n }\n } catch (IOException e) {\n }\n }\n }", "public List<ScoreInfo> getHighScores() {\n List<ScoreInfo> highScoreList = new ArrayList<>();\n if (scoreInfoList.size() <= size) {\n highScoreList = scoreInfoList;\n } else {\n for (int i = 0; i < size; i++) {\n highScoreList.add(scoreInfoList.get(i));\n }\n }\n return highScoreList;\n }", "public void sortHighScores(){\n for(int i=0; i<MAX_SCORES;i++){\n long score = highScores[i];\n String name= names[i];\n int j;\n for(j = i-1; j>= 0 && highScores[j] < score; j--){\n highScores[j+1] = highScores[j];\n names[j+1] = names[j];\n }\n highScores[j+1] = score;\n names[j+1] = name;\n }\n }", "public void highscore()\n {\n FileReader filereader;\n \n PrintWriter writer;\n ArrayList<PersonDate> hsp = new ArrayList<PersonDate>();\n \n\n try{\n if(totalScore>lowestHighscore() || (int)timer3>lowestHighscore())\n {\n DateFormat dateFormat = new SimpleDateFormat(\"MM/dd/yy\");\n Date date = new Date();\n String r = dateFormat.format(date);\n \n \n JOptionPane.showMessageDialog(null,\"New high score!\");\n String name = JOptionPane.showInputDialog(\"Please enter name\");\n while(name == null)\n {\n name = JOptionPane.showInputDialog(\"Please enter name\");\n }\n while(name.length() > 18)\n name = JOptionPane.showInputDialog(null,\"Name too long\\nPlease enter your name\");\n while(name.length()==0)\n name = JOptionPane.showInputDialog(\"Please enter name\");\n //if(name == null)\n //{\n //resetSettings();\n //System.exit(0);\n \n //}\n String[] invalidchar = {\"~\",\"`\",\"!\",\"@\",\"#\",\"$\",\"%\",\"^\",\"&\",\"*\",\"=\",\"+\",\"-\",\"_\",\":\",\";\",\"|\",\"?\",\"<\",\">\",\"/\",\"'\",\"[\",\"]\",\"{\",\"}\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"0\",\".\",\",\"};\n String[] bannedWords ={\"fuck\",\"shit\",\"asshole\",\"bitch\",\"nigger\",\"nigga\",\"cunt\",\"cock\",\"douche\",\"fag\",\"penis\",\"pussy\",\"whore\"};\n for(int i =0; i<invalidchar.length;i++)\n {\n if(name.contains(invalidchar[i]))\n {\n name = JOptionPane.showInputDialog(\"Invalid name, please only use letters\\nPlease enter name\");\n i = -1;\n }\n }\n for(int i =0; i<bannedWords.length;i++)\n {\n \n if(name.replaceAll(\"\\\\s+\",\"\").toLowerCase().contains(bannedWords[i]))\n {\n name = JOptionPane.showInputDialog(\"No potty mouth\\nPlease enter name\");\n i = -1;\n }\n }\n PersonDate p1;\n if(!modeT)\n p1 = new PersonDate(name,totalScore,r);\n else\n p1 = new PersonDate(name,(int)timer3,r);\n filereader = new FileReader(getLevel());\n BufferedReader bufferedreader = new BufferedReader(filereader);\n \n \n \n String line = bufferedreader.readLine();\n \n while(line!=null)\n {\n //hslist.add(Integer.parseInt(line.split(\":\")[1]));\n hsp.add(new PersonDate(line.split(\":\")[0],Integer.parseInt(line.split(\":\")[1]),line.split(\":\")[2]));\n line = bufferedreader.readLine();\n }\n hsp.add(p1);\n \n //sort it\n sort(hsp);\n \n \n //delete last thing\n hsp.remove(hsp.size()-1);\n \n //rewrite doc\n writer = new PrintWriter(new File(getLevel()));\n for(PersonDate p:hsp)\n {\n writer.println(p);\n }\n writer.close();\n \n //displayhs();\n \n }\n }\n catch(IOException e)\n {\n }\n }", "private void writeToFile(){\r\n File file = new File(\"leaderboard.txt\");\r\n\r\n try {\r\n FileWriter fr = new FileWriter(file, true);\r\n BufferedWriter br = new BufferedWriter(fr);\r\n for(Player player : this.sortedPlayers){\r\n br.write(player.toString());\r\n br.write(\"\\n\");\r\n }\r\n br.close();\r\n fr.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n\r\n }", "public void writeScoresToFile(File f) throws IOException, FileNotFoundException{\r\n\t\tBufferedWriter bw = null;\r\n\t\ttry{\r\n\t\t\tFileWriter fw = new FileWriter(f);\r\n\t\t\tbw = new BufferedWriter(fw);\r\n\t\t\t\r\n\t\t\tfor (int count = 0; count < scores.length; count++){\r\n\t\t\t\tbw.write(scores[9-count].getInitials()+SEPARATOR+scores[9-count].getScore());\r\n\t\t\t\tbw.newLine();\r\n\t\t\t}\r\n\t\t} catch (Exception ex){\r\n\t\t\tSystem.err.println(\"Trouble with file: \" +ex.getMessage());\r\n\t\t} finally {\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} catch (Exception ex1) {\r\n\t\t\t\tex1.printStackTrace();\r\n\t\t\t\tSystem.exit(-1);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private static void WriteMostFrequentTwoGramsToFile(List<String> input) throws IOException{\n\t\tFile file =new File(filewriteto);\n\t\tFileWriter writer = new FileWriter(file);\n\t\tStringBuffer buffer = new StringBuffer();\n\t\tfor(int i=0; i<input.size();i++)\n\t\t\tbuffer.append(input.get(i)+'\\n');\n\t\twriter.write(buffer.toString());\n\t\twriter.close();\n\t}", "public void addHighScore(HighScore h)\n\t{\n\t\tHighScore[] highScores=getHighScores();\n\t\thighScores[highScores.length-1]=h;\n\t\tfor (int i=highScores.length-2; i>=0; i--)\n\t\t{\n\t\t\tif (highScores[i+1].compareTo(highScores[i])>0)\n\t\t\t{\n\t\t\t\tHighScore temp=highScores[i];\n\t\t\t\thighScores[i]=highScores[i+1];\n\t\t\t\thighScores[i+1]=temp;\n\t\t\t}\n\t\t}\n\t\ttry \n\t\t{\n\t\t\tObjectOutputStream o=new ObjectOutputStream(new FileOutputStream(\"HighScores.dat\"));\n\t\t\to.writeObject(highScores);\n\t\t\to.close();\n\t\t} catch (FileNotFoundException e) {e.printStackTrace();} \n\t\tcatch (IOException e) {e.printStackTrace();}\n\t}", "public String createHighScoreString(ArrayList<Person> persons) {\n persons.sort(Comparator.comparingInt(Person::getScore));\n Collections.reverse(persons); //reverse the array, we should start with the highest score first\n\n StringBuilder highScoreString = new StringBuilder(\" Highscores \\n ------------------------------------------------------------------------------------\");\n for (Person person : persons)\n highScoreString.append(\"\\n \").append(person.getName()).append(\": \").append(person.getScore());\n return highScoreString.toString();\n }", "public static void SaveBestScore(int new_score)\n {\n try\n {\n StartSaveAnimation();\n PrintWriter writer = new PrintWriter(score_file_name, \"UTF-8\");\n writer.print(new_score);\n writer.close();\n currentBestScore = new_score;\n }\n catch(Exception e) { System.out.println(\"Problem writing in the file \" + score_file_name + \".\"); }\n }", "public static void createNewHighScoreFile() throws IOException {\n File f = new File(SCORE_FILE_NAME);\n f.createNewFile();\n \n HighScore[] toWrite = new HighScore[NUMBER_OF_SCORES_TO_SAVE];\n for (int i = 0; i < toWrite.length; i++) {\n toWrite[i] = new HighScore(EXAMPLE_SCORES[i]);\n }\n \n writeToFile(toWrite);\n }", "public void sortScores(){\r\n // TODO: Use a single round of bubble sort to bubble the last entry\r\n // TODO: in the high scores up to the correct location.\r\n \tcount=0;\r\n \tfor(int i=Settings.numScores-1; i>0;i--){\r\n \t\tif(scores[i]>scores[i-1]){\r\n \t\t\tint tempS;\r\n \t\t\ttempS=scores[i];\r\n \t\t\tscores[i]=scores[i-1];\r\n \t\t\tscores[i-1]=tempS;\r\n \t\t\t\r\n \t\t\tString tempN;\r\n \t\t\ttempN=names[i];\r\n \t\t\tnames[i]=names[i-1];\r\n \t\t\tnames[i-1]=tempN;\r\n \t\t\tcount++;\r\n \t\t}\r\n \t}\r\n }", "public void savePerRankListPerformanceFile(List<String> ids, List<Double> scores, String prpFile) {\n/* 1455 */ try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(prpFile)))) {\n/* 1456 */ for (int i = 0; i < ids.size(); i++)\n/* */ {\n/* */ \n/* 1459 */ out.write(this.testScorer.name() + \" \" + (String)ids.get(i) + \" \" + scores.get(i));\n/* 1460 */ out.newLine();\n/* */ }\n/* */ \n/* 1463 */ } catch (Exception ex) {\n/* */ \n/* 1465 */ throw RankLibError.create(\"Error in Evaluator::savePerRankListPerformanceFile(): \", ex);\n/* */ } \n/* */ }", "public static ArrayList<String> getTopTen() throws Exception{\n\t\n\tint start, end;\n\tFile xmlFile = getFile();\n\tif(!xmlFile.exists()){\n\t\tJOptionPane.showMessageDialog(null, \"Record Does nor exist\");\n\t}\n\tScore root = new Score();\n\tMap<String, Integer> standings = new TreeMap<String, Integer>();\n root = readObjectAsXmlFrom(new FileReader(xmlFile.getAbsolutePath()), root.getClass());\n standings = root.standings;\n Map<String, Integer> sortedStandings = sortByValue(standings);\n Set<Entry<String, Integer>> keys = sortedStandings.entrySet();\n Object[] sortedArr = keys.toArray();\n end = sortedArr.length;\n if(end<=10) start = 0;\n else start = end -10;\n ArrayList<String> result = new ArrayList<String>();\n for(int x = start; x<end;x++){\n \tresult.add(sortedArr[x].toString());\n }\n\treturn result;\n }", "private void createSaveData(){\n try {\n File f = new File(filePath, highScores);\n FileWriter output = new FileWriter(f);\n BufferedWriter writer = new BufferedWriter(output);\n\n writer.write(\"0-0-0-0-0\");\n writer.newLine();\n writer.write(\".....-.....-.....-.....-.....\");\n writer.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "String highscore(int max) {\r\n\t\tString str = highscoreToSortedMap().toString().replaceAll(\" \", \"\").replaceAll(\"}\", \"\").substring(1);\r\n\t\tString[] a = str.split(\",\");\r\n\t\tString result = \"\";\r\n\t\tif(a.length < max) { // wenn weniger als zehn Spieler im Highscore stehen\r\n\t\t\tfor(int i = 0; i < a.length; i++) { // ... werden je nach dem wie viele es sind an den String angehangen\r\n\t\t\t\tresult += a[i] + \",\";\r\n\t\t\t}\r\n\t\t} else { // wenn mehr als 10 Spieler im Highscore stehen\r\n\t\t\tfor(int i = 0; i < max; i++) { // werden nur die ersten zehn an den String angehangen\r\n\t\t\t\tresult += a[i] + \",\";\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "public void calculateHighscores(){\n if((newPlayer.getScore() > (getRecord())) && (newPlayer.getScore() > getRecord2()) && (newPlayer.getScore() > getRecord3())){\n setRecord3(getRecord2());\n setRecord2(getRecord());\n setRecord(newPlayer.getScore());\n newPlayer.resetScore();\n }\n if((newPlayer.getScore() > getRecord2()) && (newPlayer.getScore() > getRecord3()) && (newPlayer.getScore() < getRecord())){\n setRecord3(getRecord2());\n setRecord2(newPlayer.getScore());\n newPlayer.resetScore();\n }\n if((newPlayer.getScore() > getRecord3()) && newPlayer.getScore() < getRecord2()){\n setRecord3(newPlayer.getScore());\n newPlayer.resetScore();\n }else{\n newPlayer.resetScore();\n\n }\n }", "private void readFile() {\n\t\tint newPlayerScore = level.animal.getPoints();\n\t\t\n\t\tlevel.worDim = 30;\n\t\tlevel.wordShift = 25;\n\t\tlevel.digDim = 30;\n\t\tlevel.digShift = 25;\n\t\t\n\t\tfor( int y =0; y<10; y++ ) { //display placeholder numbers\n\t\t\tfor( int x=0; x<4; x++ ) {\n\t\t\t\tbackground.add(new Digit( 0, 30, 470 - (25*x), 200 + (35*y) ) );\n\t\t\t}\n\t\t}\n\t\t\n\t\ttry { //display highscores from highscores.txt\n\t\t\tScanner fileReader = new Scanner(new File( System.getProperty(\"user.dir\") + \"\\\\highscores.txt\"));\n\t\t\t\n\t\t\tint loopCount = 0;\n\t\t\twhile( loopCount < 10 ) {\n\t\t\t\tString playerName = fileReader.next() ;\n\t\t\t\tString playerScore = fileReader.next() ;\n\t\t\t\tint score=Integer.parseInt(playerScore);\n\t\t\t\t\n\t\t\t\tif( newPlayerScore >= score && newHighScore == false ) {\n\t\t\t\t\tstopAt = loopCount;\n\t\t\t\t\tnewHighScore = true;\n\t\t\t\t\tlevel.wordY = 200 + (35*loopCount);\n\t\t\t\t\t\n\t\t\t\t\tpointer = new Icon(\"pointer.png\", 30, 75, 200 + (35*loopCount) );// add pointer indicator\n\t\t\t\t\tbackground.add( pointer ); \n\t\t\t\t\tlevel.setNumber(newPlayerScore, 470, 200 + (35*loopCount));\n\t\t\t\t\tloopCount += 1;\n\t\t\t\t\tlevel.setWord(playerName, 10, 100, 200 + (35*loopCount));\n\t\t\t\t\tlevel.setNumber(score, 470, 200 + (35*loopCount));\n\t\t\t\t\tloopCount += 1;\n\t\t\t\t}else {\n\t\t\t\t\tlevel.setWord(playerName, 10, 100, 200 + (35*loopCount));\n\t\t\t\t\tlevel.setNumber(score, 470, 200 + (35*loopCount));\n\t\t\t\t\tloopCount += 1;\n\t\t\t\t}\n\t\t\t}//end while\n\t\t\tfileReader.close();\n\t\t\tif( newHighScore ) {\n\t\t\t\tnewHighScoreAlert();\n\t\t\t}else {\n\t\t\t\tgameOverAlert();\n\t\t\t}\n } catch (Exception e) {\n \tSystem.out.print(\"ERROR: Line 168: Unable to read file\");\n //e.printStackTrace();\n }\n\t}", "private void checkIfHighScore(String inits){\r\n\t\tfor(int count = 0; count < scores.length; count++){\r\n\t\t\tif (count == 9 && points > scores[count].getScore()){\t//If the player has a score higher than the highest score\r\n\t\t\t\tfor (int counter = 0; counter < 8; counter++){\r\n\t\t\t\t\tscores[counter] = scores[counter++];\t//bumps down the other scores\r\n\t\t\t\t}\r\n\t\t\t\tscores[9] = new HighScore(inits, points);\t//creates a new high score for the player on the lsit\r\n\t\t\t} else if (points > scores[count].getScore() && points <= scores[1+count].getScore()){\t//if the playe rhas a score that is higher than one score but lower than or equal to the next score\r\n\t\t\t\tfor (int counter = 0; counter < count-1; counter++){\r\n\t\t\t\t\tscores[counter] = scores[counter++];\t//bumps down the other scores\r\n\t\t\t\t}\r\n\t\t\t\tscores[count] = new HighScore(inits, points);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public String getTop(){\n StringBuilder htmlTop = new StringBuilder(\"<h2>\");\n for (int i = 0; i<10; i++){\n if (i >= this.highscores.size()){\n htmlTop.append(\" ----<br>\");\n } else {\n htmlTop.append(String.valueOf(this.highscores.get(i))).append(\"<br>\");\n }\n }\n htmlTop.append(\"</h2>\");\n return htmlTop.toString();\n }", "public void checkHighScore() {\n\t\t//start only if inserting highscore is needed\n\t\tlevel.animal.gamePaused = true;\n\t\tlevel.createTimer();\n\t\tlevel.timer.start();\n\t\t\t\t\n\t\tlevel.setWord(\"hiscores\", 7, 175, 130);\n\t\t\n\t\treadFile();\n\t}", "public boolean loadHighscores() {\n this.fileName = \"HS\" + this.gameMode + this.difficultyLevel + \".txt\";\n File file = new File(context.getFilesDir(), fileName);\n Scanner input;\n try{\n if(!file.exists()) {\n return false;\n }\n input = new Scanner(file);\n String line;\n highScoreList.clear();\n while(input.hasNextLine()) {\n line = input.nextLine();\n String[] parts = line.split(\"\\\\~\\\\$\\\\~\");\n if(parts.length != 2) {\n //File is corrupt.\n System.out.println (\"File \" + this.fileName + \" is corrupt\");\n return false;\n }\n String name = parts[0];\n int score = Integer.parseInt(parts[1]);\n User user = new User(name, score);\n highScoreList.add(user);\n }\n input.close();\n }catch (IOException ex) {\n System.out.println(ex.toString());\n return false;\n }\n\n return true;\n }", "private void saveScore() {\n\t\tif (Serializer.deserialize(Main.SCORES_FILE)) {\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tArrayList<Integer> scores = (ArrayList<Integer>) Serializer\n\t\t\t\t\t.getRecovered();\n\n\t\t\tif (this.score > 0) {\n\t\t\t\tscores.add(this.score);\n\n\t\t\t\tSerializer.serialize(Main.SCORES_FILE, scores);\n\t\t\t}\n\t\t}\n\t}", "public static void updateScores(BattleGrid player) {\n\t String fileName = SCORE_FILE_NAME;\n\t ArrayList<String> listOfScores = new ArrayList<String>(); //Also contains player names\n\t \n\t //First read old content of file and place in string ArrayList\n\t try {\n\t FileReader readerStream = new FileReader(fileName);\n\t BufferedReader bufferedReader = new BufferedReader(readerStream);\n\t \n\t //Read First Line\n\t String readLine = bufferedReader.readLine();\n\t \n\t while(readLine != null) {\n\t listOfScores.add(readLine);\n\t readLine = bufferedReader.readLine();\n\t }\n\t \n\t readerStream.close();\n\t }\n\t catch (IOException e) {\n\t //Situation where file was not able to be read, in which case we ignore assuming we create a new file.\n\t System.out.println(\"Failed to create stream for reading scores. May be ok if its the first time we set scores to this file.\");\n\t \n\t }\n\t \n\t //Determine location of new player (if same score then first in has higher ranking)\n\t int playerScore = player.getPlayerScore();\n\t int storedPlayerScore;\n\t ArrayList<String> lineFields = new ArrayList<String>();\n\t \n\t //Run code only if there are scores previously in file and the name of the user is not null\n\t if (!listOfScores.isEmpty() && (player.name != null)) {\n\t for (int index = 0; index < listOfScores.size(); index++) {\n\t //Retrieve String array of fields in line\n\t lineFields = (returnFieldsInLine(listOfScores.get(index)));\n\t \n\t //Convert score from string to int (2nd element)\n\t storedPlayerScore = Integer.parseInt(lineFields.get(1));\n\t lineFields.clear(); //Clear out for next set\n\t \n\t //Compare with new score to be added and inserts, shifting old element right\n\t if (storedPlayerScore < playerScore) {\t \n\t listOfScores.add(index, player.name + DELIMITER + playerScore);\t \n\t\t break; //Once we found the correct location we end the loop\n\t } \n\t }\n\t }\n\t //When it's the first code to be entered\n\t else\n\t listOfScores.add(player.name + DELIMITER + playerScore);\n\t \n\t //Delete old content from file and add scores again with new one.\n\t try {\n\t FileWriter writerStream = new FileWriter(fileName);\n\t PrintWriter fileWriter = new PrintWriter(writerStream);\n\t \n\t for (String index : listOfScores) {\n\t fileWriter.println(index);\n\t }\n\t \n\t writerStream.close(); //Resource Leaks are Bad! :(\n\t }\n\t catch (IOException e) {\n\t System.out.println(\"Failed to create stream for writing scores.\");\n\t } \n\t \n\t }", "private void loadHighScore() {\n this.myHighScoreInt = 0;\n \n final String userHomeFolder = System.getProperty(USER_HOME); \n final Path higheScoreFilePath = Paths.get(userHomeFolder, HIGH_SCORE_FILE);\n \n final File f = new File(higheScoreFilePath.toString());\n if (f.exists() && !f.isDirectory()) { \n FileReader in = null;\n BufferedReader br = null;\n try {\n in = new FileReader(higheScoreFilePath.toString());\n br = new BufferedReader(in);\n String scoreAsString = br.readLine();\n if (scoreAsString != null) {\n scoreAsString = scoreAsString.trim();\n this.myHighScoreInt = Integer.parseInt(scoreAsString);\n }\n } catch (final FileNotFoundException e) {\n emptyFunc();\n } catch (final IOException e) {\n emptyFunc();\n } \n \n try {\n if (in != null) {\n in.close();\n }\n if (br != null) {\n br.close();\n }\n } catch (final IOException e) { \n emptyFunc();\n } \n } else {\n try {\n f.createNewFile();\n } catch (final IOException e) {\n return;\n }\n }\n }", "private void sortPlayerScores(){\n text=\"<html>\";\n for (int i = 1; i <= Options.getNumberOfPlayers(); i++){\n if(Collections.max(playerScores.entrySet(), (entry1, entry2) -> entry1.getValue() - entry2.getValue()).getKey() != null){\n Integer pl = Collections.max(playerScores.entrySet(), (entry1, entry2) -> entry1.getValue() - entry2.getValue()).getKey();\n if(pl != null && playerScores.containsKey(pl)){\n text += \"<p>Player \" + pl + \" Scored : \" + playerScores.get(pl) + \" points </p></br>\";\n playerScores.remove(pl);\n }\n }\n }\n text += \"</html>\";\n }", "public static void exportScores(String filePath, Map<String, List<DenovoHit>> resultsMap) throws IOException {\r\n // Init the buffered writer.\r\n BufferedWriter writer = new BufferedWriter(new FileWriter(new File(filePath)));\r\n try {\r\n\r\n int count = 1;\r\n\r\n // header\r\n writer.append(getScoreHeader());\r\n writer.newLine();\r\n\r\n for (String spectrum : resultsMap.keySet()) {\r\n\r\n for (DenovoHit denovoHit : resultsMap.get(spectrum)) {\r\n\r\n // Get the protein hit.\r\n writer.append(spectrum + SEP);\r\n writer.append(denovoHit.getIndex() + SEP);\r\n writer.append(denovoHit.getSequence() + SEP);\r\n writer.append(denovoHit.getLength() + SEP);\r\n writer.append(denovoHit.getCharge() + SEP);\r\n writer.append(denovoHit.getNTermGap() + SEP);\r\n writer.append(denovoHit.getCTermGap() + SEP);\r\n writer.append(denovoHit.getPepNovoScore() + SEP);\r\n writer.append(denovoHit.getRankScore() + SEP);\r\n writer.newLine();\r\n writer.flush();\r\n }\r\n }\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n } finally {\r\n writer.close();\r\n }\r\n }", "public void sortHighscores(){\n Collections.sort(highscores);\n Collections.reverse(highscores);\n }", "private List<Integer> printTopValue() throws IOException {\n\t\t lines++;\r\n\t\t Iterator<Entry<String, MergeClass>> it = t_map.entrySet().iterator();\r\n\t\t Entry<String, MergeClass> me = it.next();\r\n content.append(me.getKey() + \":\");\r\n content.append(me.getValue().getCounter() + \":\");\r\n //System.out.print(me.getKey()+\":\");\r\n int previd = 0;\r\n MergeClass mc = me.getValue();\r\n List<FrequencyCount> fc = mc.listfc;\r\n List<Integer> filefc = mc.file;\r\n for(FrequencyCount f : fc){\r\n \t content.append(Integer.parseInt(f.getId())-previd);\r\n \t previd = Integer.parseInt(f.getId());\r\n \t if(f.getTitle() != 0){\r\n \t\t content.append(\"#t\"+f.getTitle());\r\n \t }\r\n \t if(f.getInfo() != 0){\r\n \t\t content.append(\"#i\"+f.getInfo());\r\n \t }\r\n \t if(f.getBody() != 0){\r\n \t\t content.append(\"#b\"+f.getBody());\r\n \t }\r\n \t if(f.getreferences() != 0){\r\n \t\t content.append(\"#r\"+f.getreferences());\r\n \t }\r\n \t if(f.getLink() != 0){\r\n \t\t content.append(\"#L\"+f.getLink());\r\n \t }\r\n \t if(f.getCategory() != 0){\r\n \t\t content.append(\"#c\"+f.getCategory());\r\n \t }\r\n \t if(f.getinlinks() != 0){\r\n \t\t content.append(\"#l\"+f.getinlinks());\r\n \t }\r\n \t content.append(\"|\");\r\n \t if(content.length() > 500){\r\n \t bw.write(content.toString());\r\n \t content = new StringBuilder(\"\");\r\n \t \r\n }\r\n \t \r\n \t //System.out.print(f.getId() + \" - T \" + f.getTitle() + \" | I \" + f.getInfo()+\" | B \" + f.getBody()+\" | R \" + f.getreferences()\r\n \t//\t\t +\" | L \" + f.getLink() +\" | C \" + f.getCategory() + \" #### \");\t\t\t\t \t\r\n }\r\n content.append(\"\\n\");\r\n //System.out.println();\r\n if(content.length() > 500){\r\n \t bw.write(content.toString());\r\n \t content = new StringBuilder(\"\");\r\n \t \r\n }\t\r\n t_map.remove(me.getKey());\r\n return filefc;\r\n\t}", "public static void saveHighScore(HighScores hs){\r\n\t\ttry {\r\n\t\t\tFileOutputStream fos = new FileOutputStream(highScoresFilename);\r\n\t\t\tObjectOutputStream oos = new ObjectOutputStream(fos);\r\n\t\t\toos.writeObject(hs);\r\n\t\t\toos.close();\r\n\t\t} catch (Exception e){\r\n\t\t\tSystem.out.println(\"Error in writing high scores.\\n\");\r\n\t\t}\t\t\r\n\t}", "private static void printResultsToJson (Map<String, Double> bestSuppliers, String outputJsonFile) throws IOException {\n\n\t\tint rank = 1;\n\t\tList<MatchingResult> scores = new LinkedList<MatchingResult>();\n\n\t\tfor (Entry<String, Double> e : bestSuppliers.entrySet()) {\n\t\t\tscores.add(new MatchingResult(rank, e.getKey(), e.getValue()));\n\t\t\trank++;\n\t\t}\n\n\t\tGson gson = new GsonBuilder().create();\n\n\t\tString json = gson.toJson(scores);\n\n\t\tFileWriter writer = new FileWriter(outputJsonFile);\n\t\twriter.write(json);\n\t\twriter.close();\n\n\t}", "public static void save()\r\n\t{\r\n\r\n\t\ttry {\r\n\t\t\tObjectOutputStream fileOut = new ObjectOutputStream(new FileOutputStream(\"highscores.txt\"));\r\n\t\t\tfileOut.writeObject(hsd);\r\n\t\t\tfileOut.close();\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\tJOptionPane.showMessageDialog(null,\"Save File not found\",\"Error\",JOptionPane.ERROR_MESSAGE);\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\tJOptionPane.showMessageDialog(null,\"Unable to save data\",\"Error\",JOptionPane.ERROR_MESSAGE);\r\n\t\t\te.printStackTrace();\r\n\t\t\r\n\t\t}\r\n\r\n\t}", "public boolean highScore(int score, String name) {\n //If the list is empty or has less than 5 users, add them in!\n if(highScoreList.isEmpty() || highScoreList.size() < 5){\n User newUser = new User(name, score);\n highScoreList.add(newUser);\n saveHighscores();\n return true;\n }\n //Any other case, we have to start comparing\n for(User user : highScoreList) {\n //We found a place to put their score!\n if(score > user.score) {\n User newUser = new User(name, score);\n highScoreList.add(newUser); //Add in the new User and sort\n Collections.sort(highScoreList); //Sort the list\n //Check if there's more than 5 Users, if so, remove one\n if(highScoreList.size() > 5) {\n highScoreList.remove(0);\n //Check if the user is still there, if not, they didn't belong anyway\n if(highScoreList.contains(newUser)){\n saveHighscores();\n return true;\n }else\n return false;\n }\n }\n }\n return false;\n }", "public static void main(String[] args) throws Exception {\r\n\t\t\r\n\t\tString csv = \"regional-us-weekly-latest.txt\";\r\n\t\t//String to hold file name\r\n\t\tScanner sc = new Scanner(new File(csv));\r\n\t\t//Scanner object to read the csv file\r\n\t\tPrintWriter outputFile = new PrintWriter(\"Artists-WeekOf08272020.txt\");\r\n\t\t//printwriter object to print the report to an output file\t\t\r\n\r\n\t\tString header = sc.nextLine(); //gets header\r\n\t\tString artistName = \"\"; //string for holding artist name\r\n\t\tArrayList<String> top200 = new ArrayList<>(); \r\n\t\t//arraylist for all the top 200 names, in the order they're in from the csv file\r\n\t\tArrayList<ArrayList<String>> nameList = new ArrayList<ArrayList<String>>(); \r\n\t\t//nested arraylist, one for names in report and another for the amount of times each appears\r\n\t\t\r\n\t\tString line = sc.nextLine(); //gets the first line after header before the while loop starts since it is irrelevant data\r\n\t\t/*this while loop gets all the names from the csv file and ignores the rest of the data as it is unneeded for the report\r\n\t\tit then adds all the names to the top200 arraylist in the order that they were in in the csv file (including duplicates)*/\r\n while(sc.hasNext()) { //loop continues to the end of the file\r\n \tline = sc.nextLine(); //reads in an entire line\r\n String [] name = line.split(\",\"); //splits lines by commas as the data values are separated by commas\r\n artistName = name[name.length-3];\r\n /*originally I wanted to assign values[2] to artist because the names were the third value of the data (the element is\r\n 2 due to arrays starting at 0), but there was a problem, some values had commas within them. So, I improvised, no matter\r\n what the column with the names will always be the 3rd to last column, so instead I made the array element be the length \r\n of the array minus 3 to ensure I always get the artist's name.*/\r\n top200.add(artistName); //adds artist name to the top200 arraylist\r\n } //end of while loop\r\n \r\n \r\n /*this loop sorts the top200 names in alphabetical order, the first character of an element is compared to the first character \r\n of the next element, then it swaps the two names if the name after it starts with a letter that comes before it in the alphabet*/\r\n for (int i = 1; i < top200.size(); i++) {\r\n \tString temp = \"\";\r\n \tfor (int j = 0; j < top200.size()-1; j++) {\r\n \t\tif(top200.get(i).charAt(0) < top200.get(j).charAt(0)) { //compares first letter of strings\r\n \t\t\ttemp = top200.get(i); \r\n \t\t\ttop200.set(i, top200.get(j));\r\n \t\t\ttop200.set(j, temp);\r\n \t\t}\r\n \t} //end of second for loop\r\n } //end of for loop\r\n \r\n nameList.add(top200); //this adds the list of names to the nested arraylist \r\n \r\n ArrayList<String> appearanceCount = new ArrayList<>(); \r\n //arraylist to be parallel to the names and will say how many times the name appeared on the top 200 list\r\n \r\n /*the job of this for loop is to go through the first loop in the nested arraylist, which is currently the only one, and it\r\n looks through it for duplicates, by comparing every single element with every element after it, when it finds a duplicate \r\n it deletes it, then it adds 1 to the corresponding element value on the appearanceCount arraylist, otherwise it will add \"1\" to \r\n the appearanceCount arraylist as it didnt have a duplicate for the corresponding element value, thus it will only appear once*/\r\n for (int i = 0; i < nameList.get(0).size(); i++) { // this loop goes through the arraylist containing the list of 200 names 1 by 1\r\n \tint cnt = 1; //this is the default count, if a name appears once on the list, its corresponding array will hold the string \"1\"\r\n \tString stringNum = \"\"; //this String is there to hold the count of appearances, it will hold the int when converted to a string\r\n \tfor (int j = i+1; j < nameList.get(0).size(); j++) { //this loop will compare the current element with the rest of the array\r\n \t\tif(nameList.get(0).get(i).equals(nameList.get(0).get(j))) { //this condition checks for duplicates\r\n \t\t\tnameList.get(0).remove(j); //when a duplicate is found it will be removed\r\n \t\t\tj--; //j is decreased by 1, since an element was removed the arraylist is shorter now, so the loop wont throw it out of bounds\r\n \t\t\tcnt++; //when a duplicate is found, cnt is incremented \r\n \t\t\tstringNum = Integer.toString(cnt); //the int value of cnt is converted to a string\r\n appearanceCount.set(i, stringNum); //this places the amount of times the artist appears in the parallel appearanceCount arraylist\r\n \t\t}//end of if\r\n \t\telse appearanceCount.add(\"1\"); //if there is no duplicate, that means it appears only once, so \"1\" is added to appearanceCount\r\n \t}//end of second for loop\r\n } //end of for loop\r\n \r\n /*when the loop ends, appearanceCount should be full and have all the amount of times an artist appeared on the list and its elements\r\n will correspond to the values of the arraylist containing all the names*/\r\n nameList.add(appearanceCount); //then the appearance count arraylist is added to the nested nameList arrayList\r\n \r\n //prints report for header of the report to the output file\r\n outputFile.println(\"This is a report of the list of artists that appear on Spotify's\");\r\n outputFile.println(\"Top 200 list in the United States for the week of August 27, 2020.\");\r\n outputFile.println(\"The following names in the report are in alphabetical order.\\n\");\r\n \r\n int cnt = 0; //this is to count how many names are on the list altogether\r\n //this for loop is to print out the report to the output file\r\n for (int i = 0; i < nameList.get(0).size(); i++) {\r\n \tint a = Integer.parseInt(nameList.get(1).get(i)); //this converts the appearance count of every name into an int \r\n \tif (a > 1) //this if will check if the appearance count is greater than 1\r\n \t\toutputFile.println(nameList.get(0).get(i) + \" appears \" + nameList.get(1).get(i) + \" times on the list.\");\r\n \t\t//if it is greater than 1, than to be grammatically correct it will print \"appears i times\", (times being plural)\r\n \telse outputFile.println(nameList.get(0).get(i) + \" appears \" + nameList.get(1).get(i) + \" time on the list.\");\r\n \t\t//otherwise, if its not bigger than 1, then it will say \"appears 1 time\", (time being singular)\r\n \tcnt++; //increments the count of names\r\n } //end of for loop\r\n \r\n outputFile.println(\"\\nThere are \" + cnt + \" artists on the list.\");\r\n \r\n sc.close();\r\n outputFile.close();\r\n \r\n\t}", "public void writeHiScore(int newHiScore) throws IOException {\r\n\r\n File output = new File(\"src/p4_group_8_repo/scores.dat\");\r\n FileWriter writer = new FileWriter(output);\r\n PrintWriter printWriter = new PrintWriter(writer);\r\n\r\n printWriter.printf(\"%d\", newHiScore);\r\n printWriter.close();\r\n }", "public void findH()\n {\n for(int i = 0; i <= scores.length-1; i++)\n {\n for (int j = 0; j <= scores[0].length-1; j++)\n {\n if(scores[i][j] > high)\n high = scores[i][j];\n }\n }\n for(int i = 0; i <= scores.length-1; i++)\n {\n for (int j = 0; j <= scores[0].length-1; j++)\n {\n if(scores[i][j] == high)\n System.out.println(names[i] + \" had the highest score of \" + high);\n break;\n \n }\n \n }\n }", "private void updateHighscore() {\n if(getScore() > highscore)\n highscore = getScore();\n }", "public boolean addToHighScores(Player player) {\n\n try {\n int i, j, temp = 0;\n String tempName;\n String[][] newHighScores = new String[11][2];\n boolean isHighScore = false;\n String[][] highScores;\n highScores = new String[10][2];\n if (isValidScore(player.getScore())) {\n switch (player.getDifficulty()) {\n //Easy difficulty sort\n case EASY:\n for (int k = 0; k < easyHighScores.length; k++) {\n highScores[k][0] = easyHighScores[k][0];\n highScores[k][1] = easyHighScores[k][1];\n }\n break;\n //Medium difficulty sort\n case MEDIUM:\n for (int k = 0; k < mediumHighScores.length; k++) {\n highScores[k][0] = mediumHighScores[k][0];\n highScores[k][1] = mediumHighScores[k][1];\n }\n break;\n //Hard difficulty sort\n case HARD:\n for (int k = 0; k < hardHighScores.length; k++) {\n highScores[k][0] = hardHighScores[k][0];\n highScores[k][1] = hardHighScores[k][1];\n }\n break;\n default:\n System.out.println(\"No difficulty\");\n return false;\n }\n\n isHighScore = isHighScore(highScores, player.getScore());\n\n if (!isHighScore) {\n System.out.println(\"Not a high score.\");\n return false;\n }\n \n for (int k = 0; k < highScores.length; k++) {\n newHighScores[k][0] = highScores[k][0];\n newHighScores[k][1] = highScores[k][1];\n }\n newHighScores[10][0] = player.getName();\n newHighScores[10][1] = Integer.toString(player.getScore());\n for (j = 1; j < newHighScores.length; j++) {\n temp = parseInt(newHighScores[j][1]);\n\n tempName = newHighScores[j][0];\n for (i = j - 1; (i >= 0) && (parseInt(newHighScores[i][1]) < temp); i--) {\n newHighScores[i + 1][1] = newHighScores[i][1];\n newHighScores[i + 1][0] = newHighScores[i][0];\n }\n newHighScores[i + 1][1] = Integer.toString(temp);\n newHighScores[i + 1][0] = tempName;\n }\n\n switch (player.getDifficulty()) {\n case EASY:\n for (int k = 0; k < (newHighScores.length - 1); k++) {\n this.easyHighScores[k][0] = newHighScores[k][0];\n this.easyHighScores[k][1] = newHighScores[k][1];\n }\n return true;\n case MEDIUM:\n for (int k = 0; k < (newHighScores.length - 1); k++) {\n this.mediumHighScores[k][0] = newHighScores[k][0];\n this.mediumHighScores[k][1] = newHighScores[k][1];\n }\n return true;\n case HARD:\n for (int k = 0; k < (newHighScores.length - 1); k++) {\n this.hardHighScores[k][0] = newHighScores[k][0];\n this.hardHighScores[k][1] = newHighScores[k][1];\n }\n return true;\n default:\n System.out.println(\"Invalid difficulty\");\n return false;\n }\n } else {\n System.out.println(\"Not a valid score.\");\n return false;\n }\n\n //This next part is to test the displayHighScoreWithName() function\n// Scanner input = SnakeWithPartner.getInFile();\n// System.out.println(\"Do you want to view the high score's with your name? (\\'y\\' or \\'n\\'): \");\n// if (input.hasNext(\"y\")) {\n// displayHighScoreWithName(player);\n// } else {\n// System.out.println(\"Thanks anyways!\");\n// }\n } catch (NumberFormatException numEx) {\n System.out.println(\"Error adding score to High Scores.\\n\"\n + numEx.getMessage());\n }\n return false;\n }", "public HighScore(){\n readFile();\n sortHighscores();\n }", "public List<Highscore> getTopTen(Context context){\n highscore = db.getTopTen();\n return highscore;\n }", "public static void main(String[] args) throws Exception {\n FileOutputStream file = new FileOutputStream(\"randoms.txt\");\n PrintWriter output = new PrintWriter(file);\n\n //write 100 random numbers to the file\n\n\n\n\n //open the file for input\n\n\n\n\n //print the sorted array on the screen\n\n\n\n}", "private void extractNewScoreBoard(){\n if (FileStorage.getInstance().fileNotExist(this, \"FinalScore1.ser\")){\n score = new Score();\n score.addScoreUser(user);\n FileStorage.getInstance().saveToFile(this.getApplicationContext(), score, \"FinalScore1.ser\");\n } else {\n score = (Score) FileStorage.getInstance().readFromFile(this, \"FinalScore1.ser\");\n score.insertTopFive(user);\n FileStorage.getInstance().saveToFile(this, score, \"FinalScore1.ser\");\n }\n }", "public void addToTable() {\n\n\n if (this.highScoresTable.getRank(this.scoreBoard.getScoreCounter().getValue()) <= this.highScoresTable.size()) {\n DialogManager dialog = this.animationRunner.getGui().getDialogManager();\n String name = dialog.showQuestionDialog(\"Name\", \"What is your name?\", \"\");\n\n this.highScoresTable.add(new ScoreInfo(name, this.scoreBoard.getScoreCounter().getValue()));\n File highScoresFile = new File(\"highscores.txt\");\n try {\n this.highScoresTable.save(highScoresFile);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }\n\n }", "public void exportScores(File file) throws IOException {\n exportScores(file, \"\\t\");\n }", "public boolean checkHighScore(){\n if(highScoreList.isEmpty() || highScoreList.size() < 5){\n return true;\n }\n //Any other case, we have to start comparing\n for(User user : highScoreList) {\n //We found a place to put their score!\n if(getScore() > user.score) {\n return true;\n }\n }\n return false;\n }", "public void printAndDeleteHighestItem(){\n RankedItem highestItem = new RankedItem();\n\n //find the highest ranked item\n for (RankedItem rankedItem: rankedResults){\n if(rankedItem.getWin() >= highestItem.getWin()){\n highestItem = rankedItem;\n }\n }\n //print the highest ranked item if the item doesn't have all 0 values\n if(highestItem.getWin() != 0 || highestItem.getLoss() != 0 || highestItem.getTie() != 0) {\n resultList.append(highestItem.getItemText() + \"\\t\" +\n highestItem.getWin() + \"\\t\" +\n highestItem.getLoss() + \"\\t\" +\n highestItem.getTie() + \"\\n\");\n }\n //remove the highest ranked item from the list\n rankedResults.remove(highestItem);\n }", "private void readScores() {\n final List<Pair<String, Integer>> list = new LinkedList<>();\n try (DataInputStream in = new DataInputStream(new FileInputStream(this.file))) {\n while (true) {\n /* reads the name of the player */\n final String name = in.readUTF();\n /* reads the score of the relative player */\n final Integer score = Integer.valueOf(in.readInt());\n list.add(new Pair<String, Integer>(name, score));\n }\n } catch (final Exception ex) {\n }\n this.sortScores(list);\n /* if the list was modified by the cutting method i need to save it */\n if (this.cutScores(list)) {\n this.toSave = true;\n }\n this.list = Optional.of(list);\n\n }", "private void saveScore() {\n try {\n PrintWriter writer = new PrintWriter(new FileOutputStream(new File(Const.SCORE_FILE), true));\n writer.println(this.player.getName() + \":\" + this.player.getGold() + \":\" + this.player.getStrength());\n writer.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }", "public List<ScoreInfo> getHighScores() {\n List<ScoreInfo> l = new ArrayList<ScoreInfo>();\n l.addAll(this.highScores); //make a copy;\n return l;\n }", "public void loadScoreFile() {\n try {\n inputStream = new ObjectInputStream(new FileInputStream(HIGHSCORE_FILE));\n scores = (ArrayList<Score>) inputStream.readObject();\n } catch (FileNotFoundException e) {\n } catch (IOException e) {\n } catch (ClassNotFoundException e) {\n } finally {\n try {\n if (outputStream != null) {\n outputStream.flush();\n outputStream.close();\n }\n } catch (IOException e) {\n }\n }\n }", "public void save(File filename) throws IOException {\n ObjectOutputStream outputStream = null;\n try {\n outputStream = new ObjectOutputStream(new FileOutputStream(filename));\n outputStream.writeObject(this.getHighScores());\n } catch (IOException e) {\n System.out.println(\"cannot save to file\");\n } finally {\n if (outputStream != null) { // Exception might have happened at constructor\n try {\n outputStream.close();\n } catch (IOException e) {\n System.out.println(\" Failed closing the file !\");\n }\n }\n }\n }", "private void setBoardData(Map<Player, Integer> scores) {\n Map<Player, Integer> sortedMap = MapUtil.sortByValueReverse(scores);\n\n for (Player player : Bukkit.getOnlinePlayers()) {\n int line = 1;\n for (Map.Entry<Player, Integer> entry : sortedMap.entrySet()) {\n if (line > scores.size() || line > 15) return;\n\n Player scoreboardEntry = entry.getKey();\n String score = Integer.toString(entry.getValue());\n\n titleManagerAPI.setScoreboardValue(player, line, score + \" \" + ChatColor.GREEN + scoreboardEntry.getDisplayName());\n\n line++;\n }\n }\n }", "public void exportScores(OutputStream outputStream) throws IOException {\n exportScores(outputStream, \"\\t\");\n }", "@Override\r\n\tpublic String toString(){\r\n\t\tString str = \"\";\r\n\t\t\r\n\t\tfor (int i = 0; i < scoreNumber; i++)\r\n\t\t\tstr += highScores[i].toString() + \"\\n\";\r\n\t\t\r\n\t\treturn str;\r\n\t}", "public void populateList(){\n\t\tfor (int i = 0; i < 10; i++){\n\t\t\tscoreList.add(-1);\t\t\t\n\t\t\tnameList.add(\"\");\n\t\t}\n\t\tint i=0; \n\t\ttry {\n\t\t\tScanner results = new Scanner(new File(\"results.txt\"));\n\t\t\twhile (results.hasNext()){\n\t\t\t\tnameList.set(i, results.next());\n\t\t\t\tscoreList.set(i, results.nextInt());\n\t\t\t\ti++;\n\t\t\t}\n\t\t} catch (FileNotFoundException e1){\n\t\t\te1.printStackTrace();\n\t\t}\n\t}", "public static void writeHeavyUsersToFile(HashMap<Integer,RatingUser> arr, FileWriter file) throws IOException {\n FileWriter coldUserFile = file;\n HashMap<Integer,RatingUser> ratingUsers = arr;\n for(RatingUser ru: ratingUsers.values())\n if(ru.getNeighbors().size() >=10)\n for(SimNode s: ru.getNeighbors().keySet())\n coldUserFile.append(\"\"+ru.getId()+\" \"+s.getId()+\" \"+ru.getNeighbors().get(s)+\"\\n\");\n }", "public LinkedList<HighScore> getHighScores(){\r\n\t\tLinkedList<HighScore> list = new LinkedList<HighScore>();\r\n\t\ttry{\r\n\t\t\t//Sorting by Score column\r\n\t\t ResultSet rs = statement.executeQuery(\"select * from Highscores ORDER BY Score DESC\");\r\n\t\t while(rs.next()){\r\n\t\t String username = rs.getString(\"Nickname\"); \r\n\t\t int userScore = rs.getInt(\"Score\"); \r\n\t\t HighScore userHighScore = new HighScore(username,userScore);\r\n\t\t list.add(userHighScore);\r\n\t\t \r\n\t\t }\r\n\t\t }\r\n\t\t\tcatch (Exception e){\r\n\t\t\t e.printStackTrace();\r\n\t\t\t}\r\n\t\treturn list;\r\n\t}", "public void writeSimScore() throws IOException, MalformedURLException, ParseException {\n FileWriter fw = new FileWriter(new File(scoreFile+new Double(alphaValue).toString()+\".txt\")); \r\n BufferedWriter bw = new BufferedWriter(fw);\r\n\r\n int numQueries = queryList.size();\r\n for (int i = 0; i < numQueries; i++) {\r\n String query1 = queryList.get(i);\r\n for (int j = 0; j < numQueries; j++) {\r\n String query2 = queryList.get(j);\r\n double sim = alphaValue * scorematrix[i][j] + (1 - alphaValue) * calSemanticSim(i, j);\r\n bw.write(new Double(sim).toString());\r\n bw.write(\" \");\r\n }\r\n // System.out.println(\"entered \" + i);\r\n bw.newLine();\r\n }\r\n bw.close();\r\n\r\n }", "private void writeObject(java.io.ObjectOutputStream stream)\r\n throws IOException {\r\n\t\tstream.writeInt(scoreNumber);\r\n\t\tfor (int i = 0; i < scoreNumber; i++)\r\n\t\t\tstream.writeObject(highScores[i]);\r\n }", "private void writeScoresList(JsonWriter writer, List<Score> scoreList) throws IOException {\n\t\twriter.beginArray();\n\t\tfor (Score score : scoreList) {\n\t\t\twriter.beginObject();\n\t\t\twriter.name(\"Name\").value(score.getName());\n\t\t\twriter.name(\"Score\").value(score.getScore());\n\t\t\twriter.endObject();\n\t\t}\n\t\twriter.endArray();\n\t}", "public void writeBuyingHistory(ArrayList<String> boughtBooks)throws IOException\n {\n String toWrite = new String();\n int i =0;\n if(hisMap.get(Customer.getInstance().getUsername())==null)\n {\n hisMap.put(Customer.getInstance().getUsername(),new ArrayList<String>());\n }\n else\n {\n i=0;\n while (i<boughtBooks.size())\n {\n hisMap.get(Customer.getInstance().getUsername()).add(boughtBooks.get(i));\n i++;\n }\n }\n\n\n i=0;\n\n toWrite+=Customer.getInstance().getUsername()+\",\";\n while (i<hisMap.get(Customer.getInstance().getUsername()).size()-boughtBooks.size())\n {\n toWrite+=hisMap.get(Customer.getInstance().getUsername()).get(i)+\"%\";\n i++;\n }\n ;\n i=0;\n while (i<boughtBooks.size())\n {\n toWrite+=boughtBooks.get(i);\n if(i!=boughtBooks.size()-1)\n toWrite+=\"%\";\n i++;\n }\n\n\n\n\n List<String> lines = Files.readAllLines(Paths.get(\"history.txt\"));\n if(specificLine>lines.size()-1)\n {\n lines.add(toWrite);\n }\n else {\n lines.set(specificLine, toWrite);\n }\n /*write part*/\n BufferedWriter bw = null;\n FileWriter fw = null;\n try {\n int j=0;\n String content = \"\";\n while (j<lines.size())\n {\n content+= lines.get(j)+\"\\n\";\n j++;\n }\n\n fw = new FileWriter(\"history.txt\");\n bw = new BufferedWriter(fw);\n bw.write(content);\n\n } catch (IOException e) {\n\n e.printStackTrace();\n\n } finally {\n\n try {\n\n if (bw != null)\n bw.close();\n\n if (fw != null)\n fw.close();\n\n } catch (IOException ex) {\n\n ex.printStackTrace();\n\n }\n\n }\n\n }", "public void setHighscore(int score)\n {\n this.highscore = score;\n }", "public boolean checkHighscore() {\n String[][] oldHighscores = highscore.getHighscoreList();\n int oldScore;\n int position;\n boolean newHighscore = false;\n\n //Decides position in the list by comparing to the old scores\n for (int i = 0; i < oldHighscores.length; i++) {\n oldScore = Integer.parseInt(oldHighscores[i][1]);\n if (player.getScore() > oldScore) {\n position = i;\n highscore.writeHighscore(player.getName(), player.getScore(), position);\n newHighscore = true;\n break;\n }\n }\n return newHighscore;\n }", "public HighScore() {\n try {\n BufferedReader a = new BufferedReader(new FileReader(\"points.txt\"));\n BufferedReader b = new BufferedReader(new FileReader(\"names.txt\"));\n ArrayList<String> temp = new ArrayList(0);\n temp = createArray(a);\n names = createArray(b);\n a.close();\n b.close();\n for (String x : temp) {\n points.add(Integer.valueOf(x));\n }\n\n\n }catch (IOException e)\n {}\n\n }", "public void setTopScore(double topScore) {\n this.topScore = topScore;\n }", "public static void scoreToFile(int x, ArrayList<ArrayList<ArrayList<Double>>> allQueries, String filename) throws IOException {\r\n\t\t\tBufferedWriter writer = new BufferedWriter(new FileWriter(filename));\r\n\t\t\tint minn=1;\r\n\t\t\tint maxn=1;\r\n\t\t\tString title = \"@relation Query_Title\";\r\n\t\t\twriter.write(title);\r\n\t\t\twriter.newLine();\r\n\t\t\tfor (int i=0; i<Queries.NumberOfDimensions; i++) {\r\n\t\t\t\tif (Queries.isEven(i) || i==0) {\r\n\t\t\t\t\tString attribute= \"@attribute\"+\" min\"+minn + \" numeric\";\r\n\t\t\t\t\twriter.write(attribute);\r\n\t\t\t\t\twriter.newLine();\r\n\t\t\t\t\tminn++;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tString attribute=\"@attribute\"+\" max\" +maxn + \" numeric\";\r\n\t\t\t\t\twriter.write(attribute);\r\n\t\t\t\t\twriter.newLine();\r\n\t\t\t\t\tmaxn++;\r\n\t\t\t\t}\r\n\t\r\n\t\t\t}\r\n\t\t\tString attribute =\"@attribute\"+\" score\" + \" numeric\";\r\n\t\t\twriter.write(attribute);\r\n\t\t\twriter.newLine();\r\n\t\t\t\r\n\t\t\twriter.newLine();\r\n\t\t\twriter.write(\"@DATA\");\r\n\t\t\twriter.newLine();\r\n\t\t\tfor (int i=0; i<allQueries.size(); i++) {\r\n\t\t\t\tString str=\"\";\r\n\t\t\t\tint n=0;\r\n\t\t\t\tfor(n=0; n<allQueries.get(i).size()-1; n++) {\tstr += allQueries.get(i).get(n).get(0)+\", \" + allQueries.get(i).get(n).get(1)+\", \";\r\n\t\t\t\t}\r\n\t\t\t\tif(allQueries.get(i).get(n).get(0)==0) {\r\n\t\t\t\t\tstr+=\"0.0\";\r\n\t\t\t\t}else {\r\n\t\t\t\t\tstr += allQueries.get(i).get(n).get(0); // add the score\r\n\t\t\t\t}\r\n\t\t\t\twriter.write(str);\r\n\t\t\t\twriter.newLine();\r\n\t\t\t}\r\n\t\t\twriter.close();\r\n\t\t}", "public static void main(String[] args) {\n File file = new File(\"ratings.tsv\");\n ArrayList<MovieRating> rl = new ArrayList<MovieRating>();\n\n try {\n Scanner scanner = new Scanner(file);\n while (scanner.hasNextLine()) {\n String line = scanner.nextLine();\n String[] tkns = line.split(\"\\\\t\"); // tabs separate tokens\n MovieRating nr = new MovieRating(tkns[0], tkns[1], tkns[2]);\n rl.add(nr);\n }\n scanner.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n\n int minVotes = 1;\n int numRecords = 1;\n Scanner input = new Scanner(System.in);\n while (true) {\n\n MaxHeap<MovieRating> myHeap = new MaxHeap<MovieRating>();\n\n for(int i = 0; i < rl.size(); i++) {\n myHeap.insert(rl.get(i));\n }\n\n System.out.println();\n System.out.println(\"Enter minimum vote threshold and number of records:\");\n minVotes = input.nextInt();\n numRecords = input.nextInt();\n if (minVotes * numRecords == 0)\n break;\n long startTime = System.currentTimeMillis();\n\n /* Fill in code to determine the top numRecords movies that have at least\n * minVotes votes. For each record mr, in decreasing order of average rating,\n * execute a System.out.println(mr).\n * Do not sort the movie list!\n */\n int counter = 0;\n for (int i = 0; i < rl.size(); i++) {\n MovieRating temp = myHeap.removemax();\n if(temp.getVotes() > minVotes){\n System.out.println(temp.toString());\n counter++;\n }\n if(counter >= numRecords){\n break;\n }\n }\n\n System.out.println();\n long readTime = System.currentTimeMillis();\n System.out.println(\"Time: \"+(System.currentTimeMillis()-startTime)+\" ms\");\n }\n }", "public void printScore(PrintWriter out) {\n out.format(\"SCORE OF %d PLAYERS%n\", players.size());\n out.println(\"ID\\tCASH\\tTYPE\");\n \t\n // Cria uma lista com os jogadores\n \tList<Competitor> score = new ArrayList<Competitor>(players.keySet());\n\n \t// Ordena os jogadores com base no total de cash\n \tCollections.sort(score, new PlayerComparator());\n\n \t// Imprime os resultados\n \tfor(Competitor c : score) {\n \t\tout.format(\"%d.%d\\t%.2f\\t(%s)%n\", players.get(c).Type,\n players.get(c).Id, c.getTotalCash(),\n c.getClass().getSimpleName());\n \t}\n out.flush();\n }", "public int getHighScore(int i) {\n return topScores.get(i);\n }", "public void toHighScore(View view)\n {\n scoreSettings = getSharedPreferences(scoreFile,PREFERENCE_MODE_PRIVATE);\n setContentView(R.layout.highscore_layout);\n TextView firstView = (TextView) findViewById(R.id.first);\n firstView.setText(\"1st: \"+scoreSettings.getString(\"goldName\",\"\")+\", \"+scoreSettings.getInt(\"goldScore\",0)+\" points\");\n TextView secondView = (TextView) findViewById(R.id.second);\n secondView.setText(\"2nd: \"+scoreSettings.getString(\"silverName\",\"\")+\", \"+scoreSettings.getInt(\"silverScore\",0)+\" points\");\n TextView thirdView = (TextView) findViewById(R.id.third);\n thirdView.setText(\"3rd: \"+scoreSettings.getString(\"bronzeName\",\"\")+\", \"+scoreSettings.getInt(\"bronzeScore\",0)+\" points\");\n }", "public List<GameData> getTopTen(Collection<GameData> listOfData, String difficulty){\n\t\t\n\t\tlogger.info(\"Top List on \" + difficulty + \" created.\");\t\n\t\t\n\t\tList<GameData> tempList = listOfData.stream()\n\t\t\t\t\t\t\t\t\t.filter(d -> d.getDifficulty().equals(difficulty))\n\t\t\t\t\t\t\t\t\t.collect(Collectors.toList());\n\t\tif(tempList.size()>=10) {\n\t\t\treturn tempList.stream()\n\t\t\t\t\t.sorted((d1,d2) -> d2.getFinalScore() - d1.getFinalScore())\n\t\t\t\t\t.collect(Collectors.toList()).subList(0, 10);\n\t\t} else {\n\t\t\treturn tempList.stream()\n\t\t\t\t\t.sorted((d1,d2) -> d2.getFinalScore() - d1.getFinalScore())\n\t\t\t\t\t.collect(Collectors.toList());\n\t\t}\t\n\t}", "protected void saveGroupResults(TreeSet<SpatialObject> topK) throws IOException{\n\t\t\n\t\t/* Imprime 5 */\n\t\tWriter outputFile = new OutputStreamWriter(new FileOutputStream(\"skpq/SKPQ-LD [\" + \"k=\" + \"5\" + \", kw=\" + getKeywords() + \"].txt\"), \"ISO-8859-1\");\n\t\t\n\t\tIterator<SpatialObject> it = topK.descendingIterator();\n\t\t\n\t\tfor(int a = 1; a <= 5; a++){\n\t\t\tSpatialObject obj = it.next();\n\t\t\toutputFile.write(\"-->[\" + a + \"] \" + \"[OSMlabel=\" + obj.getName() + \", lat=\" + obj.getLat() + \", lgt=\" + obj.getLgt() + \", score=\" + obj.getScore() + \"]\\n\");\n\t\t}\n\t\t\n\t\toutputFile.close();\n\t\t\n\t\t/* Imprime 10 */\n\t\toutputFile = new OutputStreamWriter(new FileOutputStream(\"skpq/SKPQ-LD [\" + \"k=\" + \"10\" + \", kw=\" + getKeywords() + \"].txt\"), \"ISO-8859-1\");\n\t\t\n\t\tit = topK.descendingIterator();\n\t\t\n\t\tfor(int a = 1; a <= 10; a++){\n\t\t\tSpatialObject obj = it.next();\n\t\t\toutputFile.write(\"-->[\" + a + \"] \" + \"[OSMlabel=\" + obj.getName() + \", lat=\" + obj.getLat() + \", lgt=\" + obj.getLgt() + \", score=\" + obj.getScore() + \"]\\n\");\n\t\t}\n\t\t\n\t\toutputFile.close();\n\t\t\n\t\t/* Imprime 15 */\n\t\toutputFile = new OutputStreamWriter(new FileOutputStream(\"skpq/SKPQ-LD [\" + \"k=\" + \"15\" + \", kw=\" + getKeywords() + \"].txt\"), \"ISO-8859-1\");\n\t\t\n\t\tit = topK.descendingIterator();\n\t\t\n\t\tfor(int a = 1; a <= 15; a++){\n\t\t\tSpatialObject obj = it.next();\n\t\t\toutputFile.write(\"-->[\" + a + \"] \" + \"[OSMlabel=\" + obj.getName() + \", lat=\" + obj.getLat() + \", lgt=\" + obj.getLgt() + \", score=\" + obj.getScore() + \"]\\n\");\n\t\t}\n\t\t\n\t\toutputFile.close();\n\t\t\n\t\t/* Imprime 20 */\n\t\toutputFile = new OutputStreamWriter(new FileOutputStream(\"skpq/SKPQ-LD [\" + \"k=\" + \"20\" + \", kw=\" + getKeywords() + \"].txt\"), \"ISO-8859-1\");\n\t\t\n\t\tit = topK.descendingIterator();\n\t\t\n\t\tfor(int a = 1; a <= 20; a++){\n\t\t\tSpatialObject obj = it.next();\n\t\t\toutputFile.write(\"-->[\" + a + \"] \" + \"[OSMlabel=\" + obj.getName() + \", lat=\" + obj.getLat() + \", lgt=\" + obj.getLgt() + \", score=\" + obj.getScore() + \"]\\n\");\n\t\t}\n\t\t\n\t\toutputFile.close();\n\t}", "public void SaveBestScore(int BestScore) {\r\n\t\ttry {\r\n\t\t\t// Comprobamos el nivel que ha seleccionado el jugador y guardamos el score\r\n\t\t\tif (cheater == false) {\r\n\t\t\t\tif (Menu.dificultad == \"facil\") {\r\n\t\t\t\t\tbw=new BufferedWriter(new FileWriter(\"C:\\\\Temp\\\\EasyScore.txt\"));\r\n\t\t\t\t\tbw.write(String.valueOf(BestScore+nl));\r\n\t\t\t\t\tbw.write(Menu.jugador);\r\n\t\t\t\t}else if (Menu.dificultad == \"normal\") {\r\n\t\t\t\t\tbw=new BufferedWriter(new FileWriter(\"C:\\\\Temp\\\\NormalScore.txt\"));\r\n\t\t\t\t\tbw.write(String.valueOf(BestScore+nl));\r\n\t\t\t\t\tbw.write(Menu.jugador);\r\n\t\t\t\t}else if (Menu.dificultad == \"dificil\") {\r\n\t\t\t\t\tbw=new BufferedWriter(new FileWriter(\"C:\\\\Temp\\\\HardScore.txt\"));\r\n\t\t\t\t\tbw.write(String.valueOf(BestScore+nl));\r\n\t\t\t\t\tbw.write(Menu.jugador);\r\n\t\t\t\t}else if (Menu.dificultad == \"Invertido\") {\r\n\t\t\t\t\tbw=new BufferedWriter(new FileWriter(\"C:\\\\Temp\\\\InvertidoScore.txt\"));\r\n\t\t\t\t\tbw.write(String.valueOf(BestScore+nl));\r\n\t\t\t\t\tbw.write(Menu.jugador);\r\n\t\t\t\t}else {\r\n\t\t\t\t\t// Pasa el cheater a false\r\n\t\t\t\t\tcheater = false;\r\n\t\t\t\t}\r\n\t\t\t\t// Cierra el Buffered Writer\r\n\t\t\t\tbw.close();\r\n\t\t\t}\r\n\t\t// Captura las diferentes exceptions\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\tSystem.out.println(\"File not found\");\r\n\t\t} catch (IOException e) {\r\n\t\t\tSystem.out.println(\"File can't open\");\r\n\t\t} \r\n\t}", "public ArrayList<Double> getFiveHighestScore() {\n int size = scoreList.size();\n ArrayList<Double> fiveHighestList = new ArrayList<>();\n if (size <= 5) {\n for (Double score: scoreList) {\n fiveHighestList.add(score);\n }\n } else {\n for (int i = 0; i < 5; i++)\n fiveHighestList.add(scoreList.get(i));\n }\n return fiveHighestList;\n }", "public void countHighest (int score){\r\n\t\tif (score > highest){\r\n\t\t\thighest = score;\r\n\t\t}\r\n\t}", "private void setUpHighscoreList() {\n highscores = fileManager.getHighscoresFromFile();\n\n tableData = new String[highscores.size()][2];\n int index = 0;\n for(String i: highscores.keySet()) {\n tableData[index][0] = i;\n tableData[index][1] = highscores.get(i).toString();\n index++;\n }\n\n highscoreTable = new JTable(tableData, columns) {\n private static final long serialVersionUID = 1L;\n\n public boolean isCellEditable(int row, int column) {\n return false;\n }\n\n };\n highscoreTable.setFocusable(false);\n highscoreTable.setCellSelectionEnabled(false);\n highscoreTable.getTableHeader().setReorderingAllowed(false);\n highscoreTable.setFillsViewportHeight(true);\n highscoreTable.setDragEnabled(false);\n highscorePane = new JScrollPane(highscoreTable);\n\n rootPanel.add(highscorePane, BorderLayout.CENTER);\n }", "public void endGame(){\t\t\r\n\t\tString inits = \r\n\t\t\t\tJOptionPane.showInputDialog(\r\n\t\t\t\t\t\t\"High Scores:\\n\"\r\n\t\t\t\t\t\t+scores[9].toString()\r\n\t\t\t\t\t\t+scores[8].toString()\r\n\t\t\t\t\t\t+scores[7].toString()\r\n\t\t\t\t\t\t+scores[6].toString()\r\n\t\t\t\t\t\t+scores[5].toString()\r\n\t\t\t\t\t\t+scores[4].toString()\r\n\t\t\t\t\t\t+scores[3].toString()\r\n\t\t\t\t\t\t+scores[2].toString()\r\n\t\t\t\t\t\t+scores[1].toString()\r\n\t\t\t\t\t\t+scores[0].toString()\r\n\t\t\t\t\t\t, \"\");\r\n\t\t\r\n\t\tcheckIfHighScore(inits);\r\n\t\t\r\n\t\ttry{\r\n\t\t\tthis.writeScoresToFile(file);\r\n\t\t} catch (Exception e){\r\n\t\t\t\r\n\t\t}\r\n\t}", "private static void printSortedArray(String outputFileName) {\n try {\n File output = new File(outputFileName);\n BufferedWriter writer = new BufferedWriter(new FileWriter(output));\n for(int i = 0; i < array.length; i++) {\n writer.write(array[i] + \"\\n\");\n }\n writer.close();\n }\n catch(IOException e){\n System.out.println(\"File Error\");\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}", "public void writeToFile(String user, Double score){\n String path = \"src/HighScoresFile.txt\";\n try{//Wrap in try catch for exception handling.\n //Create FileWriter object.\n FileWriter fr = new FileWriter(path,true);\n fr.write( score + \" \" + user + \"\\n\");\n\n fr.close();//close the fileWriter object.\n }\n //File not found Exception Block.\n catch (FileNotFoundException e){\n System.out.println(e);\n }\n //IO Exception Block.\n catch (IOException e) {\n e.printStackTrace();\n }\n }" ]
[ "0.7415415", "0.7374677", "0.71370935", "0.70978403", "0.68871015", "0.66966575", "0.6608352", "0.6486292", "0.6456492", "0.63991076", "0.6336644", "0.6334306", "0.62743163", "0.6248763", "0.61859125", "0.61401886", "0.6135829", "0.6104301", "0.6070188", "0.60651636", "0.60020286", "0.5993614", "0.59907275", "0.59879476", "0.5971342", "0.59543556", "0.5892364", "0.5858686", "0.58453333", "0.58374715", "0.58200127", "0.58172274", "0.5817034", "0.57957464", "0.5776376", "0.57743245", "0.5769542", "0.574354", "0.5738222", "0.5737278", "0.5719452", "0.5687727", "0.5681586", "0.5664267", "0.5663792", "0.56582034", "0.5657461", "0.565255", "0.563897", "0.56359464", "0.56194246", "0.56145203", "0.5593261", "0.5586215", "0.5581299", "0.5580989", "0.55774695", "0.5574807", "0.5556053", "0.55558676", "0.55534476", "0.5548416", "0.55320925", "0.5518065", "0.5517912", "0.5506071", "0.54788166", "0.54786026", "0.54751647", "0.54679066", "0.54647154", "0.5446394", "0.54459953", "0.5439878", "0.54325736", "0.54275584", "0.5418662", "0.54091406", "0.5395036", "0.5393432", "0.5393381", "0.53891623", "0.53845143", "0.53841996", "0.5383116", "0.5382821", "0.5381957", "0.5379762", "0.537733", "0.5375414", "0.53637755", "0.5362809", "0.535687", "0.5352633", "0.53506374", "0.5346206", "0.5344053", "0.5338226", "0.5320982", "0.5308624" ]
0.8209046
0
/ Draw a new frame displaying the highscores this is formatted in html to make it easier
public void drawHighscores(){ JFrame highScoreFrame = new JFrame(); highScoreFrame.setLayout(new BorderLayout()); highScoreFrame.setSize(new Dimension(280,400)); String top = "<h1><u>Highscores</u></h1>"; String numbers = getNumbers(); String scoreString = getTop(); JLabel enumeration = new JLabel("<html>" + numbers + "<html>"); JLabel scores = new JLabel("<html>" + scoreString + "<html>"); JLabel title = new JLabel("<html>" + top + "<html>"); title.setHorizontalAlignment(SwingConstants.CENTER); enumeration.setBorder(BorderFactory.createEmptyBorder(0,85,0,30)); highScoreFrame.add(title, BorderLayout.PAGE_START); highScoreFrame.add(enumeration, BorderLayout.LINE_START); highScoreFrame.add(scores, BorderLayout.CENTER); highScoreFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); highScoreFrame.setLocationRelativeTo(null); highScoreFrame.setVisible(true); for (int i = 1 ; i <= 10 ; i++){ System.out.println(i); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void draw() {\r\n\t\tclearDoc();\r\n\t\twrite(\"score: \" + score + \"\\n\", null);\r\n\t\twrite(\"+\", null);\r\n\t\tfor (int i = 0; i < COLUMNS; i++) {\r\n\t\t\twrite(\"-\", null);\r\n\t\t}\r\n\t\twrite(\"+\\n\", null);\r\n\t\tfor (int i = 0; i < ROWS; i++) {\r\n\t\t\twrite(\"|\", null);\r\n\t\t\tfor (int j = 0; j < COLUMNS; j++) {\r\n\t\t\t\tif (field[i][j] == SNAKE) {\r\n\t\t\t\t\twrite(\"S\", green);\r\n\t\t\t\t} else if (field[i][j] == APPLE) {\r\n\t\t\t\t\twrite(\"A\", red);\r\n\t\t\t\t} else if (field[i][j] == POISON) {\r\n\t\t\t\t\twrite(\"P\", magenta);\r\n\t\t\t\t} else if (field[i][j] == MOUSE) {\r\n\t\t\t\t\twrite(\"M\", grey);\r\n\t\t\t\t} else {\r\n\t\t\t\t\twrite(\"~\", null);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\twrite(\"|\\n\", null);\r\n\t\t}\r\n\t\twrite(\"+\", null);\r\n\t\tfor (int i = 0; i < COLUMNS; i++) {\r\n\t\t\twrite(\"-\", null);\r\n\t\t}\r\n\t\twrite(\"+\", null);\r\n\t\tframe.pack();\r\n\t}", "public void drawEndScreen() {\n\t\tint highScore = getHighScore();\n\t\tif (highScore <= score) {\n\t\t\thighScore = score;\n\t\t\tsetHighScore(highScore);\n\t\t}\n\t\tdisplayText(\"High Score \" + String.valueOf(highScore), 0, 0, false);\n\t\tdisplayText(\"Score\" + String.valueOf(score), 0, -100, false);\n\t}", "private void drawScore() {\n\t\tString score = myWorld.getScore() + \"\";\n\n\t\t// Draw shadow first\n\t\tAssetLoader.shadow.draw(batcher, \"\" + myWorld.getScore(), (136 / 2)\n\t\t\t\t- (3 * score.length()), 12);\n\t\t// Draw text\n\t\tAssetLoader.font.draw(batcher, \"\" + myWorld.getScore(), (136 / 2)\n\t\t\t\t- (3 * score.length() - 1), 11);\n\n\t}", "static void showHighScoreWindow( Frame owner, HighScore [] scores )\n\t{\n\t\tString message;\n\n\t\t// Special message if there are no high scores set\n\t\tif( scores[0] == null )\n\t\t\tmessage = \"No high scores.\";\n\t\telse\n\t\t\tmessage = \"\";\n\n\t\t// Show all non-null high scores\n\t\tfor( int i = 0; i < scores.length && scores[i] != null; i++ )\n\t\t\tmessage += scores[i].getName() + \": \" + scores[i].getScore() + \"\\n\";\n\n\t\tJOptionPane.showMessageDialog( owner, message, \"High Scores\",\n\t\t\t\t JOptionPane.INFORMATION_MESSAGE );\n\t}", "private void showScore() {\r\n View.show(score, this.getSize().width + 15, 0);\r\n }", "private void initialize() {\n frame = new JFrame();\n frame.getContentPane().setBackground(Color.BLACK);\n frame.setBackground(Color.BLACK);\n frame.setResizable(false);\n frame.setBounds(100, 100, 350, 300);\n frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n frame.setTitle(\"Final Score\");\n frame.getContentPane().setLayout(null);\n frame.setLocationRelativeTo(null);\n frame.setVisible(true);\n\n JLabel lblFinalScoreText = new JLabel(\"Final score:\");\n lblFinalScoreText.setHorizontalAlignment(SwingConstants.LEFT);\n lblFinalScoreText.setForeground(Color.WHITE);\n lblFinalScoreText.setFont(new Font(\"Quantico\", Font.BOLD, 18));\n lblFinalScoreText.setBounds(24, 24, 130, 54);\n frame.getContentPane().add(lblFinalScoreText);\n\n JLabel lblFinalScoreCount = new JLabel(\"\");\n lblFinalScoreCount.setFont(new Font(\"Bitstream Vera Sans Mono\", Font.BOLD, 30));\n lblFinalScoreCount.setForeground(Color.WHITE);\n lblFinalScoreCount.setHorizontalAlignment(SwingConstants.LEFT);\n lblFinalScoreCount.setBounds(197, 12, 187, 80);\n frame.getContentPane().add(lblFinalScoreCount);\n lblFinalScoreCount.setText(String.valueOf(engine.getFinalScore()));\n \n JLabel lblShipName = new JLabel(\"Ship's Name:\");\n lblShipName.setFont(new Font(\"Ubuntu Light\", Font.BOLD, 13));\n lblShipName.setForeground(Color.WHITE);\n lblShipName.setBounds(24, 163, 158, 25);\n frame.getContentPane().add(lblShipName);\n \n JLabel lblNumDays = new JLabel(\"Number of days:\");\n lblNumDays.setFont(new Font(\"Ubuntu Light\", Font.BOLD, 13));\n lblNumDays.setForeground(Color.WHITE);\n lblNumDays.setBounds(24, 212, 146, 15);\n frame.getContentPane().add(lblNumDays);\n \n JLabel lblWonGame = new JLabel(\"\");\n lblWonGame.setHorizontalAlignment(SwingConstants.LEFT);\n lblWonGame.setForeground(Color.WHITE);\n lblWonGame.setBounds(24, 88, 314, 43);\n String template = \"<html>\";\n if (engine.hasFoundEnoughPieces()) {\n lblWonGame.setForeground(Color.GREEN);\n \ttemplate += \"You have collected all the ship pieces<br>\";\n \ttemplate += \"Congratulations, you won the game!\";\n }\n else {\n lblWonGame.setForeground(Color.RED);\n \ttemplate += \"You did not collect all the ship pieces<br>\";\n \ttemplate += \"better luck next time!\";\n }\n template += \"</html>\";\n lblWonGame.setText(template);\n frame.getContentPane().add(lblWonGame);\n \n JLabel shipNameDetail = new JLabel(\"\");\n shipNameDetail.setForeground(Color.WHITE);\n shipNameDetail.setBounds(197, 168, 141, 15);\n shipNameDetail.setText(engine.getSpaceshipName());\n frame.getContentPane().add(shipNameDetail);\n \n JLabel days = new JLabel(\"\");\n days.setForeground(Color.WHITE);\n days.setBounds(197, 212, 66, 15);\n days.setText(String.valueOf(engine.getCurrDay() - 1));\n frame.getContentPane().add(days);\n }", "private void drawScoreText(Canvas canvas) {\n paint.setTextSize(bodyTextSize);\n paint.setTextAlign(Paint.Align.CENTER);\n\n int bodyWidthHighScore = (int) (paint.measureText(\"\" + game.highScore));\n int bodyWidthScore = (int) (paint.measureText(\"\" + game.score));\n\n int textWidthHighScore = Math.max(titleWidthHighScore, bodyWidthHighScore) + textPaddingSize * 2;\n int textWidthScore = Math.max(titleWidthScore, bodyWidthScore) + textPaddingSize * 2;\n\n int textMiddleHighScore = textWidthHighScore / 2;\n int textMiddleScore = textWidthScore / 2;\n\n int eXHighScore = endingX;\n int sXHighScore = eXHighScore - textWidthHighScore;\n\n int eXScore = sXHighScore - textPaddingSize;\n int sXScore = eXScore - textWidthScore;\n\n //Outputting high-scores box\n backgroundRectangle.setBounds(sXHighScore, sYAll, eXHighScore, eYAll);\n backgroundRectangle.draw(canvas);\n paint.setTextSize(titleTextSize);\n paint.setColor(getResources().getColor(R.color.text_brown));\n canvas.drawText(getResources().getString(R.string.high_score), sXHighScore + textMiddleHighScore, titleStartYAll, paint);\n paint.setTextSize(bodyTextSize);\n paint.setColor(getResources().getColor(R.color.text_white));\n canvas.drawText(String.valueOf(game.highScore), sXHighScore + textMiddleHighScore, bodyStartYAll, paint);\n\n\n //Outputting scores box\n backgroundRectangle.setBounds(sXScore, sYAll, eXScore, eYAll);\n backgroundRectangle.draw(canvas);\n paint.setTextSize(titleTextSize);\n paint.setColor(getResources().getColor(R.color.text_brown));\n canvas.drawText(getResources().getString(R.string.score), sXScore + textMiddleScore, titleStartYAll, paint);\n paint.setTextSize(bodyTextSize);\n paint.setColor(getResources().getColor(R.color.text_white));\n canvas.drawText(String.valueOf(game.score), sXScore + textMiddleScore, bodyStartYAll, paint);\n }", "private void setUpHighscoreList() {\n highscores = fileManager.getHighscoresFromFile();\n\n tableData = new String[highscores.size()][2];\n int index = 0;\n for(String i: highscores.keySet()) {\n tableData[index][0] = i;\n tableData[index][1] = highscores.get(i).toString();\n index++;\n }\n\n highscoreTable = new JTable(tableData, columns) {\n private static final long serialVersionUID = 1L;\n\n public boolean isCellEditable(int row, int column) {\n return false;\n }\n\n };\n highscoreTable.setFocusable(false);\n highscoreTable.setCellSelectionEnabled(false);\n highscoreTable.getTableHeader().setReorderingAllowed(false);\n highscoreTable.setFillsViewportHeight(true);\n highscoreTable.setDragEnabled(false);\n highscorePane = new JScrollPane(highscoreTable);\n\n rootPanel.add(highscorePane, BorderLayout.CENTER);\n }", "public void doOneFrame(DrawSurface d, double dt) {\n d.setColor(Color.BLACK);\n d.fillRectangle(0, 0, d.getWidth(), d.getHeight());\n\n d.setColor(Color.RED);\n d.drawText(19, 41, \"High Scores\", 40);\n\n d.setColor(Color.BLUE);\n d.drawText(20, 40, \"High Scores\", 40);\n\n d.drawText(100, 120, \"Player Name\", 30);\n d.drawText(500, 120, \"Score\", 30);\n\n d.setColor(Color.RED);\n d.drawText(98, 118, \"Player Name\", 30);\n d.drawText(498, 118, \"Score\", 30);\n\n d.setColor(Color.BLUE);\n d.drawLine(100, 131, 700, 131);\n\n d.setColor(Color.YELLOW);\n for (int i = 0; i < highScoresTable.getHighScores().size(); i++) {\n ScoreInfo scoreInfo = highScoresTable.getHighScores().get(i);\n d.drawText(110, (i * 40) + 155, scoreInfo.getName(), 20);\n d.drawText(510, (i * 40) + 155, \"\" + scoreInfo.getScore() + \"\", 20);\n }\n\n\n d.setColor(Color.GREEN);\n d.drawText(202, 550, \"Press space to continue\", 32);\n d.setColor(Color.GRAY);\n d.drawText(200, 550, \"Press space to continue\", 32);\n\n }", "public void displayHighScoreInfo(String[][] highScoreList, String highScoreTitle) {\n System.out.println(highScoreTitle + \"\\n\");\n for (int i = 0; i < highScoreList.length; i++) {\n System.out.println((i + 1) + \". \" + highScoreList[i][0] + \" \" + highScoreList[i][1]);\n }\n }", "public void showScore()\n {\n showText(\"Score:\" + score,550,50);\n }", "private void buildScorePanel() {\r\n scorePanel = new JPanel( new GridLayout( 1, 6 ) );\r\n scorePanel.setBackground( COLOR_SCORE_BKGRND );\r\n\r\n scoreTitle = new JLabel( Msgs.str( \"Score\" ) );\r\n scoreTitle.setHorizontalAlignment( SwingConstants.CENTER );\r\n scoreMesg = new JLabel( \"0\" );\r\n scorePanel.add( scoreTitle );\r\n scorePanel.add( scoreMesg );\r\n\r\n minesTitle = new JLabel( Msgs.str( \"mines.left\" ) );\r\n minesMesg = new JLabel( \"0\" );\r\n scorePanel.add( minesTitle );\r\n scorePanel.add( minesMesg );\r\n\r\n timeTitle = new JLabel( Msgs.str( \"Time\" ) );\r\n timeMesg = new JLabel( Msgs.str( \"zeroTime\" ) );\r\n scorePanel.add( timeTitle );\r\n scorePanel.add( timeMesg );\r\n }", "public void drawStartScreen() {\n\t\tint highScore = getHighScore();\n\t\tdisplayText(\"High Score \" + String.valueOf(highScore), 0, 0, false);\n\t\tdisplayText(\"Press to Start Game\", 0, -100, false);\n\t}", "public String getTop(){\n StringBuilder htmlTop = new StringBuilder(\"<h2>\");\n for (int i = 0; i<10; i++){\n if (i >= this.highscores.size()){\n htmlTop.append(\" ----<br>\");\n } else {\n htmlTop.append(String.valueOf(this.highscores.get(i))).append(\"<br>\");\n }\n }\n htmlTop.append(\"</h2>\");\n return htmlTop.toString();\n }", "private void generate() {\n\t\t_layout=new BorderPane();\n\t\t_winnings=_gController.getWinnings();\t\t\t\t\t\n\t\t\n\t\tLabel gameOver = new Label(\"Game Over\");\n\t\tgameOver.setTextFill(Color.WHITE);\n\t\tgameOver.setFont(new Font(40));\n\t\t\n\t\tLabel finalScore = new Label(\"Your final score is: $\"+_winnings);\n\t\tfinalScore.setTextFill(Color.WHITE);\n\t\t\n\t\tLabel rewardText = new Label(\"Congratulations! You have earned the title of \");\t\t\t\n\t\tString url=System.getProperty(\"user.dir\")+\"/images/\";\n\t\tif (_winnings < 3000) {\n\t\t\trewardText.setText(rewardText.getText()+\"Wonderful Weta!\");\n\t\t\turl=url+\"weta.png\";\n\t\t} else if (_winnings < 6000) {\n\t\t\trewardText.setText(rewardText.getText()+\"Knowledgeable Kiwi!\");\n\t\t\turl=url+\"kiwi.png\";\n\t\t} else if (_winnings < 9000) {\n\t\t\trewardText.setText(rewardText.getText()+\"Brilliant Bellbird!\");\n\t\t\turl=url+\"bellbird.png\";\n\t\t} else if (_winnings < 12000) {\n\t\t\trewardText.setText(rewardText.getText()+\"Fantastic Fantail!\");\n\t\t\turl=url+\"fantail.png\";\n\t\t} else {\n\t\t\trewardText.setText(rewardText.getText()+\"Talented Tuatara!\");\n\t\t\turl=url+\"tuatara.png\";\n\t\t}\t\n\t\t\n\t\tLabel img = new Label();\n\t\timg.setGraphic(new ImageView(new Image(new File(url).toURI().toString(),300,0,true,false)));\n\t\t\n\t\tLabel captionText= new Label();\n\t\tif (_winnings < 3000) {\n\t\t\tcaptionText.setText(\"Earn $3000 next time to earn a higher title\");\n\t\t} else if (_winnings < 6000) {\n\t\t\tcaptionText.setText(\"Earn $6000 next time to earn a higher title\");\n\t\t} else if (_winnings < 9000) {\n\t\t\tcaptionText.setText(\"Earn $9000 next time to earn a higher title\");\n\t\t} else if (_winnings < 12000) {\n\t\t\tcaptionText.setText(\"Earn $12000 next time to earn a higher title\");\n\t\t} else {\n\t\t\tcaptionText.setText(\"Nice! You have earned the highest title\");\n\t\t}\t\n\t\t\n\t\tLabel prompt = new Label(\"Enter your name below\");\n\t\tVBox.setMargin(prompt, new Insets(10,10,0,10));\n\t\t\n\t\tTextField nameField = new TextField();\n\t\tnameField.setPromptText(\"Enter your name here\");\n\t\tnameField.setOnAction(new EventHandler<ActionEvent>() {\n\t\t\t@Override\n\t\t\tpublic void handle(ActionEvent event) {\n\t\t\t\t_gController.addNZScore(nameField.getText(), _winnings);\n\t\t\t\t_gController.showLeaderboardScreen();\n\t\t\t}});\n\t\t\n\t\tButton btnContinue = new Button(\"Enter\");\n\t\tbtnContinue.setOnAction(new EventHandler<ActionEvent>() {\n\t\t\t@Override\n\t\t\tpublic void handle(ActionEvent event) {\n\t\t\t\t_gController.addNZScore(nameField.getText(), _winnings);\n\t\t\t\t_gController.showLeaderboardScreen();\n\t\t\t}\n\t\t});\t\t\n\t\tHBox userInput = new HBox(5);\n\t\tuserInput.setAlignment(Pos.CENTER);\n\t\tuserInput.getChildren().addAll(nameField,btnContinue);\n\t\tVBox.setMargin(userInput, new Insets(5,10,10,10));\n\t\t\n\t\tVBox gameInfo = new VBox();\n\t\tgameInfo.setAlignment(Pos.CENTER);\n\t\tgameInfo.getChildren().addAll(gameOver,finalScore,rewardText,img,captionText,prompt,userInput);\t\t\n\t\t_layout.setCenter(gameInfo);\n\t\t\n\t\t_gController.newGame();\n\t}", "public void makeScorecard() {\n ScorecardGUI scorecardGUI = new ScorecardGUI(this);\n pack(); // temporarily resize the JFrame so that the scorecard can be seen\n setSize(new Dimension(900, 750)); // reset the size of the frame to its original dimensions\n }", "private void histogramScore() {\r\n View.histogram(score, 0, this.getSize().width + 15, 0);\r\n }", "public void toHighScore(View view)\n {\n scoreSettings = getSharedPreferences(scoreFile,PREFERENCE_MODE_PRIVATE);\n setContentView(R.layout.highscore_layout);\n TextView firstView = (TextView) findViewById(R.id.first);\n firstView.setText(\"1st: \"+scoreSettings.getString(\"goldName\",\"\")+\", \"+scoreSettings.getInt(\"goldScore\",0)+\" points\");\n TextView secondView = (TextView) findViewById(R.id.second);\n secondView.setText(\"2nd: \"+scoreSettings.getString(\"silverName\",\"\")+\", \"+scoreSettings.getInt(\"silverScore\",0)+\" points\");\n TextView thirdView = (TextView) findViewById(R.id.third);\n thirdView.setText(\"3rd: \"+scoreSettings.getString(\"bronzeName\",\"\")+\", \"+scoreSettings.getInt(\"bronzeScore\",0)+\" points\");\n }", "@Override\n public void display() {\n Game game = PiggysRevenge.getCurrentGame();\n int bricks = 0;\n House house = game.getHouse();\n if (game.getHouse().isCompleted()) {\n try {\n bricks = GameControl.calcNumberOfBricks(house.getLength(), house.getWidth(), house.getHeight(), house.getStories());\n } catch (GameControlException ex) {\n this.console.println(ex.getMessage());\n }\n } else {\n bricks = 0;\n }\n int turns = game.getTurns();\n boolean hasEaten = game.getPlayer().isHasEaten();\n boolean wolfKilled = game.isWolfKilled();\n int result = 0;\n try {\n result = GameControl.calcScore(bricks, turns, hasEaten, wolfKilled);\n } catch (GameControlException ex) {\n this.console.println(ex.getMessage());\n }\n if (result>0) {\n this.console.println(\"+\" + (bricks*10) + \" Points for building the house.\");\n this.console.println(\"-\" + (turns*10) + \" Points for the number of turns taken (\" + turns + \" turns).\");\n } else {\n this.console.println(\"You get no points if you do not build a house,\"\n + \"\\neat the roast beef, or kill the wolf.\");\n }\n if (hasEaten) {\n this.console.println(\"+1000 Points for eating roast beef.\");\n }\n if (wolfKilled) {\n this.console.println(\"+2000 Points for killing the wolf.\");\n }\n this.console.println(\"\\nYOUR SCORE IS: \" + result);\n\n if (gameOver) {\n HighScore[] highScores;\n\n File varTmpDir = new File(\"highscores.txt\");\n\n if (varTmpDir.exists()) {\n try (FileInputStream fips = new FileInputStream(\"highscores.txt\");\n ObjectInputStream input = new ObjectInputStream(fips);) {\n \n\n highScores = (HighScore[]) input.readObject();\n highScores[10] = new HighScore(game.getPlayer().getName(), result, house);\n\n for (int n = 0; n < highScores.length; n++) {\n for (int m = 0; m < highScores.length - 1 - n; m++) {\n if (highScores[m].getScore() < highScores[m + 1].getScore()\n || \"---\".equals(highScores[m].getName())) {\n HighScore swapHighScore = highScores[m];\n highScores[m] = highScores[m + 1];\n highScores[m + 1] = swapHighScore;\n }\n }\n }\n\n try (FileOutputStream fops = new FileOutputStream(\"highscores.txt\");\n ObjectOutputStream output = new ObjectOutputStream(fops);) {\n \n output.writeObject(highScores);\n this.console.println(\"Score saved successfully\");\n \n } catch (Exception e) {\n ErrorView.display(\"ScoreView\", e.getMessage());\n }\n } catch (Exception e) {\n ErrorView.display(\"ScoreView\", e.getMessage());\n }\n\n } else {\n try (FileOutputStream fops = new FileOutputStream(\"highscores.txt\");\n ObjectOutputStream output = new ObjectOutputStream(fops);) {\n \n\n highScores = new HighScore[11];\n for (int i = 0; i < highScores.length; i++){\n highScores[i] = new HighScore(\"---\", 0, new House(5, 5, 6, 1));\n \n }\n\n highScores[0] = new HighScore(game.getPlayer().getName(), result, house);\n output.writeObject(highScores);\n this.console.println(\"New highscore file created. Score saved successfully\");\n } catch (Exception e) {\n ErrorView.display(\"ScoreView\", e.getMessage());\n }\n\n }\n }\n }", "private void printScore() {\r\n View.print(score);\r\n }", "private void showScore(Skin skin) {\r\n \tif(PlayerProfileManager.getInstance().getCurrentPlayerProfile().getCurrentLevelProfile().isTutorial()) {\r\n \t\treturn;\r\n \t}\r\n \r\n newScore = gameController.getScoreController().generateEndScore(gameController);\r\n \r\n // define some space between the labels and the values\r\n messageTable.columnDefaults(1).width(50f);\r\n \r\n int gainMoney = 0;\r\n \r\n Score recentBestScore = ScoreManager.getInstance().getCurrentLevelBestScore();\r\n if ((recentBestScore == null && newScore.getTotalScore() > 0) || newScore.getTotalScore() > recentBestScore.getTotalScore()) {\r\n \r\n \tgainMoney = (int)(newScore.getTotalScore() * PlayerProfileManager.getInstance().getCurrentPlayerProfile().getCurrentLevelGroup().getMoneyFactor());\r\n \r\n newScore.setServerScoreId(recentBestScore == null ? -1 : recentBestScore.getServerScoreId());\r\n ScoreManager.getInstance().saveBestScore(newScore);\r\n \r\n messageTable.row();\r\n messageTable.add(new Label(I18n.t(\"newRecord\") + \":\", skin)).right();\r\n messageTable.add();\r\n messageTable.add(new Label(String.valueOf(newScore.getTotalScore()), skin)).left();\r\n }\r\n else {\r\n \tgainMoney = (int)(newScore.getTotalScore() * PlayerProfileManager.getInstance().getCurrentPlayerProfile().getCurrentLevelGroup().getMoneyFactor()*0.25);\r\n \r\n \r\n Label scoreName = new Label(I18n.t(\"newScore\"), skin);\r\n \r\n messageTable.add(scoreName).right();\r\n messageTable.add();\r\n StringBuilder builder = new StringBuilder();\r\n builder.append(newScore.getTotalScore());\r\n builder.append(\", \");\r\n builder.append(I18n.t(\"record\"));\r\n builder.append(\": \");\r\n builder.append(recentBestScore.getTotalScore());\r\n messageTable.add(new Label(builder.toString(), skin)).left();\r\n }\r\n messageTable.row().expand();\r\n \r\n // adds an amount of money to the players profile that equals the score\r\n // he got in this level\r\n PlayerProfileManager.getInstance().getCurrentPlayerProfile().addMoney(gainMoney);\r\n \r\n // gates\r\n ScoreDetail detail = newScore.getScoreDetails().get(0);\r\n messageTable.add(new Label(I18n.t(detail.getDetailName()), skin, \"medium-font\")).right();\r\n messageTable.add();\r\n StringBuilder gatesBuilder = new StringBuilder();\r\n gatesBuilder.append(GameController.getInstance().getScoreController().getGatesPassed());\r\n gatesBuilder.append(\" (\");\r\n gatesBuilder.append(detail.getValue());\r\n gatesBuilder.append(\")\");\r\n \r\n messageTable.add(new Label(gatesBuilder, skin, \"medium-font\")).left();\r\n \r\n // time\r\n messageTable.row().expand();\r\n detail = newScore.getScoreDetails().get(1);\r\n messageTable.add(new Label(I18n.t(detail.getDetailName()), skin, \"medium-font\")).right();\r\n messageTable.add();\r\n StringBuilder timeBuilder = new StringBuilder();\r\n timeBuilder.append(gameController.getTimeController().getIntegerTime());\r\n timeBuilder.append(\" s (\");\r\n timeBuilder.append(detail.getValue());\r\n timeBuilder.append(\")\");\r\n messageTable.add(new Label(timeBuilder, skin, \"medium-font\")).left();\r\n \r\n // bonus points\r\n messageTable.row().expand();\r\n detail = newScore.getScoreDetails().get(2);\r\n messageTable.add(new Label(I18n.t(detail.getDetailName()), skin, \"medium-font\")).right();\r\n messageTable.add();\r\n messageTable.add(new Label(detail.getValue(), skin, \"medium-font\")).left();\r\n messageTable.row();\r\n \r\n //gain money\r\n messageTable.row().expand(); \r\n messageTable.add(new Label(I18n.t(\"gainMoney\") + \":\", skin)).right();\r\n messageTable.add();\r\n messageTable.add(new Label(gainMoney+\"\", skin)).left();\r\n messageTable.row();\r\n \r\n }", "private void showScores() {\n levelNumber.setText(String.format(\"%s%d\", getResources().getString(R.string.level), level));\n Level l = Level.getLevel(level);\n for (int i = 0; i < Level.MAX_SCORES; i++) {\n Level.Player p = l.getPlayer(i);\n if (p != null) new ScoreTextView(i + 1, p.toString());\n }\n }", "private void fillLeaderboard() {\n highscore_flwPane.getChildren().clear();\n List<HighScore> hList = mainController.getJSONHighScores();\n\n for(int i = 0; i < hList.size(); i++){\n HighscoreController hc = new HighscoreController(this, String.valueOf(i+1), hList.get(i).getName(),hList.get(i).getMode(),hList.get(i).getScore());\n highscore_flwPane.getChildren().add(hc);\n }\n\n }", "public static void displayScoreCard(){\r\n\t\t\r\n\t\t try {\r\n\t\t\t \r\n\t\t\t //getting the connection\r\n\t\t\tstatement = connection.createStatement();\r\n\t\t\t\r\n\t\t\t//retriving the data from the database\r\n\t\t\t ResultSet results = statement.executeQuery(\"select * from \" + tableName);\r\n\t\t\t \r\n\t\t\t //Retrieves the Players_Name, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE and OUT_FRONT of this ResultSet object's columns. \r\n\t\t\t ResultSetMetaData rsmd = results.getMetaData();\r\n\t\t\t \r\n\t\t\t \r\n\t\t\t System.out.println(\"\\t\\t\\t\\t Fort Cherry Golf Course\");\r\n\t\t\t // print the names of the above the table\r\n\t\t\t int numberCols = rsmd.getColumnCount();\r\n\t\t\t for (int i=1; i<=numberCols; i++) \r\n\t\t\t {\r\n\t\t\t // extract each column name from the meta data and print them\r\n\t\t\t System.out.print(rsmd.getColumnLabel(i)+\"\\t\"); \r\n\t\t\t }\r\n\r\n\t\t\t //simply printing the line\r\n\t\t\t System.out.println(\"\\n--------------------------------------------------------------------------------------------------\");\r\n\t\t\t \r\n\t\t\t // Reteriving all data one by one from the data base\r\n\t\t\t while(results.next())\r\n\t\t\t {\r\n\t\t\t String players_Name = results.getString(1);\r\n\t\t\t int ONE = results.getInt(2);\r\n\t\t\t int TWO = results.getInt(3);\r\n\t\t\t int THREE = results.getInt(4);\r\n\t\t\t int FOUR = results.getInt(5);\r\n\t\t\t int FIVE = results.getInt(6);\r\n\t\t\t int SIX = results.getInt(7);\r\n\t\t\t int SEVEN = results.getInt(8);\r\n\t\t\t int EIGHT = results.getInt(9);\r\n\t\t\t int NINE = results.getInt(10);\r\n\t\t\t int OUT_FRONT = results.getInt(11);\r\n\t\t\t \r\n\t\t\t //printing the retrive data to the console\r\n\t\t\t System.out.println(players_Name + \"\\t\" + ONE + \"\\t\" + TWO + \"\\t\" + THREE + \"\\t\" + FOUR + \"\\t\" + FIVE + \"\\t\" + SIX + \"\\t\" + SEVEN + \"\\t\" + EIGHT + \"\\t\" + NINE + \"\\t\" + OUT_FRONT);\r\n\t\t\t }\r\n\t\t\t \r\n\t\t\t //closing the resultset and the statement\r\n\t\t\t results.close();\r\n\t\t\t statement.close();\r\n\t\t\t \r\n\t\t} catch (SQLException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void scores(HashMap<String, Integer> scoreboard) {\r\n\t\tclear_screen();\r\n\t\t// Le tableau de scores arrive déjà trié.\r\n\t\tJLabel sc = new JLabel(\"Partie Terminé. Tableau des scores : \");\r\n\t\tsc.setBounds(0, 0, 1280, 40);\r\n\t\tsc.setFont(new Font(sc.getFont().getName(), Font.BOLD, 30));\r\n\t\tthis.add(sc);\r\n\r\n\t\tint begin = 60;\r\n\r\n\t\tfor (Map.Entry<String, Integer> elt : scoreboard.entrySet()) {\r\n\t\t\tJLabel u_score = new JLabel(elt.getKey()+\" : \"+elt.getValue()+\" points\", SwingConstants.CENTER);\r\n\t\t\tu_score.setFont(new Font(sc.getFont().getName(), Font.PLAIN, 20));\r\n\t\t\tu_score.setBounds(0, begin, 1280, 30);\r\n\t\t\tthis.add(u_score);\r\n\t\t\tbegin+=40;\r\n\t\t}\r\n\r\n\t\tclose = new JButton(\"Fermer\");\r\n\t\tclose.setBounds(5, 640,150,40);\r\n\t\tthis.add(close);\r\n\t\tclose.addActionListener(this);\r\n\t}", "private void howToPlay() {\n\n String s = \"You are presented with a grid of tiles, some of which contain mines.\\n\"\n + \"The aim of Minesweeper is to reveal all tiles in the grid which do not contain mines.\\n\"\n + \"To reveal a tile, click on it. If the tile you reveal is a mine, you lose the game.\\n\"\n + \"If the tile you reveal is empty, all surrounding tiles will be revealed, \\n\"\n + \"and if those are also empty, their surrounding tiles will be revealed too.\\n\"\n + \"Tiles containing numbers indicate how many mines there are surrounding that tile.\\n\"\n + \"If you think a tile contains a mine, right click on it to mark it as a mine.\\n\"\n + \"You win the game once either you mark all mines, or reveal all tiles which are not mines.\";\n\n JFrame helpframe = new JFrame(\"How to play\");\n JPanel helppanel = new JPanel();\n JButton close = new JButton(\"Got it!\");\n JTextArea text = new JTextArea(s);\n\n close.addActionListener((ActionEvent ev) -> {\n helpframe.dispose();\n });\n\n text.setEditable(false);\n text.setOpaque(false);\n text.setWrapStyleWord(true);\n helppanel.add(text);\n helppanel.add(close);\n helpframe.add(helppanel);\n helpframe.setLocationRelativeTo(null);\n helpframe.setSize(560, 200);\n helpframe.setVisible(true);\n helpframe.setResizable(false);\n }", "public void createAndShowButtons() {\n\t\t// repainting images to update after player was moved\n\t\t@SuppressWarnings(\"unused\")\n\t\tGraphics g = getGraphics();\n\t\tremoveAll();\n\t\trevalidate();\n\t\trepaint();\n\n\t\tsetLayout(new GridLayout(1, 6, 100, 0));\n\t\tJButton highscoreButton = new JButton(\"Highscore\");\n\t\tadd(highscoreButton);\n\n\t\t/*\n\t\t * Inner class listening to the highscore button being pressed.\n\t\t */\n\t\thighscoreButton.addActionListener(new ActionListener() {\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tJOptionPane.showMessageDialog(null, Scores.showHighscore());\n\t\t\t\tmapFrame.createAndShowGui();\n\t\t\t}\n\t\t});\n\n\t\tJLabel name = new JLabel(\n\t\t\t\t\"<html><div>Name: \" + player.getName() + \"<br> Difficulty: \" + map.getDifficulty() + \"</div></html>\");\n\t\tadd(name);\n\t\tJLabel skill = new JLabel(\n\t\t\t\t\"<html><div> Energy: \" + player.getEnergy() + \" <br> Skill: \" + player.getSkill() + \"</div></html>\");\n\t\tadd(skill);\n\t\tJLabel currentScore = new JLabel(\"<html><div> Score: \" + score.getScore() + \"<br> Key(s): \"\n\t\t\t\t+ player.getNumberOfKeys() + \"/\" + map.getNUMBER_OF_REQUIRED_KEYS() + \"</div></html>\");\n\t\tadd(currentScore);\n\t\tJLabel numberOfMoves = new JLabel(\"<html><div> Moves: \" + player.getNumberOfMoves() + \"<br> Prices: \"\n\t\t\t\t+ player.getWonPrices() + \"</div></html>\");\n\t\tadd(numberOfMoves);\n\t\tJButton quitButton = new JButton(\"Quit\");\n\t\tadd(quitButton);\n\n\t\t/*\n\t\t * Inner class listening to the Quit button being pressed.\n\t\t */\n\t\tquitButton.addActionListener(new ActionListener() {\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tJOptionPane.showMessageDialog(null, \"Bye, come back soon!\");\n\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t});\n\t}", "public void makeFrame() {\r\n\r\n\t\tframe = new JFrame(\"Avoid-the-bomb\");\r\n\t\tframe.setSize(1000, 500);\r\n\t\tframe.setResizable(false);\r\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\r\n\t\tleftSection = new JPanel();\r\n\t\tmiddleSection = new JPanel();\r\n\t\trightSection = new JPanel();\r\n\r\n\t\tGridLayout grid = new GridLayout(2, 5);\r\n\t\tGridLayout gameStructure = new GridLayout(1, 3);\r\n\r\n\t\tframe.setLayout(gameStructure);\r\n\r\n\t\tleftSection.setLayout(grid);\r\n\t\tleftSection.setSize(333, 500);\r\n\r\n\t\tJPanel [] gameSquares = new JPanel[10];\r\n\r\n\t\t//Loop for generating and formatting the 10 game squares into the left section panel, using array of Jpanels\r\n\t\tfor(int index = 0; index < gameSquares.length; index++) {\r\n\r\n\t\t\tgameSquares[index] = new JPanel();\r\n\t\t\tleftSection.add(gameSquares[index]);\r\n\t\t\tgameSquares[index].setBorder(BorderFactory.createLineBorder(Color.BLACK));\r\n\t\t\tgameSquares[index].setBackground(Color.BLUE);\r\n\r\n\t\t}\r\n\r\n\t\tDimension buttonSize = new Dimension(300, 125);\r\n\t\tFont buttonFont = new Font(\"Arial\", Font.BOLD, 23);\r\n\r\n\t\tplayGame = new JButton(\"Play the game\");\r\n\t\tplayGame.addActionListener(source -> playGame());\r\n\r\n\t\texitGame = new JButton(\"exit\");\r\n\t\texitGame.addActionListener(source -> resetGame());\r\n\r\n\t\tscoreLabel = new JLabel();\r\n\r\n\t\tmiddleSection.setSize(333, 500);\r\n\t\tmiddleSection.setBackground(Color.WHITE);\r\n\r\n\t\tplayGame.setPreferredSize(buttonSize);\r\n\t\texitGame.setPreferredSize(buttonSize);\r\n\t\tscoreLabel.setPreferredSize(buttonSize);\r\n\r\n\t\tplayGame.setBackground(Color.GREEN);\r\n\t\texitGame.setBackground(Color.RED);\r\n\r\n\t\tplayGame.setFont(buttonFont);\r\n\t\texitGame.setFont(buttonFont);\r\n\t\tscoreLabel.setFont(buttonFont);\r\n\r\n\t\tplayGame.setBorder(BorderFactory.createLineBorder(Color.BLACK));\r\n\t\texitGame.setBorder(BorderFactory.createLineBorder(Color.BLACK));\r\n\r\n\t\tmiddleSection.add(playGame);\r\n\t\tmiddleSection.add(Box.createHorizontalStrut(100));\r\n\t\tmiddleSection.add(exitGame);\t\r\n\t\tmiddleSection.add(Box.createHorizontalStrut(100));\r\n\t\tmiddleSection.add(scoreLabel);\r\n\t\tmiddleSection.add(Box.createHorizontalStrut(100));\r\n\r\n\t\trightSection.setSize(333, 500);\r\n\t\trightSection.setBackground(Color.RED);\r\n\r\n\t\tJButton easy = new JButton(\"Easy\");\r\n\t\tJButton intermediate = new JButton(\"Intermediate\");\r\n\t\tJButton hard = new JButton(\"Hard\");\r\n\t\t\t\t\r\n\t\teasy.setBackground(Color.ORANGE);\t\r\n\t\t\r\n\t\t//Where the difficulty is set, using somewhat lengthy lambda functions\r\n\t\teasy.addActionListener(source -> { levelEasy = true; levelIntermediate = false; levelHard = false; easy.setBackground(Color.ORANGE); intermediate.setBackground(Color.GRAY); hard.setBackground(Color.GRAY);} );\r\n\t\tintermediate.addActionListener(source -> { levelEasy = false; levelIntermediate = true; levelHard = false; intermediate.setBackground(Color.ORANGE); easy.setBackground(Color.GRAY); hard.setBackground(Color.GRAY);});\r\n\t\thard.addActionListener(source -> { levelEasy = false; levelIntermediate = false; levelHard = true; hard.setBackground(Color.ORANGE); easy.setBackground(Color.GRAY); intermediate.setBackground(Color.GRAY);});\r\n\t\t\t\t\r\n\t\teasy.setPreferredSize(buttonSize);\r\n\t\tintermediate.setPreferredSize(buttonSize);\r\n\t\thard.setPreferredSize(buttonSize);\r\n\r\n\t\teasy.setFont(buttonFont);\r\n\t\tintermediate.setFont(buttonFont);\r\n\t\thard.setFont(buttonFont);\r\n\r\n\t\teasy.setBorder(BorderFactory.createLineBorder(Color.BLACK));\r\n\t\tintermediate.setBorder(BorderFactory.createLineBorder(Color.BLACK));\r\n\t\thard.setBorder(BorderFactory.createLineBorder(Color.BLACK));\r\n\t\t\t\t\r\n\t\tintermediate.setBackground(Color.GRAY);\r\n\t\thard.setBackground(Color.GRAY);\r\n\r\n\t\trightSection.add(easy);\r\n\t\trightSection.add(Box.createHorizontalStrut(100));\r\n\t\trightSection.add(intermediate);\r\n\t\trightSection.add(Box.createHorizontalStrut(100));\r\n\t\trightSection.add(hard);\r\n\t\trightSection.add(Box.createHorizontalStrut(100));\t\r\n\r\n\t\tframe.add(leftSection);\r\n\t\tframe.add(middleSection);\r\n\t\tframe.add(rightSection);\r\n\r\n\t\tframe.setVisible(true);\r\n\r\n\t}", "public void display_game_over_text () {\n\n fill(150, 100);\n rect(0, 0, displayW, displayH);\n\n textFont(myFont);\n textAlign(CENTER);\n textSize(displayH/20);\n fill(255);\n text(\"Game Over\", displayW/2, 3*displayH/7);\n\n if (score.winnerName == \"Pacmax\") {\n text(\"Winner is Pacmax! Your score is \" + score.score, displayW/2, 4*displayH/7);\n } else {\n text(\"Winner is Blinky!\", displayW/2, 4*displayH/7);\n }\n\n mySound.play_game_over_song();\n\n isKeyInputAllowed = false;\n }", "public void switchToHighScoresScreen() {\n \tCardLayout currLayout = (CardLayout) screens.getLayout();\n \tcurrLayout.show(screens, \"highscores\");\n }", "public void paintComponent(Graphics page)//MAIN METHOD FOR ADDING ALL GRAPHICS TO THE FRAME\n\t\t{\n\t\tsuper.paintComponent(page);//passing the graphics object to the constructor of super(mother) class\n\t\t\n\t\t\tpage.drawImage(background, 0, 0, WIDTH, HEIGHT, this); //Places the background image on the background\n\t \n\t \n\t page.drawImage(flappy, bird.x, bird.y, bird.width, bird.height, this); //Places the flappy image on the character\n\t \n\t page.drawImage(foreground, 0, HEIGHT-100, WIDTH, 200, this);\n\t \n\t for(Rectangle box : obstacles)\n\t {\n\t \tpaintbox(page, box);\n\t }\n\t \n\t page.setColor(Color.black); //Sets the font to orange\n\t \n\t page.setFont(new Font(\"Monospaced\", 3, 60));\n\t if(!start)\n\t {\n\t \tpage.drawString(\"ENTER SPACE\", 250, HEIGHT/4);\n\t \tpage.drawString(\"OR\", 450, HEIGHT/2-100);\n\t \tpage.drawString(\"Press to Play\", 200, HEIGHT/2 -50);\n\t }\n\t \n\t page.setFont(new Font(\"Helvitica\", 4, 100));\n\t if(gameOver)\n\t {\n\t \tpage.drawString(\"GAME OVER!\", 100, HEIGHT/2 - 50); //Displays \"GAME OVER!\"\n\t \t\n\t \tpage.setFont(new Font(\"Arial\",1,30));\n\t \tpage.drawString(\"HIT SPACE TO BEGIN AGAIN\", 170, HEIGHT/2+50);\n\t \t\n\t }\n\t page.setFont(new Font(\"Arial\", 1, 30));//SETS FONT AND SIZE FOR CURRENT SCORE\n\t if(!gameOver && start)\n\t {\n\t \tpage.setColor(Color.BLACK); //Font color for score\n\t \tpage.drawString(\"Your Score: \"+score, 100, HEIGHT/15); //Displays the score in the game\n\t }\n\t page.setFont(new Font(\"Arial\", 1, 30));\n\t if(gameOver || (!gameOver && start))\n\t {\n\t \tpage.setColor(Color.orange); //Sets the font to back to orange for the high score \n\t \tpage.drawString(\"HighScore: \", 550, HEIGHT/15); //Displays the \"HighScore: \"\n\t \t \t\t\t\n\t \tpage.drawString(String.valueOf(highScore), 725, HEIGHT/15); //Displays the number for high score\n\t }\n\t \n\t \n\t\t}", "private void drawStuff() {\n //Toolkit.getDefaultToolkit().sync();\n g = bf.getDrawGraphics();\n bf.show();\n Image background = window.getBackg();\n try {\n g.drawImage(background, 4, 24, this);\n\n for(i=12; i<264; i++) {\n cellKind = matrix[i];\n\n if(cellKind > 0)\n g.drawImage(tile[cellKind], (i%12)*23-3, (i/12)*23+17, this);\n }\n\n drawPiece(piece);\n drawNextPiece(pieceKind2);\n\n g.setColor(Color.WHITE);\n g.drawString(\"\" + (level+1), 303, 259);\n g.drawString(\"\" + score, 303, 339);\n g.drawString(\"\" + lines, 303, 429);\n\n } finally {bf.show(); g.dispose();}\n }", "public void displayDBScores(){\n\t\tCursor c = db.getScores();\n\t\tif(c!=null) {\n\t\t\tc.moveToFirst();\n\t\t\twhile(!c.isAfterLast()){\n\t\t\t\tdisplayScore(c.getString(0),c.getInt(1));\n\t\t\t\tc.moveToNext();\n\t\t\t}\n\t\t\tc.close();\n\t\t}\n\t}", "public void display() {\r\n\t\tJFrame myFrame = new JFrame(\"BlackJack\");\r\n\t\tmyFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tmyFrame.setContentPane(this);\r\n\t\tmyFrame.setPreferredSize(new Dimension(700, 550));\r\n\t\tmyFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);\r\n\t\t// Display the window.\r\n\t\tmyFrame.pack();\r\n\t\tmyFrame.setVisible(true);\r\n\t\t//game = new Blackjack();\r\n\t}", "void displayScores(int pts)\n\t{\n\t\tString[][] scs = new String[10][2];\n\t\ttry\n\t\t{\n\t\t\tScanner str = new Scanner(new File(\"./scores.log\"));\n\t\t\tfor (int i = 0; i < 10; i++)\n\t\t\t{\n\t\t\t\tscs[i] = str.nextLine().split(\"\\t\");\n\t\t\t}\n\t\t\tstr.close();\n\t\t}\n\t\tcatch (FileNotFoundException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tString scores = \"\";\n\t\tfor (int i = 0; i < 10; i++)\n\t\t\tscores += scs[i][0] + \"\\t\" + scs[i][1] + \"\\n\";\n\t\t\n\t\tint place = 10; // > 9; remains if the new score below the scoreboard\n\t\t\n\t\t// if new highscore\n\t\tif (pts > Integer.parseInt(scs[9][1]))\n\t\t{\n\t\t\t// determine the place\n\t\t\tplace = 9;\n\t\t\twhile (pts > Integer.parseInt(scs[place-1][1])) // place is too low\n\t\t\t{\n\t\t\t\tplace--; // move the \"pointer\" to higher place\n\t\t\t\tif (place == 0) break; // 1st place!\n\t\t\t}\n\t\t\t\n\t\t\t// insert where it should be\n\t\t\tfor (int i = 8; i >= place; i--)\n\t\t\t{\n\t\t\t\tscs[i+1][0] = new String(scs[i][0]); // drop place to lower\n\t\t\t\tscs[i+1][1] = new String(scs[i][1]);\n\t\t\t}\n\t\t\tscs[place][0] = parent.getUsername();\n\t\t\tscs[place][1] = \"\" + pts;\n\t\t}\n\t\t\n\t\t// prepare text for writing to file\n\t\tString textToWrite = \"\";\n\t\tfor (int i = 0; i < 10; i++) // for every place\n\t\t\ttextToWrite += scs[i][0] + \"\\t\" + scs[i][1] + \"\\n\";\n\t\t\n\t\t// write to scores.log\n\t\ttry\n\t\t{\n\t\t\tFileWriter str = new FileWriter(new File(\"./scores.log\"), false);\n\t\t\tstr.write(textToWrite);\n\t\t\tstr.close();\n\t\t}\n\t\tcatch (IOException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t// prepare text for displaying in the scoreboard\n\t\tString textDisplayed = \"<html><style>p{font-size:40px; font-family:\\\"Lucida Console\\\"}</style>\";\n\t\tfor (int i = 0; i < 10; i++) // for every place\n\t\t{\n\t\t\tif (i == place) textDisplayed += \"<font color=\\\"red\\\">\";\n\t\t\ttextDisplayed += \"<p>\" + scs[i][0] + \" \";\n\t\t\t// add dots to fill places up to 30\n\t\t\tfor (int j = 30; j > scs[i][0].length(); j--)\n\t\t\t\ttextDisplayed += \".\";\n\t\t\ttextDisplayed += \" \" + scs[i][1] + \"</p>\";\n\t\t\tif (i == place) textDisplayed += \"</font>\";\n\t\t}\n\t\t\n\t\tscoreboard.setText(textDisplayed);\n\t}", "public Scoreboard() { // constructor to initialize \n\t\tfor (int i = 1; i < 10; i++) { // adds the first 9 frames, hence the start from i = 1.\n\t\t\tframes.add(new Frame(this));\n\t\t}\n\t\tframes.add(new FinalFrame(this)); // 10th frame is added separately with its own properties. \n\t\t\n\t\tcurrent = frames.get(0); // current is the first added frame at 0th index. \n\t}", "public WarGUI()\n {\n setLayout(new GridLayout(2,1));\n \n //start a game \n warGame = new WarCW();\n \n //Top panel for game details\n topPanel = new JPanel();\n topPanel.setBackground(Color.green); //it's green.\n \n //bottom panel for gameplay\n gamePanel = new JPanel();\n \n //Top panel stuff \n sup = new JLabel(\"**** Mike's WAR game ****\");\n sup.setFont(new Font(\"ARIAL\",Font.BOLD,46));\n topPanel.add(sup);\n \n //Bottom panel stuff\n roundNum = 1;\n temp = (\" || Round number \" + roundNum + \" || \");\n rounds = new JLabel(temp);\n \n back = new ImageIcon(\"back.jpg\");\n frontP1 = new ImageIcon(); //set it when it happens.\n frontP1 = new ImageIcon(); \n joker = new ImageIcon(\"joker.jpg\");\n \n p1 = new JLabel(\"P1 ->\");\n p2 = new JLabel(\"<- P2\");\n \n picP1 = new JLabel(back); \n picP2 = new JLabel(back); \n p1Played = new JLabel(joker);\n p2Played = new JLabel(joker);\n \n //The button that makes the game go and keep going\n button = new JButton(\"NEXT\");\n button.addActionListener(new ButtonListener());\n gamePanel.add(button); \n \n gamePanel.add(p1); \n gamePanel.add(picP1);\n gamePanel.add(p1Played);\n gamePanel.add(p2Played);\n gamePanel.add(picP2);\n gamePanel.add(p2);\n gamePanel.add(rounds);\n \n //trying to display the score in poor fashion\n p1Num = (WarCW.p1.cardsRemaining() + WarCW.p1e.cardsRemaining());\n p2Num = (WarCW.p2.cardsRemaining() + WarCW.p2e.cardsRemaining());\n \n temp1 = (\"P1: \"+p1Num + \" || \");\n temp2 = (\"P2: \"+p2Num); \n \n p1 = new JLabel(temp1); //26\n p2 = new JLabel(temp2); //26 \n \n topPanel.add(p1);\n topPanel.add(p2); \n\n add(topPanel);\n add(gamePanel);\n }", "private void renderGuiScore (SpriteBatch batch) \n\t{\n\t\t//float x = -15;\n\t\t//float y = -15;\n\t\t//batch.draw(Assets.instance.goldCoin.goldCoin, x, y, 50, 50, 100,\n\t\t//\t\t100, 0.35f, -0.35f, 0);\n\t\t//Assets.instance.fonts.defaultBig.draw(batch, \"\" + worldController.score,\n\t\t//\t\tx + 75, y + 37);\n\t\t\n\t\tfloat x = -15;\n\t\tfloat y = -15;\n\t\tfloat offsetX = 50;\n\t\tfloat offsetY = 50;\n\t\tif (worldController.scoreVisual<worldController.score) \n\t\t{\n\t\t long shakeAlpha = System.currentTimeMillis() % 360;\n\t\t float shakeDist = 1.5f;\n\t\t offsetX += MathUtils.sinDeg(shakeAlpha * 2.2f) * shakeDist;\n\t\t offsetY += MathUtils.sinDeg(shakeAlpha * 2.9f) * shakeDist;\n\t\t}\n\t\tbatch.draw(Assets.instance.goldCoin.goldCoin, x, y, offsetX,\n\t\toffsetY, 100, 100, 0.35f, -0.35f, 0);\n\t\tAssets.instance.fonts.defaultBig.draw(batch, \"\" + (int)worldController.scoreVisual, x + 75, y + 37);\n\t}", "@Override\n public void doOneFrame(DrawSurface d) {\n d.setColor(new Color(229, 238, 255));\n d.fillRectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);\n d.setColor(Color.BLACK);\n if (this.win) {\n d.drawText(d.getWidth() / 5, d.getHeight() / 2, \"You Win! Your score is \" + this.score, 32);\n } else {\n d.drawText(d.getWidth() / 5, d.getHeight() / 2, \"Game Over. Your score is \" + this.score, 32);\n }\n if (this.keyboard.isPressed(KeyboardSensor.SPACE_KEY)) {\n this.runner.getGui().close();\n this.stop = true;\n }\n }", "private void showHighscore(int keynumber) {\n int highscore = getHighscore(keynumber);\n if (highscore > 0) {\n if (keynumber == 1) {\n tVHighscore.setText(Integer.toString(highscore) + getString(R.string.HighscoreFrom) + getHighscoreName(keynumber) + \"\\n\");\n } else{\n tVHighscore.append(Integer.toString(highscore) + getString(R.string.HighscoreFrom) + getHighscoreName(keynumber) + \"\\n\");\n }\n } else {\n tVHighscore.append(\"-\\n\");\n }\n }", "private void newHighScoreAlert() {\n\t\tAlert alert = new Alert(AlertType.INFORMATION);\n\t\t\n\t\talert.setTitle(\"New High Score!\");\n \talert.setHeaderText(\"You Got A New High Score!\\nYour High Score: \" + level.animal.getPoints());\n \talert.setContentText(\"Enter Your Name With Alphabet Or Digit Keys.\\nPress 'Enter' To Confirm Your Name Afterwards.\");\n \talert.show();\n\t}", "public HighScoresPanel(BufferedImage background, ScreenController sc) {\r\n\t\tsuper(background, sc);\r\n\t\t\r\n\t\ttry \r\n\t\t{\r\n\t\t\ttitle = new Widget(\"- Highscores -\", ImageIO.read(new File(FileManager.ImageUtils.MENU_BACKGROUND_PATH)),\r\n\t\t\t\t\tFileManager.ImageUtils.MENU_BACKGROUND_PATH, (int) TITLE_LOC.getX(), (int) TITLE_LOC.getY(), true);\r\n\t\t\tnamesLabel = new Widget(\"Names\", ImageIO.read(new File(FileManager.ImageUtils.MENU_BACKGROUND_PATH)),\r\n\t\t\t\t\tFileManager.ImageUtils.MENU_BACKGROUND_PATH, (int) NAMES_LABEL_LOC.getX(), (int) NAMES_LABEL_LOC.getY(), true);\r\n\r\n\t\t\tscoresLabel = new Widget(\"Scores\", ImageIO.read(new File(FileManager.ImageUtils.MENU_BACKGROUND_PATH)),\r\n\t\t\t\t\tFileManager.ImageUtils.MENU_BACKGROUND_PATH, (int) SCORES_LABEL_LOC.getX(), (int) SCORES_LABEL_LOC.getY(), true);\r\n\t\t\t\r\n\t\t\tresetButton = new Widget(\"Reset\", ImageIO.read(new File(FileManager.ImageUtils.MENU_BACKGROUND_PATH)),\r\n\t\t\t\t\tFileManager.ImageUtils.MENU_BACKGROUND_PATH, (int) RESET_BUTTON_LOC.getX(), (int) RESET_BUTTON_LOC.getY(), true){\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic void mousePressed(MouseEvent e) {\r\n\t\t\t\t\tcontroller.playButtonSound();\r\n\t\t\t\t\tcontroller.resetHighscores();\r\n\t\t\t\t\tupdateTable();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic void paintComponent(Graphics g) {\r\n\t\t\t\t\tsuper.paintComponent(g);\r\n\t\t\t\t\t\r\n\t\t\t\t\tGraphics2D gra = (Graphics2D) g;\r\n\t\t\t\t\t\r\n\t\t\t\t\tStroke defaultStroke = gra.getStroke();\r\n\t\t\t\t\tgra.setColor(getBackground());\r\n\t\t\t\t\tgra.setStroke(new BasicStroke(7f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));\r\n\t\t\t\t\tgra.drawRect(0, 0, getWidth(), getHeight());\r\n\t\t\t\t\tgra.setStroke(defaultStroke);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t} \r\n\t\tcatch (IOException e) \r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t\tSystem.err.println(\"[ERROR]:[HighScoresPanel] Failed to load widget images.\");\r\n\t\t}\r\n\t\tsetEntries();\r\n\t\t\r\n\t\taddKeyListener(new KeyAdapter() {\r\n\t\t\t@Override\r\n\t\t\tpublic void keyPressed(KeyEvent e) {\r\n\t\t\t\tif(e.getKeyCode() == KeyEvent.VK_ESCAPE)\r\n\t\t\t\t\tcontroller.playButtonSound();\r\n\t\t\t\t\tcontroller.goBackWhenESC();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\ttitle.resizeFont(26f);\r\n\t\tnamesLabel.resizeFont(26f);\r\n\t\tscoresLabel.resizeFont(26f);\r\n\t\tresetButton.resizeFont(26f);\r\n\t\t\r\n\t\ttitle.setFontColor(Color.WHITE);\r\n\t\tnamesLabel.setFontColor(Color.WHITE);\r\n\t\tscoresLabel.setFontColor(Color.WHITE);\r\n\t\tresetButton.setFontColor(Color.WHITE);\r\n\t\t\r\n\t\tadd(title);\r\n\t\tadd(namesLabel);\r\n\t\tadd(scoresLabel);\r\n\t\tadd(resetButton);\r\n\t}", "public String getHighscore() {\n String str = \"\";\n\t int max = 10;\n \n ArrayList<Score> scores;\n scores = getScores();\n \n int i = 0;\n int x = scores.size();\n if (x > max) {\n x = max;\n } \n while (i < x) {\n \t str += (i + 1) + \".\\t \" + scores.get(i).getNaam() + \"\\t\\t \" + scores.get(i).getScore() + \"\\n\";\n i++;\n }\n if(x == 0) str = \"No scores for \"+SlidePuzzleGUI.getRows()+\"x\"+SlidePuzzleGUI.getCols()+ \" puzzle!\";\n return str;\n }", "public NewJFrame() {\n initComponents();\n \n jl=new JLabel[4][4];\n values=new int[4][4];\n rd=new Random();\n score_user=0;\n this.setTitle(\"2048\");\n this.assign_respective_labels();\n btnLeft.setFocusable(false);\n btnRight.setFocusable(false);\n btnUP.setFocusable(false);\n btnDown.setFocusable(false);\n c0=new Color(240, 240, 240);\n c2=new Color(240, 225, 235);\n c4=new Color(224, 217, 205);\n c8=new Color(173, 109, 77);\n c16=new Color(211,148,69);\n c32=new Color(142,70,90);\n c64=new Color(199,78,56);\n c128=new Color(79,153,234);\n c256=new Color(235,154,87);\n c512=new Color(247,197,43);\n c1024=new Color(247,157,43);\n c2048=new Color(239,183,101);\n score.requestFocus();\n \n for(int i=0;i<values.length;++i)\n {\n for(int j=0;j<values[i].length;++j)\n {\n //jl[i][j].setText(\"0\");\n jl[i][j].setOpaque(true);\n values[i][j]=0;\n }\n }\n \n // this.store_values_from_label();\n this.generating_new_number();\n this.show_values_into_labels();\n \n \n \n }", "public void displayhs()\n {\n FileReader filereader;\n //System.out.println(dateFormat.format(date));\n try{\n filereader = new FileReader(getLevel());\n BufferedReader bufferedreader = new BufferedReader(filereader);\n \n String str = \"High Scores\\n\";\n int hscount = 1;\n String line = bufferedreader.readLine();\n while(line!=null)\n {\n str += hscount +\". \" + line.split(\":\")[0] + \", \" + line.split(\":\")[1] + \", \" + line.split(\":\")[2] + \"\\n\";\n hscount++;\n line = bufferedreader.readLine();\n }\n //JOptionPane.showMessageDialog(null,str);\n String[] options = {\"OK\",\"Reset\"};\n \n int choice = JOptionPane.showOptionDialog(null,str,\"High Scores\",JOptionPane.YES_NO_OPTION,JOptionPane.INFORMATION_MESSAGE,null,options,options[0]);\n if(choice == 0)\n {\n //JOptionPane.showMessageDialog(null,\"Game will resume\");\n }\n else\n { //Reset was chosen\n int n = JOptionPane.showConfirmDialog(null,\"Are you sure you would like to reset all high scores?\",\"Are you sure?\",JOptionPane.YES_NO_OPTION);\n if(n == 0)\n {\n JOptionPane.showMessageDialog(null,\"Scores will reset\");\n PrintWriter writer;\n writer = new PrintWriter(new File(getLevel()));\n for(int i=0;i<5;i++)\n writer.println(\"null:0:n/a\");\n writer.close();\n }\n else\n JOptionPane.showMessageDialog(null,\"Scores will NOT reset\");\n }\n }\n catch(IOException e)\n {\n System.out.println(\"There is an error\");\n }\n }", "public void doOneFrame(DrawSurface d) {\r\n d.drawText(180, d.getHeight() / 2, \"You win! Your score is: \" + this.score, 32);\r\n }", "public void createMatchesFrame() {\n int numBigs = this.matching.bigsPreferences.size();\n JTable origMatchesTable = new JTable(numBigs + 1, 3);\n JScrollPane pane = new JScrollPane(origMatchesTable);\n pane.setPreferredSize(new Dimension(500, 700));\n JFrame matchFrame = new JFrame(\"Matches\");\n JPanel matchPanel = new JPanel();\n\n origMatchesTable.setRowHeight(30);\n origMatchesTable.setValueAt(\"Big\", 0, 0);\n origMatchesTable.setValueAt(\"Little 1\", 0, 1);\n origMatchesTable.setValueAt(\"Little 2\", 0, 2);\n origMatchesTable.getColumnModel().getColumn(0).setPreferredWidth(70);\n origMatchesTable.getColumnModel().getColumn(1).setPreferredWidth(70);\n origMatchesTable.getColumnModel().getColumn(2).setPreferredWidth(70);\n\n matchPanel.setBorder(BorderFactory.createBevelBorder(2));\n matchPanel.setLayout((new FlowLayout()));\n matchPanel.add(pane);\n matchFrame.add(matchPanel, BorderLayout.CENTER);\n matchFrame.setTitle(\"Big Little Matching\");\n matchFrame.pack();\n matchFrame.setVisible(true);\n matchFrame.setSize(700, 700);\n matchPanel.setBorder(new EmptyBorder(20, 20, 20, 20));\n\n }", "private void sketchScore() {\r\n View.sketch(score, this.getSize().width + 15, 0);\r\n }", "public void addHighScoreText(Pane root,int currentHighScore) throws FileNotFoundException{\n\t\thighScore=new Text(level.columnX(12),level.rowX(-1)+10,\"\"+currentHighScore);\n\t\thighScore.setFill(Color.WHITE);\n\t\thighScore.setFont(Font.loadFont(\"file:recources\\\\Font\\\\PressStart2P-Regular.ttf\", 20));\n\t\tif(Level.getHieght()==720)\n\t\t\thighScore.setFont(Font.loadFont(\"file:recources\\\\Font\\\\PressStart2P-Regular.ttf\", 10));\n\t\tif(GameLoop.getLevelSelector()==1)\n\t\t\thighScore.setTranslateX(40);\n\t\tif(GameLoop.getLevelSelector()==1&&Level.getHieght()==1080)\n\t\t\thighScore.setTranslateX(80);\n\t\troot.getChildren().add(highScore);\n\t}", "public HighscoreMenu(JFrame parentFrame) {\n try {\n fileManager = new FileManager(\"highscores.txt\", \"questions.txt\");\n } catch(IOException e) {\n e.printStackTrace();\n }\n setUpFrame();\n setUpHeader();\n setUpHighscoreList();\n\n JDialog frame = new JDialog(parentFrame, \"Buzz!: Highscores\", true);\n frame.getContentPane().add(rootPanel);\n frame.pack();\n frame.setLocationRelativeTo(null);\n frame.setVisible(true);\n }", "public void render(Graphics2D g){\n if(game.gameState == Game.AppState.MENU){\n Font fnt0 = new Font(\"Serif\", Font.BOLD,45);\n Font fnt1 = new Font(\"Serif\", Font.BOLD,25);\n\n g.setFont(fnt0);\n g.setColor(Color.BLACK);\n g.drawString(\"DYNA BLASTER\", 122, 100);\n\n g.setFont(fnt1);\n g.fillRect(190,200,220,54);\n g.setColor(Color.cyan);\n g.drawString(\"PLAY\", 268, 235);\n\n g.setColor(Color.BLACK);\n g.fillRect(190,300,220,54);\n g.setColor(Color.cyan);\n g.drawString(\"BEST RESULTS\", 205, 335);\n\n g.setColor(Color.BLACK);\n g.fillRect(190,400,220,54);\n g.setColor(Color.cyan);\n g.drawString(\"HELP\", 268, 435);\n\n g.setColor(Color.BLACK);\n g.fillRect(190,500,220,54);\n g.setColor(Color.cyan);\n g.drawString(\"EXIT\", 272, 535);\n }\n else if(game.gameState == Game.AppState.RESULTS){\n Font fnt0 = new Font(\"Serif\", Font.BOLD, 35);\n Font fnt1 = new Font(\"Serif\", Font.BOLD, 25);\n Font fnt2 = new Font(\"Serif\", Font.BOLD, 20);\n\n g.setFont(fnt0);\n g.setColor(Color.BLACK);\n g.drawString(\"LIST\", 255, 80);\n g.setFont(fnt2);\n g.drawString(\"Place Nick Score\", 70, 120);\n for(int i=0;i<10;i++) {\n g.drawString(i+1+\" \"+handler.scores.getScores(i), 90, 150+30*i);\n }\n g.setFont(fnt1);\n g.setColor(Color.BLACK);\n g.fillRect(190,500,220,54);\n g.setColor(Color.cyan);\n g.drawString(\"BACK\", 265, 535);\n }\n else if(game.gameState == Game.AppState.HELP){\n Font fnt0 = new Font(\"Serif\", Font.BOLD, 35);\n Font fnt1 = new Font(\"Serif\", Font.BOLD, 25);\n Font fnt2 = new Font(\"Serif\", Font.BOLD, 20);\n Font fnt3 = new Font(\"Serif\", Font.PLAIN, 16);\n\n g.setFont(fnt0);\n g.setColor(Color.BLACK);\n g.drawString(\"HELP\", 255, 100);\n String []command=helpconfig.gethelpstring();\n g.setFont(fnt2);\n g.drawString(command[0], 70, 150);\n g.setFont(fnt3);\n g.drawString(command[1], 70, 170);\n g.drawString(command[2], 70, 190);\n g.setFont(fnt2);\n g.drawString(command[3], 70, 230);\n g.setFont(fnt3);\n for(int i=4;i<helpconfig.get_length_of_commands();i++) {\n g.drawString(command[i], 70, 250+(i-4)*20);\n\n }\n g.setFont(fnt1);\n g.setColor(Color.BLACK);\n g.fillRect(190,500,220,54);\n g.setColor(Color.cyan);\n g.drawString(\"BACK\", 265, 535);\n }\n }", "@SuppressLint(\"SetTextI18n\")\r\n private void displayScore() {\r\n\r\n\r\n mFinalScore.setText(\"Final score: \" + mScore);\r\n mQuestionView.setVisibility(View.GONE);\r\n mOption1.setVisibility(View.GONE);\r\n mOption2.setVisibility(View.GONE);\r\n mOption3.setVisibility(View.GONE);\r\n mNext.setVisibility(View.GONE);\r\n mTimer.setVisibility(View.GONE);\r\n mScoreView.setVisibility(View.GONE);\r\n mTimerLabel.setVisibility(View.GONE);\r\n mBackToStart.setVisibility(View.VISIBLE);\r\n\r\n }", "public void drawOverview()\n\t{\n\t\tstackRows = (int)Math.ceil(stacks.size()/9.f);\n\t\tfor(int y = 0; y < 6; y++)\n\t\t{\n\t\t\tfor(int x = 0; x < 9; x++)\n\t\t\t{\t\t\n\t\t\t\t\tint slotIndex = x+9*y;\n\t\t\t\t\tint stackIndex = x+9*(y+scrollOffset);\n\t\t\t\t\t//System.out.println(slotIndex);\n\t\t\t\t\tSlot slot = new Slot(inventory,slotIndex, x*24, y*18);\t\t\t\t\n\t\t\t\t\tthis.addSlotToContainer(slot);\n\t\t\t\t\t\n\t\t\t\t\tif(stackIndex < stacks.size())\n\t\t\t\t\t\tslot.putStack(stacks.get(stackIndex));\n\t\t\t\t\telse\n\t\t\t\t\t\tslot.putStack(null);\n\t\t\t}\n\t\t}\n\t\t/*int i =0;\n\t\tfor(ItemStack stack : stacks)\n\t\t{\n\t\t\tthis.inventorySlots.get(i).putStack(stack);\n\t\t\t\n\t\t\ti++;\n\t\t}*/\n\t\t//this.inventoryItemStacks = stacks;\n\t}", "private void scoreDialog() {\n JPanel jp = new JPanel();\n \n Box verticalBox = Box.createVerticalBox();\n \n JLabel scoreTitle = new JLabel(\"<html><font size=13><center>Score: \" + challengeModel.getChallenge().getScore().getScorePoints() + \"</center></font></html>\");\n scoreTitle.setAlignmentX(CENTER_ALIGNMENT);\n verticalBox.add(scoreTitle);\n \n Box horizontalBox = Box.createHorizontalBox();\n String scoreResult = \"\" + challengeModel.getChallenge().getScore().getGold() + challengeModel.getChallenge().getScore().getSilver() + challengeModel.getChallenge().getScore().getBronze();\n switch(Integer.parseInt(scoreResult)) {\n case 111: // Gold, Silver, Bronze\n horizontalBox.add(new JLabel(Resources.getImageMedalGold()));\n case 11: // Silver, Bronze\n horizontalBox.add(new JLabel(Resources.getImageMedalSilver()));\n case 1: // Bronze\n horizontalBox.add(new JLabel(Resources.getImageMedalBronze()));\n break;\n default:\n break;\n }\n \n verticalBox.add(horizontalBox);\n \n jp.add(verticalBox);\n \n int value = JOptionPane.showOptionDialog(null, jp, \"Fim do desafio\", JOptionPane.NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, new String[] {\"Novo Desafio\"}, 1);\n \n hideAnswerResult(false);\n \n if (value == 0)\n challengeModel.newGame();\n }", "@Override\r\n public void drawOn(DrawSurface surface) {\r\n surface.setColor(Color.LIGHT_GRAY);\r\n String str = \"Score: \" + Integer.toString(getScore());\r\n int x = Constants.SCORE_BLOCK_X_LOCATION;\r\n int y = Constants.SCORE_BLOCK_Y_LOCATION;\r\n int width = Constants.SCORE_BLOCK_WIDTH;\r\n int height = Constants.SCORE_BLOCK_HEIGHT;\r\n surface.fillRectangle(x, y, width, height);\r\n surface.setColor(Color.BLACK);\r\n surface.drawRectangle(x, y, width, height);\r\n surface.setColor(Color.BLACK);\r\n surface.drawText(Constants.SCORE_FONT_X, Constants.SCORE_FONT_Y, str, Constants.SCORE_FONT_SIZE);\r\n }", "public static void displayHighScorePosition(String playersName, int position){\n System.out.println(playersName + \" managed to get into position \" + position + \" on the high score table\");\n }", "public HighScorePromptPanel (int location,int score, JFrame parent)\n {\n this.parent = parent;\n this.location = location;\n this.score = score;\n JButton submitButton = new JButton (\"Submit\");\n submitButton.addActionListener (this);\n add (new JLabel (\"NEW HIGHSCORE\"));\n add (new JLabel (\"Score: \" + score));\n add (new JLabel (\"Enter your name: \"));\n add (nameField);\n add (submitButton);\n setSize (300,200);\n setFocusable (true);\n setVisible (true);\n }", "private void setupPlayerScoresPanel(){\n\n // adds Player numbers and scores to String variable text\n sortPlayerScores();\n \n paragraph = new JLabel(text);\n paragraph.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));\n\n playerScoresPanel.add(paragraph);\n fullPanel.add(playerScoresPanel,BorderLayout.CENTER);\n }", "public void printScore()\n {\n if (score.isEmpty())\n System.out.println(\"\\nThe score is currently empty\");\n else\n {\n for (int i = 0; i < score.size(); i++)\n {\n System.out.format(\"%n%s%d%s %c %d\", \"Note \", i + 1, \":\", score.get(i).getNote(), score.get(i).getBeat());\n }\n System.out.println();\n }\n removeNote();\n }", "public void printScreen() {\n Graphics g;\n try {\n g = this.getGraphics();\n g.setColor(Color.red);\n if (dbImage != null) {\n g.drawImage(dbImage, 0, 0, null);\n String text = \"Score:\" + gameData.score.score;//text of displated score\n g.drawString(text, 50, 50);\n } else {\n System.out.println(\"printScreen:graphic is null\");\n }\n Toolkit.getDefaultToolkit().sync();\n g.dispose();\n } catch (Exception e) {\n System.out.println(\"Graphics error: \" + e);\n }\n }", "private void refreshScore(){\n String info = players[0] + \" \"+playerScores[0]+\":\" +playerScores[1]+ \" \"+players[1];\n scoreInfo.setText(info);\n }", "private void displayGameHeader()\n {\n System.out.println(\"########Welcome to Formula 9131 Championship########\");\n }", "private void resultsScreen(Stage stage, String[][] leaderboard) {\n\t\t\n\t\t//A HBox is prepared, with an int to determine spacing between the nodes within it later.\n\t\tHBox h = new HBox(30);\n\t\t\n\t\t//A VBox array of length 3 is prepared, as well as a Label array, with three values given\n\t\t//to it immediately. \n\t\tVBox[] v = new VBox[3];\n\t\tLabel[] title = {new Label(\"Name\"), new Label(\"Incorrect Guesses\"), new Label(\"Time\")};\n\t\t\n\t\t//A separate VBox is prepared.\n\t\tVBox v2;\n\t\t\n\t\t//For loop adding all the names from the leaderboard array into one VBox, then\n\t\t//adding all the incorrectGuesses to a second VBox, then adding all the times\n\t\t//to the third VBox. By doing it this way, names and scores are much more better\n\t\t//aligned as columns than if each player and their scores were put into HBoxes.\n\t\tfor(int i = 0; i < 3; i++) {\n\t\t\tv[i] = new VBox();\n\t\t\tv[i].getChildren().add(title[i]);\n\t\t\t\n\t\t\tfor(int j = 0; j < 3; j++) {\n\t\t\t\tLabel l = new Label(leaderboard[j][i]);\n\t\t\t\tv[i].getChildren().add(l);\n\t\t\t}\n\t\t\th.getChildren().add(v[i]);\n\t\t}\n\t\t\n\t\th.setAlignment(Pos.BASELINE_CENTER);\n\t\t\n\t\t//A label is now created and put into the second VBox, along with the HBox just created.\n\t\t//This results in the statement being placed below the entire leaderboard without issues.\n\t\tLabel endStatement = new Label(\"Press any key to start a new game or escape to exit.\");\n\t\tendStatement.setWrapText(true);\n\t\tendStatement.setPrefWidth(200);\n\t\tendStatement.setMinWidth(200);\n\t\tendStatement.setMaxWidth(200);\n\n\t\tv2 = new VBox(2,h,endStatement);\n\t\tv2.setAlignment(Pos.TOP_CENTER);\n\t\tgroup = new Group(v2);\n\t\t\n\t\tscene = new Scene(group,300,300,Color.LIGHTGREY);\n\t\tstage.setScene(scene);\n\t\tstage.setResizable(false);\n\t\tstage.setTitle(\"Hangman\");\n\t\tstage.show();\n\t\t\n\t\tscene.setOnKeyReleased(new EventHandler<KeyEvent>() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void handle(KeyEvent e) {\n\t\t\t\t\n\t\t\t\tif(e.getCode()==KeyCode.ESCAPE) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tclient.close();\n\t\t\t\t\t}catch(IOException ioe) {\n\t\t\t\t\t}\n\t\t\t\t\tstage.close();\n\t\t\t\t}else {\n\t\t\t\t\tstart(stage);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "public void updateScoreUI() {\n\t\tMap<Integer, Integer> scoreMap = gameLogic.getScoreboard().getTotalScore();\n\n\t\tlblScoreA.setText(String.valueOf(scoreMap.get(0)));\n lblScoreB.setText(String.valueOf(scoreMap.get(1)));\n lblScoreC.setText(String.valueOf(scoreMap.get(2)));\n lblScoreD.setText(String.valueOf(scoreMap.get(3)));\n\t}", "private String formatHighScore(HighScore highScore){\n return formatTime(highScore.getSeconds()) + \" \" + highScore.getName();\n }", "public void displayYelowCardB(int score) {\n TextView scoreView = (TextView) findViewById(R.id.yelowcardBtext);\n scoreView.setText(String.valueOf(score));\n }", "private void drawGameOver() {\r\n\t\tg.setColor(Color.GRAY);\r\n\t\t// creates a new font\r\n\t\tFont myFont = new Font(Font.SANS_SERIF, Font.BOLD, TetrisGame.PANEL_WIDTH * 3 / 2);\r\n\t\tg.setFont(myFont);\r\n\t\t// draws the words \"Game Over\"\r\n\t\tg.drawString(\"GAME OVER!\",\r\n\t\t\t\t TetrisGame.PANEL_WIDTH * TetrisGame.SQUARE_LENGTH / 3,\r\n\t\t\t\t TetrisGame.PANEL_HEIGHT * TetrisGame.SQUARE_LENGTH / 2);\r\n\t\t// draws the score\r\n\t\tg.drawString(game.gameOverMessage,\r\n\t\t\t\t TetrisGame.PANEL_WIDTH * TetrisGame.SQUARE_LENGTH / 3,\r\n\t\t\t\t TetrisGame.PANEL_HEIGHT * TetrisGame.SQUARE_LENGTH / 2 + 20);\r\n\t\t// draws the restart message\r\n\t\tg.drawString(\"Press R to Retry\",\r\n\t\t\t\t TetrisGame.PANEL_WIDTH * TetrisGame.SQUARE_LENGTH / 3,\r\n\t\t\t\t TetrisGame.PANEL_HEIGHT * TetrisGame.SQUARE_LENGTH / 2 + 40);\r\n\t}", "public static void display(String[] names, int[] scores) {\n Stage display = new Stage();\n display.initModality(Modality.APPLICATION_MODAL);\n display.setTitle(\"TOP SCORES\");\n display.setMinWidth(250);\n display.setResizable(false);\n\n\n // Initialize GridPane layout \n GridPane grid = new GridPane();\n grid.setHgap(50);\n grid.setVgap(10);\n\n // Set Labels\n //Arrange labels on grid\n // First row\n Label First = new Label();\n First.setText(\"1.\");\n GridPane.setConstraints(First, 0, 0);\n Label FirstName = new Label();\n FirstName.setText(names[0]);\n GridPane.setConstraints(FirstName, 1, 0);\n Label First_lblScore = new Label();\n First_lblScore.setText(\"\" + scores[0]);\n GridPane.setConstraints(First_lblScore, 2, 0);\n // Second row\n Label Second = new Label();\n Second.setText(\"2.\");\n GridPane.setConstraints(Second, 0, 1);\n Label Second_lblName = new Label();\n Second_lblName.setText(names[1]);\n GridPane.setConstraints(Second_lblName, 1, 1);\n Label Second_lblScore = new Label();\n Second_lblScore.setText(\"\" + scores[1]);\n GridPane.setConstraints(Second_lblScore, 2, 1);\n // Third row\n Label Third = new Label();\n Third.setText(\"3.\");\n GridPane.setConstraints(Third, 0, 2);\n Label Third_lblName = new Label();\n Third_lblName.setText(names[2]);\n GridPane.setConstraints(Third_lblName, 1, 2);\n Label Third_lblScore = new Label();\n Third_lblScore.setText(\"\" + scores[2]);\n GridPane.setConstraints(Third_lblScore, 2, 2);\n // Fourth row\n Label Fourth = new Label();\n Fourth.setText(\"4.\");\n GridPane.setConstraints(Fourth, 0, 3);\n Label Fourth_lblName = new Label();\n Fourth_lblName.setText(names[3]);\n GridPane.setConstraints(Fourth_lblName, 1, 3);\n Label Fourth_lblScore = new Label();\n Fourth_lblScore.setText(\"\" + scores[3]);\n GridPane.setConstraints(Fourth_lblScore, 2, 3);\n // Fifth row\n Label Fifth = new Label();\n Fifth.setText(\"5.\");\n GridPane.setConstraints(Fifth, 0, 4);\n Label Fifth_lblName = new Label();\n Fifth_lblName.setText(names[4]);\n GridPane.setConstraints(Fifth_lblName, 1, 4);\n Label Fifth_lblScore = new Label();\n Fifth_lblScore.setText(\"\" + scores[4]);\n GridPane.setConstraints(Fifth_lblScore, 2, 4);\n\n // Add the elements to the GridPane\n grid.getChildren().addAll(Fifth,Fifth_lblName,Fifth_lblScore,Fourth,Fourth_lblName,Fourth_lblScore,\n Third,Third_lblName,Third_lblScore,First,FirstName,First_lblScore,Second,Second_lblName,Second_lblScore);\n grid.setAlignment(Pos.CENTER);\n Button btClose = new Button(\"Close\");\n // Communicate status with the Main class\n btClose.setOnAction(e -> {\n display.close();\n\n });\n\n // Combine the GridPane and a Close button in a VBox layout\n VBox layout = new VBox(35);\n layout.getChildren().addAll(grid, btClose);\n layout.setAlignment(Pos.CENTER);\n layout.setPadding(new Insets(30, 20, 40, 20));\n\n Scene scene = new Scene(layout);\n display.setScene(scene);\n display.show();\n }", "public String getHighscores(){\r\n\t\tString returnString = \"\";\r\n\t\tList<Score> allScores = database.getAllScores(\"hard\");\r\n\t\t\r\n\t\t//loop through top 4 entries of table as obtained in the allScores list\r\n\t\tfor(int i = allScores.size()-1, j = 3; i>=0 && j>=0; j--, i--){\r\n\t\t\treturnString += String.valueOf(allScores.get(i).score + \" | \" + allScores.get(i).time + \"\\n\");\r\n\t\t}\r\n\t\treturn returnString;\r\n\t}", "private void renderGuiScore(SpriteBatch batch)\n {\n float x = -15;\n float y = -15;\n float offsetX = 50;\n float offsetY = 50;\n \n /*\n if(worldController.scoreVisual < worldController.score)\n {\n long shakeAlpha = System.currentTimeMillis() % 360;\n float shakeDist = 1.5f;\n offsetX += MathUtils.sinDeg(shakeAlpha * 2.2f) * shakeDist;\n offsetY += MathUtils.sinDeg(shakeAlpha * 2.9f) * shakeDist;\n }*/\n \n batch.draw(Assets.instance.candy.candycorn, x, y, 50, 50, 100, 100, 0.35f, -0.35f, 0);\n Assets.instance.fonts.defaultBig.draw(batch, \"\" + worldController.score, x + 75, y + 37);\n }", "public void drawScore(Graphics art)\n\t{\n\t\tart.setColor(Color.black);\n\t\tart.drawString(\"Score =\"+score, 50, 50);\n\t\tif(score >= 20)\n\t\t{\n\t\t\tplayGame = false;\n\t\t}\n\t}", "private void draw(){\n\t\t\t Point level = new Point(txtBoard_top_left.x, txtBoard_top_left.y);\n\t\t\t level_info = new TextInfo(g, level, txt_width, size*4, LEVEL, this.level);\n\t\t\t level_info.drawTextInfo();\n\t\t\t \n\t\t\t // draw 2nd text info\n\t\t\t Point lines = new Point(level.x, level.y+size*2);\n\t\t\t lines_info = new TextInfo(g, lines, txt_width, size*4, LINES, this.lines);\n\t\t\t lines_info.drawTextInfo();\n\t\t\t \n\t\t\t // draw 3rd text info\n\t\t\t Point score = new Point(lines.x, lines.y+size*2);\n\t\t\t score_info = new TextInfo(g, score, txt_width, size*4, SCORE, this.score);\n\t\t\t score_info.drawTextInfo();\t\t\n\t\t}", "public void addHIGH_SCOREText(Pane root) throws FileNotFoundException {\n\t\thighScoreT=new Text(level.columnX(9),level.rowX(-2)+10,\"HIGH SCORE\");\n\t\tif(Level.getHieght()==720) \n\t\t\thighScoreT=new Text(level.columnX(10)-5,level.rowX(-2)+10,\"HIGH SCORE\");\n\t\thighScoreT.setFill(Color.WHITE);\n\t\thighScoreT.setFont(Font.loadFont(\"file:recources\\\\Font\\\\PressStart2P-Regular.ttf\", 20));\n\t\tif(Level.getHieght()==720) \n\t\t\thighScoreT.setFont(Font.loadFont(\"file:recources\\\\Font\\\\PressStart2P-Regular.ttf\", 10));\n\t\tif(GameLoop.getLevelSelector()==1)\n\t\t\thighScoreT.setTranslateX(40);\n\t\tif(GameLoop.getLevelSelector()==1&&Level.getHieght()==1080)\n\t\t\thighScoreT.setTranslateX(80);\n\t\troot.getChildren().add(highScoreT);\n\t}", "public void makeScoringOptions() {\n ScoringOptionsGUI scoringOptionsGUI = new ScoringOptionsGUI(player);\n scoringOptionsGUI.setTitle(\"Yahtzee!\");\n scoringOptionsGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n scoringOptionsGUI.setSize(new Dimension(900, 750));\n scoringOptionsGUI.setVisible(true);\n dispose();\n }", "private void setUpLastPanel() {\n // add one more panel to display the game details.\n final JPanel toAddLabels = new JPanel();\n toAddLabels.setLayout(new GridLayout(NUM_ROWS_PANEL_BOTTOM, 1));\n // Add a JLabel which will show number of lines get cleared.\n myLineCleared = new JLabel();\n myLineCleared.setText(\"CLEARED LINES : \" + Integer.toString(this.myClearedLines));\n myLineCleared.setForeground(Color.GRAY);\n myLineCleared.setFont(new Font(FONT_TIMES, Font.BOLD, SCORE_FONT_SIZE));\n myLineCleared.setBackground(null);\n myLineCleared.setHorizontalAlignment(JLabel.CENTER);\n toAddLabels.add(this.myLineCleared);\n // Add JLabel which will show game score and.\n myScoreLabel = new JLabel();\n myScoreLabel.setText(\"CURRENT SCORE : \" + Integer.toString(this.myCurrentScoreInt));\n myScoreLabel.setForeground(Color.MAGENTA);\n myScoreLabel.setFont(new Font(FONT_TIMES, Font.BOLD, SCORE_FONT_SIZE));\n myScoreLabel.setBackground(null);\n myScoreLabel.setHorizontalAlignment(JLabel.CENTER);\n toAddLabels.add(this.myScoreLabel);\n myHighScoreLabel = new JLabel();\n myHighScoreLabel.setText(\"HIGH SCORE : \" + Integer.toString(this.myHighScoreInt));\n myHighScoreLabel.setForeground(Color.MAGENTA);\n myHighScoreLabel.setFont(new Font(FONT_TIMES, Font.BOLD, SCORE_FONT_SIZE));\n myHighScoreLabel.setBackground(null);\n myHighScoreLabel.setHorizontalAlignment(JLabel.CENTER);\n toAddLabels.add(this.myHighScoreLabel);\n // Add a JLabel which will show the current level.\n myCurrentLevel = new JLabel();\n myCurrentLevel.setText(\"\");\n myLevelBalance = 0;\n myCurrentLevel.setForeground(Color.MAGENTA);\n myCurrentLevel.setFont(new Font(FONT_TIMES, Font.BOLD, SCORE_FONT_SIZE));\n myCurrentLevel.setBackground(null);\n myCurrentLevel.setHorizontalAlignment(JLabel.CENTER);\n toAddLabels.add(this.myCurrentLevel);\n // Add a JLabel which shows when next level would be reached.\n myNextLevelDistance = new JLabel();\n myNextLevelDistance.setText(Integer.toString(this.myLinesToGo));\n myNextLevelDistance.setForeground(Color.MAGENTA);\n myNextLevelDistance.setFont(new Font(FONT_TIMES, Font.BOLD, SCORE_FONT_SIZE));\n myNextLevelDistance.setBackground(null);\n myNextLevelDistance.setHorizontalAlignment(JLabel.CENTER);\n toAddLabels.add(this.myNextLevelDistance);\n // Add a JLabel which will show some status.\n this.myStatusString = new JLabel(\"PLAY\");\n this.myStatusString.setForeground(Color.GREEN);\n this.myStatusString.setFont(new Font(FONT_TIMES, Font.BOLD, NUM_FONT_SIZE));\n this.myStatusString.setBackground(null);\n this.myStatusString.setHorizontalAlignment(JLabel.CENTER);\n toAddLabels.add(this.myStatusString); \n this.add(toAddLabels);\n }", "private void renderScore() {\r\n FileDialog fd = new FileDialog(this, \"Save as an audio file...\", FileDialog.SAVE);\r\n fd.setFile(\"FileName.au\");\r\n fd.show();\r\n //write a MIDI file to disk\r\n if ( fd.getFile() != null) {\r\n this.audioFileName = fd.getDirectory() + fd.getFile();\r\n Write.au(score, audioFileName, insts);\r\n \r\n }\r\n audioViewBtn.setEnabled(true);\r\n audioPlayBtn.setEnabled(true);\r\n }", "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 }", "public void showScore(int points) {\n sb.replace(0, sb.length() - 1, \"Score: \" + points);\n score.setText(sb.toString());\n }", "public void updateHighScoreText(int pacScore,int currentHighScore) {\n\t\tif(pacScore>currentHighScore)\n\t\t\thighScore.setText(\"\"+pacScore);\n\t}", "public void drawGame() {\n\t\tif (first) {\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tint place = r.nextInt(4);\n\t\t\t\twhile (heightUsed[place] == true) {\n\t\t\t\t\tplace = r.nextInt(4);\n\t\t\t\t}\n\t\t\t\tif (i == 0) {\n\t\t\t\t\ta1.setBounds(heights[place], 265, 150, 60);\n\t\t\t\t\tstage.addActor(a1);\n\t\t\t\t\theightUsed[place] = true;\n\t\t\t\t} else if (i == 1) {\n\t\t\t\t\ta2.setBounds(heights[place], 265, 150, 60);\n\t\t\t\t\tstage.addActor(a2);\n\t\t\t\t\theightUsed[place] = true;\n\t\t\t\t} else if (i == 2) {\n\t\t\t\t\ta3.setBounds(heights[place], 265, 150, 60);\n\t\t\t\t\tstage.addActor(a3);\n\t\t\t\t\theightUsed[place] = true;\n\t\t\t\t} else if (i == 3) {\n\t\t\t\t\ta4.setBounds(heights[place], 265, 150, 60);\n\t\t\t\t\tstage.addActor(a4);\n\t\t\t\t\theightUsed[place] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (mini == GameState.questions) {\n\t\t\tbasketball.render();\n\t\t\tbatch.begin();\n\t\t\tif (Qclicks == 0) {\n\t\t\t\tfor (int i = 0; i < text.size(); i++) {\n\t\t\t\t\tif (i == 0) {\n\t\t\t\t\t\tquestionfont.draw(batch, \"1: \" + text.get(i), 50,\n\t\t\t\t\t\t\t\t450 - 50 * i);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tquestionfont.draw(batch, text.get(i), 50, 450 - 50 * i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ta1.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(0));\n\t\t\t\ta2.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(1));\n\t\t\t\ta3.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(2));\n\t\t\t\ta4.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(3));\n\t\t\t}\n\t\t\tif (Qclicks == 1) {\n\t\t\t\tfor (int i = 0; i < text.size(); i++) {\n\t\t\t\t\tif (i == 0) {\n\t\t\t\t\t\tquestionfont.draw(batch, \"2: \" + text.get(i), 50,\n\t\t\t\t\t\t\t\t450 - 50 * i);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tquestionfont.draw(batch, text.get(i), 50, 450 - 50 * i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ta1.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(0));\n\t\t\t\ta2.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(1));\n\t\t\t\ta3.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(2));\n\t\t\t\ta4.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(3));\n\t\t\t}\n\t\t\tif (Qclicks == 2) {\n\t\t\t\tfor (int i = 0; i < text.size(); i++) {\n\t\t\t\t\tif (i == 0) {\n\t\t\t\t\t\tquestionfont.draw(batch, \"3: \" + text.get(i), 50,\n\t\t\t\t\t\t\t\t450 - 50 * i);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tquestionfont.draw(batch, text.get(i), 50, 450 - 50 * i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ta1.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(0));\n\t\t\t\ta2.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(1));\n\t\t\t\ta3.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(2));\n\t\t\t\ta4.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(3));\n\t\t\t}\n\t\t\tif (Qclicks == 3) {\n\t\t\t\tfor (int i = 0; i < text.size(); i++) {\n\t\t\t\t\tif (i == 0) {\n\t\t\t\t\t\tquestionfont.draw(batch, \"4: \" + text.get(i), 50,\n\t\t\t\t\t\t\t\t450 - 50 * i);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tquestionfont.draw(batch, text.get(i), 50, 450 - 50 * i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ta1.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(0));\n\t\t\t\ta2.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(1));\n\t\t\t\ta3.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(2));\n\t\t\t\ta4.setText(answersForQuestions.get(\n\t\t\t\t\t\tquestionsOrdered.get(Qclicks)).get(3));\n\t\t\t}\n\t\t\tfont.setColor(Color.BLACK);\n\t\t\tfont.draw(batch, \"(Click answers below)\",\n\t\t\t\t\t(Gdx.graphics.getWidth() / 2) - 80, 350);\n\t\t\tfont.draw(batch, score + \" out of \" + Qclicks, 50, 100);\n\t\t\tfont.setColor(Color.WHITE);\n\t\t\tbatch.end();\n\t\t\tstage.draw();\n\t\t}\n\n\t\tif (mini == GameState.start) {\n\t\t\tbatch.begin();\n\t\t\tfont.draw(batch, \"(click here to continue)\", Gdx.graphics.getWidth() / 2 - 75, 150);\n\t\t\tfont.draw(batch, InteractWithFiles.readMiniGameScreen(0),\n\t\t\t\t\tGdx.graphics.getWidth() / 2 - 75,\n\t\t\t\t\tGdx.graphics.getHeight() / 2 + 50);\n\t\t\tfont.draw(batch, InteractWithFiles.readMiniGameScreen(1),\n\t\t\t\t\tGdx.graphics.getWidth() / 2 - 200,\n\t\t\t\t\tGdx.graphics.getHeight() / 2 + 25);\n\t\t\tfont.draw(batch, InteractWithFiles.readMiniGameScreen(2),\n\t\t\t\t\tGdx.graphics.getWidth() / 2 - 150,\n\t\t\t\t\tGdx.graphics.getHeight() / 2);\n\t\t\tbatch.end();\n\t\t}\n\t\tif (mini == GameState.score) {\n\n\t\t\tbatch.begin();\n\t\t\tfont.draw(batch, \"(click to continue)\", 200, 150);\n\t\t\tif (score >= 3) {\n\t\t\t\tfont.draw(batch, \"You passed!\",\n\t\t\t\t\t\tGdx.graphics.getWidth() / 2 - 125,\n\t\t\t\t\t\tGdx.graphics.getHeight() / 2 + 50);\n\t\t\t\tfont.draw(batch, score + \" out of 4\",\n\t\t\t\t\t\tGdx.graphics.getWidth() / 2 - 125,\n\t\t\t\t\t\tGdx.graphics.getHeight() / 2 - 5);\n\t\t\t\tsuccess = true;\n\t\t\t} else {\n\t\t\t\tfont.draw(batch, \"You Failed...\",\n\t\t\t\t\t\tGdx.graphics.getWidth() / 2 - 125,\n\t\t\t\t\t\tGdx.graphics.getHeight() / 2 + 50);\n\t\t\t\tfont.draw(batch, score + \" out of 4\",\n\t\t\t\t\t\tGdx.graphics.getWidth() / 2 - 125,\n\t\t\t\t\t\tGdx.graphics.getHeight() / 2 - 5);\n\t\t\t}\n\t\t\tbatch.end();\n\t\t}\n\t\tif (mini == GameState.review) {\n\t\t\tif (!first) {\n\t\t\t\tbatch.begin();\n\t\t\t\tfont.draw(batch, \"Review Section\", 200, 350);\n\t\t\t\tfont.draw(batch, \"(click to continue)\", 200, 150);\n\t\t\t\tArrayList<String> text = InteractWithFiles\n\t\t\t\t\t\t.drawQuestionsDifferentLines(\n\t\t\t\t\t\t\t\tneedToReview.get(reviewNum), 50);\n\t\t\t\tfor (int i = 0; i < text.size(); i++) {\n\t\t\t\t\tfont.draw(batch, text.get(i), 50, 300 - 50 * i);\n\t\t\t\t}\n\n\t\t\t\tbatch.end();\n\t\t\t}\n\t\t}\n\t\tfirst = false;\n\t}", "private void favouriteChampion() {\r\n JFrame recordWindow = new JFrame(\"Favourite a champion\");\r\n// recordWindow.setLocationRelativeTo(null);\r\n// recordWindow.getContentPane().setLayout(new BoxLayout(recordWindow.getContentPane(), BoxLayout.Y_AXIS));\r\n initiateFavouriteChampionFields(recordWindow);\r\n new Frame(recordWindow);\r\n// recordWindow.pack();\r\n// recordWindow.setVisible(true);\r\n }", "public static void main(String[] args) {\n\t\t\n\t\tfinal int WIDTH = 600 ; //Width of window\n\t\tfinal int HEIGHT = 500 ; //Height of window\n\t\tJFrame frame = new JFrame(\"Game Viewer\") ; //Opening JFRAME\n\t\t//Pop-up which explains the instructions of the game. \n\t\tJOptionPane.showMessageDialog(null, \"The red tokens are the game tokens. \\n\"\n\t\t\t\t+ \"The blue game token is the user-token. \\n\"\n\t\t\t\t+ \"The user clicks the left mouse button to change the user-token’s position. \\n\"\n\t\t\t\t+ \"The user clicks the right mouse button to cycle through the user-token’s pattern (4 token patterns) displayed inside the token’s bounding rectangle. \\n\"\n\t\t\t\t+ \"The user chooses a pattern (using the right mouse button) and then clicks the left mouse button to set the user-token overtop one of the game tokens. \\n\"\n\t\t\t\t+ \"If the pattern types match, the user’s score is incremented and the game token’s color is set to green. \\n\"\n\t\t\t\t+ \"In this example, some of the game tokens show their pattern for a random number of seconds at the beginning of the game and then show only their bounding rectangle. \\n\"\n\t\t\t\t+ \"Some of the game tokens randomly turn their pattern off and then back on for a short amount of time. (One in 1/1000th chance every 10 miliseconds.) \\n\"\n\t\t\t\t+ \"The game begins (the blue user-token appears in the upper left) after 3 seconds. \\n\"\n\t\t\t\t+ \"Thus, the user has 3 seconds to memorize the game token patterns. \\n\"\n\t\t\t\t+ \"The score is decremented if the user unsuccessfully attempts to match a game token more than 2 times. \\n\"\n\t\t\t\t+ \"In the figure above, the user has successfully matched 2 game tokens (colored green). \\n\"\n\t\t\t\t+ \"All tokens not yet matched are colored red. When the user has successfully matched all tokens, the game is over. \\n\"\n\t\t\t\t+ \"The number of elapsed seconds and the score are shown in the upper left of the figure.\"\n\t\t\t\t, \"Instructions\", JOptionPane.OK_OPTION);\n\t\tGameComponent component = new GameComponent();// Creates a GameComponent\n\t\t//Adding the component to frame, setting size of frame, setting the DefaultCloseOperation and setting to visible\n\t\tframe.add(component);\n\t\tframe.setSize(WIDTH, HEIGHT) ;\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) ;\n\t\tframe.setVisible(true) ;\n\n\t}", "public static void displayHighScorePosition(String name, int position){\n System.out.println(name + \" managed to get into position \" + position + \" on the high score table\");\n }", "private void gameOver(Graphics g){\n g.setColor(Color.WHITE);\n g.setFont(new Font(\"arial\", Font.BOLD, 50));\n g.drawString(\"Game Over\", 300, 300);\n\n g.setFont(new Font(\"arial\", Font.BOLD, 20));\n g.drawString(\"Space to RESTART\", 340, 340);\n\n g.setColor(Color.WHITE);\n g.setFont( new Font(\"arial\", Font.PLAIN, 20));\n g.drawString(\"Score: \" +score, 390,380);\n }", "private void showGameScore() {\n System.out.println(messageProvider.provideMessage(\"score\"));\n System.out.println(settings.getPlayers().get(0).getScore()\n + \" vs \" + settings.getPlayers().get(1).getScore());\n }", "private void setScore(Stack a) {\n\n //clears the current high score\n items.clear();\n\n //adds the high score from stack\n for (Node i = a.top; i != null; i = i.next) {\n\n items.add(i.name + \" \" + i.score);\n\n }\n\n //displays the new high scores again\n List = new JList(items.toArray());\n ScrollView.setViewportView(List);\n\n }", "public void displayYcardForLpool(int score) {\n TextView scoreView = (TextView) findViewById(R.id.yellow_card_count_lvp);\n scoreView.setText(String.valueOf(score));\n }", "public GameOverScreen(final PApplet display) {\n\t\tsuper(display);\n\n\t\tviews.add(new Background(display));\n\t\tviews.add(new Text(display, \"Game Over\\n\" + \"¯\\\\_(X.x)_/¯\\n\" + \"Press ENTER to restart ♪♫♪\", true));\n\t}", "public void gameOver() \n {\n ScoreBoard endGame = new ScoreBoard(\"You Lose!\", scoreCounter.getValue());\n addObject(endGame, getWidth()/2, getHeight()/2);\n }", "public void setup(Pane root,int currentHighScore) {\n\t\taddLifes(root);\n\t\ttry {\n\t\t\taddReadyText(root);\n\t\t\taddScoreText(root);\n\t\t\taddGameOverText(root);\n\t\t\tadd1UpText(root);\n\t\t\taddHIGH_SCOREText(root);\n\t\t\taddHighScoreText(root,currentHighScore);\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.err.println(\"Eine Datei wurde nicht gefunden.\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\taddBlackScreen(root);\n\t}", "public void showStory() {\r\n\t\tGameEngine.getInstance().getCommandProcessor().clearScreen();\r\n\t\tprintln(\"\");\r\n\t\tprintln(RenderUtil.getWelcomeMessage());\r\n\t\ttry {\r\n\t\t\tfor (String outputString : GamePlayUtil.GAME_STORY) {\r\n\t\t\t\tThread.sleep(1000);\r\n\t\t\t\tRenderUtil.println(\"\\t\" + outputString);\r\n\t\t\t}\r\n\t\t\tThread.sleep(2000);\r\n\t\t} catch (Exception e) {\r\n\t\t\tprintln(\"Problem Occured...\");\r\n\t\t}\r\n\t}", "private void gameOverDisplay(Graphics g) {\r\n Font small = new Font(\"Helvetica\", Font.BOLD, 20);\r\n FontMetrics metric = getFontMetrics(small);\r\n g.setColor(Color.blue);\r\n g.setFont(small);\r\n if(winner == null) g.drawString(\"DRAW!\", (size - metric.stringWidth(\"DRAW!\")) / 2, size / 2);\r\n else g.drawString(winner.getPlayerName()+\" WIN!\", (size - metric.stringWidth(winner.getPlayerName()+\" WIN!\")) / 2, size / 2);\r\n }", "public void vytvorPanelScore() {\n this.warnPlayLabel = new JLabel(\" \");\n this.warnPlayLabel.setBackground(Color.WHITE);\n this.warnPlayLabel.setFont(this.scorePismo);\n this.warnPlayLabel.setText(\"Stlac tab a hraj :) \");\n \n this.menuButton = new JButton(\"Menu\");\n this.menuButton.setBackground(Color.lightGray);\n this.menuButton.addActionListener(new BackPosluchac());\n \n this.scoreStitok = new JLabel(\" \");\n this.scorePanel = new JPanel();\n this.scorePanel.add(this.warnPlayLabel);\n this.scorePanel.add(this.menuButton);\n this.scorePanel.setPreferredSize(new Dimension(900, 30));\n this.scorePanel.setBackground(Color.WHITE);\n this.scoreStitok.setFont(this.scorePismo);\n this.scoreStitok.setText(\"Score \" + 0);\n this.scoreStitok.setForeground(Color.red);\n this.scorePanel.add(this.scoreStitok);\n \n \n \n\n }", "public abstract Scoreboard renderSidebar(Player player);", "private void updateHighscore() {\n if(getScore() > highscore)\n highscore = getScore();\n }", "public HighScoresDialog(Frame owner, boolean modal) {\n super(owner, modal);\n JLabel easyLabel = new JLabel(\"Easy:\", SwingConstants.TRAILING);\n JLabel mediumLabel = new JLabel(\"Medium:\", SwingConstants.TRAILING);\n JLabel hardLabel = new JLabel(\"Hard\", SwingConstants.TRAILING);\n easyData = new JLabel(formatHighScore(getPrefs().getEasyHighScore()));\n mediumData = new JLabel(formatHighScore(getPrefs().getMediumHighScore()));\n hardData = new JLabel(formatHighScore(getPrefs().getHardHighScore()));\n\n JPanel mainPanel = new JPanel(new SpringLayout());\n mainPanel.add(easyLabel);\n mainPanel.add(easyData);\n mainPanel.add(mediumLabel);\n mainPanel.add(mediumData);\n mainPanel.add(hardLabel);\n mainPanel.add(hardData);\n\n SpringUtilities.makeCompactGrid(mainPanel, 3, 2, 5, 5, 5, 5);\n\n resetButton = new JButton(\"Reset\");\n resetButton.addActionListener(this);\n\n getContentPane().setLayout(new BorderLayout());\n getContentPane().add(mainPanel, BorderLayout.CENTER);\n getContentPane().add(resetButton, BorderLayout.PAGE_END);\n\n setResizable(false);\n setTitle(\"Records\");\n pack();\n setLocationRelativeTo(owner);\n setVisible(true);\n }", "public void displayRoundScore() {\n\n System.out.println(\"Round stats: \");\n System.out.println(\"Par: \" + parTotal);\n System.out.println(\"Strokes: \" + strokesTotal);\n\n if(strokesTotal > parTotal) {\n System.out.println(strokesTotal-parTotal + \" over par\\n\");\n } \n else if (strokesTotal < parTotal) {\n System.out.println(parTotal-strokesTotal + \" under par\\n\");\n }\n else {\n System.out.println(\"Making par\\n\");\n }\n }", "public void saveScores(){\n try {\n File f = new File(filePath, highScores);\n FileWriter output = new FileWriter(f);\n BufferedWriter writer = new BufferedWriter(output);\n\n writer.write(topScores.get(0) + \"-\" + topScores.get(1) + \"-\" + topScores.get(2) + \"-\" + topScores.get(3) + \"-\" + topScores.get(4));\n writer.newLine();\n writer.write(topName.get(0) + \"-\" + topName.get(1) + \"-\" + topName.get(2) + \"-\" + topName.get(3) + \"-\" + topName.get(4));\n writer.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "void win() {\n String name = score.getName();\n if (Time.getSecondsPassed() < 1) {\n calculateMissionScore();\n setHighscoreName(name);\n int totalSum = score.getCurrentScore() + (10000 / 1);\n System.out.println(\"You have won the game!\" + \"\\n\" + \"You spend: \" + 1 + \" seconds playing the game!\");\n System.out.println(\"Your score is: \" + totalSum);\n System.out.println(\"your score has been added to highscore\");\n data.addHighscore(score.getName(), totalSum);\n System.out.println(\"\");\n System.out.println(\"Current highscore list is: \");\n System.out.println(data.printHighscore());\n } else {\n calculateMissionScore();\n setHighscoreName(name);\n int totalSum = score.getCurrentScore() + (10000 / Time.getSecondsPassed());\n System.out.println(\"You have won the game!\" + \"\\n\" + \"You spend: \" + Time.getSecondsPassed() + \" seconds playing the game!\");\n System.out.println(\"Your score is: \" + totalSum);\n System.out.println(\"your score has been added to highscore\");\n data.addHighscore(score.getName(), totalSum);\n System.out.println(\"\");\n System.out.println(\"Current highscore list is: \");\n System.out.println(data.printHighscore());\n }\n }", "private void scoreBoard(){\n \n //sort brackets by score \n //playerBrackets.sort((Bracket p1, Bracket p2) -> p1.scoreBracket(simResultBracket) -p2.scoreBracket(simResultBracket)); \n \n //scoreBoardButton.setDisable(true);\n displayPane(scoreBoard._start());\n //viewBracket.setDisable(false);\n }" ]
[ "0.67250216", "0.65430456", "0.6541761", "0.6475348", "0.6415613", "0.63596046", "0.63151497", "0.6311109", "0.6279658", "0.6235756", "0.6166651", "0.6157992", "0.60820574", "0.60779697", "0.60421365", "0.6028171", "0.6022303", "0.60153395", "0.60076237", "0.6006571", "0.5995983", "0.59949625", "0.5970768", "0.59251", "0.58905256", "0.58831954", "0.58766377", "0.5870532", "0.5852866", "0.5836659", "0.58309174", "0.58273727", "0.5798765", "0.5788816", "0.5781735", "0.5781218", "0.5780736", "0.57754403", "0.5767918", "0.57652044", "0.57581943", "0.57564867", "0.575296", "0.57382536", "0.5711716", "0.5706071", "0.57004756", "0.5694344", "0.5687053", "0.567359", "0.56685823", "0.5663864", "0.5661221", "0.5657871", "0.56538486", "0.5639154", "0.5623602", "0.5622815", "0.561584", "0.5598932", "0.5580058", "0.55744594", "0.55712414", "0.5568569", "0.5566154", "0.5565946", "0.55634856", "0.55596876", "0.5556291", "0.5554413", "0.55538976", "0.55521274", "0.55447984", "0.554371", "0.55387914", "0.5534107", "0.5522962", "0.55204076", "0.5518237", "0.55078214", "0.5505552", "0.55043525", "0.5491243", "0.54911995", "0.54752076", "0.5462346", "0.5459472", "0.54561853", "0.5444319", "0.54433835", "0.54429525", "0.54399437", "0.543343", "0.5431187", "0.54308563", "0.5427987", "0.542531", "0.54189265", "0.54139346", "0.54118764" ]
0.82851547
0
/ create a string of html code that contains the numbers from 1 to 10
public String getNumbers(){ StringBuilder htmlNumbers = new StringBuilder("<h2>"); for (int i = 1; i<=10; i++){ htmlNumbers.append(String.valueOf(i) + ".<br>"); } htmlNumbers.append("</h2>"); return htmlNumbers.toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String toHtml(String text, int number) {\r\n StringBuilder sb = new StringBuilder(text);\r\n int loc = 0;\r\n String space = \" \";\r\n loc = loc + number;\r\n while (loc < sb.length()) {\r\n createLine(loc, sb);\r\n loc = loc + number; \r\n }\r\n text = sb.toString();\r\n return text;\r\n }", "private static String create50DigitString(){\n StringBuilder sb = new StringBuilder(\"1\");\n for(int i = 1; i < 50; i++){\n sb.append(\"0\");\n }\n return sb.toString();\n }", "public static String createString(int integer){\n StringBuilder result = new StringBuilder(\"\");\n\n for(int i = 0; i < 20; i++){\n result.append(integer);\n }\n\n result.append(\"\\n\");\n return result.toString();\n }", "private String helper(int num) {\n if (num == 0) {\n // return empty string here so that we can append a white\n // space in the next if \n return \"\"; \n }\n \n if (num < 20) {\n return LESS_THAN_20[num] + \" \";\n }\n \n if (num < 100) {\n // use helper on num%10 instead of LESS_THAN_20[num%10] so that\n // white space is handled properly\n return TENS[num / 10] + \" \" + helper(num % 10);\n }\n \n return LESS_THAN_20[num / 100] + \" Hundred \" + helper(num % 100);\n }", "@Override\n\tpublic String generateHTML() {\n\t\tStringBuilder stringBuilder = new StringBuilder();\n\t\tString level = \"\\t\";\n\t\tstringBuilder.append(level.repeat(levelCount)+\"<div>\\n\");\n\t\tlevelCount++;\n\t\tfor (HTMLGenerator htmlGenerator : tags) {\n\t\t\tstringBuilder.append(level.repeat(levelCount)+htmlGenerator.generateHTML());\n\t\t}\n\t\tstringBuilder.append(\"</div>\\n\");\n\t\treturn stringBuilder.toString();\n\t}", "private static String mod10(String code) {\n if (!code.matches(\"\\\\d+\")) {\n return null;\n }\n if (code.length() > 5) {\n return null;\n }\n // if length < 5, add leading \"0\"\n StringBuffer input = new StringBuffer(code);\n while (input.length() < 5) {\n input.insert(0, \"0\");\n }\n\n // 1. Using the number 12345, assign positions to the digits, from right\n // to left.\n\n // 2. Take the odd digit positions counting from the right (1st, 3rd,\n // 5th, etc.)\n StringBuffer odd = new StringBuffer();\n for (int i = 0; 2 * i < input.length(); i++) {\n odd.insert(0, input.charAt(2 * i));\n }\n\n // 3.Multiply by 2.\n int odd2 = Integer.parseInt(odd.toString()) * 2;\n\n // 4. Take the even digit positions starting from the right (2nd, 4th,\n // etc.).\n StringBuffer even = new StringBuffer();\n for (int i = 0; 2 * i + 1 < input.length(); i++) {\n even.insert(0, input.charAt(2 * i + 1));\n }\n\n // 5.Append (4) to the front of the results of (3).\n even.append(odd2);\n\n // 6. Add the digits of (5) together.\n double add = 0;\n for (int i = 0; i < even.length(); i++) {\n add = add + Integer.parseInt(even.substring(i, i + 1));\n }\n\n // 7. Find the next highest multiple of 10.\n double multiple = Math.ceil(add / 10) * 10;\n\n // 8. Subtract (6) from (7).\n Long result = Math.round(multiple - add);\n\n return result.toString();\n }", "public String getRandomNumberString() {\n Random rnd = new Random();\n int number = rnd.nextInt(899999) + 100000;\n\n // this will convert any number sequence into 6 character.\n String formatted_code = String.format(\"%06d\", number);\n\n return formatted_code;\n }", "public String getHTML(int index) {\n\t\tString raw=getString(index);\n\t\tif (raw==null) {\n\t\t\treturn raw;\n\t\t}\n\t\tint[] style=getStyle(index);\n\t\tif (style==null) {\n\t\t\treturn raw;\n\t\t}\n\t\tStringBuilder html=new StringBuilder(raw.length()+32);\n\t\tint offset=0;\n\t\twhile (true) {\n\t\t\tint i=-1;\n\t\t\tfor (int j=0;j!=style.length;j+=3) {\n\t\t\t\tif (style[j+1]==-1) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (i==-1 || style[i+1]>style[j+1]) {\n\t\t\t\t\ti=j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint start=((i!=-1)?style[i+1]:raw.length());\n\t\t\tfor (int j=0;j!=style.length;j+=3) {\n\t\t\t\tint end=style[j+2];\n\t\t\t\tif (end==-1 || end>=start) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (offset<=end) {\n\t\t\t\t\thtml.append(raw,offset,end+1);\n\t\t\t\t\toffset=end+1;\n\t\t\t\t}\n\t\t\t\tstyle[j+2]=-1;\n\t\t\t\thtml.append('<');\n\t\t\t\thtml.append('/');\n\t\t\t\thtml.append(getString(style[j]));\n\t\t\t\thtml.append('>');\n\t\t\t}\n\t\t\tif (offset<start) {\n\t\t\t\thtml.append(raw,offset,start);\n\t\t\t\toffset=start;\n\t\t\t}\n\t\t\tif (i==-1) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\thtml.append('<');\n\t\t\thtml.append(getString(style[i]));\n\t\t\thtml.append('>');\n\t\t\tstyle[i+1]=-1;\n\t\t}\n\t\treturn html.toString();\n\t}", "private String intString(int n){\r\n String s=\"\";\r\n if(n>9){\r\n s+=(char)(Math.min(n/10,9)+'0');\r\n }\r\n s+=(char)(n%10+'0');\r\n return s; \r\n }", "@Override\n public String apply(Integer i) {\n List<Character> list = new ArrayList<>();\n RandomStrings rnd = new RandomStrings();\n StringBuilder sb = new StringBuilder();\n for (int j = 0; j < i ; j++) {\n list.add((char)rnd.generateNumberAscii());\n }\n for (Character character : list) {\n sb.append(character);\n }\n return sb.toString();\n }", "public static void main(String[] args) {\nint t = 101010101;\n// koden begynner her\nString s = \"\";\nwhile ( t % 10 > 0 ) {\ns = t % 10 + s;\nt = t / 10;\n}\ns = \"s = \" + s;\nout.println(s);\n\n }", "public static String replaceHtmlEscapeNumber(String str)\n\t{\n\t\tMatcher matcher = htmlNumber.matcher(str);\n\t\twhile (matcher.find())\n\t\t{\n\t\t int pos = matcher.start();\n\t\t int end = matcher.end();\n\t\t int number = Integer.parseInt(str.substring(pos+2, end-1));\n\t\t char ch = (char)number;\n\t\t str = str.substring(0, pos) + ch + str.substring(end);\n\t\t\tmatcher = htmlNumber.matcher(str);\n\t\t}\n\n\t return str;\n\t}", "private static void printNumber(){\r\n\t\tfor(int i = 1;i <= 10; i++)\r\n\t\t\tSystem.out.println(i);\r\n\t}", "private String createNumberLine(){\n StringBuilder numberLine = new StringBuilder();\n for(int i = 0; i < this.columns; i++){\n numberLine.append(i + 1).append(\" \");\n }\n return numberLine.toString();\n }", "protected String createText() {\r\n\t\t// Default text is 1 based.\r\n\t\tNumberFormat formatter = NumberFormat.getFormat(\"#,###\");\r\n\t\tHasRows display = getDisplay();\r\n\t\tRange range = display.getVisibleRange();\r\n\t\tint pageStart = range.getStart() /*+ 1*/;\r\n\t\tint pageSize = range.getLength();\r\n\t\tint dataSize = display.getRowCount();\r\n\t\tint endIndex = Math.min(dataSize, pageStart + pageSize /*- 1*/);\r\n\t\tendIndex = Math.max(pageStart, endIndex);\r\n\t\tif(endIndex==0)\r\n\t\t\tpageStart = 0;\r\n\t\telse\r\n\t\t\tpageStart = pageStart + 1;\r\n\t\tString text = formatter.format(pageStart) + \"-\"\r\n\t\t\t\t+ formatter.format(endIndex);\r\n\t\treturn text;\r\n\t}", "@Override\n\tpublic String str(int number) {\n\t\treturn \"C3(\"+number+\")\";\n\t}", "public String converter(int n){\r\n str = \"\";\r\n condition = true;\r\n while(condition){\r\n if(n >= 1 && n < 100){\r\n str = str + oneToHundred(n);\r\n condition = false; \r\n }else if (n >= 100 && n < 1000){\r\n str = str + oneToHundred(n / 100);\r\n str = str + \"Hundred \";\r\n n = n % 100;\r\n condition = true; \r\n }\r\n \r\n }\r\n return str;\r\n \r\n }", "public void print1T0255(){\n StringBuilder out = new StringBuilder();\n for (int i = 1; i <= 255; i++){\n out.append( i + \" \");\n }\n System.out.println( out.toString());\n }", "public static String randomNumberString() {\n\r\n Random random = new Random();\r\n int i = random.nextInt(999999);\r\n\r\n\r\n return String.format(\"%06d\", i);\r\n }", "public static String generaSerieAscendente(int n){\n\t\tStringBuilder sb;\n\t\tsb=new StringBuilder();\n\t\t\n\t\tfor(int i=1; i<=n;i++)\n\t\t\tsb.append(i+\" \" );\n\t\t\t\n\t\treturn sb.toString();\t\n\t\t}", "public static String getRandomNumberString() {\n Random rnd = new Random();\n int number = rnd.nextInt(9999999);\n\n // this will convert any number sequence into 6 character.\n return String.format(\"%07d\", number);\n }", "public static String replaceHtmlEscapeNumber(String str)\n\t{\n\t\tif (str == null)\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\tMatcher matcher = htmlNumber.matcher(str);\n\t\twhile (matcher.find())\n\t\t{\n\t\t\tint pos = matcher.start();\n\t\t\tint end = matcher.end();\n\t\t\tint number = Integer.parseInt(str.substring(pos + 2, end - 1));\n\t\t\tchar ch = (char)number;\n\t\t\tstr = str.substring(0, pos) + ch + str.substring(end);\n\t\t\tmatcher = htmlNumber.matcher(str);\n\t\t}\n\n\t\treturn str;\n\t}", "@Test\n void StringBuffer() {\n StringBuilder builder = new StringBuilder();\n for (int i = 0; i < 10; i++) {\n builder.append(i).append(\" \");\n }\n assertThat(builder.toString()).isEqualTo(\"0 1 2 3 4 5 6 7 8 9 \");\n }", "public static void pattern10(int input){\n\t\tfor(int i= input;i >0;i--){\n\t\t\tfor(int j=i;j<=input;j++){\n\t\t\t\tSystem.out.print(j+\" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "public String NumberToString(int number){return \"\"+number;}", "public String getTop(){\n StringBuilder htmlTop = new StringBuilder(\"<h2>\");\n for (int i = 0; i<10; i++){\n if (i >= this.highscores.size()){\n htmlTop.append(\" ----<br>\");\n } else {\n htmlTop.append(String.valueOf(this.highscores.get(i))).append(\"<br>\");\n }\n }\n htmlTop.append(\"</h2>\");\n return htmlTop.toString();\n }", "private String hR(int x) {\n if (x < 10) {\n return \"0\" + x;\n }\n return \"\" + x;\n }", "void random(){\r\n Random dice = new Random ();\r\n int number;\r\n \r\n for (int counter=1; counter<=10;counter++);\r\n number = 10000+dice.nextInt(100000);\r\n \r\n String hasil = TF3.getText();\r\n isi4.setText(number + \" \");\r\n }", "private String formatNumbers(int[] numbers) {\r\n String formattedResponse = \"\";\r\n for (int number : numbers) {\r\n formattedResponse += number + \" \";\r\n }\r\n return formattedResponse;\r\n }", "public static void main(String[] args) {\n StringBuilder numbers = new StringBuilder();\n for (int i = 1; i < 5; i++) {\n numbers.append(i);\n }\n System.out.println(numbers.toString());\n }", "private static String repeatSpace(int number) {\n StringBuilder space = new StringBuilder();\n\n // Adding spaces.\n for (int i = 0; i < number; i++) {\n space.append(\" \");\n }\n\n //returning spaces.\n return space.toString();\n }", "HTML createHTML();", "public String intToRoman(int num) {\n StringBuilder ans = new StringBuilder(\"\");\n char a[][] ={ {'I','V','X'}, {'X','L','C'}, {'C','D','M'}, {'M','M','M'}};\n int threshold = 1000;\n for(int i=3;i>=0;i--){\n if(num>=threshold){\n int k = num/threshold;\n num -= k*threshold;\n if(k==0){\n \n }\n else if(k==9){\n ans.append(a[i][0]);\n ans.append(a[i][2]);\n }else if(k<=3){\n for(int j=0;j<k;j++){\n ans.append(a[i][0]);\n }\n }else if(k==4){\n ans.append(a[i][0]);\n ans.append(a[i][1]);\n }else if(k<=8){\n ans.append(a[i][1]);\n for(int j=0;j<k-5;j++){\n ans.append(a[i][0]);\n }\n }\n }\n threshold /=10;\n }\n return ans.toString();\n }", "public static String toUI(int value) {\n return toUI(value, SCALE);\n }", "public static String printBeutifulNumber(String num){\n String[] s_num = num.split(\"\\\\s+\");// converting given string to string array\n int[] input_num = new int[s_num.length];\n for(int i = 0; i<s_num.length; i++){\n input_num[i] = Integer.parseInt(s_num[i]);\n }//Convert given string to int array\n String result = beutifulMaker(input_num);\n return result;\n }", "public static void main(String[] args) {\n\t\t\n\t\tint num = 999;\n\t\tString numXXX = \"\";\n\t\t\n\t\tif ((num < 100) & (num >=10) ){\n\t\t\tnumXXX = \"0\" + num;\t\t\n\t\t} else if (num < 10) {\n\t\t\tnumXXX = \"00\" + num; \t\n\t\t} else {\n\t\t\tnumXXX = \"\" + num;\n\t\t}\n\t\t\n\t\tint hundred = Character.digit(numXXX.charAt(0),10);\n\t\tint ten = Character.digit(numXXX.charAt(1),10);\n\t\tint digit = Character.digit(numXXX.charAt(2),10);\n\t\t\n\t\t//System.out.println(numXXX + \":\" + hundred + ten + digit);\n\t\t\n\t\tString hundredStr = \"\";\n\t\tString tenStr = \"\";\n\t\tString digitStr = \"\";\n\t\t\n\t\tswitch (hundred) {\n\t\t\tcase 1: \n\t\t\t\thundredStr = \"one hundred\";\n\t\t\t\tbreak;\n\t\t\tcase 2: \n\t\t\t\thundredStr = \"two hundred\";\n\t\t\t\tbreak;\n\t\t\tcase 3: \n\t\t\t\thundredStr = \"three hundred\";\n\t\t\t\tbreak;\n\t\t\tcase 4: \n\t\t\t\thundredStr = \"four hundred\";\n\t\t\t\tbreak;\n\t\t\tcase 5: \n\t\t\t\thundredStr = \"five hundred\";\n\t\t\t\tbreak;\n\t\t\tcase 6: \n\t\t\t\thundredStr = \"six hundred\";\n\t\t\t\tbreak;\n\t\t\tcase 7: \n\t\t\t\thundredStr = \"seven hundred\";\n\t\t\t\tbreak;\n\t\t\tcase 8: \n\t\t\t\thundredStr = \"eight hundred\";\n\t\t\t\tbreak;\n\t\t\tcase 9: \n\t\t\t\thundredStr = \"nine hundred\";\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t\n\t\tswitch (ten) {\n\t\t\tcase 1:\n\t\t\t\tif (digit == 0){\n\t\t\t\t\ttenStr = \"ten\";\n\t\t\t\t} else {\n\t\t\t\t\tswitch (digit) {\n\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\ttenStr = \"eleven\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\ttenStr = \"twelve\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\ttenStr = \"thirteen\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\ttenStr = \"fourteen\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 5:\n\t\t\t\t\t\t\ttenStr = \"fifteen\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 6:\n\t\t\t\t\t\t\ttenStr = \"sixteen\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 7:\n\t\t\t\t\t\t\ttenStr = \"seventeen\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 8:\n\t\t\t\t\t\t\ttenStr = \"eighteen\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 9:\n\t\t\t\t\t\t\ttenStr = \"nineteen\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n \t\t\tcase 2: \n \t\t\t\ttenStr = \"twenty\";\n \t\t\t\tbreak;\n \t\t\tcase 3: \n \t\t\t\ttenStr = \"thirty\";\n \t\t\t\tbreak;\n \t\t\tcase 4: \n \t\t\t\ttenStr = \"fourty\";\n \t\t\t\tbreak;\n \t\t\tcase 5: \n \t\t\t\ttenStr = \"fifty\";\n \t\t\t\tbreak;\n \t\t\tcase 6: \n \t\t\t\ttenStr = \"sixty\";\n \t\t\t\tbreak;\n \t\t\tcase 7: \n \t\t\t\ttenStr = \"seventy\";\n \t\t\t\tbreak;\n \t\t\tcase 8: \n \t\t\t\ttenStr = \"eighty\";\n \t\t\t\tbreak;\n \t\t\tcase 9: \n \t\t\t\ttenStr = \"ninety\";\n \t\t\t\tbreak;\t\n }\n\t\t\n\t\tif ((ten != 1) | (ten == 0)){\n\t\t\tswitch (digit) {\n\t\t\t\tcase 0:\n\t\t\t\t\tif ((ten == 0) & (hundred == 0)){\n\t\t\t\t\t\tdigitStr = \"zero\";\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tdigitStr = \"one\";\n\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tdigitStr = \"two\";\n\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tdigitStr = \"three\";\n\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\tdigitStr = \"four\";\n\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\tdigitStr = \"five\";\n\t\t\t\tbreak;\n\t\t\t\tcase 6:\n\t\t\t\t\tdigitStr = \"six\";\n\t\t\t\tbreak;\n\t\t\t\tcase 7:\n\t\t\t\t\tdigitStr = \"seven\";\n\t\t\t\tbreak;\n\t\t\t\tcase 8:\n\t\t\t\t\tdigitStr = \"eight\";\n\t\t\t\tbreak;\n\t\t\t\tcase 9:\n\t\t\t\t\tdigitStr = \"nine\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (ten == 0){\n\t\t\tSystem.out.println(num + \" => \" + hundredStr + \" \" + digitStr);\n\t\t} else if (ten == 1){\n\t\t\tSystem.out.println(num + \" => \" + hundredStr + \" \" + tenStr);\n\t\t} else if ((ten != 1) & (digit == 0)){\n\t\t\tSystem.out.println(num + \" => \" + hundredStr + \" \" + tenStr);\n\t\t} else {\n\t\t\tSystem.out.println(num + \" => \" + hundredStr + \" \" + tenStr + \"-\" + digitStr);\n\t\t}\n\t\t\n\t}", "public String toString(){\r\n return \"(\" + num + \")\";\r\n }", "public HBox horNum(){\n HBox horiNum = new HBox(32);\n for(int i = 0; i < 10; i++){\n Label num = new Label(Integer.toString(i));\n horiNum.getChildren().add(num);\n }\n return horiNum;\n }", "public static void printNum() {\n\t\tfor(int i = 1; i<= 20; i++) {\n\t\t\tSystem.out.print(\" \" + i);\n\t\t}\n\t\tSystem.out.println(\"\\n\");\n\t\t}", "public static void main(String[] args){\n for(int i = 23; i <= 89; i++){\n System.out.print(i + \" \");\n if(i % 10 == 2)\n System.out.print(\"\\n\"); }\n }", "private static String accountNumberGenerator() {\n char[] chars = new char[10];\n for (int i = 0; i < 10; i++) {\n chars[i] = Character.forDigit(rnd.nextInt(10), 10);\n }\n return new String(chars);\n }", "public static String m51361a(int i) {\n return i == 1000 ? \"E100000\" : i == 3000 ? \"E100002\" : i == 2000 ? \"E100001\" : i == 6000 ? \"E100003\" : \"\";\n }", "public static String contentAscending(int quantity){\r\n String content = \"\";\r\n \r\n for (int i = 0; i < quantity; i++) {\r\n content += i + \"\\r\\n\";\r\n }\r\n \r\n return content;\r\n }", "String renderHTML();", "private static String numberToProse(int n) {\n if(n == 0)\n return \"zero\";\n\n if(n < 10)\n return intToWord(n);\n\n StringBuilder sb = new StringBuilder();\n\n // check the tens place\n if(n % 100 < 10)\n sb.insert(0, intToWord(n % 10));\n else if(n % 100 < 20)\n sb.insert(0, teenWord(n % 100));\n else\n sb.insert(0, tensPlaceWord((n % 100) / 10) + \" \" + intToWord(n % 10));\n\n n /= 100;\n\n // add the hundred place\n if(n > 0 && sb.length() != 0)\n sb.insert(0, intToWord(n % 10) + \" hundred and \");\n else if (n > 0)\n sb.insert(0, intToWord(n % 10) + \" hundred \");\n\n if(sb.toString().equals(\" hundred \"))\n sb = new StringBuilder(\"\");\n\n n /= 10;\n\n // the thousand spot\n if(n > 0)\n sb.insert(0, intToWord(n) + \" thousand \");\n\n return sb.toString();\n }", "public static String intToNumeral(int number)\n\t{\n\t\tString numeral = \"\";\n\t\twhile(number > 0)\n\t\t{\n\t\t\tif(number >= 1000)\n\t\t\t{\n\t\t\t\tnumber -= 1000;\n\t\t\t\tnumeral = numeral + \"M\";\n\t\t\t}\n\t\t\telse if(number >= 900)\n\t\t\t{\n\t\t\t\tnumber -= 900;\n\t\t\t\tnumeral = numeral + \"CM\";\n\t\t\t}\n\t\t\telse if(number >= 500)\n\t\t\t{\n\t\t\t\tnumber -= 500;\n\t\t\t\tnumeral = numeral + \"D\";\n\t\t\t}\n\t\t\telse if(number >= 400)\n\t\t\t{\n\t\t\t\tnumber -= 400;\n\t\t\t\tnumeral = numeral + \"DC\";\n\t\t\t}\n\t\t\telse if(number >= 100)\n\t\t\t{\n\t\t\t\tnumber -= 100;\n\t\t\t\tnumeral = numeral + \"C\";\n\t\t\t}\n\t\t\telse if(number >= 90)\n\t\t\t{\n\t\t\t\tnumber -= 90;\n\t\t\t\tnumeral = numeral + \"XC\";\n\t\t\t}\n\t\t\telse if(number >= 50)\n\t\t\t{\n\t\t\t\tnumber -= 50;\n\t\t\t\tnumeral = numeral + \"L\";\n\t\t\t}\n\t\t\telse if(number >= 40)\n\t\t\t{\n\t\t\t\tnumber -= 40;\n\t\t\t\tnumeral = numeral + \"XL\";\n\t\t\t}\n\t\t\telse if(number >= 10)\n\t\t\t{\n\t\t\t\tnumber -= 10;\n\t\t\t\tnumeral = numeral + \"X\";\n\t\t\t}\n\t\t\telse if(number >= 9)\n\t\t\t{\n\t\t\t\tnumber -= 9;\n\t\t\t\tnumeral = numeral + \"IX\";\n\t\t\t}\n\t\t\telse if(number >= 5)\n\t\t\t{\n\t\t\t\tnumber -= 5;\n\t\t\t\tnumeral = numeral + \"V\";\n\t\t\t}\n\t\t\telse if(number >= 4)\n\t\t\t{\n\t\t\t\tnumber -= 4;\n\t\t\t\tnumeral = numeral + \"IV\";\n\t\t\t}\n\t\t\telse if(number >= 1)\n\t\t\t{\n\t\t\t\tnumber -= 1;\n\t\t\t\tnumeral = numeral + \"I\";\n\t\t\t}\n\t\t\tif(number < 0) return \"ERROR\";\n\t\t}\n\t\treturn numeral;\n\t}", "public static String FormatNumber(int i) {\n\t\ttry {\n\t\t\tif (i >= 0 && i < 10)\n\t\t\t\treturn \"0\" + i;\n\t\t\telse\n\t\t\t\treturn \"\" + i;\n\t\t} catch (Exception e) {\n\t\t\treturn \"\";\n\t\t}\n\t}", "public String getNormalizedN(int i) {\n\tint nb = getNb(i);\n\tif (nb == 1) return \"1\";\n\tint maxN = getMaxNb();\n\tif (maxN <= 5) return Integer.toString(nb);\n\tmaxN--;\n\tnb--;\n\tif (maxN < 21) {\n\t\tif (4*nb <= maxN) return \"1\";\n\t\tif (3*nb <= maxN) return \"2\";\n\t\tif (2*nb <= maxN) return \"3\";\n\t\tif (3*nb <= 2*maxN) return \"4\";\n\t\treturn \"5\";\n\t} else if (maxN < 100) {\n\t\tif (10*nb <= maxN) return \"1\";\n\t\tif (5*nb <= maxN) return \"2\";\n\t\tif (4*nb <= maxN) return \"3\";\n\t\tif (3*nb <= maxN) return \"4\";\n\t\tif (2*nb <= 1*maxN) return \"5\";\n\t\tif (3*nb <= 2*maxN) return \"6\";\n\t\treturn \"7\";\n\t} else {\n\t\tif (20*nb <= maxN) return \"1\";\n\t\tif (10*nb <= maxN) return \"2\";\n\t\tif (5*nb <= maxN) return \"3\";\n\t\tif (4*nb <= maxN) return \"4\";\n\t\tif (3*nb <= 1*maxN) return \"5\";\n\t\tif (2*nb <= 1*maxN) return \"6\";\n\t\treturn \"7\";\n\t}\n}", "public String convert(int num) {\n if (num == 0)\n return ZERO_STRINGS;\n\n long tmpNum = num;\n StringBuilder buffer = new StringBuilder();\n if (tmpNum < 0) { // Negative number\n tmpNum *= -1;\n buffer.append(\"minus \");\n }\n\n for (int i : NUMERIC_INDEXES) {\n long pow = (int)Math.pow(10, i);\n if (tmpNum >= pow) {\n long numberAtIndex = tmpNum/pow; // The number at position 3\n tmpNum -= numberAtIndex*pow;\n buffer.append(convert((int)numberAtIndex)).append(\" \");\n buffer.append(NUMERIC_STRINGS.get(pow)).append(\" \");\n }\n }\n if (tmpNum >= 20) { // second number in the integer\n long numberAtIndex = ((tmpNum % 100)/10)*10; // The number at position 2\n tmpNum -= numberAtIndex;\n buffer.append(NUMERIC_STRINGS.get(numberAtIndex)).append(\" \");\n }\n if (NUMERIC_STRINGS.containsKey(tmpNum))\n buffer.append(NUMERIC_STRINGS.get(tmpNum));\n return buffer.toString().trim();\n }", "private String feelZero(Integer i){\n if( i < 10 ){\n return \"0\"+i;\n }else{\n return Integer.toString(i);\n }\n }", "public void startNumberMethod(int startNumber) {\n for (int i = startNumber; i <= 100; i++) {\n System.out.println(i);\n }\n }", "public static String getResult() {\n\t\t\n\t\tRandom rand=new Random();\n\t\t do{\n\t\t x=rand.nextInt(35+1-7)+7;\n\t }while(x%7!=0);\n\t\t y=x/7;\n\t\treturn Integer.toString(x+y);\n\t}", "private String convert99(int num) {\r\n\t\t\r\n\t\t//check if number is within 20\r\n\t\tif(num<TWENTY) {\r\n\t\t\treturn lowNames[num];\r\n\t\t}\r\n\t\t\r\n\t\t// fetch the appropriate value from tenNames array\r\n\t\tStringBuilder str=new StringBuilder(tenNames[num / TEN - TWO]);\r\n\t\t\r\n\t\t//check if number is divisible by 10 and remainder is zero\r\n\t\tif(num % TEN == ZERO) {\r\n\t\t\treturn str.toString();\r\n\t\t}\r\n\t\t\r\n\t\t//number is neither below 20 nor divisible by 10 and remainder is zero\r\n\t\tstr.append(SPACE);\r\n\t\treturn str.append(lowNames[num % TEN]).toString();\r\n\t}", "public String convert(int input) {\n\t\tif (input < 1 || input > 3000)\n\t\t\treturn \"invalid numeral\" ;\n\t\tString n = \"\";\n\t\t\n\t\twhile (input >= 1000) {\n\t\t\tn += \"M\";\n\t\t\tinput -= 1000;\n\t\t}\n\t\t\n\t\twhile (input >= 900) {\n\t\t\tn += \"CM\";\n\t\t\tinput -= 900;\n\t\t}\n\t\t\n\t\twhile (input >= 500) {\n\t\t\tn += \"D\";\n\t\t\tinput -= 500;\n\t\t}\n\t\t\n\t\twhile (input >= 400) {\n\t\t\tn += \"CD\";\n\t\t\tinput -= 400;\n\t\t}\n\t\t\n\t\twhile (input >= 100) {\n\t\t\tn += \"C\";\n\t\t\tinput -= 100;\n\t\t}\n\t\t\n\t\twhile (input >= 90) {\n\t\t\tn += \"XC\";\n\t\t\tinput -= 90;\n\t\t}\n\t\t\n\t\twhile (input >= 50) {\n\t\t\tn += \"L\";\n\t\t\tinput -= 50;\n\t\t}\n\t\t\n\t\twhile (input >= 40) {\n\t\t\tn += \"XL\";\n\t\t\tinput -= 40;\n\t\t}\n\t\t\n\t\twhile (input >= 10) {\n\t\t\tn += \"X\";\n\t\t\tinput -= 10;\n\t\t}\n\t\t\n\t\twhile (input >= 9) {\n\t\t\tn += \"IX\";\n\t\t\tinput -= 9;\n\t\t}\n\t\t\n\t\twhile (input >= 5) {\n\t\t\tn += \"V\";\n\t\t\tinput -= 5;\n\t\t}\n\t\t\n\t\twhile (input >= 4) {\n\t\t\tn += \"IV\";\n\t\t\tinput -= 4;\n\t\t}\n\t\t\n\t\twhile (input >= 1) {\n\t\t\tn += \"I\";\n\t\t\tinput -= 1;\n\t\t}\n\t\t\n\t\treturn n; \n\t}", "public static void main(String[] args) {\nint i=1;\nwhile(i<=10)\n{\n\tSystem.out.println(i+\"raj\");//display nos from 1 to 10 and raj \n\ti=i+1;\n}\n\t}", "public String toString(){\n String html = \"<html>\\n<head>\\n</head>\\n<body>\";\n for (int i=0; i< dom.size(); i++){\n html+= dom.get(i);\n }\n /* TODO\nLoop through the elemments of the dom and append them to html */\n return html+\"</body>\\n</html>\";\n }", "private JLabel numberLabel(int i) {\n\t\tJLabel label = new JLabel();\n\t\tlabel.setIcon(Icon.returnIcon(Integer.toString(i)));\n\t\tlabel.setOpaque(true);\n\t\tlabel.setBackground(labelBackground);\n\t\t\n\t\treturn label;\t\n\t}", "public String getResult() {\n\t\tDecimalFormat df = new DecimalFormat(\"##.00\");\n\t\tswitch(currentUnit) {\n\t\t\tcase 0:\n\t\t\t\tresult = \"<html>\"+df.format(celsius)+\"\\u00B0C = \"+df.format(fahrenheit)+\"\\u00B0F<br />\"\n\t\t\t\t\t+df.format(celsius)+\"\\u00B0C = \"+df.format(kelvin)+\"\\u00B0K</html\";\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tresult = \"<html>\"+df.format(fahrenheit)+\"\\u00B0F = \"+df.format(celsius)+\"\\u00B0C<br />\"\n\t\t\t\t\t\t+df.format(fahrenheit)+\"\\u00B0F = \"+df.format(kelvin)+\"\\u00B0K</html\";\n\t\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tresult = \"<html>\"+df.format(kelvin)+\"\\u00B0K = \"+df.format(celsius)+\"\\u00B0C<br />\"\n\t\t\t\t\t\t+df.format(kelvin)+\"\\u00B0K = \"+df.format(fahrenheit)+\"\\u00B0F</html\";\n\t\t\t\t\tbreak;\t\n\t\t}\n\t\treturn result;\n\t}", "private int parseHTMLForSpeed(String line){\n String output = \"\";\n int end = 0;\n char charInt;\n for (int i=0; i<line.length(); i++){\n charInt=line.charAt(i);\n if(charInt>=45 && charInt<=57){\n output = output + charInt;\n end+=1;\n }\n else{\n if (end > 1){\n break;\n }\n }\n }\n\n return Integer.parseInt(output.substring(1));\n }", "static String getAlphaNumericString(int n) \n {\n String AlphaNumericString = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n + \"0123456789\"\n + \"abcdefghijklmnopqrstuvxyz\"; \n \n // create StringBuffer size of AlphaNumericString \n StringBuilder sb = new StringBuilder(n); \n \n for (int i = 0; i < n; i++) { \n \n // generate a random number between \n // 0 to AlphaNumericString variable length \n int index \n = (int)(AlphaNumericString.length() \n * Math.random()); \n \n // add Character one by one in end of sb \n sb.append(AlphaNumericString \n .charAt(index)); \n } \n \n return sb.toString(); \n }", "private String getAlphaNumericString(int n) \n {\n String AlphaNumericString = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n + \"0123456789\"\n + \"abcdefghijklmnopqrstuvxyz\"; \n \n // create StringBuffer size of AlphaNumericString \n StringBuilder sb = new StringBuilder(n); \n \n for (int i = 0; i < n; i++) { \n \n // generate a random number between \n // 0 to AlphaNumericString variable length \n int index \n = (int)(AlphaNumericString.length() \n * Math.random()); \n \n // add Character one by one in end of sb \n sb.append(AlphaNumericString \n .charAt(index)); \n } \n \n return sb.toString(); \n }", "public static int getRandomNumberString() {\n // It will generate 6 digit random Number.\n // from 0 to 999999\n Random rnd = new Random();\n int number = rnd.nextInt(999999);\n\n // this will convert any number sequence into 6 character.\n return number;\n }", "@Override\n public String toString(){\n return '+' + code + number.substring(0, 3) + '-' + number.substring(3, 6) + '-' +number.substring(6);\n }", "public static String generateRandomInteger() {\n SecureRandom random = new SecureRandom();\n int aStart = 1;\n long aEnd = 999999999;\n long range = aEnd - (long) aStart + 1;\n long fraction = (long) (range * random.nextDouble());\n long randomNumber = fraction + (long) aStart;\n return String.valueOf(randomNumber);\n }", "public String getHtmlString() {\r\n\t\tString getHtmlString = \"\";\r\n\t\tgetHtmlString += \"<h1>\" + this.title + \"</h1>\";\r\n\t\tfor (int i = 0; i < portfolioSize; i++) {\r\n\t\t\tgetHtmlString += stockStatus[i].getHtmlDescription();\r\n\t\t}\r\n\t\tgetHtmlString += \"<br>Total portfolio value: \"\r\n\t\t\t\t+ getStocksValue(stockStatus) + \"$, Total Stocks value: \"\r\n\t\t\t\t+ getTotalValue(stockStatus) + \"$, Balnce :\" + getBalance()\r\n\t\t\t\t+ \"$ </br>\";\r\n\t\treturn getHtmlString;\r\n\t}", "public static String addLeadingZeros(Number numeric,int nbLength)\n {\n Double theNumerDbl = toDoubleObj(numeric);\n Integer theNumerInt = theNumerDbl.intValue();\n String thePattern = \"%0\"+nbLength+\"d\";\n return String.format(thePattern, theNumerInt);\n }", "public static String generateID(int num){\n StringBuilder str=new StringBuilder();//定义变长字符串\n Random random=new Random();\n for (int i = 0; i < num; i++) {\n str.append(random.nextInt(10));\n }\n return str.toString();\n }", "public static String getAlphaNumericString(int n) \n {\n String AlphaNumericString = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n + \"0123456789\";\n \n // create StringBuffer size of AlphaNumericString \n StringBuilder sb = new StringBuilder(n); \n \n for (int i = 0; i < n; i++) { \n \n // generate a random number between \n // 0 to AlphaNumericString variable length \n int index \n = (int)(AlphaNumericString.length() \n * Math.random()); \n \n // add Character one by one in end of sb \n sb.append(AlphaNumericString \n .charAt(index)); \n } \n \n return sb.toString(); \n }", "private void display(int number){\n TextView quantTV = (TextView) findViewById(R.id.quant_tv);\n quantTV.setText(\"\"+ number);\n }", "private String convert999(int num) {\r\n \t//return a number which is in 100th position\r\n \tStringBuilder str1= new StringBuilder(lowNames[num / ONE_HUNDRED]);\r\n \tstr1.append(SPACE);\r\n \tstr1.append(bigNames[0]);\r\n \tstr1.append(AND);\r\n \t\r\n \tStringBuilder str2=new StringBuilder(convert99(num % ONE_HUNDRED));\r\n \t\r\n\t\tif(num <= TWO_DIGIT_MAX_VALUE) {//check if number is lessthan or equal 99\r\n\t\t\treturn str2.toString();\r\n\t\t}else if(num % ONE_HUNDRED == ZERO) { //check if number is divisible by 100 and remainder is zero\r\n\t\t\treturn str1.toString();\r\n\t\t}\r\n\t\t\r\n\t\treturn str1.append(str2).toString();\r\n\t\t\r\n\t}", "public static String dtrmn(int number) {\n\t\t\n\t\tString letter = \"\";\n\t\t\n\t\tint cl = number / 100;\n\t\tif (cl != 9 && cl != 4) {\n\t\t\t\n\t\t\tif (cl < 4) {\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i <= cl; i++) {\n\t\t\t\t\tletter = letter + \"C\";\n\t\t\t\t}\n\t\t\t} else if (cl < 9 && cl > 4) {\n\t\t\t\t\n\t\t\t\tletter = letter + \"D\";\n\t\t\t\tfor (int i = 1; i <= cl - 5; i++) {\n\t\t\t\t\tletter = letter + \"C\";\n\t\t\t\t}\n\t\t\t} else if(cl == 10) { \n\t\t\t\t\n\t\t\t\tletter = letter + \"M\";\n\t\t\t}\n\t\t} else if (cl == 4) {\n\t\t\t\n\t\t\tletter = letter + \"CD\";\n\t\t\t\n\t\t} else if (cl == 9) {\n\t\t\t\n\t\t\tletter = letter + \"CM\";\n\t\t}\n\t\t\n\t\tint cl1 = (number % 100)/10;\n\t\tif (cl1 != 9 && cl1 != 4) {\n\t\t\t\n\t\t\tif (cl1 < 4) {\n\t\t\t\t\n\t\t\t\tfor (int i = 1; i <= cl1; i++) {\n\t\t\t\t\tletter = letter + \"X\";\n\t\t\t\t}\n\t\t\t} else if (cl1 < 9 && cl1 > 4) {\n\t\t\t\tletter = letter + \"L\";\n\t\t\t\t\n\t\t\t\tfor (int i = 1; i <= cl1 -5; i++) {\n\t\t\t\t\tletter = letter + \"X\";\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t} else if (cl1 == 4) {\n\t\t\tletter = letter + \"XL\";\n\t\t} else if (cl1 == 9) {\n\t\t\tletter = letter + \"XC\";\n\t\t}\n\t\t\n\t\tint cl2 = (number % 100)%10;\n\t\t\n\t\tif (cl2 != 9 && cl2 != 4) {\n\t\t\t\n\t\t\tif (cl2 < 4) {\n\t\t\t\tfor (int i = 1; i <= cl2; i++) {\n\t\t\t\t\tletter = letter + \"I\";\n\t\t\t\t}\n\t\t\t} else if (cl2 < 9 && cl2 > 4) {\n\t\t\t\t\n\t\t\t\tletter = letter + \"V\";\n\t\t\t\tfor (int i = 1; i <= cl2-5; i++) {\n\t\t\t\t\tletter = letter + \"I\";\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t} else if (cl2 == 4) {\n\t\t\tletter = letter +\"IV\";\n\t\t} else if (cl2 == 9) {\n\t\t\tletter = letter + \"IX\";\n\t\t}\n\t\treturn letter;\n\t}", "@RequestMapping(\"/\")\n\n public String printNumbers(){\n\n String result=\"\";\n/*\n for(int i=1;i<=100;i++ ){\n\n if(i%3==0&&i%5==0)\n result+=\"FizzBuzz\"+\"\\n\";\n\n else if (i%3==0)\n result+=\"Fizz\"+\"\\n\";\n\n else if(i%5==0)\n result+=\"Buzz\"+\"\\n\";\n else\n result+=Integer.toString(i)+\"\\n\";\n\n }\n*/\n//With the bonus...\n\n int count7=0,count17=0,count23=0;\n System.out.println(\"Enter the ending number: \");\n Scanner scanner = new Scanner(System.in);\n int endingNumber = scanner.nextInt();\n\n for(int i=1;i<=endingNumber;i++ ){\n\n if(i%3==0&&i%5==0)\n result+=\"FizzBuzz\"+\"\\n\"+\"<br/>\";\n\n else if (i%3==0)\n result+=\"Fizz\"+\"\\n\"+\"<br/>\";\n\n else if(i%5==0)\n result+=\"Buzz\"+\"\\n\"+\"<br/>\";\n else\n result+=Integer.toString(i)+\"\\n\"+\"<br/>\";\n\n if(i%7==0)\n count7++;\n if(i%17==0)\n count17++;\n if(i%23==0)\n count23++;\n\n }\n\n System.out.println(result);\n result+=\"Number of multiples of 7:\"+count7+\"\\n\"+\"<br/>\"+\"Number of multiples of 17:\"+count17+\"\\n\"+\"<br/>\"+\"Number of multiples of 23:\"+count23+\"\\n\"+\"<br/>\";\n return result;\n }", "private void display(int number) {\n TextView quantityTextView = (TextView) findViewById(R.id.quantity_text_view);\n quantityTextView.setText(String.format(\"%d\", number));\n }", "public String getAlphaNumericString(int n) {\n String AlphaNumericString = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n + \"0123456789\"\n + \"abcdefghijklmnopqrstuvxyz\";\n\n // create StringBuffer size of AlphaNumericString\n StringBuilder sb = new StringBuilder(n);\n\n for (int i = 0; i < n; i++) {\n\n // generate a random number between\n // 0 to AlphaNumericString variable length\n int index\n = (int)(AlphaNumericString.length()\n * Math.random());\n\n\n sb.append(AlphaNumericString\n .charAt(index));\n }\n\n return sb.toString();\n }", "public String covertIng(int num) {\n\t\tchar[] digits = new char[10];\r\n\t\t\r\n\t\tboolean sign = num >= 0 ? true : false;\r\n\t\tint idx = 0;\r\n\t\t\r\n\t\twhile(idx <digits.length){\r\n\t\t\tdigits[idx] = toChar(num % 10);\r\n\t\t\tnum = num /10;\r\n\t\t\tif(num== 0)\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tidx++;\r\n\t\t}\r\n\t\t\r\n\t\tStringBuffer sb = new StringBuffer();\r\n\t\tif(!sign)\r\n\t\t\tsb.append('-');\r\n\t\t\r\n\t\twhile(idx>=0){\r\n\t\t\tsb.append(digits[idx--]);\r\n\t\t}\r\n\t\t\r\n\t\treturn sb.toString();\r\n\t\t\r\n\t}", "public String getAlphaNumericString(int n) \n\t {\n\t String AlphaNumericString = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\t + \"0123456789\"\n\t + \"abcdefghijklmnopqrstuvxyz\"; \n\t \n\t // create StringBuffer size of AlphaNumericString \n\t StringBuilder sb = new StringBuilder(n); \n\t \n\t for (int i = 0; i < n; i++) { \n\t \n\t // generate a random number between \n\t // 0 to AlphaNumericString variable length \n\t int index \n\t = (int)(AlphaNumericString.length() \n\t * Math.random()); \n\t \n\t // add Character one by one in end of sb \n\t sb.append(AlphaNumericString \n\t .charAt(index)); \n\t } \n\t \n\t return sb.toString(); \n\t }", "protected String toStringAsCode() {\r\n \t\treturn \"<\"+toStringAsElement()+\">\";\r\n \t}", "String convert(int number) {\n final Supplier<IntStream> factors = () -> IntStream.of(3, 5, 7)\n .filter(factor -> number % factor == 0);\n\n if (factors.get().count() == 0) {\n return Integer.toString(number);\n }\n\n return factors.get().mapToObj(factor -> {\n switch (factor) {\n case 3:\n return \"Pling\";\n case 5:\n return \"Plang\";\n case 7:\n return \"Plong\";\n default:\n return \"\";\n }\n }).collect(Collectors.joining());\n }", "static String m20335a(int i) {\n return String.format(null, \"%s.ols%d.%d\", \"v2\", 100, Integer.valueOf(i));\n }", "public String covertToAscii(int num){\n\t\t\n\t\tString result=\"\";\n\t\t//int i=result.length -1;\n\t\tint rem;\n\t\tif(num==0){\n\t\t\treturn \"0\";\n\t\t}\n\t\tboolean negative=(num<0);\n\t\tif(negative){\n\t\t\tnum=0-num;\n\t\t}\n\t\t//works for integers with base 10\n\t\twhile(num>0){\n\t\t\trem=num%10;\n\t\t\tnum=num/10;\n\t\t\tresult=(char)(rem+'0')+result;\n\t\t}\n\t\tif(negative){\n\t\t\tresult=\"-\"+result;\n\t\t}\n\t\treturn result;\n\t}", "public String intToRoman(int num) {\n String result = \"\";\n\n while (num > 0) {\n if (num >= 1000) {\n result += \"M\";\n num -= 1000;\n } else if (num >= 900) {\n result += \"CM\";\n num -= 900;\n } else if (num >= 500) {\n result += \"D\";\n num -= 500;\n } else if (num >= 400) {\n result += \"CD\";\n num -= 400;\n } else if (num >= 100) {\n result += \"C\";\n num -= 100;\n } else if (num >= 90) {\n result += \"XC\";\n num -= 90;\n } else if (num >= 50) {\n result += \"L\";\n num -= 50;\n } else if (num >= 40) {\n result += \"XL\";\n num -= 40;\n } else if (num >= 10) {\n result += \"X\";\n num -= 10;\n } else if (num >= 9) {\n result += \"IX\";\n num -= 9;\n } else if (num >= 5) {\n result += \"V\";\n num -= 5;\n } else if (num >= 4) {\n result += \"IV\";\n num -= 4;\n } else if (num >= 1) {\n result += \"I\";\n num -= 1;\n }\n }\n return result;\n }", "private static void displayNumbers(){\n BigInteger bigInteger = new BigInteger(create50DigitString());\n int i = 1;\n do {\n // Checking the remainder's int value == 0 since the requirement is to find the number greater than Long.MAX_VALUE and divisible by 2 or 3.\n if (bigInteger.remainder(new BigInteger(\"2\")).intValue() == 0 || bigInteger.remainder(new BigInteger(\"3\")).intValue() == 0) {\n System.out.println(bigInteger);\n i++;\n }\n// Incrementing the bigInteger\n bigInteger = bigInteger.add(new BigInteger(\"1\"));\n// Exit condition\n } while (i != 11);\n }", "public String getHtml() {\n\t\tStringBuffer sb = new StringBuffer();\n\t\tfor(StringContainer sc : container) {\n\t\t\tsb.append(sc.getString());\n\t\t}\n\t\treturn \"<html><body>\"+sb.toString()+\"</body></html>\";\n\t}", "public String makeHTML(String DataLine) {\n\t\tDataLine = \"<HTML><BODY>\" + \"<b>\" + DataLine + \"</b>\" + \"</BODY></HTML>\";\n\n\n\t\treturn DataLine;\n\t}", "static String stringMultiplier( String word , int multiplier) {\n\t\tString largeWord = \"\"; \n\t\tfor (int i = 1; i <= multiplier; i++ ) {\n\t\t\tlargeWord += (word + \" \"); \n\t\t}\n\t\treturn largeWord;\n\t}", "public String generateString() {\n\t\tint maxLength = 9;\n\t\tRandom random = new Random();\n\t\tStringBuilder builder = new StringBuilder(maxLength);\n\n\t\t// Looping 9 times, one for each char\n\t\tfor (int i = 0; i < maxLength; i++) {\n\t\t\tbuilder.append(ALPHABET.charAt(random.nextInt(ALPHABET.length())));\n\t\t}\n\t\t// Generates a random ID that has may have a quintillion different combinations\n\t\t// (1/64^9)\n\t\treturn builder.toString();\n\t}", "public static void main(String[] args){\n\n for(int n = 2; n < 102; n+=2)System.out.printf(\"%d\\n\",n);\n \n \n }", "public static String getAlphaNumericString(int n) {\n String AlphaNumericString = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" + \"0123456789\" + \"abcdefghijklmnopqrstuvxyz\";\n\n // create StringBuffer size of AlphaNumericString\n StringBuilder sb = new StringBuilder(n);\n\n for (int i = 0; i < n; i++) {\n\n // generate a random number between\n // 0 to AlphaNumericString variable length\n int index = (int) (AlphaNumericString.length() * Math.random());\n\n // add Character one by one in end of sb\n sb.append(AlphaNumericString.charAt(index));\n }\n\n return sb.toString();\n }", "public void print()\r\n {\r\n int i = numar.length()/3;\r\n while( i != 0 ){\r\n String n = numar.substring(0,3);\r\n numar = numar.substring(3);\r\n printNo(n);\r\n if( i == 3){\r\n System.out.print(\"million \");\r\n }\r\n else if( i == 2 ){\r\n System.out.print(\"thousand \");\r\n }\r\n i--;\r\n }\r\n }", "public static void pattern9(int input){\n\t\tfor(int i= 1;i <= input;i++){\n\t\t\tfor(int j=i;j<=input;j++){\n\t\t\t\tSystem.out.print(j+\" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "public String convertToString(int i) {\n\t\tswitch (i) {\n\t\t\tcase 0: return \"\";\n\t\t\tcase 1: return \"1\";\n\t\t\tcase 2: return \"2\";\n\t\t\tcase 3: return \"3\";\n\t\t\tcase 4: return \"4\";\n\t\t\tcase 5: return \"5\";\n\t\t\tcase 6: return \"6\";\n\t\t\tcase 7: return \"7\";\n\t\t\tcase 8: return \"8\";\n\t\t\tcase 9: return \"9\";\n\t\t\tcase 10: return \"A\";\n\t\t\tcase 11: return \"B\";\n\t\t\tcase 12: return \"C\";\n\t\t\tcase 13: return \"D\";\n\t\t\tcase 14: return \"E\";\n\t\t\tcase 15: return \"F\";\n\t\t\tcase 16: return \"G\";\n\t\t\tcase 17: return \"H\";\n\t\t\tcase 18: return \"I\";\n\t\t\tcase 19: return \"J\";\n\t\t\tcase 20: return \"K\";\n\t\t\tcase 21: return \"L\";\n\t\t\tcase 22: return \"M\";\n\t\t\tcase 23: return \"N\";\n\t\t\tcase 24: return \"O\";\n\t\t\tcase 25: return \"P\";\n\t\t\tcase 26: return \"Q\";\n\t\t\tcase 27: return \"R\";\n\t\t\tcase 28: return \"S\";\n\t\t\tcase 29: return \"T\";\n\t\t\tcase 30: return \"U\";\n\t\t\tcase 31: return \"V\";\n\t\t\tcase 32: return \"W\";\n\t\t\tcase 33: return \"X\";\n\t\t\tcase 34: return \"Y\";\n\t\t\tcase 35: return \"Z\";\n\t\t\tdefault: System.out.println(\"The number is too high.\");\n\t\t return \"0\";\n\t\t}\n }", "public static String randomNumberGenerator() {\r\n\t\tint max = 999999999; // e.g. 714053349 (9 digits)\r\n\t\tRandom rand = new Random();\r\n\t\tint min = 0;\r\n\t\tint randomNum = rand.nextInt(max - min + 1) + min;\r\n\t\treturn Integer.toString(randomNum);\r\n\t}", "@Override\n\tpublic void printLotteryNo() {\n\t\tint[] prefixNums = generateNumber(35, 5);\n\t\tint[] suffixNums = generateNumber(12, 2);\n\t\tSystem.out.println(\"本期大乐透前区号码是:\" + printNums(prefixNums));\n\t\tSystem.out.println(\"本期大乐透后区号码是:\" + printNums(suffixNums));\n\t}", "public static String intToString(int n) { \n\t if (n == 0) return \"0\";\n\t StringBuilder sb = new StringBuilder();\n\t while (n > 0) { \n\t int curr = n % 10;\n\t n = n/10;\n\t sb.append(curr);\n\t }\n\t String s = sb.substring(0);\n\t sb = new StringBuilder();\n\t for (int i = s.length() -1; i >= 0; i--) { \n\t sb.append(s.charAt(i));\n\t }\n\t return sb.substring(0);\n\t}", "public static void main(String[] args) {\nScanner Sc= new Scanner(System.in);\nSystem.out.printf(\"Nhap vao so N = \");\nint N = Sc.nextInt();\nint S=0,i;\nfor (i=1;i<=N;i++)\n S=S+(10*i+i);\nSystem.out.printf(\"\\n%d\",S);\n\n\t}", "public String getCellHTML(String groupName, int id) {\n\r\n List<String> examples = phraseExamplesMap.get(id);\r\n String phrase = wordListMap.get(id);\r\n String htmlExs = \"\";\r\n for (String ex : examples) {\r\n htmlExs += \"...\" + ex + \"...<br/>\";\r\n }\r\n htmlExs = htmlExs.substring(0, htmlExs.length() - 5);\r\n return \"<span><span class=\" + groupName + \" id=\" + id + \">\" + phrase + \"</span><div class=ex>\" + htmlExs + \"</div></span>\";\r\n }", "public String get(){\n\t\tString s = value%13+1+\"\"+suits[value/13]+\" \";\r\n\t\treturn s;\r\n\t}", "public static String randInt(){\n return String.valueOf(rand.nextInt(10));\n }", "private static String m10f() {\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"sh\");\n stringBuilder.append(\"el\");\n stringBuilder.append(\"la\");\n return stringBuilder.toString();\n }", "public String intToRoman(int num) {\n\t\tString[] dict = { \"M\", \"CM\", \"D\", \"CD\", \"C\", \"XC\", \"L\", \"XL\", \"X\", \"IX\", \"V\", \"IV\", \"I\" };\n\t\tint[] vals = { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 };\n\t\tStringBuilder res = new StringBuilder();\n\t\tfor (int i = 0; i < vals.length; i++) {\n\t\t\tif (num >= vals[i]) {\n\t\t\t\tint count = num / vals[i];\n\t\t\t\tnum = num % vals[i];\n\t\t\t\tfor (int j = 0; j < count; j++) {\n\t\t\t\t\tres.append(dict[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn res.toString();\n\t}" ]
[ "0.73521537", "0.6409138", "0.5977175", "0.5877316", "0.5877039", "0.5849201", "0.5823992", "0.5807115", "0.5761926", "0.57257295", "0.5708955", "0.570776", "0.56646144", "0.5557054", "0.55454326", "0.5545055", "0.55434895", "0.5512821", "0.54500186", "0.54383487", "0.53813976", "0.5368878", "0.53668225", "0.53641057", "0.5356311", "0.5353006", "0.53371567", "0.5332429", "0.5331292", "0.5310941", "0.52935535", "0.5274415", "0.52669585", "0.525924", "0.5255623", "0.52539563", "0.52498305", "0.52346355", "0.5218898", "0.5214878", "0.5207594", "0.5203644", "0.52015036", "0.51896083", "0.5184402", "0.5171147", "0.5164605", "0.5139551", "0.51286817", "0.5115731", "0.5110952", "0.51090205", "0.5105201", "0.5098588", "0.509034", "0.5090241", "0.5087604", "0.5077337", "0.507012", "0.5064365", "0.50629586", "0.50555515", "0.5052749", "0.5049992", "0.50363237", "0.50284237", "0.5016999", "0.50154704", "0.49994493", "0.49964622", "0.49873775", "0.4985201", "0.49845064", "0.4980488", "0.49772006", "0.4975734", "0.49674347", "0.4961506", "0.49614775", "0.49608785", "0.49545366", "0.4945787", "0.49392787", "0.49370515", "0.4935265", "0.4929156", "0.49272907", "0.49244824", "0.49164638", "0.49155357", "0.49155062", "0.49103007", "0.48995367", "0.48878077", "0.48794007", "0.48782614", "0.48764712", "0.48742777", "0.48729277", "0.48676506" ]
0.7760708
0
/ Create a string of html code that contains the scores in descending order
public String getTop(){ StringBuilder htmlTop = new StringBuilder("<h2>"); for (int i = 0; i<10; i++){ if (i >= this.highscores.size()){ htmlTop.append(" ----<br>"); } else { htmlTop.append(String.valueOf(this.highscores.get(i))).append("<br>"); } } htmlTop.append("</h2>"); return htmlTop.toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void sortPlayerScores(){\n text=\"<html>\";\n for (int i = 1; i <= Options.getNumberOfPlayers(); i++){\n if(Collections.max(playerScores.entrySet(), (entry1, entry2) -> entry1.getValue() - entry2.getValue()).getKey() != null){\n Integer pl = Collections.max(playerScores.entrySet(), (entry1, entry2) -> entry1.getValue() - entry2.getValue()).getKey();\n if(pl != null && playerScores.containsKey(pl)){\n text += \"<p>Player \" + pl + \" Scored : \" + playerScores.get(pl) + \" points </p></br>\";\n playerScores.remove(pl);\n }\n }\n }\n text += \"</html>\";\n }", "public String getHighscore() {\n String str = \"\";\n\t int max = 10;\n \n ArrayList<Score> scores;\n scores = getScores();\n \n int i = 0;\n int x = scores.size();\n if (x > max) {\n x = max;\n } \n while (i < x) {\n \t str += (i + 1) + \".\\t \" + scores.get(i).getNaam() + \"\\t\\t \" + scores.get(i).getScore() + \"\\n\";\n i++;\n }\n if(x == 0) str = \"No scores for \"+SlidePuzzleGUI.getRows()+\"x\"+SlidePuzzleGUI.getCols()+ \" puzzle!\";\n return str;\n }", "public String getHighscores(){\r\n\t\tString returnString = \"\";\r\n\t\tList<Score> allScores = database.getAllScores(\"hard\");\r\n\t\t\r\n\t\t//loop through top 4 entries of table as obtained in the allScores list\r\n\t\tfor(int i = allScores.size()-1, j = 3; i>=0 && j>=0; j--, i--){\r\n\t\t\treturnString += String.valueOf(allScores.get(i).score + \" | \" + allScores.get(i).time + \"\\n\");\r\n\t\t}\r\n\t\treturn returnString;\r\n\t}", "public String createHighScoreString(ArrayList<Person> persons) {\n persons.sort(Comparator.comparingInt(Person::getScore));\n Collections.reverse(persons); //reverse the array, we should start with the highest score first\n\n StringBuilder highScoreString = new StringBuilder(\" Highscores \\n ------------------------------------------------------------------------------------\");\n for (Person person : persons)\n highScoreString.append(\"\\n \").append(person.getName()).append(\": \").append(person.getScore());\n return highScoreString.toString();\n }", "ArrayList<String> getScoreContent(String order) {\n ArrayList<String> ids = new ArrayList<>();\n String name = \"\";\n String score = \"\";\n if (order.equals(\"Ascending\")) {\n for (Object o : topScores.keySet().toArray()) {\n name = name + o.toString() + \"\\r\\n\";\n }\n for (Object o : topScores.values().toArray()) {\n score = score + o.toString() + \"\\r\\n\";\n }\n } else if (order.equals(\"Descending\")) {\n for (Object o : topScores.keySet().toArray()) {\n name = o.toString() + \"\\r\\n\" + name;\n }\n for (Object o : topScores.values().toArray()) {\n score = o.toString() + \"\\r\\n\" + score;\n }\n }\n ids.add(name);\n ids.add(score);\n return ids;\n }", "private String getScore(){\n return whiteName + \" : \" + blackName + \" - \" + whiteScore + \" : \" + blackScore;\n }", "public String toString(){\n StringBuilder string = new StringBuilder();\n for(double s : scores)string.append(s + \" \");\n return string.toString();\n }", "public void sortScores(){\r\n // TODO: Use a single round of bubble sort to bubble the last entry\r\n // TODO: in the high scores up to the correct location.\r\n \tcount=0;\r\n \tfor(int i=Settings.numScores-1; i>0;i--){\r\n \t\tif(scores[i]>scores[i-1]){\r\n \t\t\tint tempS;\r\n \t\t\ttempS=scores[i];\r\n \t\t\tscores[i]=scores[i-1];\r\n \t\t\tscores[i-1]=tempS;\r\n \t\t\t\r\n \t\t\tString tempN;\r\n \t\t\ttempN=names[i];\r\n \t\t\tnames[i]=names[i-1];\r\n \t\t\tnames[i-1]=tempN;\r\n \t\t\tcount++;\r\n \t\t}\r\n \t}\r\n }", "public void sortHighScores(){\n for(int i=0; i<MAX_SCORES;i++){\n long score = highScores[i];\n String name= names[i];\n int j;\n for(j = i-1; j>= 0 && highScores[j] < score; j--){\n highScores[j+1] = highScores[j];\n names[j+1] = names[j];\n }\n highScores[j+1] = score;\n names[j+1] = name;\n }\n }", "public void displayYcardForLpool(int score) {\n TextView scoreView = (TextView) findViewById(R.id.yellow_card_count_lvp);\n scoreView.setText(String.valueOf(score));\n }", "public String getScoreBoardText() {\n putListInPointOrder();\n String scoreText;\n StringBuilder sb = new StringBuilder();\n\n for (Player player : players)\n sb.append(player.toString() + \"\\n\");\n\n scoreText = sb.toString();\n return scoreText;\n }", "public static Student[] sortScore( Student s[]){\n\t\tStudent temp ;\r\n\t\tfor(int i=0; i<s.length; i++){\r\n\t\t\tfor(int j=i+1; j<s.length;j++)\r\n\t\t\t\tif(s[i].score > s[j].score){\r\n\t\t\t\t\ttemp = s[i];\r\n\t\t\t\t\ts[i] = s[j];\r\n\t\t\t\t\ts[j]= temp;\r\n\t\t\t\t} \t\t\t\r\n\t\t\t}\r\n\t\t\r\n\r\n\r\n\r\n\t\tSystem.out.println(\"Students with score<50 are: \");\r\n\t\tfor(int i=0; i<s.length;i++){\r\n\t\t\tif(s[i].score<50){\r\n\t\t\ts[i].Display();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tSystem.out.println(\"Students with score>=50 and <65 are: \");\r\n\t\tfor(int i=0; i<s.length;i++){\r\n\t\t\tif(s[i].score>=50 && s[i].score<65){\r\n\t\t\ts[i].Display();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tSystem.out.println(\"Students with score>=65 and <80 are: \");\r\n\t\tfor(int i=0; i<s.length;i++){\r\n\t\t\tif(s[i].score>=65 && s[i].score<80){\r\n\t\t\ts[i].Display();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tSystem.out.println(\"Students with score>=80 and <100 are: \");\r\n\t\tfor(int i=0; i<s.length;i++){\r\n\t\t\tif(s[i].score>=80 && s[i].score<=100){\r\n\t\t\ts[i].Display();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn s;\r\n\r\n\r\n\t}", "public static List<String> getScoreDetails(final Match match){\n\t\tArrayList<String> scoreList = new ArrayList<String>(2);\n\t\tString scoreDisplay = \"\";\n\t\t\t\t\n\t\t// If a game has been played, get the card information\n\t\tif(match.getCurrentStatus() == MatchStatus.PLAYED){\n\t\t\tString strScoreDetails = \"\";\n\t\t\t// Check if the match went to penalties\n\t\t\tif(match.isPenalties()){\n\t\t\t\tstrScoreDetails = \"<b>(</b>\" + Escaper.htmlEscape(match.getHomeTeamPenalties()) + \"<b>)</b>\" +\n\t\t\t\tEscaper.htmlEscape(match.getHomeTeamScore()) + \"-\" + Escaper.htmlEscape(match.getAwayTeamScore()) +\n\t\t\t\t\"<b>(</b>\" + Escaper.htmlEscape(match.getAwayTeamPenalties()) + \"<b>)</b>\";\n\t\t\t}else{\n\t\t\t\tstrScoreDetails = Escaper.htmlEscape(match.getHomeTeamScore()) + \"-\" + Escaper.htmlEscape(match.getAwayTeamScore());\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Writing the actual score\n\t\tif(match.getCurrentStatus() == MatchStatus.NOT_YET_PLAYED)\n\t\t{\t\n\t\t\tscoreDisplay = \"<td class=\\\"c3\\\"> Vs </td>\";\n\t\t}else if (match.getCurrentStatus() == MatchStatus.PLAYED){\n\t\t\tscoreDisplay = \"<td class=\\\"c3\\\">\";\n\t\t\n\t\t\t// If the match went to penalties, then display it in the score\n\t\t\tif(match.isPenalties()){\n\t\t\t\tscoreDisplay = scoreDisplay + \"<b>(</b>\" + Escaper.htmlEscape(match.getHomeTeamPenalties()) + \"<b>)</b>\" + \n\t\t\t\tEscaper.htmlEscape(match.getHomeTeamScore()) + \"-\" + Escaper.htmlEscape(match.getAwayTeamScore()) + \"<b>(</b>\" +\n\t\t\t\tEscaper.htmlEscape(match.getAwayTeamPenalties()) + \"<b>)</b></td>\";\n\t\t\t}else{\n\t\t\t\tscoreDisplay = scoreDisplay + Escaper.htmlEscape(match.getHomeTeamScore()) + \"-\" + Escaper.htmlEscape(match.getAwayTeamScore()) +\"</td>\";\t\t\n\t\t\t}\n\t\t}else if (match.getCurrentStatus() == MatchStatus.CANCELLED){\n\t\t\tscoreDisplay = \"<td class=\\\"c3\\\">CANCELLED</td>\";\n\t\t}else if (match.getCurrentStatus() == MatchStatus.POSTPONED){\n\t\t\tscoreDisplay = \"<td class=\\\"c3\\\">POSTPONED</td>\";\n\t\t}else if (match.getCurrentStatus() == MatchStatus.FORFEIT){\n\t\t\tscoreDisplay = \"<td class=\\\"c3\\\">\" + Escaper.htmlEscape(match.getHomeTeamScore()) + \"-\" + Escaper.htmlEscape(match.getAwayTeamScore()) + \"*</td>\";\n\t\t}else if (match.getCurrentStatus() == MatchStatus.DOUBLE_FORFEIT){\n\t\t\tscoreDisplay = \"<td class=\\\"c3\\\">\" + Escaper.htmlEscape(match.getHomeTeamScore()) + \"-\" + Escaper.htmlEscape(match.getAwayTeamScore()) + \"**</td>\";\n\t\t}\n\t\t\n\t\t// Populate the array with the tooltip and the score\n\t\tscoreList.add(scoreDisplay);\n\t\treturn scoreList;\n\t}", "public void winner() {\n\t\tList<String> authors = new ArrayList<String>(scores_authors.keySet());\n\t\tCollections.sort(authors, new Comparator<String>() {\n\n\t\t\t@Override\n\t\t\tpublic int compare(String o1, String o2) {\n\t\t\t\treturn scores_authors.get(o1).compareTo(scores_authors.get(o2));\n\t\t\t}\n\t\t});\n\t\tSystem.out.println(\"Score des auteurs :\");\n\t\tfor(String a :authors) {\n\t\t\tSystem.out.println(a.substring(0,5)+\" : \"+scores_authors.get(a));\n\t\t}\n\t\t\n\t\tList<String> politicians = new ArrayList<String>(scores_politicians.keySet());\n\t\tCollections.sort(politicians, new Comparator<String>() {\n\n\t\t\t@Override\n\t\t\tpublic int compare(String o1, String o2) {\n\t\t\t\treturn scores_politicians.get(o1).compareTo(scores_politicians.get(o2));\n\t\t\t}\n\t\t});\n\t\tSystem.out.println(\"Score des politiciens :\");\n\t\tfor(String p :politicians) {\n\t\t\tSystem.out.println(p.substring(0,5)+\" : \"+scores_politicians.get(p));\n\t\t}\n\t}", "@Override\r\n\tpublic String toString(){\r\n\t\tString str = \"\";\r\n\t\t\r\n\t\tfor (int i = 0; i < scoreNumber; i++)\r\n\t\t\tstr += highScores[i].toString() + \"\\n\";\r\n\t\t\r\n\t\treturn str;\r\n\t}", "public void sortHighscores(){\n Collections.sort(highscores);\n Collections.reverse(highscores);\n }", "public void sortScoresDescendently(){\n this.langsScores.sort((LangScoreBankUnit o1, LangScoreBankUnit o2) -> {\n return Double.compare(o2.getScore(),o1.getScore());\n });\n }", "private void printScore() {\r\n View.print(score);\r\n }", "@Override\r\n\tpublic String getResults(int[] scoreCounter)\r\n\t{\r\n\t\tint largest = scoreCounter[0], index = 0;\r\n\t\tString str;\r\n\t\tboolean equalChecker = true;\r\n\t\tint firstScore = scoreCounter[1];\r\n\r\n\t\t// checks whether all scores in the array are equal)\r\n\t\tfor (int y = 2; y <scoreCounter.length; y++)\r\n\t\t{\t\t\r\n\t\t\tif(scoreCounter[y] != firstScore)\r\n\t\t\t\tequalChecker = false;\r\n\t\t}\r\n\r\n\t\tif (equalChecker)\r\n\t\t str = \"Stalemate! All players are tied for points! Everyone loses.\";\r\n\t\telse\r\n\t\t{\r\n\t\t\tfor(int x = 1; x < scoreCounter.length; x++)\r\n\t\t\t{\r\n\t\t\t\tif (scoreCounter[x] > largest)\r\n\t\t\t\t{\t\r\n\t\t\t\t\tlargest = scoreCounter[x];\r\n\t\t\t\t\tindex = x;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tstr = \"Player \" + index + \" wins with \" + largest\r\n\t\t \t + \" correct guesses in a row! Congratulations!\";\r\n\t\t}\r\n\r\n\t\treturn str;\r\n\t\t\r\n\t}", "public String getNumbers(){\n StringBuilder htmlNumbers = new StringBuilder(\"<h2>\");\n for (int i = 1; i<=10; i++){\n htmlNumbers.append(String.valueOf(i) + \".<br>\");\n }\n htmlNumbers.append(\"</h2>\");\n return htmlNumbers.toString();\n }", "private static void writeHtmlBody(SimpleWriter out,\n SortingMachine<Pair<String, Integer>> words, String inputName,\n int n) {\n\n out.println(\"<body>\");\n out.println(\"<h2> Top \" + n + \" words in \" + inputName + \" </h2>\");\n out.println(\"<hr>\");\n\n out.println(\"<div class=\\\"cdiv\\\">\\r\\n\" + \"<p class=\\\"cbox\\\">\");\n\n while (words.size() > 0) {\n Map.Pair<String, Integer> pair = words.removeFirst();\n\n int font = (48 - 11) * (pair.value() - 30);\n font /= (500 - 30);\n font += 11;\n out.println(\"<span style='cursor:default' class=\\\"f\" + font\n + \"\\\" title=\\\"count: \" + pair.value() + \"\\\">\" + pair.key()\n + \" </span>\");\n }\n\n out.println(\"</p>\");\n out.println(\"</div>\");\n\n }", "private String generateSendableHighscoreList() {\n\t\tString toReturn = \"\";\n\t\tfor(String s : highscore.keySet()) {\n\t\t\ttoReturn += s + \"@\" + highscore.get(s) + \"@\";\n\t\t}\n\t\treturn toReturn;\n\t}", "public void displayForLpool(int score) {\n TextView scoreView = (TextView) findViewById(R.id.score_for_lpool);\n scoreView.setText(String.valueOf(score));\n }", "public void score(){\n\t\tscores=new float[3];\n\t\ttop3=new String[3];\n\t\tfor(int i=0;i<3;i++){\n\t\t\ttop3[i]=new String();\n\t\t\tscores[i]=(float)0;\n\t\t}\n\t\t//System.out.println(doclist.size());\n\t\tfor(int i=0;i<doclist.size();i++){\n\t\t\ttry{\n\t\t\t\tDocProcessor dp=new DocProcessor(doclist.get(i));\n\t\t\t\tdp.tokenizing();\n\t\t\t\tdp.stem();\n\t\t\t\t//System.out.println(dp.getContent());\n\t\t\t\t/*for(int j=2;j>=0;j--){\n\t\t\t\t\tSystem.out.println(\"top\"+(3-j)+\": \"+scores[j]);\n\t\t\t\t\tSystem.out.println(top3[j]);\n\t\t\t\t}*/\n\t\t\t\tfloat score=dp.score(this.keywords);\n\t\t\t\tfor(int j=2;j>=0;j--){\n\t\t\t\t\tif(score>scores[j]){\n\t\t\t\t\t\tfor(int k=0;k<j;k++){\n\t\t\t\t\t\t\tscores[k]=scores[k+1];\n\t\t\t\t\t\t\ttop3[k]=top3[k+1];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tscores[j]=score;\n\t\t\t\t\t\ttop3[j]=dp.getContent();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*for(int j=2;j>=0;j--){\n\t\t\t\t\tSystem.out.println(\"top\"+(3-j)+\": \"+scores[j]);\n\t\t\t\t\tSystem.out.println(top3[j]);\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"*******************************\");*/\n\t\t\t}catch(NullPointerException f){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t}", "public String getEstimateReport() {\n\t\tString estimateReport = \"Grade Estimate is based on \" + scores.size()\n\t\t\t\t+ \" scores.\\n\"; // The first sentence of the report indicating\n\t\t// the number of scores based on.\n\t\tdouble totalScore = 0.0; // The score you get.\n\t\tdouble iteratedCatVal = 0.0; // each percentage in the assignment\n\t\t\t\t\t\t\t\t\t\t// percentage\n\t\tdouble categoryScore = 0.0; // The score you get in each category.\n\t\tdouble weightedScore = 0.0; // the final score you get for each category\n\t\t// after multiple the percentage\n\t\tString letterGrade = \"\"; // The final letterGrade\n\n\t\tfor (int i = 0; i < categories.length; i++) {\n\t\t\tScoreIterator itr = scores.iterator(categories[i]);\n\t\t\t// Call the construct and create an iterator.\n\t\t\tif (!itr.hasNext()) { // if there is only one assignment in the\n\t\t\t\t\t\t\t\t\t// array\n\t\t\t\tcategoryScore = 100.00;\n\t\t\t\titeratedCatVal = catValues[i];\n\t\t\t\tweightedScore = categoryScore * iteratedCatVal / 100;\n\t\t\t}\n\t\t\twhile (itr.hasNext()) { // if there are many, find the match one\n\t\t\t\tScore iterated = itr.next();\n\t\t\t\t// Get the next Score in the specific category.\n\t\t\t\tString iteratedCat = iterated.getCategory();\n\t\t\t\t// Get the category of the score which is currently iterating\n\t\t\t\t// on.\n\t\t\t\tfor (int j = 0; j < categories.length; j++) {\n\t\t\t\t\tif (iteratedCat.equalsIgnoreCase(categories[j])) {\n\t\t\t\t\t\titeratedCatVal = catValues[j];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcategoryScore = getAverageScore(iteratedCat);\n\t\t\t\t// call the get Average method to calculate the score of each\n\t\t\t\t// category\n\t\t\t\tweightedScore = categoryScore * iteratedCatVal / 100;\n\t\t\t\t// Calculate the score earned in total scale according to the\n\t\t\t\t// category weight.\n\t\t\t}\n\n\t\t\ttotalScore += weightedScore;\n\t\t\t// create a line of output\n\t\t\testimateReport += String.format(\n\t\t\t\t\t\"%1$7.2f%% = %2$5.2f%% of %3$2.0f%% for \", weightedScore,\n\t\t\t\t\tcategoryScore, iteratedCatVal) + this.catNames[i] + \"\\n\";\n\t\t\t// Output the first part of the estimateReport in a specific format.\n\t\t}\n\n\t\t// Match the letterGrades.\n\t\tfor (int k = 0; k < letterGrades.length; k++) {\n\t\t\tif (totalScore >= letterValues[k]) {\n\t\t\t\tletterGrade = letterGrades[k];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (letterGrade.equals(\"\")) {\n\t\t\tletterGrade = \"unable to estimate letter grade for \" + totalScore;\n\t\t}\n\t\t// Output the wrong message if the totalScore can't be matched\n\t\testimateReport += String.format(\n\t\t\t\t\"--------------------------------\\n%7.2f%% weighted percent \"\n\t\t\t\t+ \"\\nLetter Grade Estimate: \",\n\t\t\t\ttotalScore) + letterGrade;\n\t\t// Output the second part of the estimateReport in a specific format.\n\t\treturn estimateReport;\n\t}", "public void displayY_CardForRmadrid(int score) {\n TextView scoreView = (TextView) findViewById(R.id.yellow_card_count_rmd);\n scoreView.setText(String.valueOf(score));\n }", "public String toTextList() {\r\n Iterator<Match> itr = this.resultsTree.iterator();\r\n Match m;\r\n StringBuilder str = new StringBuilder();\r\n \r\n while (itr.hasNext()) {\r\n m = itr.next();\r\n //Match without results\r\n if (m.getScore1() == -1) {\r\n str\r\n .append(this.leftAlign(m.getTeam1().getName(), 10))\r\n .append(this.centerAlign(\" vs \", 10))\r\n .append(this.leftAlign(m.getTeam2().getName(), 10))\r\n .append(this.centerAlign(\"*** no results yet ***\", 30))\r\n .append(System.lineSeparator());\r\n }\r\n else {\r\n str\r\n .append(this.leftAlign(m.getTeam1().getName(), 10))\r\n .append(\" \")\r\n .append(m.getScore1())\r\n .append(\" \")\r\n .append(this.leftAlign(m.getTeam2().getName(), 10))\r\n .append(\" \")\r\n .append(m.getScore2())\r\n .append(System.lineSeparator());\r\n }\r\n }\r\n \r\n return str.toString();\r\n }", "public static void main(String[] args) {\n\t\tint i;\r\n\t\tint score[] = {80, 90, 20, 60, 100, 50};\r\n\t\tString result = \"A학점입니다\";\r\n\t\t\r\n\t\tfor(i=0; i<score.length; i++) {\r\n\t\t\tresult = (score[i] >= 90) ? \"A학점입니다\"\r\n\t\t\t\t\t: (score[i] >= 80) ? \"B학점입니다\" \r\n\t\t\t\t\t: (score[i] >= 70) ? \"C학점입니다\" \r\n\t\t\t\t\t: (score[i] >= 60) ? \"D학점입니다\" \r\n\t\t\t\t\t: \"F학점입니다\";\r\n\t\t\tSystem.out.println(result);\r\n\t\t}\r\n\t}", "private void displayScore(int score) {\n\n String strScore = String.valueOf (score);\n String message = getString (R.string.yourScoreIs) + strScore + getString (R.string.outOf6);\n\n if (score == 0) message += getString (R.string.score_zero);\n\n if (score == 1 || score == 2 || score == 3) message += getString (R.string.score_low);\n\n if (score == 4 || score == 5) message += getString (R.string.score_notBad);\n\n if (score == 6) message += getString (R.string.score_six);\n\n Toast.makeText (getApplicationContext (), message, Toast.LENGTH_LONG).show ();\n\n }", "public void displayYelowCardB(int score) {\n TextView scoreView = (TextView) findViewById(R.id.yelowcardBtext);\n scoreView.setText(String.valueOf(score));\n }", "private static String getScoreHeader() {\r\n return \"PSM No.\" + SEP\r\n + \"Rank\" + SEP\r\n + \"sequence\" + SEP\r\n + \"length\" + SEP\r\n + \"charge\" + SEP\r\n + \"N-term gap\" + SEP\r\n + \"C-term gap\" + SEP\r\n + \"Pepnovo score\" + SEP\r\n + \"rank score\" + SEP;\r\n }", "private void drawScore() {\n\t\tString score = myWorld.getScore() + \"\";\n\n\t\t// Draw shadow first\n\t\tAssetLoader.shadow.draw(batcher, \"\" + myWorld.getScore(), (136 / 2)\n\t\t\t\t- (3 * score.length()), 12);\n\t\t// Draw text\n\t\tAssetLoader.font.draw(batcher, \"\" + myWorld.getScore(), (136 / 2)\n\t\t\t\t- (3 * score.length() - 1), 11);\n\n\t}", "public String toString()\n { \n \treturn (\"Score: \" + score);\n }", "public void printScore()\n {\n if (score.isEmpty())\n System.out.println(\"\\nThe score is currently empty\");\n else\n {\n for (int i = 0; i < score.size(); i++)\n {\n System.out.format(\"%n%s%d%s %c %d\", \"Note \", i + 1, \":\", score.get(i).getNote(), score.get(i).getBeat());\n }\n System.out.println();\n }\n removeNote();\n }", "private String createShortQuizSummary(int score, String name) {\n String shortQuizSummary = name + getResources().getString(R.string.scored);\n shortQuizSummary += score;\n shortQuizSummary += getResources().getString(R.string.points);\n return shortQuizSummary;\n }", "private String submitAnswersScore(int calculatedScore) {\n String totalMessagePerfect = \"Great Job! You finished with a score of \" + calculatedScore + \" out of 6!\";\n totalMessagePerfect += \"\\nYou really know your Bears history!\";\n totalMessagePerfect += \"\\nThanks for taking my quiz!\";\n\n String totalMessageAlmost = \"Great Try! You finished with a score of \" +calculatedScore + \" out of 6.\";\n totalMessageAlmost += \"\\nThanks for taking my quiz!\";\n\n if (calculatedScore == 6) {\n return totalMessagePerfect;\n }\n else {\n return totalMessageAlmost;\n }\n }", "public void displayDBScores(){\n\t\tCursor c = db.getScores();\n\t\tif(c!=null) {\n\t\t\tc.moveToFirst();\n\t\t\twhile(!c.isAfterLast()){\n\t\t\t\tdisplayScore(c.getString(0),c.getInt(1));\n\t\t\t\tc.moveToNext();\n\t\t\t}\n\t\t\tc.close();\n\t\t}\n\t}", "public String toString() {\n String table = \"\";\n if (this.highScores.isEmpty()) {\n return \"[]\";\n }\n for (ScoreInfo s: this.highScores) {\n table = table.concat(s.getName()).concat(\" : \").concat(Integer.toString(s.getScore())).concat(\"\\n\");\n }\n return table;\n }", "public String toString(){\n\t\tfor (int i = 0; i < scoreList.size(); i++) {\n\t\t\tsource += \" \" + scoreList.get(i);\n\t }\n\t return source;\n\t}", "public void displayRcardForLpool(int score) {\n TextView scoreView = (TextView) findViewById(R.id.red_card_count_lvp);\n scoreView.setText(String.valueOf(score));\n }", "public void printScore(PrintWriter out) {\n out.format(\"SCORE OF %d PLAYERS%n\", players.size());\n out.println(\"ID\\tCASH\\tTYPE\");\n \t\n // Cria uma lista com os jogadores\n \tList<Competitor> score = new ArrayList<Competitor>(players.keySet());\n\n \t// Ordena os jogadores com base no total de cash\n \tCollections.sort(score, new PlayerComparator());\n\n \t// Imprime os resultados\n \tfor(Competitor c : score) {\n \t\tout.format(\"%d.%d\\t%.2f\\t(%s)%n\", players.get(c).Type,\n players.get(c).Id, c.getTotalCash(),\n c.getClass().getSimpleName());\n \t}\n out.flush();\n }", "private void displayStudentByGrade() {\n\n studentDatabase.sortArrayList();\n\n for (Student student : studentDatabase) {\n\n stdOut.println(student.toStringsort() + \"\\n\");\n }\n }", "public void displayYelowCardA(int score) {\n TextView scoreView = (TextView) findViewById(R.id.yelowCardAtext);\n scoreView.setText(String.valueOf(score));\n }", "@Override\n\tpublic void printScore() {\n\n\t}", "public String toRankedTable() {\r\n TreeSet<Team> teamTree = this.getTeamTreeFromMatchTree();\r\n String medal;\r\n int i = 1;\r\n String[] str = new String[teamTree.size() + 1];\r\n List<Team> unorderedTeams = new LinkedList<>();\r\n int currentRank = 0;\r\n int nextMedal = 0;\r\n \r\n //Add all the teams to the list\r\n unorderedTeams.addAll(teamTree);\r\n \r\n //Sort the list with the ranking comparator\r\n Collections.sort(unorderedTeams, rankingComparator);\r\n \r\n //Add the columns headings\r\n str[0] = String.format(\"%15s%10s%10s%10s%10s%10s%10s%10s%10s%10s%n\",\r\n this.centerAlign(\"Team\", 15),\r\n this.centerAlign(\"Rank\", 10),\r\n this.centerAlign(\"Won\", 10),\r\n this.centerAlign(\"Drawn\", 10),\r\n this.centerAlign(\"Lost\", 10),\r\n this.centerAlign(\"For\", 10),\r\n this.centerAlign(\"Against\", 10),\r\n this.centerAlign(\"Points\", 10),\r\n this.centerAlign(\"Diff\", 10),\r\n this.centerAlign(\"Medal\", 10));\r\n \r\n for (Team t : unorderedTeams) {\r\n //Get medal if any\r\n //If the team has a different ranking from the previous ones\r\n if (t.getRank() != currentRank){\r\n //Get the ranking of the current team\r\n currentRank = t.getRank();\r\n //Get the next medal\r\n nextMedal++;\r\n if (nextMedal == 1){\r\n medal = \"Gold\";\r\n }\r\n else if (nextMedal == 2){\r\n medal = \"Silver\";\r\n }\r\n else if (nextMedal == 3){\r\n medal = \"Bronze\";\r\n }\r\n else {\r\n medal = \"\";\r\n }\r\n }\r\n //Same ranking as previous team\r\n //No need to change the medal or ranking\r\n else {\r\n if (nextMedal == 1){\r\n medal = \"Gold\";\r\n }\r\n else if (nextMedal == 2){\r\n medal = \"Silver\";\r\n }\r\n else if (nextMedal == 3){\r\n medal = \"Bronze\";\r\n }\r\n else {\r\n medal = \"\";\r\n }\r\n }\r\n \r\n //Add the team details to the string\r\n str[i] = String.format(\"%15s%10s%10s%10s%10s%10s%10s%10s%10s%10s%n\",\r\n this.centerAlign(t.getName(), 15),\r\n this.centerAlign(Integer.toString(t.getRank()), 10),\r\n this.centerAlign(Integer.toString(t.getMatchWon()), 10),\r\n this.centerAlign(Integer.toString(t.getMatchDrawn()), 10),\r\n this.centerAlign(Integer.toString(t.getMatchLost()), 10),\r\n this.centerAlign(Integer.toString(t.getGoalsFor()), 10),\r\n this.centerAlign(Integer.toString(t.getGoalsAgainst()), 10),\r\n this.centerAlign(Integer.toString(t.getPoints()), 10),\r\n this.centerAlign(Integer.toString(t.goalDiff()), 10),\r\n this.centerAlign(medal, 10));\r\n \r\n i++;\r\n }\r\n \r\n //Transform the array into a single String\r\n StringBuilder sb = new StringBuilder();\r\n for(String s : str) {\r\n sb.append(s);\r\n }\r\n \r\n return sb.toString();\r\n }", "@Override\n\t\t\tpublic int compare(Sentence s1, Sentence s2) {\n\t\t\t\tif(s1.getScore() > s2.getScore()) return -1;\n\t\t\t\telse return 1;\n\t\t\t}", "public String toString() {\r\n\t\t//sort dice\r\n\t\t//now assemble a string, use StringBuilder for speed (it really can get slow)\r\n\t\tStringBuilder result = new StringBuilder();\r\n\t\tfor( DiceGroup diceGroup:dice.values() ) {\r\n\t\t\tresult.append( diceGroup + \" \");\r\n\t\t}\r\n\t\tresult.append(BOLD + \" Total:\" + NORMAL + getTotalScore());\r\n\t\treturn result.toString();\r\n\t}", "@Override\n\tpublic String genResult() {\n\t\tCollections.sort(meanTimes, new Comparator<Time>() {\n\n\t\t\t@Override\n\t\t\tpublic int compare(Time a, Time b) {\n\t\t\t\treturn a.toString().compareTo(b.toString());\n\t\t\t}\n\t\t});\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(realLaps()).append(\"; \");\n\t\tsb.append(totalTime()).append(\"; \");\n\t\tLinkedList<Time> times = new LinkedList<>();\n\t\tif(!startTimes.isEmpty()) times.add(startTimes.getFirst());\n\t\tfor(Time t: meanTimes) times.addLast(t);\n\t\tif(!finishTimes.isEmpty()) times.addLast(finishTimes.getFirst());\n\t\tint i = 0;\n\t\tif(startTimes.isEmpty()) {\n\t\t\ti++;\n\t\t\tsb.append(\"; \");\n\t\t}\n\t\tfor (; i < maxLaps; i++) {\n\t\t\tif (times.size() > 1) {\n\t\t\t\tTime t = times.removeFirst();\n\t\t\t\tsb.append(Time.diff(times.getFirst(), t).toString());\n\t\t\t}\n\t\t\tsb.append(\"; \");\n\t\t}\n\t\tString out = sb.toString();\n\t\treturn out.substring(0, out.length() - 2);\n\n\t}", "private void sort() {\n ScoreComparator comparator = new ScoreComparator();\n Collections.sort(scores, comparator);\n }", "void displayScore(){\n\t\tTextView yourScore = (TextView) findViewById (R.id.yourscore); \n String currentScoreText;\n currentScoreText = Integer.toString(currentScore);\n\t\tyourScore.setText(currentScoreText);\n\t\t\n\t}", "abstract String getScoreString();", "public String getStringScore() {\n\t\treturn Integer.toString(score);\n\t}", "public static List<String> sortScores(List<Double> results) {\n\t\treturn null;\n\t}", "private void setResultsDisplay(double score) {\n TextView resultsTextView = (TextView) findViewById(R.id.results_text_view);\n String letterGrade = getLetterGrade(score);\n resultsTextView.setText(\"Your Grade: \" + letterGrade);\n }", "public void displayFoulForLpool(int score) {\n TextView scoreView = (TextView) findViewById(R.id.foul_count_lvp);\n scoreView.setText(String.valueOf(score));\n }", "public void toHighScore(View view)\n {\n scoreSettings = getSharedPreferences(scoreFile,PREFERENCE_MODE_PRIVATE);\n setContentView(R.layout.highscore_layout);\n TextView firstView = (TextView) findViewById(R.id.first);\n firstView.setText(\"1st: \"+scoreSettings.getString(\"goldName\",\"\")+\", \"+scoreSettings.getInt(\"goldScore\",0)+\" points\");\n TextView secondView = (TextView) findViewById(R.id.second);\n secondView.setText(\"2nd: \"+scoreSettings.getString(\"silverName\",\"\")+\", \"+scoreSettings.getInt(\"silverScore\",0)+\" points\");\n TextView thirdView = (TextView) findViewById(R.id.third);\n thirdView.setText(\"3rd: \"+scoreSettings.getString(\"bronzeName\",\"\")+\", \"+scoreSettings.getInt(\"bronzeScore\",0)+\" points\");\n }", "public String getTop5() {\n\t\tboolean boo = false;\n\t\tArrayList<String> keys = new ArrayList<String>();\n\t\tkeys.addAll(getConfig().getConfigurationSection(\"player.\").getKeys(false));\n\t\tArrayList<Integer> serious = new ArrayList<Integer>();\n\t\tHashMap<Integer, String> seriousp = new HashMap<Integer, String>();\n\t\tfor (int i = 0; i < keys.size(); i++) {\n\t\t\tserious.add(getConfig().getInt(\"player.\" + keys.get(i) + \".gp\"));\n\t\t\tseriousp.put(getConfig().getInt(\"player.\" + keys.get(i) + \".gp\"), keys.get(i));\n\t\t}\n\t\tComparator<Integer> comparator = Collections.<Integer> reverseOrder();\n\t\tCollections.sort(serious, comparator);\n\t\tString retstr = \"\";\n\t\tfor (int i = 0; i < serious.size(); i++) {\n\t\t\tretstr += serious.get(i).toString() + \" - \" + seriousp.get(serious.get(i)) + \"\\n\";\n\t\t\tif (i == 6) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn retstr;\n\t}", "public static String getScoreboard(List<Player> players) {\n // Team Rock Adam Points: 20\n // Team Paper Eve Points: 10\n // Team Scissors Abel Points: 5 DEAD\n\n throw new RuntimeException(\"Method not implemented!\");\n }", "private void displayTeamB_score(int score) {\n TextView teamB_scoreView = findViewById(R.id.teamB_score_textView);\n teamB_scoreView.setText(String.valueOf(score));\n }", "public ArrayList<Question> getQuestionsSortedByScore() {\n \t\tArrayList<Question> sortedQuestions = questions;\n \n \t\tCollections.sort(sortedQuestions, Collections.reverseOrder(new ScoreComparator()));\n \t\t\n \t\treturn sortedQuestions;\n \t}", "public String toString() \n {\n String words = \"\";\n boolean empty = true;\n for (int i = 0; i < scores.length; i++)\n {\n if(scores[i] == null)\n {\n empty = false;\n words = this.name + \" ID Number: \" + this.idNum + \" Home Course: \" + this.homeCourse + \" \\n \" + \"Score\" +\n \" \\t \" + \"Date\" + \" \\t \" + \"Course\" + \" \\t \" + \"Course Rating\" + \" \\t \" + \"Course Slope\" + \" \\n \";\n break;\n }\n else \n {\n words = this.name + \" ID Number: \" + this.idNum + \" Home Course: \" + this.homeCourse + \" \\n \" + \"Score\" +\n \" \\t \" + \"Date\" + \" \\t \" + \"Course\" + \" \\t \" + \"Course Rating\" + \" \\t \" + \"Course Slope\" + \" \\n \" + \n Arrays.asList(scores).toString().replaceFirst(\"]\", \"\").replace(\", \", \"\").replace(\"[\",\"\");\n }\n } \n return words;\n }", "public void print()\n {\n List<Integer> scores = new ArrayList<>();\n ListNode currNode = this.head;\n while(true)\n {\n\n scores.add(currNode.getValue());\n currNode = currNode.getNextNode();\n if(currNode.getNextNode() == null)\n {\n scores.add(currNode.getValue());\n break;\n }\n \n }\n\n if(scores.size() > 1)\n {\n scores.sort((v1, v2) -> v2.compareTo(v1));\n for(int score: scores)\n {\n System.out.println(score);\n }\n } \n }", "public String returnScore(int index)\n {\n if(index<0 || index>=100)\n {\n return \"OutofRange\";\n }\n SQLiteDatabase db = getWritableDatabase();\n Cursor c = db.rawQuery(\"SELECT * FROM Player ORDER BY Score ASC LIMIT 0,100;\",null);\n String entry = \"\";\n\n Log.d(\"G\",index+\"<=\"+c.getCount()+\"\");\n if(index>=c.getCount())\n {\n c.close();\n return \"Empty\";\n }\n\n c.moveToPosition(index);\n\n if(c.getString(c.getColumnIndex(\"Name\"))!=null && c.getString(c.getColumnIndex(\"Score\"))!=null)\n {\n entry = c.getString(c.getColumnIndex(\"Name\"))+\":\"+c.getString(c.getColumnIndex(\"Score\"));\n }\n c.close();\n return entry;\n }", "private String formatHighScore(HighScore highScore){\n return formatTime(highScore.getSeconds()) + \" \" + highScore.getName();\n }", "public static String contentAscending(int quantity){\r\n String content = \"\";\r\n \r\n for (int i = 0; i < quantity; i++) {\r\n content += i + \"\\r\\n\";\r\n }\r\n \r\n return content;\r\n }", "public void createSummary(){\n\n for(int j=0;j<=noOfParagraphs;j++){\n int primary_set = paragraphs.get(j).sentences.size()/5;\n\n //Sort based on score (importance)\n Collections.sort(paragraphs.get(j).sentences,new SentenceComparator());\n for(int i=0;i<=primary_set;i++){\n contentSummary.add(paragraphs.get(j).sentences.get(i));\n }\n }\n\n //To ensure proper ordering\n Collections.sort(contentSummary,new SentenceComparatorForSummary());\n printSummary();\n }", "public String getDetails() {\n\t\tString res = \"\";\n\t\t\n\t\t// -add heading to results String\n\t\tres += \"Scores for game: \" + gameName + \"\\n\";\n\t\t\n\t\t// -does a topScore exist?\n\t\tif ( topScore != -1) {\n\t\t\t\t// -add topScore to results String\n\t\t\tres += \"1st\\t\" + topScore + \"\\t\" + topScorerName + \"\\n\";\n\t\t\t\t// -does a secondScore exist?\n\t\t\tif ( secondScore != -1) {\n\t\t\t\t\t\t// - add secondScore to results String\n\t\t\t\tres += \"2nd\\t\" + secondScore + \"\\t\" + secondScorerName + \"\\n\";\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t// -otherwise \n\t\t\t\t// - add \"Game has not been played.\" to results String\n\t\t\tres += \"Game not played.\\n\";\n\t\t\n\t\t}\n\t\t// return results String\n\t\treturn res;\n\t}", "private void displayScore(int score) {\n // Set a text view to show the score.\n TextView scoreView = findViewById(R.id.score_text_view);\n scoreView.setText(format(\" %d\", score));\n }", "private String topOrderedSentences(PriorityQueue<Sentence> sortedSentences) {\n StringBuilder summarySentences = new StringBuilder();\n\n List<Sentence> orderedSentences = new ArrayList<>();\n int limit = Math.min(3, sortedSentences.size());\n for (int i = 0; i < limit; i++) {\n Sentence topNthSentence = sortedSentences.poll();\n orderedSentences.add(topNthSentence);\n }\n\n // Sort sentences by order they appeared in the article, and restore punctuation\n orderedSentences.sort(new IndexComparator());\n for (Sentence s: orderedSentences) {\n summarySentences.append(s.getSentence());\n summarySentences.append(\". \");\n }\n\n return summarySentences.toString();\n }", "public String findHighestScorers() {\n ArrayList<String> names = new ArrayList<String>();\n String theirNames = \"\";\n int highest = findHighestScore();\n for (int i = 0; i < allQuizTakers.size(); i++) {\n\n if (allQuizTakers.get(i).getScore(0).compareTo(highest) == 0) {\n //note that each quiz taker's arraylist of scores is already sorted in descending order post-constructor\n boolean alreadyThere = false;\n for(String name: names) {\n if(name.equals(allQuizTakers.get(i).getName())) {\n alreadyThere = true;\n }\n }\n if (!alreadyThere) {\n theirNames += allQuizTakers.get(i).getName() + \" \";\n names.add(allQuizTakers.get(i).getName());\n }\n }\n }\n return theirNames;\n }", "@Test\n public void testTopFiveToString() {\n // Complexity 5 -> no record\n this.scoreBoard.setComplexity(5);\n List result = this.scoreBoard.TopFiveToString();\n int count = 0;\n for (Object message : result) {\n assertEquals(\"Not enough users to get a full rank\", message);\n count++;\n }\n assertEquals(5, count);\n\n\n // Complexity 3 -> should have 3 records\n this.scoreBoard.setComplexity(3);\n List result3 = this.scoreBoard.TopFiveToString();\n List<String> expected = new ArrayList<>();\n expected.add(\"User: @u1, got 1 steps in game: ST, in level: 1\");\n expected.add(\"User: @u2, got 10 steps in game: ST, in level: 1\");\n expected.add(\"User: @u3, got 15 steps in game: ST, in level: 1\");\n expected.add(\"Not enough users to get a full rank\");\n expected.add(\"Not enough users to get a full rank\");\n for (int i = 0; i < expected.size(); i++) {\n assertEquals(expected.get(i), result3.get(i));\n }\n }", "public String getScoreText() {\n return scoreText;\n }", "public void showStats() {\r\n List<String> list = new ArrayList();\r\n for (int i = 1; i < 31; i++) {\r\n switch (i) {\r\n case 4:\r\n list.add(name);\r\n break;\r\n case 6:\r\n list.add(String.valueOf(stats.get(\"name\")));\r\n break;\r\n case 7:\r\n list.add(String.valueOf(stats.get(\"score\").split(\":\")[0]));\r\n break;\r\n case 8:\r\n list.add(\"Score\");\r\n break;\r\n case 9:\r\n list.add(String.valueOf(stats.get(\"score\").split(\":\")[1]));\r\n break;\r\n case 10:\r\n list.add(String.valueOf(stats.get(\"break\").split(\":\")[0]));\r\n break;\r\n case 11:\r\n list.add(\"Max Break\");\r\n break;\r\n case 12:\r\n list.add(String.valueOf(stats.get(\"break\").split(\":\")[1]));\r\n break;\r\n case 13:\r\n list.add(String.valueOf(stats.get(\"fouls\").split(\":\")[0]));\r\n break;\r\n case 14:\r\n list.add(\"Fouls\");\r\n break;\r\n case 15:\r\n list.add(String.valueOf(stats.get(\"fouls\").split(\":\")[1]));\r\n break;\r\n case 16:\r\n list.add(String.valueOf(stats.get(\"misses\").split(\":\")[0]));\r\n break;\r\n case 17:\r\n list.add(\"Misses\");\r\n break;\r\n case 18:\r\n list.add(String.valueOf(stats.get(\"misses\").split(\":\")[1]));\r\n break;\r\n case 19:\r\n list.add(String.valueOf(stats.get(\"pots\").split(\":\")[0]));\r\n break;\r\n case 20:\r\n list.add(\"Pots\");\r\n break;\r\n case 21:\r\n list.add(String.valueOf(stats.get(\"pots\").split(\":\")[1]));\r\n break;\r\n case 22:\r\n list.add(String.valueOf(stats.get(\"shots\").split(\":\")[0]));\r\n break;\r\n case 23:\r\n list.add(\"Shots\");\r\n break;\r\n case 24:\r\n list.add(String.valueOf(stats.get(\"shots\").split(\":\")[1]));\r\n break;\r\n case 25:\r\n list.add(String.format(\"%.1f\", Double.parseDouble(stats.get(\"potPercentage\").split(\":\")[0])) + \"%\");\r\n break;\r\n case 26:\r\n list.add(\"Pot Percentage\");\r\n break;\r\n case 27:\r\n list.add(String.format(\"%.1f\", Double.parseDouble(stats.get(\"potPercentage\").split(\":\")[1])) + \"%\");\r\n break;\r\n case 28:\r\n list.add(String.format(\"%.1f\", Double.parseDouble(stats.get(\"safetyPercentage\").split(\":\")[0])) + \"%\");\r\n break;\r\n case 29:\r\n list.add(\"Safety Percentage\");\r\n break;\r\n case 30:\r\n list.add(String.format(\"%.1f\", Double.parseDouble(stats.get(\"safetyPercentage\").split(\":\")[1])) + \"%\");\r\n break;\r\n default:\r\n list.add(\"\");\r\n }\r\n }\r\n\r\n GridView grid = new GridView(context);\r\n grid.setAdapter(new ArrayAdapter(context, android.R.layout.simple_list_item_1, list));\r\n grid.setNumColumns(3);\r\n\r\n new AlertDialog.Builder(context)\r\n .setNegativeButton(\"Back\", null)\r\n .setTitle(\"Match Statistics\")\r\n .setView(grid)\r\n .show();\r\n }", "private void showScores() {\n levelNumber.setText(String.format(\"%s%d\", getResources().getString(R.string.level), level));\n Level l = Level.getLevel(level);\n for (int i = 0; i < Level.MAX_SCORES; i++) {\n Level.Player p = l.getPlayer(i);\n if (p != null) new ScoreTextView(i + 1, p.toString());\n }\n }", "private Label getScoreLabel(final int score){\n\t\tfinal BitmapFontData bitmapFontData = new BitmapFontData(Gdx.files.internal(FontConstants.LARGE_FONT_FILE), false);\n\n\t\tArray<TextureRegion> textureRegions = new Array<TextureRegion>(false, 2);\n\t\ttextureRegions.add(new TextureRegion(new Texture(Gdx.files.internal(FontConstants.LARGE_FONT_IMAGE_1), false)));\n\t\ttextureRegions.add(new TextureRegion(new Texture(Gdx.files.internal(FontConstants.LARGE_FONT_IMAGE_2), false)));\n\t\t\n\t\treturn new Label(Integer.toString(score), new Label.LabelStyle( new BitmapFont(bitmapFontData, textureRegions, true), TEXT_COLOR ));\n\t}", "@Override\n\tpublic String getHTMLwithQuestionResult(int questionNum, ArrayList<String> userAnsList,\n\t\t\tint curScore) {\n\t\tString userAns = userAnsList.get(0);\n\t\tString html_question = getHTML(questionNum);\n\t\tString html_user_answer = \"<b>Your answer:</b> \" + userAns + \"</br><br>\";\n\t\tString html_correct_answer = \"<b>Correct answer:</b> \" + answer + \"</br><br>\";\n\t\tString html_correct = \"\";\n\t\tif (score == curScore) {\n\t\t\thtml_correct += \"<b>You are correct!</b>\" + \"</br><br>\";\n\t\t} else {\n\t\t\thtml_correct += \"<b>You are wrong!</b>\" + \"</br><br>\";\n\t\t}\n\t\t\n\t\treturn html_question + html_user_answer + html_correct_answer + html_correct;\n\t}", "public void displayForTeamB(int score) {\n TextView scoreView = findViewById(R.id.team_b_score);\n scoreView.setText(String.valueOf(score));\n }", "public void displayForTeamB(int score) {\n TextView scoreView = findViewById(R.id.team_b_score);\n scoreView.setText(String.valueOf(score));\n }", "public void displayForTeamB(int score) {\n TextView scoreView = (TextView) findViewById(R.id.team_b_score);\n scoreView.setText(String.valueOf(score));\n }", "public void displayForTeamB(int score) {\n TextView scoreView = (TextView) findViewById(R.id.team_b_score);\n scoreView.setText(String.valueOf(score));\n }", "public void displayForTeamB(int score) {\n TextView scoreView = (TextView) findViewById(R.id.team_b_score);\n scoreView.setText(String.valueOf(score));\n }", "public void displayForTeamB(int score) {\n TextView scoreView = (TextView) findViewById(R.id.team_b_score);\n scoreView.setText(String.valueOf(score));\n }", "public String toString() {\n\t\tStringBuilder str = new StringBuilder();\n\t\tstr.append(\"<html><body><p style=\\\"font-size:15px\\\">\");\n\t\tstr.append(\"Dealer Average Points per Hand: <font color = red>\" + calcAvgPointsPerHand(false) + \"</font><br>\");\n\t\tstr.append(\"Player Average Points per Hand: <font color = red>\" + calcAvgPointsPerHand(true) + \"</font><br><br>\");\n\t\tstr.append(\"Dealer Win Percentage: <font color = red>\" + calcWinPercentage(false) + \"</font><br>\");\n\t\tstr.append(\"Player Win Percentage: <font color = red>\" + calcWinPercentage(true) + \"</font><br>\");\n\t\tstr.append(\"Hand Push Percentage: <font color = red>\" + calcPushPercentage() + \"</font><br>\");\n\t\tstr.append(\"</p><br><br><p style=\\\"font-size:12px\\\">\");\t\t\n\t\t\n\t\tfor(HandStats h : handStats) {\n\t\t\tstr.append(h.toString());\n\t\t}\t\t\n\t\t\n\t\tstr.append(\"</p></body></html>\");\n\t\t\t\t\n\t\treturn str.toString();\t\t\n\t}", "public void displayForTeamB(int score) {\n TextView scoreView = (TextView) findViewById(R.id.team_bb_score);\n scoreView.setText(String.valueOf(score));\n }", "public String getHTML(int index) {\n\t\tString raw=getString(index);\n\t\tif (raw==null) {\n\t\t\treturn raw;\n\t\t}\n\t\tint[] style=getStyle(index);\n\t\tif (style==null) {\n\t\t\treturn raw;\n\t\t}\n\t\tStringBuilder html=new StringBuilder(raw.length()+32);\n\t\tint offset=0;\n\t\twhile (true) {\n\t\t\tint i=-1;\n\t\t\tfor (int j=0;j!=style.length;j+=3) {\n\t\t\t\tif (style[j+1]==-1) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (i==-1 || style[i+1]>style[j+1]) {\n\t\t\t\t\ti=j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint start=((i!=-1)?style[i+1]:raw.length());\n\t\t\tfor (int j=0;j!=style.length;j+=3) {\n\t\t\t\tint end=style[j+2];\n\t\t\t\tif (end==-1 || end>=start) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (offset<=end) {\n\t\t\t\t\thtml.append(raw,offset,end+1);\n\t\t\t\t\toffset=end+1;\n\t\t\t\t}\n\t\t\t\tstyle[j+2]=-1;\n\t\t\t\thtml.append('<');\n\t\t\t\thtml.append('/');\n\t\t\t\thtml.append(getString(style[j]));\n\t\t\t\thtml.append('>');\n\t\t\t}\n\t\t\tif (offset<start) {\n\t\t\t\thtml.append(raw,offset,start);\n\t\t\t\toffset=start;\n\t\t\t}\n\t\t\tif (i==-1) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\thtml.append('<');\n\t\t\thtml.append(getString(style[i]));\n\t\t\thtml.append('>');\n\t\t\tstyle[i+1]=-1;\n\t\t}\n\t\treturn html.toString();\n\t}", "private void displayTeamA_score(int score) {\n TextView teamA_scoreView = findViewById(R.id.teamA_score_textView);\n teamA_scoreView.setText(String.valueOf(score));\n }", "@Override\n\tpublic void printStudent() {\n\t\tSystem.out.print(\"학번\\t국어\\t영어\\t수학\\n\");\n\t\tSystem.out.println(\"=\".repeat(60));\n\t\tint nSize = scoreList.size();\n\t\tfor(int i = 0 ; i < nSize ; i++) {\n\t\t\tScoreVO vo = new ScoreVO();\n\t\t\tSystem.out.print(vo.getNum() + \"\\t\");\n\t\t\tSystem.out.print(vo.getKor() + \"\\t\");\n\t\t\tSystem.out.print(vo.getEng() + \"\\t\");\n\t\t\tSystem.out.print(vo.getMath() + \"\\n\");\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t}", "public void showScore()\n {\n showText(\"Score:\" + score,550,50);\n }", "public void displayForRmadrid(int score) {\n TextView scoreView = (TextView) findViewById(R.id.score_for_madrid);\n scoreView.setText(String.valueOf(score));\n\n }", "private String generateLeaderboardText(String channelId, String channelName) {\r\n String text = \"No leaderboard for this channel yet. Play some games!\";\r\n\r\n Leaderboard lb = leaderboardRepository.findByChannelId(channelId);\r\n\r\n // found leaderboard\r\n if(lb != null) {\r\n List<UserScore> scores = lb.getSortedScores();\r\n\r\n text = String.format(\"Top 5 scores for *#%s*:\\n\", channelName);\r\n\r\n // display first 5\r\n for(int i = 0; i < scores.size() && i < 5; i++) {\r\n UserScore us = scores.get(i);\r\n text += String.format(\"\\t\\u2022 %s: %d\\n\", us.displayName, us.score);\r\n }\r\n }\r\n\r\n return text;\r\n }", "public void displayFoulForRmadrid(int score) {\n TextView scoreView = (TextView) findViewById(R.id.foul_count_rmd);\n scoreView.setText(String.valueOf(score));\n }", "public void displayForTeamK(int score) {\n TextView scoreView = (TextView) findViewById(R.id.team_k_score);\n scoreView.setText(String.valueOf(score));\n }", "public String getScore(){\n return score;\n }", "public void calculateScore(){\n\n score.setText(Integer.toString(80));\n\n\n }", "private void sortScoreboard() {\n score.setSortType(TableColumn.SortType.DESCENDING);\n this.scoreboard.getSortOrder().add(score);\n score.setSortable(true);\n scoreboard.sort();\n }", "public String countScore() {\n String str =\"\";\n System.out.println(\"Game has ended\");\n int playerOneCount = 0;\n int playerTwoCount = 0;\n System.out.println(\"this is size of computer board\" + player2.playerTwoDomino.size());\n System.out.println(\"this is size of boneyard \" + allElements.size());\n System.out.println(\"this is size of human board \" + human1.playerOneDomino.size());\n System.out.println(\"this is size of game board \" + gameBoard.size());\n for (int i = 0; i < human1.playerOneDomino.size(); i++) {\n playerOneCount = playerOneCount + human1.playerOneDomino.get(i).getX() + human1.playerOneDomino.get(i).getX();\n }\n for (int j = 0; j < player2.playerTwoDomino.size(); j++) {\n playerTwoCount = playerTwoCount + player2.playerTwoDomino.get(j).getX() + player2.playerTwoDomino.get(j).getY();\n }\n\n if (playerOneCount < playerTwoCount) {\n str = \"Winner is Human by \" + (playerTwoCount - playerOneCount) + \" points\";\n\n\n } else {\n str = \"Winner is Computer by \" + (playerOneCount - playerTwoCount) + \" points\";\n\n }\n\n return str;\n }", "public void displayScoreA (int score){\n\n TextView scoreA = (TextView)findViewById(R.id.team_a_score);\n scoreA.setText(String.valueOf(score));\n }", "public String printSortedResult() {\n\t\tStringBuilder sb = new StringBuilder();\n\n\t\tsb.append(printStartNumberAndName() + \"; \");\n\t\tsb.append(printInfo());\n\t\t\n\t\tsb.append(printTotalTime());\n\t\t\n\t\tsb.append(errorHandler.print());\n\t\t\n\t\treturn sb.toString();\n\t}", "public void drawHighscores(){\n JFrame highScoreFrame = new JFrame();\n highScoreFrame.setLayout(new BorderLayout());\n highScoreFrame.setSize(new Dimension(280,400));\n String top = \"<h1><u>Highscores</u></h1>\";\n String numbers = getNumbers();\n String scoreString = getTop();\n JLabel enumeration = new JLabel(\"<html>\" + numbers + \"<html>\");\n JLabel scores = new JLabel(\"<html>\" + scoreString + \"<html>\");\n JLabel title = new JLabel(\"<html>\" + top + \"<html>\");\n title.setHorizontalAlignment(SwingConstants.CENTER);\n enumeration.setBorder(BorderFactory.createEmptyBorder(0,85,0,30));\n highScoreFrame.add(title, BorderLayout.PAGE_START);\n highScoreFrame.add(enumeration, BorderLayout.LINE_START);\n highScoreFrame.add(scores, BorderLayout.CENTER);\n highScoreFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);\n highScoreFrame.setLocationRelativeTo(null);\n highScoreFrame.setVisible(true);\n\n for (int i = 1 ; i <= 10 ; i++){\n System.out.println(i);\n }\n }", "public void displayScoreB (int score){\n\n TextView scoreA = (TextView)findViewById(R.id.team_b_score);\n scoreA.setText(String.valueOf(score));\n }" ]
[ "0.71647453", "0.6425889", "0.6325911", "0.6258105", "0.5948416", "0.5860394", "0.5824553", "0.5653893", "0.5647321", "0.56025016", "0.55972", "0.55741864", "0.5561514", "0.55609137", "0.55506134", "0.553353", "0.55246395", "0.55077666", "0.5504714", "0.5503533", "0.54996085", "0.5428478", "0.5407523", "0.539042", "0.5374455", "0.53599936", "0.5354776", "0.5348014", "0.5335464", "0.5334396", "0.533387", "0.5332468", "0.5331827", "0.5331598", "0.5313385", "0.5305491", "0.52942663", "0.5293746", "0.5266529", "0.5263417", "0.526271", "0.5262133", "0.5261557", "0.52582306", "0.5256718", "0.5250263", "0.5249268", "0.5249018", "0.5248744", "0.5240513", "0.5236836", "0.5236542", "0.5236376", "0.522804", "0.52203006", "0.52013046", "0.5194493", "0.51924133", "0.51891845", "0.51820743", "0.51672584", "0.5167101", "0.5167028", "0.51641023", "0.51625395", "0.5162327", "0.5162298", "0.51605827", "0.5155777", "0.51524913", "0.514657", "0.51372296", "0.5134826", "0.5132868", "0.5128313", "0.5127974", "0.51148105", "0.51148105", "0.5107508", "0.5107508", "0.5107508", "0.5107508", "0.51036596", "0.50996387", "0.50990367", "0.50984", "0.50971174", "0.50930244", "0.508986", "0.50808173", "0.50778687", "0.507736", "0.5073632", "0.50719076", "0.5062723", "0.5061849", "0.50589246", "0.5052673", "0.505144", "0.50493354" ]
0.67752147
1
onCreateView: This inflates the view and checks to see if an existing WebView already exists. If it does, the old WebView is added to the view.
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_browser, container, false); webViewContainer = (LinearLayout) view.findViewById(R.id.webViewContainer); //Add the previous WebView to the view if one exists. if(webView != null) { ViewGroup oldParent = (ViewGroup) webView.getParent(); oldParent.removeView(webView); webViewContainer.addView(webView); } else { createNewWebView(); } return view; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_program_unggulan, container, false);\n wvPage1 = (WebView)v.findViewById(R.id.activity_main_webview);\n WebSettings settings = wvPage1.getSettings();\n settings.setJavaScriptEnabled(true);\n wvPage1.setWebViewClient(new MyWebViewClient());\n\n wvPage1.loadUrl(url);\n return v;\n }", "private void createNewWebView()\n {\n //Remove the webView from it's parent if the webView exists\n if(webView != null) {\n ViewGroup parent = (ViewGroup) webView.getParent();\n parent.removeView(webView);\n }\n\n //Create a new WebView\n webView = new WebView(getContext());\n webView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));\n\n //Add the new WebView to the webViewContainer\n webViewContainer.addView(webView);\n }", "@Override public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_contentslist, container, false);\n //View tv = v.findViewById(R.id.text);\n //((TextView)tv).setText(mLabel != null ? mLabel : \"(no label)\");\n //tv.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.gallery_thumb));\n webView = (WebView)v.findViewById(ddoba.android.lwsoft.ddoba.R.id.webView);\n\n customViewContainer = (FrameLayout) v.findViewById(ddoba.android.lwsoft.ddoba.R.id.customViewContainer);\n mWebViewClient = new myWebViewClient();\n webView.setWebViewClient(mWebViewClient);\n\n mWebChromeClient = new myWebChromeClient();\n webView.setWebChromeClient(mWebChromeClient);\n\n //MainActivity.setWebViewSettings(webView);\n setwebsetting(webView);\n\n\n webView.loadUrl(\"http://www.dasibogi.com/\");\n return v;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_web_view, container, false);\n ButterKnife.bind(this, view);\n\n getDataFromBundle();\n wvHomepage.setWebViewClient(new WebViewClient());\n wvHomepage.loadUrl(url);\n\n return view;\n }", "@Override\n public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_web_view, container, false);\n ButterKnife.bind(this, view);\n if(savedInstanceState == null) {\n radioWebView.reset();\n if (getArguments() != null) {\n radioWebView.loadUrl(getArguments().getString(urlTag));\n if (holder.getTimeShiftPlayer() != null)\n radioWebView.setTimeshiftPlayer(holder.getTimeShiftPlayer());\n }\n }\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n if (rootView==null) {\n rootView = inflater.inflate(R.layout.fragment_about_scrolls, container, false);\n web_view = (WebView) rootView.findViewById(R.id.about_scrolls_web_view);\n final WebSettings webSettings = web_view.getSettings();\n webSettings.setJavaScriptEnabled(true);\n web_view.setWebViewClient(new myWebClient());\n web_view.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View view, MotionEvent motionEvent) {\n //Blank listener to disable long click text selection\n return true;\n }\n });\n web_view.setWebViewClient(new WebViewClient() {\n\n @Override\n public void onPageFinished(final WebView view, final String url) {\n super.onPageFinished(view, url);\n web_view.invalidate();\n }\n });\n }\n return rootView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_terms_and_condition, container, false);\n\n\n webView = (WebView) view.findViewById(R.id.webView);\n // displaying content in WebView from html file that stored in assets folder\n webView.getSettings().setJavaScriptEnabled(true);\n //webView.loadUrl(\"file:///android_res/raw/\" + \"terms_and_condition.html\");\n if (AppController.isBaseUrl) {\n webView.loadUrl(AppController.devURL + AppController.terms_and_conditions);\n } else {\n webView.loadUrl(AppController.prodURL + AppController.terms_and_conditions);\n }\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View inflate = inflater.inflate(R.layout.fragment_gui_ge_xq, container, false);\n WebView webView= (WebView) inflate.findViewById(R.id.webView_gg);\n\n webView.getSettings().setJavaScriptEnabled(true);\n// webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);\n webView.loadUrl(\"http://product.suning.com/pds-web/product/graphicDetailsApp/0000000000/102295661/10051/R9000413/1.html\");\n return inflate;\n\n\n }", "@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n\t\tif (savedInstanceState != null) {\n\t\t\tmCurrentPosition = savedInstanceState.getInt(ARG_POSITION);\n\t\t\tmCurrentLink = savedInstanceState.getString(ARG_LINK);\n\t\t}\n\n\t\t// Inflate the layout for this fragment\n\t\tview = inflater.inflate(R.layout.browser, container, false);\n\n\t\t// //////////////\n\t\tintent = getActivity().getIntent();\n\t\tnewLink = intent.getStringExtra(\"newLink\");\n\n\t\t_webView = (WebView) view.findViewById(R.id.wv);\n\n\t\tWebSettings webSettings = _webView.getSettings();\n\t\twebSettings.setJavaScriptEnabled(true);\n\t\twebSettings.setLoadWithOverviewMode(true);\n\t\twebSettings.setPluginState(WebSettings.PluginState.ON);\n\t\t_webView.setInitialScale(1);\n\t\t_webView.getSettings().setBuiltInZoomControls(true);\n\t\t_webView.getSettings().setUseWideViewPort(true);\n\t\t_webView.getSettings().setDisplayZoomControls(false);\n\n\t\taddressEditText = (EditText) view.findViewById(R.id.web_address_edit_text);\n\t\t_goButton = (ImageButton) view.findViewById(R.id.web_go_button);\n\t\t_goButton.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (addressEditText.getText().toString().startsWith(HTTP)) {\n\t\t\t\t\t_webView.loadUrl(addressEditText.getText().toString());\n\t\t\t\t} else {\n\t\t\t\t\t_webView.loadUrl(HTTP + addressEditText.getText().toString());\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\taddressEditText.setOnEditorActionListener(new OnEditorActionListener() {\n\t\t\t@Override\n\t\t\tpublic boolean onEditorAction(TextView v, int actionId, KeyEvent event) {\n\t\t\t\tif (addressEditText.getText().toString().startsWith(HTTP)) {\n\t\t\t\t\t_webView.loadUrl(addressEditText.getText().toString());\n\t\t\t\t} else {\n\t\t\t\t\t_webView.loadUrl(HTTP + addressEditText.getText().toString());\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\n\t\tWebViewClient webClient = new WebViewClient() {\n\t\t\t@Override\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onPageStarted(WebView view, final String url, Bitmap favicon) {\n\t\t\t\tsuper.onPageStarted(view, url, favicon);\n\t\t\t\taddressEditText.post(new Runnable() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\taddressEditText.setText(url);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t_webView.setDownloadListener(new DownloadListener() {\n\t\t\t@Override\n\t\t\tpublic void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {\n\t\t\t\tboolean isExternalStorageConnected = false;// getExternalStorageController().isExtStorage();\n\n\t\t\t\tif (!isExternalStorageConnected) {\n\t\t\t\t\t// makeInfoNotification(MessagesManager.getTitle($insert_usb_to_download,\n\t\t\t\t\t// getResources().getString(R.string.insert_usb_to_download)));\n\t\t\t\t} else {\n\t\t\t\t\t// Intent intent = new Intent(WebActivity.this,\n\t\t\t\t\t// DownloadChooseActivity.class);\n\t\t\t\t\t// intent.putExtra(\"url\", url);\n\t\t\t\t\t// startActivityForResult(intent, DOWNLOAD_RESULTCODE);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t_webView.setWebViewClient(webClient);\n\t\t// _webView.setWebViewClient(new WebViewClient());\n\t\t_webView.setWebChromeClient(new WebChromeClient() {\n\t\t\t@Override\n\t\t\tpublic void onShowCustomView(View view,\n\t\t\t\t\tfinal WebChromeClient.CustomViewCallback callback) {\n\t\t\t\t// if a view already exists then immediately terminate the new\n\t\t\t\t// one\n\t\t\t\tif (mCustomView != null) {\n\t\t\t\t\tcallback.onCustomViewHidden();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Add the custom view to its container.\n\t\t\t\tfinal ImageButton fs = new ImageButton(getActivity());\n\t\t\t\tfs.setOnClickListener(new OnClickListener() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\tfs.setVisibility(View.GONE);\n\t\t\t\t\t\tonHideCustomView();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tGRAVITY_BOTTOM_RIGHT.rightMargin = 16;\n\t\t\t\tGRAVITY_BOTTOM_RIGHT.bottomMargin = 16;\n\n\t\t\t\tmCustomViewContainer.addView(view, COVER_SCREEN_GRAVITY_CENTER);\n\t\t\t\tmCustomViewContainer.addView(fs, GRAVITY_BOTTOM_RIGHT);\n\t\t\t\tmCustomView = view;\n\t\t\t\tmCustomViewCallback = callback;\n\n\t\t\t\t// hide main browser view\n\t\t\t\tmContentView.setVisibility(View.GONE);\n\n\t\t\t\t// Finally show the custom view container.\n\t\t\t\tmCustomViewContainer.setVisibility(View.VISIBLE);\n\t\t\t\tmCustomViewContainer.bringToFront();\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onHideCustomView() {\n\t\t\t\tif (mCustomView == null)\n\t\t\t\t\treturn;\n\n\t\t\t\t// Hide the custom view.\n\t\t\t\tmCustomView.setVisibility(View.GONE);\n\t\t\t\t// Remove the custom view from its container.\n\t\t\t\tmCustomViewContainer.removeView(mCustomView);\n\t\t\t\tmCustomView = null;\n\t\t\t\t// mCustomViewContainer.setVisibility(View.GONE);\n\t\t\t\tmCustomViewCallback.onCustomViewHidden();\n\n\t\t\t\t// Show the content view.\n\t\t\t\tmContentView.setVisibility(View.VISIBLE);\n\t\t\t\tmContentView.bringToFront();\n\t\t\t}\n\n\t\t\t// For Android 3.0+\n\t\t\tpublic void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {\n\t\t\t\t// mUploadMessage = uploadMsg;\n\t\t\t\t// final boolean isExternalStorageConnected =\n\t\t\t\t// getExternalStorageController().isExtStorage();\n\t\t\t\t//\n\t\t\t\t// runOnUiThread(new Runnable()\n\t\t\t\t// {\n\t\t\t\t//\n\t\t\t\t// @Override\n\t\t\t\t// public void run()\n\t\t\t\t// {\n\t\t\t\t// if(!isExternalStorageConnected)\n\t\t\t\t// {\n\t\t\t\t// //makeInfoNotification(MessagesManager.getTitle($insert_usb_to_upload,\n\t\t\t\t// getResources().getString(R.string.insert_usb_to_upload)));\n\t\t\t\t// mUploadMessage.onReceiveValue(null);\n\t\t\t\t// return;\n\t\t\t\t// }\n\t\t\t\t//\n\t\t\t\t// // Intent intent = new Intent(WebActivity.this,\n\t\t\t\t// UploadChooserActivity.class);\n\t\t\t\t// // startActivityForResult(intent, UPLOAD_RESULTCODE);\n\t\t\t\t// }\n\t\t\t\t// });\n\n\t\t\t}\n\n\t\t\t// For Android < 3.0\n\t\t\t@SuppressWarnings(\"unused\")\n\t\t\tpublic void openFileChooser(ValueCallback<Uri> uploadMsg) {\n\t\t\t\topenFileChooser(uploadMsg, \"\");\n\t\t\t}\n\n\t\t\t// For Android > 4.1\n\t\t\t@SuppressWarnings(\"unused\")\n\t\t\tpublic void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {\n\t\t\t\topenFileChooser(uploadMsg, acceptType);\n\t\t\t}\n\n\t\t});\n\n\t\tfinal ImageButton homeImageView = (ImageButton) view.findViewById(R.id.web_home_image_view);\n\t\thomeImageView.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t_webView.loadUrl(HOME_PAGE);\n\t\t\t}\n\t\t});\n\n\t\tfinal ImageButton webBackImageView = (ImageButton) view.findViewById(R.id.web_back_image_view);\n\t\twebBackImageView.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (_webView.canGoBack()) {\n\t\t\t\t\t_webView.goBack();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tfinal ImageButton webForwardImageView = (ImageButton) view.findViewById(R.id.web_forward_image_view);\n\t\twebForwardImageView.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (_webView.canGoForward()) {\n\t\t\t\t\t_webView.goForward();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tif (getActivity().getIntent().getExtras() != null) {\n\t\t\tString _url = getActivity().getIntent().getExtras()\n\t\t\t\t\t.getString(LINK_PARAM, null);\n\t\t\tif (_url != null) {\n\t\t\t\turl = _url;\n\t\t\t}\n\t\t}\n\t\t_webView.loadUrl(url);\n\t\treturn view;\n\t}", "@Override\r\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n\t\t\tBundle savedInstanceState) {\n\t\tView view = inflater.inflate(R.layout.fragment_lesson_web_view, container,\r\n\t\t\t\tfalse);\r\n\t\tlessonWeb = (WebView) view.findViewById(R.id.webview);\r\n\t\tString sourceLesson = getArguments().getString(lessonWebUrl);\r\n\t\tlessonWeb.loadUrl(sourceLesson);\r\n\t\t\r\n\t\treturn view;\r\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n if (mWebView != null) {\n mWebView.destroy();\n }\n mWebView = new WebView(getActivity());\n \n mWebView.setWebViewClient(new WebViewClient() {\n \n \n public void onPageFinished(WebView view, String url1) {\n if(url1.contains(\"students.yale.edu/evalsearch\")){\n \t ((MainActivity) activity).userAuthenticated = true;\n \n \t onFinishCreateCourseFragment(); \n }\n }\n });\n mWebView.loadUrl(mUrl); //load the course evaluation search url to generate correct cookies.\n \n mIsWebViewAvailable = true;\n return mWebView;\n }", "@SuppressWarnings(\"deprecation\")\n\t@SuppressLint({ \"SetJavaScriptEnabled\", \"NewApi\" })\n\tprivate void initWebview() {\n\t\twebView = (WebView) findViewById(AppUtility.getResourseIdByName(getApplicationContext().getPackageName(), \"id\", \"webView1\"));\n\n\t\twebView.setWebChromeClient(webChromeClient);\n\t\twebView.getSettings().setJavaScriptEnabled(true);\n\t\twebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n\t\twebView.getSettings().setDomStorageEnabled(true);\n\t\twebView.getSettings().setSupportZoom(false);\n\n\t\t// To enable web debugging for Android KitKat(API level 19) & above\n\t\tif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n\t\t\tWebView.setWebContentsDebuggingEnabled(true);\n\t\t}\n\t\t// ----------------------------------------------------------------\n\n\t\t// Done to facilitate debugging through tools such as Node JS as devices\n\t\t// running Jelly Bean and above were not supporting such debugging\n\t\tif (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN)\n\t\t\twebView.getSettings().setAllowUniversalAccessFromFileURLs(true);\n\n\t\t// TODO temp changes\n\t\twebView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);\n\t\t// -------------------------------------\n\n\t\twebView.setVerticalScrollBarEnabled(false);\n\t\twebView.setOverScrollMode(View.OVER_SCROLL_NEVER);\n\t\t// Defines the rendering priority for WebView.Improves performance in\n\t\t// rendering pages\n\t\twebView.getSettings().setRenderPriority(RenderPriority.HIGH);\n\t\t// Prevents the cache from loading. Improves performance in creating and\n\t\t// rendering pages\n\t\twebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);\n\t\t// Disabling hardware acceleration by default in Android 4.0+\n\t\tif (isICSOrHigher) {\n\t\t\twebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);\n\t\t}\n\n\t\tSmartJsInterface smartJsInterface = new SmartJsInterface(this);\n\t\twebView.addJavascriptInterface(smartJsInterface, \"appezAndroid\");\n\t\twebView.setWebViewClient(new SmartWebViewClient(this));\n\n\t\t// To restrict horizontal scrolling\n\t\twebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);\n\t\twebView.setBackgroundResource(AppUtility.getResourseIdByName(getApplicationContext().getPackageName(), \"drawable\", \"splash\"));\n\t\tif (getIntent().hasExtra(SmartConstants.CHECK_FOR_BACKGROUND)) {\n\t\t\twebViewDefaultImg = (ImageView) findViewById(AppUtility.getResourseIdByName(getApplicationContext().getPackageName(), \"id\", \"webview1bg\"));\n\t\t\tif (webViewDefaultImg != null) {\n\t\t\t\tif (getIntent().getBooleanExtra(SmartConstants.CHECK_FOR_BACKGROUND, false)) {\n\t\t\t\t\twebViewDefaultImg.setVisibility(View.VISIBLE);\n\t\t\t\t} else {\n\t\t\t\t\twebViewDefaultImg.setVisibility(View.INVISIBLE);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Added for detecting the show/hide of the soft keyboard\n\t\tfinal View activityRootView = findViewById(AppUtility.getResourseIdByName(getApplicationContext().getPackageName(), \"id\", \"frame_layout\"));\n\t\tactivityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {\n\t\t\t@Override\n\t\t\tpublic void onGlobalLayout() {\n\t\t\t\tint heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();\n\t\t\t\tLog.d(SmartConstants.APP_NAME, \"SmartViewActivity->initWebview->soft keyboard->heightDiff:\" + heightDiff);\n\t\t\t\tif (heightDiff > 100) {\n\t\t\t\t\t// if more than 100 pixels, its probably a keyboard...\n\t\t\t\t\tisSoftKeyboardShown = true;\n\t\t\t\t\tLog.d(SmartConstants.APP_NAME, \"SmartViewActivity->initWebview->soft keyboard shown\");\n\t\t\t\t} else {\n\t\t\t\t\tif (isSoftKeyboardShown) {\n\t\t\t\t\t\tisSoftKeyboardShown = false;\n\t\t\t\t\t\tLog.d(SmartConstants.APP_NAME, \"SmartViewActivity->initWebview->soft keyboard hidden\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t// ---------------------------------------\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_article, container, false);\n\n mProgressBar = view.findViewById(R.id.progress_bar);\n mProgressBar.setVisibility(View.VISIBLE);\n\n mWebView = view.findViewById(R.id.web_view);\n WebSettings webSettings = mWebView.getSettings();\n webSettings.setJavaScriptEnabled(true);\n\n// WebViewClientImpl webViewClient = new WebViewClientImpl(getActivity());\n// mWebView.setWebViewClient(webViewClient);\n\n view.findViewById(R.id.image_view_back).setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n dismiss();\n }\n });\n\n mWebView.setWebViewClient(new WebViewClient() {\n @Override\n public void onPageFinished(WebView view, String url) {\n Log.e(TAG, \"onPageFinished: \");\n mPresenter.dismissProgressBar();\n }\n });\n\n Bundle bundle = getArguments();\n mPresenter = new ArticlePresenter(this);\n mPresenter.checkBundle(bundle);\n\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n {\n View view = inflater.inflate(R.layout.fragment_chat, container, false);\n\n w = (WebView)view.findViewById(R.id.wi);\n progressBar = (ProgressBar) view.findViewById(R.id.progressBar);\n w.setWebViewClient(new WebViewClient(){\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon) {\n super.onPageStarted(view, url, favicon);\n progressBar.setVisibility(View.VISIBLE);\n }\n\n @Override\n public void onPageFinished(WebView view, String url) {\n super.onPageFinished(view, url);\n progressBar.setVisibility(View.GONE);\n }\n });\n WebSettings ws = w.getSettings();\n ws.setJavaScriptEnabled(true);\n w.loadUrl(\"https://tawk.to/chat/5c3b502e494cc76b7872d77a/default\");\n w.getSettings().setJavaScriptEnabled(true);\n w.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_electro_potential, container, false);\n fordisplay = (WebView)view.findViewById(R.id.displayPotential);\n fordisplay.getSettings().setJavaScriptEnabled(true);\n fordisplay.getSettings().setBuiltInZoomControls(true);\n fordisplay.loadUrl(\"file:///android_asset/potential.html\");\n return view;\n }", "@Nullable\n @Override\n public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_condition, container, false);\n webView = v.findViewById(R.id.webView);\n webView.loadUrl(\"http://www.mazad-sa.net/ma5dom/api/webview\");\n return v;\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View root = inflater.inflate(R.layout.fragment_web, container, false);\n webView = root.findViewById(R.id.web_webView);\n webView.setWebViewClient(new WebViewClient());\n webView.loadUrl(\"https://www.google.com\");\n webView.setOnKeyListener(new View.OnKeyListener(){\n public boolean onKey(View v, int keyCode, KeyEvent event) {\n if (keyCode == KeyEvent.KEYCODE_BACK\n && event.getAction() == MotionEvent.ACTION_UP\n && webView.canGoBack()) {\n handler.sendEmptyMessage(1);\n return true;\n }\n return false;\n }\n });\n return root;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_web, container, false);\n initialize(view);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View fragmentView = inflater.inflate(R.layout.fragment_quiz_intro_nasilje, container, false);\n WebView webView = fragmentView.findViewById(R.id.webViewKviz1);\n webView.loadUrl(\"file:///android_asset/upute_kviz__nasilje.html\");\n unbinder = ButterKnife.bind(this, fragmentView);\n return fragmentView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n binding = DataBindingUtil.inflate(inflater, R.layout.fragment_ggunotice, container, false);\n View v = binding.getRoot();\n\n asyncDialog = new ProgressDialog(getActivity());\n WebSettings settings = binding.webview.getSettings();\n settings.setJavaScriptEnabled(true);\n settings.setSupportZoom(true);\n binding.webview.loadUrl(URL);\n binding.webview.setWebViewClient(new WebViewClient() {\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon) {\n asyncDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);\n asyncDialog.setMessage(\"잠시만 기다려주세요...\");\n asyncDialog.show();\n }\n\n @Override\n public void onPageFinished(WebView view, String url) {\n asyncDialog.dismiss();\n binding.webview.loadUrl(\"javascript:(function(){\" +\n \"document.getElementById('spot').style.display = 'none';\"+\n \"document.getElementById('header').style.display = 'none';\"+\n \"document.getElementById('footer').style.display = 'none';\"+\n \"})()\");\n }\n });\n binding.webview.setOnKeyListener (new View.OnKeyListener () {\n @Override\n public boolean onKey (View v, int keyCode, KeyEvent event) {\n\n if (keyCode == KeyEvent. KEYCODE_BACK ) {\n if (binding.webview.canGoBack()) {\n binding.webview.goBack();\n } else {\n getActivity().onBackPressed();\n }\n return true;\n }\n return false;\n }\n });\n\n return v;\n }", "@Override\n public void onDestroyView() {\t\t\n \t\t\t \n mIsWebViewAvailable = false;\n super.onDestroyView();\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View myView = inflater.inflate(R.layout.fragment_second, container, false);\n TextView myTextView = (TextView) myView.findViewById(R.id.textView2);\n //set the value of the TextView to include the position\n myTextView.setText(tag);\n\n WebView webView = (WebView) myView.findViewById(R.id.webView);\n webView.setWebViewClient(new WebViewClient() {\n\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n // TODO Auto-generated method stub\n view.loadUrl(url);\n return true;\n }\n });\n\n webView.getSettings().setJavaScriptEnabled(true);\n webView.loadUrl(url);\n return myView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n // Inflate the layout for this fragment\n View v = inflater.inflate(R.layout.fragment_share_flickr, container, false);\n WebView myWebView = v.findViewById(R.id.flickrWebView);\n myWebView.setWebViewClient(new WebViewClient());\n myWebView.loadUrl(flickrUrl);\n return v;\n }", "@Override\n\tpublic void initWebView(BBWebView webView) {\n\t\tthis._webView = webView;\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_risk_inspection, container, false);\n initTitle(view, mTitle);\n WebView webView = (WebView) view.findViewById(R.id.risk_webview);\n CircleProgressBar bar = (CircleProgressBar) view.findViewById(R.id.risk_progressbar);\n initWebView(webView, bar, mUrl, new WebRiskInspectionJSInterface() {\n @JavascriptInterface\n @Override\n public void WebGetResult(String json) {\n if (BuildConfig.DEBUG) {\n Log.e(TAG, json);\n }\n RiskResult riskResult = RiskResult.parser(json);\n final String uri = Strings.getIntentUri(RiskInspectionFragment.class.getSimpleName(),\n Strings.INTENT_CONTENT, String.valueOf(riskResult.getData().getF2()));\n getActivity().runOnUiThread(new Runnable() {\n @Override\n public void run() {\n onButtonPressed(Uri.parse(uri));\n }\n });\n }\n });\n return view;\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.common_browser);\n mWebView = (WebView) findViewById(R.id.web_view);\n init();\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view= inflater.inflate(R.layout.fragment_blog_detail, container, false);\n\n sharedPreferences = getActivity().getSharedPreferences(Configuration.MY_PREF, Context.MODE_PRIVATE);\n editor = sharedPreferences.edit();\n user_id=sharedPreferences.getString(\"user_id\",\"\");\n url=getArguments().getString(\"blogId\");\n webView=(WebView)view.findViewById(R.id.wv);\n webView.getSettings().setJavaScriptEnabled(true);\n\n webView.setWebViewClient(new WebViewClient(){\n\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, String url){\n view.loadUrl(url+\"/\"+user_id);\n return true;\n }\n });\n webView.loadUrl(url+\"/\"+user_id);\n\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.fragment_web_view, container, false);\n\n String url = ((MainActivity) getActivity()).getUrl();\n webTitle = rootView.findViewById(R.id.url_text);\n webTitle.setText(url);\n web_refresh = rootView.findViewById(R.id.web_refresh);\n web_refresh.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n web_refresh.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.fade_in));\n web_view.loadUrl(webTitle.getText()+\"\");\n }\n });\n\nif(url!= null) {\n web_view = rootView.findViewById(R.id.webViewFragment);\n progressBar = rootView.findViewById(R.id.progressBar);\n WebSettings webSettings = web_view.getSettings();\n webSettings.setJavaScriptEnabled(true);\n web_view.setWebChromeClient(new WebChromeClient() {\n public void onProgressChanged(WebView view, int progress) {\n if (progress < 100 && progressBar.getVisibility() == ProgressBar.GONE) {\n progressBar.setVisibility(ProgressBar.VISIBLE);\n }\n\n progressBar.setProgress(progress);\n if (progress == 100) {\n progressBar.setVisibility(ProgressBar.GONE);\n web_refresh.clearAnimation();\n }\n }\n });\n //webView.loadUrl(\"https://drivezy.com\");\n //title.setText();\n\n web_view.loadUrl(url);\n}\n\n return rootView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n if (rootView==null) {\n rootView = inflater.inflate(R.layout.fragment_about_scrolls, container, false);\n web_view = (WebView) rootView.findViewById(R.id.about_scrolls_web_view);\n webView=(WebView)rootView.findViewById(R.id.webView);\n// rl=(ImageView)rootView.findViewById(R.id.sprite);\n // rl.setImageResource(R.drawable.animback);\n\n // AnimationDrawable imgAnimation = (AnimationDrawable) rl.getDrawable();\n // imgAnimation.setOneShot(false);\n // imgAnimation.start();\n final WebSettings webSettings = web_view.getSettings();\n webSettings.setJavaScriptEnabled(true);\n web_view.setWebViewClient(new myWebClient());\n web_view.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View view, MotionEvent motionEvent) {\n //Blank listener to disable long click text selection\n return true;\n }\n });\n web_view.setWebViewClient(new WebViewClient() {\n\n @Override\n public void onPageFinished(final WebView view, final String url) {\n super.onPageFinished(view, url);\n web_view.invalidate();\n }\n });\n //startWaterAnimation();\n }\n final WebSettings webSettings = web_view.getSettings();\n webSettings.setJavaScriptEnabled(true);\n webView.setWebViewClient(new myWebClient());\n webView.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View view, MotionEvent motionEvent) {\n //Blank listener to disable long click text selection\n return true;\n }\n });\n webView.setWebViewClient(new WebViewClient() {\n\n @Override\n public void onPageFinished(final WebView view, final String url) {\n super.onPageFinished(view, url);\n web_view.invalidate();\n }\n });\n //startWaterAnimation();\n\n return rootView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.fragment_webview, container, false);\n ((MainActivity) getActivity()).setDrawerState(false);\n ((MainActivity) getActivity()).setTitle(\"\");\n webView = (WebView) rootView.findViewById(R.id.webview);\n img_download = (ImageView) rootView.findViewById(R.id.img_download);\n progressDialog = new ProgressDialog(getActivity());\n\n\n webView.getSettings().setJavaScriptEnabled(true);\n webView.getSettings().setAllowContentAccess(true);\n webView.getSettings().setUseWideViewPort(true);\n webView.getSettings().setLoadWithOverviewMode(true);\n // webView.getSettings().setSupportZoom(true);\n webView.getSettings().setBuiltInZoomControls(true);\n webView.getSettings().setDisplayZoomControls(false);\n webView.getSettings().setDomStorageEnabled(true);\n\n if (Build.VERSION.SDK_INT >= 21) {\n webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);\n }\n bundle = getArguments();\n if (bundle.containsKey(\"Social_url\")) {\n img_download.setVisibility(View.GONE);\n// progressDialog.setMessage(\"Please Wait..\");\n// progressDialog.show();\n try {\n String[] file_split = bundle.getString(\"Social_url\").split(\"\\\\.(?=[^\\\\.]+$)\");\n String str_exten = file_split[1];\n if (str_exten.equalsIgnoreCase(\"pdf\")) {\n webView.setWebViewClient(new WebViewController());\n webView.loadUrl(\"http://docs.google.com/gview?embedded=true&url=\" + bundle.getString(\"Social_url\"));\n\n } else {\n webView.setWebViewClient(new WebViewClient());\n webView.loadUrl(bundle.getString(\"Social_url\"));\n }\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n } else if (bundle.containsKey(\"document_file\")) {\n img_download.setVisibility(View.VISIBLE);\n Log.d(\"AITL\", \"BundleWebview\" + \"http://docs.google.com/gview?embedded=true&url=\" + bundle.getString(\"document_file\"));\n progressDialog.setMessage(\"Please Wait..\");\n progressDialog.show();\n webView.setWebViewClient(new WebViewController());\n webView.loadUrl(\"http://docs.google.com/gview?embedded=true&url=\" + bundle.getString(\"document_file\"));\n\n img_download.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n if (Build.VERSION.SDK_INT >= 23) {\n if (isCameraPermissionGranted()) {\n downloadFile();\n } else {\n requestPermission();\n }\n } else {\n downloadFile();\n }\n }\n });\n }\n return rootView;\n }", "private void setupWebView(){\n \t\n\t\twebView = (WebView) findViewById(R.id.webview);\n\t\twebView.getSettings().setJavaScriptEnabled(true);\n\t\t/** Create an WebViewClient to add and remove an progress dialog*/\n\t\twebView.setWebViewClient(new WebViewClient() {\n\t\t\t@Override\n\t\t\tpublic void onPageStarted(WebView view, String url, Bitmap favicon) {\n\t\t\t\tshowDialog(PROGRESS_DIALOG);\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onPageFinished(WebView view, String url) {\n\t\t\t\tremoveDialog(PROGRESS_DIALOG); \n\t\t\t}\n\t\t});\n\t\twebView.loadUrl(MAP_URL);\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_tab2, container, false);\n\n //find webView layout\n\n //find id\n button1 = view.findViewById(R.id.buttonId1);\n button2 = view.findViewById(R.id.buttonId2);\n button3 = view.findViewById(R.id.buttonId3);\n button4 = view.findViewById(R.id.buttonId4);\n button5 = view.findViewById(R.id.buttonId5);\n button6 = view.findViewById(R.id.buttonId6);\n button7 = view.findViewById(R.id.buttonId7);\n button8 = view.findViewById(R.id.buttonId8);\n\n button1.setOnClickListener(this);\n button2.setOnClickListener(this);\n button3.setOnClickListener(this);\n button4.setOnClickListener(this);\n button5.setOnClickListener(this);\n button6.setOnClickListener(this);\n button7.setOnClickListener(this);\n button8.setOnClickListener(this);\n\n\n return view;\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_web_view);\n\n webView = findViewById(R.id.webView);\n\n webView.setWebViewClient(new WebViewClient());\n webView.getSettings().setJavaScriptEnabled(true);\n webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n // webView.setWebChromeClient(new MyCustomChromeClient(this));\n// webView.setWebViewClient(new MyCustomWebViewClient(this));\n// webView.clearCache(true);\n// webView.clearHistory();\n// webView.getSettings().setJavaScriptEnabled(true);\n// webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n webView.loadUrl(\"https://uperfect.in/\");\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View mview=inflater.inflate(R.layout.fragment_smartgrid, container, false);\n mywebview=(WebView)mview.findViewById(R.id.web);\n mywebview.loadUrl(\"https://solarrooftop.gov.in/rooftop_calculator\");\n WebSettings webSettings=mywebview.getSettings();\n webSettings.setJavaScriptEnabled(true);\n mywebview.setWebViewClient(new WebViewClient());\n return mview;\n }", "@SuppressLint({ \"SetJavaScriptEnabled\", \"NewApi\" })\n\tprivate void init_webview() {\n\t\tmWebView = (WebView) findViewById(R.id.webView1);\n\t\tmWebView.getSettings().setJavaScriptEnabled(true);\n\t\tmWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);\n\t\tmWebView.setHorizontalScrollBarEnabled(true);\n\t\tmWebView.getSettings().setSupportZoom(true);\n\t\tmWebView.getSettings().setBuiltInZoomControls(true);\n\t\tmWebView.setInitialScale(50);\n\t\tmWebView.setHorizontalScrollbarOverlay(true);\n\t\tmWebView.getSettings().setUseWideViewPort(true);\n\t\tmWebView.getSettings().setLoadWithOverviewMode(true);\n\t}", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.banner_webview);\n\t\tinitView();\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n\n\n v = inflater.inflate(R.layout.fragment_blank, container, false);\n webView = v.findViewById(R.id.webv);\n if (activity!=null)\n\n ((MainActivity) activity).showDialog(false);\n\n\n alertDialog = new AlertDialog.Builder(activity)\n//set title\n//set message\n .setView(R.layout.loadind_dialog)\n // .setMessage(\"برجاء الانتظار وسيتم تحويلك تلقائيا\")\n//set positive button\n .setCancelable(false)\n .create();\n\n\n final String mimeType = \"text/html\";\n final String encoding = \"UTF-8\";\n String html = getArguments().getString(\"html\");\n\n\n // webView.setWebViewClient(new WebViewClient());\n\n webView.getSettings().setJavaScriptEnabled(true);\n webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n webView.loadDataWithBaseURL(\"\", html, mimeType, encoding, \"\");\n webView.addJavascriptInterface(new MyJavaScriptInterface(activity), \"HtmlViewer\");\n\n\n webView.setWebChromeClient(new WebChromeClient() {\n public boolean onConsoleMessage(ConsoleMessage cmsg) {\n\n /* process JSON */\n\n Log.e(\"console\",\"message is \"+cmsg.message());\n\n try {\n JSONObject jsonObject = new JSONObject(cmsg.message());\n System.out.println(\"json is \" + cmsg.message());\n int status = Integer.parseInt(jsonObject.getString(\"status\"));\n boolean success = (boolean) jsonObject.getBoolean(\"success\");\n\n if (status == 200 && success) {\n\n\n // ((MainActivity)activity).setPaymentSuccess(true);\n\n // ((MainActivity)activity).fragmentStack.replace(new OrderDoneFragment());\n\n\n\n } else {\n // ((MainActivity)activity).setPaymentSuccess(false);\n\n\n // ((MainActivity)activity).fragmentStack.pop();\n\n }\n\n } catch (JSONException e) {\n\n }\n\n\n return true;\n\n }\n });\n\n\n webView.setWebViewClient(new WebViewClient() {\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {\n\n // Log.d(\"webb \", \"shouldOverrideUrlLoading \" + request.getUrl().toString());\n\n return super.shouldOverrideUrlLoading(view, request);\n }\n\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n // Log.d(\"webb \", \"shouldOverrideUrlLoading \" + url);\n\n return super.shouldOverrideUrlLoading(view, url);\n }\n\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon) {\n super.onPageStarted(view, url, favicon);\n\n if (url.contains(\"handle-payment-response\"))\n webView.setVisibility(View.INVISIBLE);\n Log.d(\"webb \", \"onPageStarted \" + url);\n if (url.equals(\"http://www.mawared.badee.com.sa/api/v1/payment/return\")||url.contains(\".payfort.com/FortAPI/general/backToMerchant\")) {\n // Toast.makeText(activity, \"please wait\", Toast.LENGTH_SHORT).show();\n showDialog();\n //startActivity(new Intent(activity,MainActivity.class));\n }\n if (url.equals(BASE_URL+\"payments/status/failure\")) {\n ((MainActivity)activity).setPaymentSuccess(false);\n\n ((MainActivity) activity).fragmentStack.pop();\n\n }\n else if (url.equals(BASE_URL+\"payments/status/success\")){\n ((MainActivity)activity).setPaymentSuccess(true);\n\n ((MainActivity) activity).fragmentStack.pop();\n ((MainActivity) activity).fragmentStack.pop();\n\n }\n\n }\n\n @Override\n public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {\n super.onReceivedError(view, request, error);\n\n // Log.d(\"webb \", \"onReceivedError \" + error.getDescription() + error.getErrorCode());\n\n }\n\n\n @Nullable\n @Override\n public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {\n //Log.d(\"requestto\", request.getMethod() + \" \" + request.getUrl() + \" \" + request.getRequestHeaders().toString());\n\n\n return super.shouldInterceptRequest(view, request);\n }\n\n @Override\n public void onPageFinished(WebView view, String url) {\n // Toast.makeText(activity, \"is \"+url, Toast.LENGTH_SHORT).show();\n // Toast.makeText(activity, \"web \"+view.toString(), Toast.LENGTH_LONG).show();\n\n Log.d(\"webb \", \"onPageFinished \" + url);\n Log.d(\"webb \", \"webview \" + view.toString());\n if (url.equals(\"http://www.mawared.badee.com.sa/api/v1/payment/return\")||url.contains(\".payfort.com/FortAPI/general/backToMerchant\")) {\n // Toast.makeText(activity, \"please wait\", Toast.LENGTH_SHORT).show();\n showDialog();\n //startActivity(new Intent(activity,MainActivity.class));\n }\n\n Log.e(\"console\",\"url is \"+url);\n webView.loadUrl(\"javascript:console.log(document.body.getElementsByTagName('pre')[0].innerHTML);\");\n\n }\n });\n return v;\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_webvitool);\n webview= findViewById(R.id.webviewweb);\n webview.getSettings().setJavaScriptEnabled(true);\n webview.setWebViewClient(new MyWebViewClient());\n openURL();\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_mainpage_, container, false);\n initUI(v);\n clickEvents();\n return v;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_course, container, false);\n WebView mWebView = view.findViewById(R.id.courseWebView);\n // Enable Javascript\n WebSettings webSettings = mWebView.getSettings();\n webSettings.setJavaScriptEnabled(true);\n // 화면 비율\n webSettings.setUseWideViewPort(true);// wide viewport를 사용하도록 설정\n webSettings.setLoadWithOverviewMode(true);// 컨텐츠가 웹뷰보다 클 경우 스크린 크기에 맞게 조정\n // 웹뷰 멀티 터치 가능하게 (줌기능)\n //webSettings.setBuiltInZoomControls(true);// 줌 아이콘 사용\n webSettings.setSupportZoom(true);\n // Force links and redirects to open in the WebView instead of in a browser\n mWebView.setWebViewClient(new WebViewClient());\n mWebView.loadUrl(\"http://192.168.219.100:7000/E_LearningPage.jsp\");\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_tv, container, false);\n WebView webView_video = view.findViewById(R.id.webView_video);\n String url = \"https://www.google.com/\";\n webView_video.loadUrl(url);\n// String header = \"<iframe width=\\\"\\\" height=\\\"480\\\" src=\\\"https://www.youtube.com/embed/MM4ShEnKw3A\\\" frameborder=\\\"0\\\" allow=\\\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\\\" allowfullscreen></iframe>\";\n// webView_video.loadData(header, \"text/html\", \"UTF-8\");\n webView_video.setWebViewClient(new WebViewClient());\n webView_video.getSettings().setJavaScriptEnabled(true);\n// webView_video.setWebViewClient(new WebViewClient(){\n// @Override\n// public boolean shouldOverrideUrlLoading(WebView view, String url){\n// view.loadUrl(url);\n// return false;\n// }\n// });\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_login, container, false);\n init();\n\n btnLoginRegister.setOnClickListener(view1 -> checkEditTexts());\n tvForgotPass.setOnClickListener(view1 ->\n changeFragment(new ForgetPassFragment())\n );\n\n tvPrivacyPolicy.setOnClickListener(view1 -> {\n Intent i = new Intent(Intent.ACTION_VIEW);\n i.setData(Uri.parse(Constants.webViewLink));\n startActivity(i);\n });\n\n return view;\n }", "@Override\n public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n super.onViewCreated(view, savedInstanceState);\n initView();\n }", "public View onCreateView(LayoutInflater inflater, ViewGroup container,\n\t\t\t\t\t\t\t\t\t\t\t\t Bundle savedInstanceState) {\n\t\t\n\t\t/* Acquire the context we're working in, and the layout settings. */\n\t\tthis.context = container.getContext();\n\t\tthis.appearance = Appearance.getApperanceFor(\n\t\t\t\t\t\t\t\tthis.context, Strings.GLOBAL_GRAMMAR_STYLE);\n\t\t\n\t\t/* Build the fragment. */\n\t\tthis.layout = new LinearLayout(this.context);\n\t\tthis.layout.setOrientation(LinearLayout.VERTICAL);\n\t\t\n\t\tthis.webView = new WebView(this.context);\n\t\tthis.layout.setLayoutParams(new ViewGroup.LayoutParams(Tracker.getInstance().getWindowSize().x,\n\t\t\t\tTracker.getInstance().getWindowSize().y-100));\n\t\tthis.webView.setLayoutParams(new ViewGroup.LayoutParams(Tracker.getInstance().getWindowSize().x,\n\t\t\t\tTracker.getInstance().getWindowSize().y-100));\n\t\tthis.webView.getSettings().setDefaultTextEncodingName(\"utf-8\");\n\t\tthis.updateDisplay();\n\t\tthis.getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);\n\t\t\n\t\treturn this.layout;\n\t\t\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_home, container, false);\n apiCall();\n webView = view.findViewById(R.id.webView);\n btnPlay = view.findViewById(R.id.btn_play);\n relativeLayout = view.findViewById(R.id.background);\n initUI();\n\n btnPlay.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n GeneralUtils.connectFragment(getActivity(),new LoginSignupFragment());\n\n\n }\n });\n return view;\n }", "@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\twebview = new WebView(this);\n\t\t// Add progress bar\n\t\tgetWindow().requestFeature(Window.FEATURE_PROGRESS);\n\t\t// Enable Javascript\n\t\twebview.getSettings().setJavaScriptEnabled(true);\n\n\t\tfinal Activity activity = this;\n\t\twebview.setWebChromeClient(new WebChromeClient() {\n\t\t\tpublic void onProgressChanged(WebView view, int progress) {\n\t\t\t\tactivity.setProgress(progress * 1000);\n\t\t\t}\n\t\t});\n\t\twebview.setWebViewClient(new WebViewClient() {\n\t\t\t// Handle errors accordingly\n\t\t\tpublic void onReceivedError(WebView view, int errorCode,\n\t\t\t\t\tString description, String failingUrl) {\n\t\t\t\tToast.makeText(activity, \"Error Received:\" + description,\n\t\t\t\t\t\tToast.LENGTH_SHORT).show();\n\t\t\t}\n\t\t});\n\n\t\twebview.loadUrl(\"http://www.java.net\");\n\t\tsetContentView(webview);\n\t}", "private void startWebView(String url)\n {\n Utility.freeMemory();\n mBinding.webView1.setWebViewClient(new WebViewClient() {\n ProgressDialog progressDialog;\n\n //If you will not use this method url links are opeen in new brower not in webview\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n view.loadUrl(url);\n return true;\n }\n\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon)\n {\n super.onPageStarted(view, url, favicon);\n if (progressDialog == null) {\n // in standard case YourActivity.this\n progressDialog = new ProgressDialog(AttachmentDisplay.this);\n progressDialog.setMessage(\"Loading. Please wait...\");\n progressDialog.setCancelable(false);\n progressDialog.show();\n }\n }\n\n public void onPageFinished(WebView view, String url) {\n try{\n if (progressDialog.isShowing()) {\n progressDialog.dismiss();\n progressDialog = null;\n }\n }catch(Exception exception){\n exception.printStackTrace();\n }\n }\n\n });\n\n // Javascript inabled on webview\n mBinding.webView1.getSettings().setJavaScriptEnabled(true);\n\n // Other webview options\n /*\n webView.getSettings().setLoadWithOverviewMode(true);\n webView.getSettings().setUseWideViewPort(true);\n webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);\n webView.setScrollbarFadingEnabled(false);\n webView.getSettings().setBuiltInZoomControls(true);\n */\n\n /*\n String summary = \"<html><body>You scored <b>192</b> points.</body></html>\";\n webview.loadData(summary, \"text/html\", null);\n */\n\n //Load url in webview\n mBinding.webView1.loadUrl(url);\n }", "private void setupWebView() {\n\t\twebView = (WebView) findViewById(R.id.webview);\n\t\twebView.getSettings().setJavaScriptEnabled(true);\n\t\twebView.addJavascriptInterface(new JavaScriptInterface(this), \"Android\");\n\t\twebView.loadUrl(MAP_URL);\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_fitbit_web_view, container, false);\n\n button = (Button) v.findViewById(R.id.launchChromeButton);\n button.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n launchNativeChrome();\n }\n });\n\n\n return v;\n }", "@Override\r\n\tpublic void onViewCreated(View view, Bundle savedInstanceState) {\n\t\tsuper.onViewCreated(view, savedInstanceState);\r\n\t\tfindViews(view);\r\n\t\tinitViews(savedInstanceState);\r\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_about_artist,container,false);\n//authen = (RatingBar)view.findViewById(R.id.authenrate);\n // prices = (RatingBar)view.findViewById(R.id.pricerate);\n // overall = (RatingBar)view.findViewById(R.id.overallrating);\n // authen.setRating(Float.parseFloat(mParam1.get(\"authentic\")));\n //prices.setRating(Float.parseFloat(mParam1.get(\"price\")));\n //overall.setRating(Float.parseFloat(mParam1.get(\"rating\")));\n artistproducts = (TwoWayView)view.findViewById(R.id.artistproducts);\n SliderLayout sliderShow = (SliderLayout) view.findViewById(R.id.slider);\n final ArrayList<HashMap<String, String>> data = dbHelper.GetArtistProducts(mParam1.get(\"artuid\"));\n artistproducts.setAdapter(new Trending_Pro_Adapter_Product_Page(getContext(),dbHelper.GetArtistProducts(mParam1.get(\"artuid\"))));\n artistproducts.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {\n Intent intent = new Intent(getContext(),ProductView.class);\n intent.putExtra(\"promap\",data.get(i));\n startActivity(intent);\n\n }\n });\n WebView webView = (WebView)view.findViewById(R.id.webs);\n webView.getSettings().getJavaScriptCanOpenWindowsAutomatically();\n webView.getSettings().setJavaScriptEnabled(true);\n //webView.getSettings().setLoadWithOverviewMode(true);\n ///webView.getSettings().setUseWideViewPort(true);\n // webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);\n // webView.clearCache(true);\n webView.clearView();\n webView.reload();\n // webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);\n webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);\n webView.setScrollbarFadingEnabled(false);\n webView.clearCache(true);\n webView.loadUrl(mParam1.get(\"des\"));\n webView.setWebChromeClient(new WebChromeClient());\n// Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(),\"BioRhyme-Regular.ttf\");\n// int noimg = Integer.parseInt(mParam1.get(\"noimg\"));\n // Log.d(\"No Images in art\", \"\"+noimg);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.AppTheme_Nav);\n\n // clone the inflater using the ContextThemeWrapper\n LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);\n View view = localInflater.inflate(R.layout.fragment_master_list, container, false);\n Log.v(\"Is view null\", Boolean.toString(view == null));\n initializeView(view);\n addButtonListener(view);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_penjelasan_makhorijul_huruf, container, false);\n\n WebView webView = v.findViewById(R.id.isi);\n String text;\n text = \"The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog. \" +\n \"Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs. Waltz, \" +\n \"bad nymph, for quick jigs vex! Fox nymphs grab quick-jived waltz. \" +\n \"Brick quiz whangs jumpy veldt fox. Bright vixens jump; dozy fowl quack. \" +\n \"Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. \" +\n \"Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. \" +\n \"Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs!\" +\n \"\\\"Now fax quiz Jack!\\\" my brave ghost pled. Five quacking zephyrs jolt my wax bed. \" +\n \"Flummoxed by job, kvetching W. zaps Iraq. Cozy sphinx waves quart jug of bad milk. \" +\n \"A very bad quack might jinx zippy fowls. Few quips galvanized the mock jury box.\" +\n \"zaps Iraq. Cozy sphinx waves quart jug of bad milk. A very bad quack might jinx \" +\n \"zippy fowls. Few quips galvanized the mock jury box.\";\n webView.loadData(\"<p style=\\\"text-align:justify\\\">\"+ text +\"</p\", \"text/html\", \"UTF-8\");\n\n return v;\n }", "@Override\n public void onLoadResource(WebView view, String url) {\n super.onLoadResource(view, url);\n }", "@Override\n public void onLoadResource(WebView view, String url) {\n super.onLoadResource(view, url);\n }", "@SuppressLint(\"SetJavaScriptEnabled\")\n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.r_main);\n\n WebView webView = (WebView) this.findViewById(R.id.webview);\n WebSettings webSettings = webView.getSettings();\n webSettings.setJavaScriptEnabled(true);\n webSettings.setBuiltInZoomControls(true);\n webView.requestFocusFromTouch();\n webView.setWebViewClient(new WebViewClient());\n webView.setWebChromeClient(new WebChromeClient());\n\n // Load the URL\n webView.loadUrl(\"http://10.0.2.2/crescenttech/graph/graph.php\");\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.wbview1);\n \n //String rawHTML = \"<HTML>\"+ \n // \t \"<body><h1>Hello Android </h1></body>\"+ \n \t// \"</HTML>\";\n \n mWebView = (WebView) findViewById(R.id.webview);\n mWebView.getSettings().setJavaScriptEnabled(true);\n mWebView.setWebViewClient(new WebViewClient1()); \n //mWebView.loadData(rawHTML, \"text/HTML\", \"UTF-8\");\n \n mWebView.loadUrl(\"file:///android_asset/www/sunburst.html\");\n }", "@Nullable\n @Override\n public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n\n\n view = inflater.inflate(LAYOUT, container, false);\n return view;\n }", "@Override\r\n\tpublic void onViewCreated(View view, Bundle savedInstanceState) {\n\t\tsuper.onViewCreated(view, savedInstanceState);\r\n\r\n\t\tviewPager = (ViewPager) view.findViewById(R.id.viewpager);\r\n\t\tviewPager.setOnPageChangeListener(new OnPageChangeListener() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onPageSelected(int arg0) {\r\n\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onPageScrolled(int arg0, float arg1, int arg2) {\r\n\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onPageScrollStateChanged(int arg0) {\r\n\r\n\t\t\t}\r\n\t\t});\r\n//\t\tdoStart();\r\n\t\tif (getActivity() instanceof MainActivity) {\r\n\t\t\t((MainActivity) getActivity()).getSlidingMenu().addIgnoredView(\r\n\t\t\t\t\tviewPager);\r\n\t\t}\r\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n LayoutInflater inflater = getActivity().getLayoutInflater();\n if (mainView == null) {\n mainView = inflater.inflate(R.layout.fragment_mywarrelease, null);\n mContext = inflater.getContext();\n initView();\n }\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(getLayoutId(), container, false);\n init(view);\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.fragment_web, container, false);\n\n progressBar = (ProgressBar)rootView.findViewById(R.id.progressBarWeb);\n final FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab_email);\n fab.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n String[] addresses = {getString(R.string.contact_email)};\n composeEmail(addresses,\"\");\n }\n });\n\n WebView webView = (WebView) rootView.findViewById(R.id.webView);\n\n //set client so link clicks do not load external browser\n webView.setWebViewClient(new WebViewClient(){\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n //disable all links, users should use float button to send email\n //return true;\n return false;\n }\n @Override\n public void onPageFinished(WebView view, String url){\n //show float email button after page has loaded\n if (url.equals(getString(R.string.urlContact))) {\n fab.show();\n }\n progressBar.setVisibility(View.INVISIBLE);\n }\n });\n\n\n webView.getSettings().setJavaScriptEnabled(true);\n webView.loadUrl(url);\n\n // Inflate the layout for this fragment\n return rootView;\n }", "@Override\r\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n\t\tmainLayout = inflater.inflate(R.layout.fragment_play, container, false);\r\n\t\treturn mainLayout;\r\n\t}", "public void onLoadResource(WebView view, String url) {\n\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n WebView webView = (WebView) findViewById(R.id.webView);\n final TextView contentView = (TextView) findViewById(R.id.contentView);\n\n /* An instance of this class will be registered as a JavaScript interface */\n class MyJavaScriptInterface\n {\n private TextView contentView;\n\n public MyJavaScriptInterface(TextView aContentView)\n {\n contentView = aContentView;\n }\n\n @SuppressWarnings(\"unused\")\n\n public void processContent(String aContent)\n {\n final String content = aContent;\n contentView.post(new Runnable()\n {\n public void run()\n {\n contentView.setText(content);\n }\n });\n }\n }\n\n webView.getSettings().setJavaScriptEnabled(true);\n webView.addJavascriptInterface(new MyJavaScriptInterface(contentView), \"INTERFACE\");\n webView.setWebViewClient(new WebViewClient() {\n @Override\n public void onPageFinished(WebView view, String url)\n {\n view.loadUrl(\"javascript:window.INTERFACE.processContent(document.getElementsByTagName('body')[0].innerText);\");\n // view.addJavascriptInterface(new IJavascriptHandler(WebviewTest2Activity.this), \"Android\"); //if your class extends Activity\n view.getSettings().setJavaScriptEnabled(true);\n view.addJavascriptInterface(new MyJavaScriptInterface(contentView), \"HtmlViewer\");\n }\n });\n\n webView.loadUrl(\"https://html-online.com/editor/\");\n }", "boolean attachWebView(WebView webView, boolean screenshotsEnabled, boolean pullToRefreshEnabled) {\n if (webView.getParent() == refreshLayout) return false;\n\n refreshLayout.setEnabled(pullToRefreshEnabled);\n\n if (webView.getParent() instanceof TurbolinksSwipeRefreshLayout) {\n TurbolinksSwipeRefreshLayout previousRefreshLayout = (TurbolinksSwipeRefreshLayout) webView.getParent();\n TurbolinksView previousTurbolinksView = (TurbolinksView) previousRefreshLayout.getParent();\n\n if (screenshotsEnabled) previousTurbolinksView.screenshotView();\n previousRefreshLayout.removeView(webView);\n }\n\n // Set the webview background to match the container background\n if (getBackground() instanceof ColorDrawable) {\n webView.setBackgroundColor(((ColorDrawable) getBackground()).getColor());\n }\n\n refreshLayout.addView(webView);\n return true;\n }", "private void webViewSettings(String url){\n this.registerForContextMenu(wV);\n wV.loadUrl(\"http://\"+url);\n WebIconDatabase.getInstance().open(getDir(\"icons\", MODE_PRIVATE).getPath());\n wV.getSettings().setJavaScriptEnabled(true);\n wV.getSettings().setBuiltInZoomControls(true);\n wV.getSettings().setSupportZoom(true);\n wV.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View v, MotionEvent event) {\n switch (event.getAction()) {\n case MotionEvent.ACTION_DOWN:\n case MotionEvent.ACTION_UP:\n if (!v.hasFocus()) {\n v.requestFocus();\n }\n break;\n }\n return false;\n }\n });\n wV.setWebChromeClient(new WebChromeClient() {\n\n @Override\n public void onReceivedIcon(WebView view, Bitmap icon) {\n favicon.setImageBitmap(icon);\n }\n\n @Override\n public void onReceivedTitle(WebView view, String title) {\n getWindow().setTitle(title);\n }\n });\n\n wV.setWebViewClient(new WebViewClient() {\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n\n\n\n return super.shouldOverrideUrlLoading(view, url);\n\n }\n\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon) {\n editUrl.setText(url);\n progress.setVisibility(View.VISIBLE);\n }\n\n @Override\n public void onPageFinished(WebView view, String url) {\n progress.setVisibility(View.INVISIBLE);\n\n //if not errors\n if(error==0){\n //insert historic\n dao.insertHistoric(MainActivity.this, wV.getUrl());\n }\n error=0;\n\n }\n\n @Override\n public void onReceivedError(WebView view, int errorCode, String description, String failUrl) {\n AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);\n builder.setMessage(description).setPositiveButton(\"OK\",null).setTitle(\"Web Page Error! \"+failUrl);\n builder.show();\n error = 1;\n\n\n }\n });\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view= inflater.inflate(R.layout.fragment_upload_new, container, false);\n findViewByIds(view);\n return view;\n }", "@SuppressLint(\"NewApi\")\n\t@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\tLog.d(SmartConstants.APP_NAME, \"SmartViewActivity->onCreate->savedInstanceState:\" + savedInstanceState);\n\t\tsuper.onCreate(savedInstanceState);\n\t\tAppUtility.initUtils(getApplicationContext());\n\t\tif (getIntent().hasExtra(SmartConstants.SHOW_APP_HEADER)) {\n\t\t\tif (!(getIntent().getBooleanExtra(SmartConstants.SHOW_APP_HEADER, false))) {\n\t\t\t\tthis.requestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\t\t}\n\t\t}\n\n\t\tfindOsVersion();\n\n\t\t// Check for the presence of the application configuration information\n\t\tinitAppConfigInformation();\n\n\t\tthis.menuInfoBeanCollection = AppStartupManager.getMenuInfoCollection();\n\n\t\tif (isICSOrHigher) {\n\t\t\tif (getActionBar() != null) {\n\t\t\t\tsetTitle(\"\");\n\t\t\t\tactionbar = getActionBar();\n\t\t\t\tactionbar.hide();\n\t\t\t\tactionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);\n\n\t\t\t\tactionbar.setDisplayShowCustomEnabled(true);\n\t\t\t\tactionbar.setDisplayShowTitleEnabled(false);\n\n\t\t\t\tchangeActionBarBackground();\n\t\t\t}\n\t\t} else {\n\t\t\t// For Android 2.3 devices\n\t\t\tif (appIsActionBarEnabled) {\n\t\t\t\tsetTitle(\"\");\n\t\t\t} else {\n\t\t\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\t\t}\n\t\t}\n\n\t\tif (this.getParent() != null) {\n\t\t\twebChromeClient = new SmartWebChromeClient(this.getParent());\n\t\t} else {\n\t\t\twebChromeClient = new SmartWebChromeClient(SmartViewActivity.this);\n\t\t}\n\n\t\tsetContentView(AppUtility.getResourseIdByName(getApplicationContext().getPackageName(), \"layout\", \"im_webview_layout\"));\n\t\tgetIntent().setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);\n\t\tinitWebview();\n\n\t\tString pageURI = null;\n\t\tisActivityCreated = true;\n\n\t\t// Check for the presence of the page URL details and load the WebView\n\t\t// accordingly\n\t\tif (getIntent().hasExtra(SmartConstants.CHECK_FOR_INTENT_EXTRA) && getIntent().getBooleanExtra(SmartConstants.CHECK_FOR_INTENT_EXTRA, false)) {\n\t\t\t// Initialise Smart connector here with reference of\n\t\t\t// SmartViewActivity to receive SmartConnectorListener\n\t\t\t// notifications\n\t\t\tthis.mobiletManager = new MobiletManager(this);\n\t\t\tif (getIntent().hasExtra(SmartConstants.PAGE_URI)) {\n\t\t\t\t// It means the user hasn't opted for the soft upgrade process.\n\t\t\t\t// In thsi case load, the URL provided by the user.\n\t\t\t\tpageURI = getIntent().getStringExtra(SmartConstants.PAGE_URI);\n\t\t\t\twebView.loadUrl(pageURI);\n\t\t\t\tLog.d(SmartConstants.APP_NAME, \"SmartViewActivity->onCreate->pageURI:\" + pageURI);\n\t\t\t} else {\n\t\t\t\tthrow new MobiletException(ExceptionTypes.INVALID_PAGE_URI_EXCEPTION);\n\t\t\t}\n\t\t}\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_site_progress_add, container, false);\n setHasOptionsMenu(true);\n ButterKnife.bind(this, view);\n\n initializeUI();\n bindData();\n return view;\n }", "@Override\n public void onCreate(Bundle savedInstanceState)\n {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n\n mWebView = (WebView) findViewById(R.id.webview);\n mWebView.setWebViewClient(new BasicWebViewClient());\n mWebView.getSettings().setJavaScriptEnabled(true);\n mWebView.getSettings().setDomStorageEnabled(true);\n mWebView.getSettings().setAppCacheMaxSize(1024*1024*5);\n mWebView.getSettings().setAppCacheEnabled(true);\n \n mWebView.getSettings().setAppCachePath(\"/data/data/com.hcsn.kidbook.secondgrademath/cache\");\n mWebView.getSettings().setAllowFileAccess(true);\n \n// WebView myWebView = (WebView) findViewById(R.id.myWebView);\n mWebView.setBackgroundColor(Color.parseColor(\"#333333\"));\n \n mWebView.loadUrl(launchURL);\n }", "@Override\n public boolean onCreateWindow(WebView view, boolean isDialog,\n boolean isUserGesture, Message resultMsg) {\n\n WebView.HitTestResult result = view.getHitTestResult();\n String url = result.getExtra();\n\n if(url != null && url.indexOf(\"about:blank\")>-1){\n Intent intent = new Intent(Intent.ACTION_VIEW);\n intent.setData(Uri.parse(url));\n startActivity(intent);\n return true;\n }else{\n WebView newWebView = new WebView(MainActivity.this);\n view.addView(newWebView);\n WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;\n\n transport.setWebView(newWebView);\n resultMsg.sendToTarget();\n return true;\n }\n\n }", "void continueWhenLoaded(WebView webView) {\n webView.setWebViewClient(new WebViewClient());\n }", "private void initWebView(){ \r\n WebEngine webEngine = viewerPane.getEngine();\r\n webEngine.load(\"http://www.google.com\");\r\n }", "@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n\t\tLogUtil.d(TAG, \"onCreateView---------\");\n\t\tview = inflater.inflate(getContentViewId(),container,false);\n\t\tunbinder = ButterKnife.bind(this,view);\n\t\tinitView(savedInstanceState);\n\t\treturn view;\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n if (mInflate == null) {\n mInflate = inflater.inflate(R.layout.fragment_fa_xian, container, false);\n init();\n }\n //缓存的rootView需要判断是否已经被加过parent, 如果有parent需要从parent删除,要不然会发生这个rootview已经有parent的错误。\n ViewGroup parent = (ViewGroup) mInflate.getParent();\n if (parent != null) {\n parent.removeView(mInflate);\n }\n return mInflate;\n }", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tgetWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);\r\n\t\tgetWindow().requestFeature(Window.FEATURE_NO_TITLE);\r\n\t\tthis.requestWindowFeature(Window.FEATURE_PROGRESS);\r\n\t this.setProgressBarVisibility(true);\r\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.website);\r\n\t\tWebView mWebView=(WebView) findViewById(R.id.webView1);\r\n\t\tToast.makeText(getApplicationContext(), \"Loading...Please Wait!!\", Toast.LENGTH_LONG).show();\r\n\t\tmWebView.getSettings().setJavaScriptEnabled(true);\r\n\t\t mWebView.getSettings().setSupportZoom(true);\r\n mWebView.getSettings().setBuiltInZoomControls(true);\r\n\t mWebView.setWebViewClient(new WebViewClient());\r\n\t mWebView.loadUrl(\"http://www.tesla.org.in/\");\r\n\t}", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_web_view);\n\n\t\tsetTitle(\"지식경제부 기술표준원\");\n\t\tgetActionBar().setDisplayHomeAsUpEnabled(true);\n\t\t// 액션바에서 뒤로가기 버튼을 생성하기 위해 선언.\n\n\t\t// webview.setWebViewClient(new WebClient()); // 응룡프로그램에서 직접 url 처리\n\n\t\twv = (WebView) findViewById(R.id.webview);\n\t\t\n\t\t// 이렇게 해야 Web이 App 바깥영역으로 나가지 않는다.\n\t\twv.setWebViewClient(new MyWebClient());\n\t\t\n\t\t// WebSetting 옵션\n\t\tWebSettings set = wv.getSettings();\n\t\tset.setJavaScriptEnabled(true);\n\t\tset.setBuiltInZoomControls(true);\t// 감압식 폰 화면 확대\n\t\twv.getSettings().setJavaScriptEnabled(true);\n\t\twv.loadUrl(\"http://www.kats.go.kr/mobile/main.do\");\n\t}", "@SuppressLint(\"JavascriptInterface\")\nprivate void setupWebView(){ \n \n webView = (WebView) findViewById(R.id.webview01); \n webView.getSettings().setJavaScriptEnabled(true); \n webView.setWebViewClient(new WebViewClient()); \n webView.loadUrl(MAP_URL); \n \n /** Allows JavaScript calls to access application resources **/ \n webView.addJavascriptInterface(new JavaScriptInterface(), \"android\"); \n \n }", "public static void registerWebView(Activity activity, ObservableWebView webView, ObservableScrollViewCallbacks observableScrollViewCallbacks) {\n if (activity != null && hashMap.containsKey(activity)) {\n MaterialViewPagerAnimator animator = hashMap.get(activity);\n if (animator != null) {\n animator.registerWebView(webView, observableScrollViewCallbacks);\n }\n }\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\t\n\t\t/**全屏设置,隐藏窗口所有装饰*/ \n//\t\tgetWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, \n//\t\t\t\tWindowManager.LayoutParams.FLAG_FULLSCREEN); \n\t\t/**标题是属于View的,所以窗口所有的修饰部分被隐藏后标题依然有效*/ \n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\t\n\t\tsetContentView(R.layout.content_fenye);\n\t\t\n\t\tmprogressBar = (ProgressBar)findViewById(R.id.content_progress_bar_fenye);\n\t\tIntent mIntent = getIntent();\n\t\tString url = mIntent.getStringExtra(\"url\");\n\t\tLog.v(TAG, \"contentWebView loadURL:\"+url);\n\t\t\n\t\tcontentWV = (WebView)findViewById(R.id.contentWV_fenye);\n\t\tcontentWV.getSettings().setSupportZoom(false);\n\t\tcontentWV.getSettings().setJavaScriptEnabled(true); \n\t\tcontentWV.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n\t\tcontentWV.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);\n\t\t\n\t\t\n\t\tcontentWV.setWebViewClient(new WebViewClient(){\n \t\t\t@Override\n \t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) { //重写此方法表明点击网页里面的链接还是在当前的webview里跳转,不跳到浏览器那边\n \t\t\t\tLog.e(\"content\", \"loadUrl:\"+url);\n \t\t\t\tif(\"quit://\".equals(url)){\n \t\t\t\t\tLog.e(\"content\", \"Quit:\"+url);\n \t\t\t\t\tcontent_fenye.this.finish();\n \t\t\t\t}else if(url.startsWith(\"pic://\")){\n// \t\t\t\t\tToast.makeText(content_fenye.this, \"pic url:\"+url.substring(6, url.length()), Toast.LENGTH_SHORT).show();\n \t\t\t\t\tstartActivity(new Intent().setClass(content_fenye.this, pic_content.class).putExtra(\"picUrl\", url.substring(6, url.length())));\n \t\t\t\t}else{\n \t\t\t\t\tview.loadUrl(url);\n \t\t\t\t}\n \t\t\t\t\n \t\t\t return true;\n \t\t\t}\n \t\t\t\n \t\t\t@Override\n\t\t\tpublic void onPageFinished(WebView webview,\n\t\t\t\t\tString url) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tsuper.onPageFinished(webview, url);\n\t\t\t\t\n\t\t\t\tmprogressBar.setVisibility(View.GONE);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onPageStarted(WebView view,\n\t\t\t\t\tString url, Bitmap favicon) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tsuper.onPageStarted(view, url, favicon);\n\t\t\t\t\n\t\t\t\tmprogressBar.setVisibility(View.VISIBLE);\n\t\t\t}\n\t\t\t\n\t\t});\n \t\t\t\n\t\tcontentWV.loadUrl(url);\n\t}", "@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n\t\t\tBundle savedInstanceState) {\n\t\tsuper.onCreateView(inflater, container, savedInstanceState);\n\t\tView rootView = inflater.inflate(R.layout.post_detail_fragment_layout,\n\t\t\t\tcontainer, false);\n\t\tnavigation=(ImageView) rootView.findViewById(R.id.weiba_fragment_title);\n\t\tpost_title=(TextView)rootView.findViewById(R.id.post_title);\n\t\tweiba_name=(TextView)rootView.findViewById(R.id.weiba_name);\n\t\tpost_user=(TextView)rootView.findViewById(R.id.post_user);\n\t\tpost_date=(TextView)rootView.findViewById(R.id.post_date);\n\t\tpost_content=(WebView)rootView.findViewById(R.id.post_content);\n\t\tpost_comment=(TextView)rootView.findViewById(R.id.post_comment);\n\t\tpost_view=(TextView)rootView.findViewById(R.id.post_view);\n\t\tpost_collect=(ImageView)rootView.findViewById(R.id.post_collect);\n\t\tScrollView=rootView.findViewById(R.id.scrollView);\n\t\tinputView=(EditText) rootView.findViewById(R.id.edit_comment);\n\t\tsendButton=rootView.findViewById(R.id.create_post_send);\n\t\tdetail_comment=rootView.findViewById(R.id.detail_comment);\n\t\tnavigation.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n ((MainFragmentActivity) getActivity()).getSlidingMenu()\n .toggle();\n }\n });\n\t\t\n\t\tpost_title.setText(post.getTitle());\n\t\tweiba_name.setText(\"[\"\n\t\t\t\t+ WeibaOperator.getInstance().queryWeibaNameByID(\n\t\t\t\t\t\tpost.getWeiba_id()) + \"]\");\n\t\tpost_user.setText(post.getUname());\n\t\tpost_date.setText(DateUtils.getTimeInString(post.getPost_time()));\n\t\t//帖子内容显示设置\n\t\tWebSettings contentSetting= post_content.getSettings();\n\t\tcontentSetting.setDefaultTextEncodingName(\"utf-8\"); \n\t\tcontentSetting.setSupportZoom(true);\n\t\tcontentSetting.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);\n\t\tpost_content.setBackgroundColor(0);\n\t\tpost_content.loadDataWithBaseURL(\"http://tsimg.tsurl.cn\", post.getContent(), \"text/html\", \"utf-8\", null);\n\t\tdisplayflag=1;\n\t\tpost_content.setOnTouchListener(new OnTouchListener(){//双击实现不同的显示模式。\n\t\t\tint count = 0; \n\t\t\tlong firClick = 0; \n long secClick = 0; \n @Override\n\t\t\tpublic boolean onTouch(View view, MotionEvent event) {\n\t\t\t\t// TODO Auto-generated method stub \n\t\t\t\tif(MotionEvent.ACTION_DOWN == event.getAction()){ \n\t\t\t count++; \n\t\t\t if(count == 1){ \n\t\t\t firClick = System.currentTimeMillis(); \n\t\t\t \n\t\t\t } else if (count == 2){ \n\t\t\t secClick = System.currentTimeMillis(); \n\t\t\t if(secClick - firClick < 500){ \n\t\t\t if(displayflag==1){\n\t\t\t \t\t\t WebSettings contentSetting= post_content.getSettings(); \n\t\t\t \t\tcontentSetting.setUseWideViewPort(true);\n\t\t\t \t\t//contentSetting.setLoadWithOverviewMode(true);\n\t\t\t \t\tcontentSetting.setSupportZoom(true);\n\t\t\t \t\tcontentSetting.setBuiltInZoomControls(true);\n\t\t\t \t\tpost_content.loadDataWithBaseURL(\"http://tsimg.tsurl.cn\", post.getContent(), \"text/html\", \"utf-8\", null);\n\t\t\t \tdisplayflag=2;\n\t\t\t \tToast.makeText(mContext,\"切换到缩放模式\", Toast.LENGTH_SHORT)\n\t\t\t\t\t\t\t\t\t.show();\n\t\t\t }else{\n\t\t\t \tWebSettings contentSetting= post_content.getSettings();\n\t\t\t \t\t//contentSetting.setUseWideViewPort(false);\n\t\t\t \t\t//contentSetting.setLoadWithOverviewMode(false);\n\t\t\t \tcontentSetting.setSupportZoom(false);\n\t\t\t \t\tcontentSetting.setBuiltInZoomControls(false);\n\t\t\t \t\tcontentSetting.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);\n\t\t\t \t\tpost_content.loadDataWithBaseURL(\"http://tsimg.tsurl.cn\", post.getContent(), \"text/html\", \"utf-8\", null);\n\t\t\t \tdisplayflag=1;\n\t\t\t \tToast.makeText(mContext,\"切换到自适应屏幕模式\", Toast.LENGTH_SHORT)\n\t\t\t\t\t\t\t\t\t.show();\n\t\t\t } \n\t\t\t } \n\t\t\t count = 0; \n\t\t\t firClick = 0; \n\t\t\t secClick = 0; \n\t\t\t } \n\t\t\t } \n\t\t\t return true; \n\t\t\t}\t\t\t\n\t\t});\n\n\t\tpost_comment.setText(\"(\" + post.getReply_count()+ \")\");\n\t\tpost_view.setText(\"(\" + post.getRead_count() + \")\");\n\t\tpost_comment.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tif(flag){\n\t\t\t\t\tScrollView.setVisibility(View.GONE);\n\t\t\t\t\tdetail_comment.setVisibility(View.VISIBLE);\n\t\t\t\t\tinitCommentList();\n\t\t\t\t\tflag=!flag;\n\t\t\t\t}else{\n\t\t\t\t\tScrollView.setVisibility(View.VISIBLE);\n\t\t\t\t\tdetail_comment.setVisibility(View.GONE);\n\t\t\t\t\t//getChildFragmentManager().beginTransaction().hide(post_comment_list).commit();\n\t\t\t\t\tflag=!flag;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tsendButton.setOnClickListener(new OnClickListener() {\n\t\t\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tString tag=(String)inputView.getTag();\n\t\t\t\tString act,id,content;\n\t\t\t\tcontent=inputView.getText().toString();\n\t\t\t\tif(!content.contains(\"@\")){\n\t\t\t\t\ttag=null;\n\t\t\t\t}\n\t\t\t\tif(tag!=null){\n\t\t\t\t\tact=REPLY_COMMENT;\n\t\t\t\t\tid=tag;\n\t\t\t\t}else{\n\t\t\t\t\tact=COMMENT_POST;\n\t\t\t\t\tid=post.getPost_id();\n\t\t\t\t}\n\t\t\t\tfinal Map<String, String> reply = new HashMap<String, String>();\n\t\t\t\treply.put(\"app\", APP);\n\t\t\t\treply.put(\"mod\", MOD);\n\t\t\t\treply.put(\"act\", act);\n\t\t\t\treply.put(\"id\", id);\n\t\t\t\treply.put(\"content\", content);\n\t\t\t\treply.put(\"oauth_token\", OAUTH_TOKEN);\n\t\t\t\treply.put(\"oauth_token_secret\", OAUTH_TOKEN_SECRECT);\n\t\t\t\tnew Thread(new WeibaActionHelper(myHandler, mContext,\n\t\t\t\t\t\treply, COMMENT_OK)).start();\n\t\t\t}\n\t\t});\n\t\tfinal boolean followState=post.getFavorite() == 1;\n\t\tfinal String post_id=post.getPost_id();\n\t\tpost_collect.setImageResource(followState?R.drawable.heart:R.drawable.favourite);\n\t\tpost_collect.setOnClickListener(new OnClickListener() {\t\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t((ImageView) v)\n\t\t\t\t.setImageResource(!followState ? R.drawable.heart\n\t\t\t\t\t\t: R.drawable.favourite);\n\t\t\t\tpost.setFavorite(!followState?1:0);\n\t\t\t\tmHandler.obtainMessage(!followState?3:4, post_id)\n\t\t\t\t.sendToTarget();\n\t\t\t}\n\t\t});\n\t\tinit();\n\t\treturn rootView;\n\n\t}", "@Override\n public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_foreign_language, container, false);\n\n getWidgets(view);\n initialize();\n setWidgetsListener();\n\n return view;\n }", "@SuppressLint(\"SetJavaScriptEnabled\")\n\t@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\ttxt_title = (TextView) findViewById(R.id.txt_title);\n\t\tselfActivity = this;\n\t\ttitleName = getIntent().getStringExtra(\"title\");\n\t\ttxt_title.setText(titleName);\n\t\tString url = getIntent().getStringExtra(\"url\");\n\t\tWebView wv = (WebView) findViewById(R.id.webview1);\n\t\t// Log.d(TAG,\"url=\"+url);\n\t\tif (url.startsWith(\"http://\")) {\n\t\t\t// 普通打开url\n\t\t\twv.loadUrl(url);\n\t\t} else {\n\t\t\t// 易宝相关的使用\n\t\t\twv.loadData(url, \"text/html\", \"UTF-8\");\n\t\t\tLog.d(TAG, \"url=\" + url);\n\t\t}\n\t\tWebSettings ws = wv.getSettings();\n\t\tws.setBuiltInZoomControls(true);\n\t\tws.setJavaScriptEnabled(true);\n\n\t\twv.setWebViewClient(new WebViewClient() {\n\t\t\t@Override\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t// view.loadUrl(url);\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onPageStarted(WebView view, String url, Bitmap favicon) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tsuper.onPageStarted(view, url, favicon);\n\t\t\t\tprogressDialogSet = new ProgressDialogSet();\n\t\t\t\tprogressDialogSet.setCon(selfActivity);\n\t\t\t\tprogressDialogSet.setMsg(\"正在请求数据,请稍后...\");\n\t\t\t\tprogressDialogSet.startProgress();\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onPageFinished(WebView view, String url) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tsuper.onPageFinished(view, url);\n\t\t\t\tif (progressDialogSet != null) {\n\t\t\t\t\tprogressDialogSet.stopProgress();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t}", "private void init() {\n\tTextView tvTopTitle = getViewById(R.id.tv_top_title);\n\ttvTopTitle.setText(\"提兑记录\");\n\tTextView tvLeftIcon = getViewById(R.id.tv_left_icon);\n\ttvLeftIcon.setOnClickListener(new OnClickListener() {\n\n\t @Override\n\t public void onClick(View arg0) {\n\t\t// TODO Auto-generated method stub\n\t\tfinish();\n\t }\n\t});\n\tfindViewById(R.id.tv_top_action).setVisibility(View.GONE);\n\n\tmWebView = getViewById(R.id.webview);\n\n\t// 设置WebView对JavaScript的支持\n\tmWebView.getSettings().setJavaScriptEnabled(true);\n\n\t// 先让 asyncHttp 加载所有数据, 再将内容交给webView渲染\n\t//\tHttpUtil.get(AppConstants.URL_PROFILE, new AsyncHttpResponseHandler() {\n\t//\n\t//\t @Override\n\t//\t public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {\n\t//\t\t// TODO Auto-generated method stub\n\t//\t\tString res = new String(arg2);\n\t//\t\tmWebView.loadDataWithBaseURL(null, res, \"text/html\", \"\", null);\n\t//\t }\n\t//\n\t//\t @Override\n\t//\t public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {\n\t//\t\t// TODO Auto-generated method stub\n\t//\t\tmWebView.loadDataWithBaseURL(null, \"加载出错,请重试\", \"text/html\", \"\", null);\n\t//\t }\n\t//\t});\n\n\t// 添加cookie 确保session能用\n\tCookieSyncManager.createInstance(this);\n\tCookieManager cookieManager = CookieManager.getInstance();\n\tString cookies = \"PHPSESSID=\" + MyApplication.PHPSESSID + \"\";\n\tcookieManager.setCookie(AppConstants.HOST, cookies);//cookies是在HttpClient中获得的cookie \n\tCookieSyncManager.getInstance().sync();\n\n\t//\n\n\t//自定义WebView的背景颜色\n\tmWebView.setBackgroundColor(Color.TRANSPARENT);//先设置背景色为transparent\n\tmWebView.setBackgroundResource(R.drawable.m);\n\n\tMWebViewClient mWebViewClient = new MWebViewClient(mWebView, getApplicationContext());\n\tmWebView.setWebViewClient(mWebViewClient);\n\t//\tMWebChromeClient mWebChromeClient = new MWebChromeClient(getApplicationContext());\n\t//\tmWebView.setWebChromeClient(mWebChromeClient);\n\t//添加JS调用Android(Java)的方法接口\n\t//\tMJavascriptInterface mJavascriptInterface = new MJavascriptInterface(getApplicationContext());\n\t//\tmWebView.addJavascriptInterface(mJavascriptInterface, \"WebViewFunc\");\n\n\t// 从assets目录下面的加载html\n\t//\tmWebView.loadUrl(\"file:///android_asset/web.html\");\n\t// 该方法需要设置cookie, 但是cookie由AsyncHttp存储着, 换成先由asyncHttp加载下所有的html内容再给webView\n\tmWebView.loadUrl(AppConstants.URL_WITHDRAW_LOGS);\n\n }", "@Override\r\n public void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n requestWindowFeature(Window.FEATURE_NO_TITLE);\r\n getWindow().setFormat(PixelFormat.RGBA_8888);\r\n setContentView(R.layout.webview);\r\n Log.i(\"webactivity\", \"webactivity\");\r\n \r\n //初始化界面元素\r\n webView = (WebView) findViewById(R.id.webView);\r\n //初始化界面数据\r\n Intent intent = getIntent();\r\n String fileAddress = intent.getStringExtra(\"webAddress\");\r\n //wenview初始化设置\r\n webView.setInitialScale(25);//为25%,最小缩放等级 \r\n //设置双击缩放网页\r\n \r\n webView.getSettings().setSupportZoom(true);\r\n webView.getSettings().setBuiltInZoomControls(true);\r\n webView.getSettings().setJavaScriptEnabled(true);//支持js\r\n\r\n //加载网页\r\n webView.loadUrl(fileAddress);\r\n \r\n\r\n }", "@Override\n public void onResume() {\n mWebView.onResume();\n super.onResume();\n }", "@Override\r\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_fore_cast, container, false);\r\n initView();\r\n mainLayout.setVisibility(View.GONE);\r\n apiInterface = RestClinet.getClient().create(ApiInterface.class);\r\n loadData();\r\n return view;\r\n }", "@Override\n\t\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n\t\t\t{\n\t\t\t\tflag = (Page) getArguments().getSerializable(\"flag\");\n\t\t\t\tview = inflater.inflate(R.layout.activity_main, container, false);\n\t\t\t\tfillView();\n\t\t\t\treturn view;\n\t\t\t}", "@Override\n public void onClick(View v) {\n LogUtil.log(\"重新请求\");\n linearLayout.setVisibility(View.GONE);\n webviewinit();\n }", "@Nullable\n @Override\n @CallSuper\n public View onCreateView(@NonNull final LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState) {\n View view = getView();\n if (view == null) {\n view = inflater.inflate(getContentLayout(), container, false);\n }\n unbinder = ButterKnife.bind(this, view);\n return view;\n }", "@Override\r\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n\t\t\tBundle savedInstanceState) {\n\t\tViewGroup p = (ViewGroup) mMainView.getParent();\r\n\t\tif (p != null) {\r\n\t\t\tp.removeAllViewsInLayout();\r\n\t\t}\r\n\t\treturn mMainView;\r\n\t}", "@Override\r\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n\t\t\tBundle savedInstanceState) {\n\t\tViewGroup p = (ViewGroup) mMainView.getParent();\r\n\t\tif (p != null) {\r\n\t\t\tp.removeAllViewsInLayout();\r\n\t\t}\r\n\t\treturn mMainView;\r\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState)\n\t{\n \t\tif (v != null) \n \t\t{\n \t ViewGroup parent = (ViewGroup) v.getParent();\n \t if (parent != null)\n \t parent.removeView(v);\n \t }\n \t\t\n \t try \n \t {\n \t v = inflater.inflate(R.layout.tab3_fragment, container, false);\n \t } \n \t catch (InflateException e)\n \t {\n \t /* map is already there, just return view as it is */\n \t \te.printStackTrace();\n \t }\n \t return v;\n }", "@Override\n\tprotected void setContentView() {\n\t\tsetContentView(R.layout.common_webview);\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_down_load_manage, container, false);\n mListView = (ListView) view.findViewById(R.id.lv_download);\n tvEmpty = (RelativeLayout) view.findViewById(R.id.empty_offline);\n initView();\n getUpdateInfo();\n return view;\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n\n getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,\n\n WindowManager.LayoutParams.FLAG_FULLSCREEN);\n\n\n setContentView(R.layout.activity_main);\n\n\n\n\n\n web = (WebView) findViewById(R.id.web);\n WebSettings webSettings = web.getSettings();\n // settings.setJavaScriptEnabled(true);\n\n\n //支持js\n web.getSettings().setJavaScriptEnabled(true);\n // 解决图片不显示\n web.getSettings().setBlockNetworkImage(false);\n if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n web.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);\n }\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\n StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();\n StrictMode.setVmPolicy(builder.build());\n }\n\n\n\n //设置WebView属性,能够执行Javascript脚本\n webSettings.setJavaScriptEnabled(true);\n //设置可以访问文件\n webSettings.setAllowFileAccess(true);\n //设置支持缩放\n webSettings.setBuiltInZoomControls(true);\n\n webSettings.setAppCacheEnabled(true);\n webSettings.setDomStorageEnabled(true);\n webSettings.supportMultipleWindows();\n webSettings.setAllowContentAccess(true);\n webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);\n webSettings.setUseWideViewPort(true);\n webSettings.setLoadWithOverviewMode(true);\n webSettings.setSavePassword(true);\n webSettings.setSaveFormData(true);\n webSettings.setJavaScriptCanOpenWindowsAutomatically(true);\n webSettings.setLoadsImagesAutomatically(true);\n\n web.loadUrl(urlAddress);\n\n web.setWebViewClient(new WebViewClient() {\n @TargetApi(Build.VERSION_CODES.LOLLIPOP)\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request)\n {\n //返回false,意味着请求过程里,不管有多少次的跳转请求(即新的请求地址),均交给webView自己处理,这也是此方法的默认处理\n //返回true,说明你自己想根据url,做新的跳转,比如在判断url符合条件的情况下,我想让webView加载http://ask.csdn.net/questions/178242\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n if (request.getUrl().toString().contains(\"sina.cn\")){\n // view.loadUrl(\"http://ask.csdn.net/questions/178242\");\n return true;\n }\n }\n\n view.loadUrl(request.getUrl().toString());\n return true;\n }\n\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon) {\n // TODO Auto-generated method stub\n super.onPageStarted(view, url, favicon);\n }\n\n @Override\n public void onPageFinished(WebView view, String url) {\n // TODO Auto-generated method stub\n super.onPageFinished(view, url);\n }\n });\n\n web.setWebChromeClient(new WebChromeClient() {\n @Override\n // onShowFileChooser详解 http://teachcourse.cn/2224.html\n public boolean onShowFileChooser(WebView webView,\n ValueCallback<Uri[]> filePathCallback,\n FileChooserParams fileChooserParams) {\n mUploadCallbackAboveL = filePathCallback;\n take();\n return true;\n }\n\n public void openFileChooser(ValueCallback<Uri> uploadMsg) {\n mUploadMessage = uploadMsg;\n take();\n }\n\n public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {\n mUploadMessage = uploadMsg;\n take();\n }\n\n public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {\n mUploadMessage = uploadMsg;\n take();\n }\n });\n\n\n\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tsetContentView(R.layout.activity_bannerweb);\n\n\t\tinitView();\n\t\tinitdata();\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n myView = inflater.inflate(R.layout.fragment_main, container, false);\n initPhotoError();\n return myView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_feed_web, container, false);\n mDieselTextView = (TextView) v.findViewById(R.id.dieselTextView);\n mE85TextView = (TextView) v.findViewById(R.id.e85TextView);\n mE20TextView = (TextView) v.findViewById(R.id.e20TextView);\n mGas91TextView = (TextView) v.findViewById(R.id.gas91TextView);\n mGas95TextView = (TextView) v.findViewById(R.id.gas95TextView);\n\n // set custom font\n Typeface type = Typeface.createFromAsset(getActivity().getAssets(), \"ds_digital.TTF\");\n mDieselTextView.setTypeface(type);\n mE85TextView.setTypeface(type);\n mE20TextView.setTypeface(type);\n mGas91TextView.setTypeface(type);\n mGas95TextView.setTypeface(type);\n\n\n connectWebservice();\n return v;\n }" ]
[ "0.6986889", "0.6971986", "0.69283235", "0.6915438", "0.68647933", "0.6851758", "0.6683397", "0.66490746", "0.66411555", "0.66151077", "0.65639234", "0.6555548", "0.65514034", "0.6536503", "0.65346515", "0.64839906", "0.6479389", "0.6432816", "0.64127654", "0.64026153", "0.637087", "0.6325462", "0.63155353", "0.6297142", "0.6289951", "0.6223389", "0.6219936", "0.6198657", "0.6140579", "0.6117172", "0.6112244", "0.61042", "0.60879076", "0.60777605", "0.60728616", "0.60288525", "0.6015227", "0.6005139", "0.59622616", "0.59502566", "0.5945952", "0.5931215", "0.591107", "0.58838546", "0.5873471", "0.586407", "0.586288", "0.5856767", "0.5852462", "0.58505493", "0.582954", "0.5819748", "0.5818552", "0.5789236", "0.5789236", "0.5788468", "0.57853335", "0.5783509", "0.5782398", "0.5778497", "0.5760606", "0.5753528", "0.5752248", "0.5750994", "0.57487565", "0.57470095", "0.5738982", "0.5736176", "0.5729096", "0.57280517", "0.57263815", "0.5723129", "0.57181054", "0.5709492", "0.5709025", "0.5707228", "0.5705657", "0.56938094", "0.5689297", "0.5688286", "0.56838095", "0.5680587", "0.56764096", "0.56670827", "0.5664668", "0.56449276", "0.5642766", "0.5640883", "0.56375456", "0.5632213", "0.56233513", "0.56193674", "0.56193674", "0.56184065", "0.56164277", "0.5616267", "0.56103456", "0.5609934", "0.56087136", "0.5607461" ]
0.7524885
0
displayUrl: This method updates the WebView in the fragment to display the specified url.
public void displayUrl(String url) { //Create a new WebView to clear the old data createNewWebView(); //Enable JavaScript WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); //Display website to user webView.setWebViewClient(new WebViewClient()); webView.loadUrl(url); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setDisplayUrl(String displayUrl) {\r\n this.displayUrl = displayUrl;\r\n }", "public void setDisplayUrl(String displayUrl) {\r\n this.displayUrl = displayUrl;\r\n }", "public void updateDisplay() {\n\t\t\n\t\tif (!this.isAdded()) return;\n\t\t\n\t\tthis.layout.removeAllViews();\n\t\t\n\t\t/* Set the background parameters. */\n\t\tthis.layout.setBackgroundColor(this.appearance.getBackColour());\n\t\tif(this.appearance.getBackImage() != null)\n\t\t\tthis.layout.setBackground(this.appearance.getBackImage());\n\t\t\n\t\tif (url != null) {\n\t\t\tthis.webView.loadUrl(url);\n\t\t} else {\n\t\t\tthis.webView.loadData(html, \"text/html; charset=utf-8\", null);\n\n\t\t}\t\t\n\t\t\n\t\tthis.layout.addView(webView);\n\t\tthis.getActivity().setTitle(title);\n\t\t\t\t\n\t}", "public String getDisplayUrl() {\r\n return displayUrl;\r\n }", "public String getDisplayUrl() {\r\n return displayUrl;\r\n }", "public void loadUrl(String url) {\n Uri uri = Uri.parse(url);\n Bundle bundle = serialBundle(uri.getQuery());\n if (bundle != null) {\n this.mH5RequestToken = bundle.getString(ParamsConstants.UrlConstant.H5_REQUEST_TOKEN);\n }\n if (checkWebviewBridge(url)) {\n if (getSupportActionBar() != null) {\n getSupportActionBar().hide();\n }\n overrideCallback(uri);\n return;\n }\n this.memberWebView.loadUrl(url);\n }", "@Override\n public void run() {\n MainActivity.webView.loadUrl(\"https://www.facebook.com/\" + id);\n }", "@Override\n public void onPageFinished(WebView view, String url) {\n super.onPageFinished(view, url);\n web.setVisibility(View.VISIBLE);\n progressBar.setVisibility(View.GONE);\n }", "public void changeUrl() {\n url();\n }", "public void SetUrl(String url)\n\t{\n\t if (video_view.isPlaying())\n\t {\n\t video_view.stopPlayback();\n\t }\n\t \n Uri uri = Uri.parse(url);\n video_view.setVideoURI(uri);\n\t}", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n view.loadUrl(url);\n return true;\n }", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n view.loadUrl(url);\n return true;\n }", "public void setUrl(String url);", "public void setUrl(String url);", "@Override\n public void onPageFinished(WebView view, String url) {\n super.onPageFinished(view, url);\n if (mOnOpenUrlListener != null) {\n mOnOpenUrlListener.onOpenUrl(url);\n mOnOpenUrlListener.hideLoadingLayout();\n }\n\n }", "void onUrlFragmentInteraction(String url);", "public void changlink(String url2) {\n\t\t_webView.loadUrl(url2);\n\t}", "@Override\n\t\t\t\tpublic void onPageFinished(WebView view, String url) {\n\t\t\t\t\tsuper.onPageFinished(view, url);\n\t\t\t\t\tpd.show();\n\t\t\t\t}", "public void setUrl(String url) {\r\n hc.setUrl(url);\r\n }", "@Override\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\tview.loadUrl(url);\n\t\t\t\treturn true;\n\t\t\t}", "@Override\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\tview.loadUrl(url);\n\t\t\t\treturn true;\n\t\t\t}", "@Override\n public void onPageFinished(WebView view, String url){\n if (url.equals(getString(R.string.urlContact))) {\n fab.show();\n }\n progressBar.setVisibility(View.INVISIBLE);\n }", "public void setDisplay(String title, String html, String url) {\n\t\t\n\t\tthis.title = title;\n\t\tthis.html = html;\n\t\tthis.url = url;\n\t\t\n\t}", "@Override\n\t\t\tpublic void onPageFinished(final WebView view, String url) {\n\t\t\t\t\t\n\t\t\t\tLog.d(\"Finished\",\"Loading\"+url);\n\t\t\t\tpbLine.setVisibility(View.GONE);\n\t\t\t\tsuper.onPageFinished(view, url);\n\t\t\t\t\t\n\t\t\t}", "@Override\n public boolean shouldOverrideUrlLoading(android.webkit.WebView view, String url) {\n view.loadUrl(url);\n return true;\n }", "public void setUrl(String url) {\r\n this.url = url;\r\n }", "public void setUrl(String url) {\r\n this.url = url;\r\n }", "public void setUrl(String url) {\r\n this.url = url;\r\n }", "public void setUrl(String url) {\n this.url = url;\n }", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n view.loadUrl(url);\n return true;\n }", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n view.loadUrl(url);\n return true;\n }", "void displayBrowser(Context context, String urlString) {\n displayBrowser(context, urlString, true);\n }", "public void setUrl(URL url)\n {\n this.url = url;\n }", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n view.loadUrl(url);\n return true;\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.fragment_web_view, container, false);\n\n String url = ((MainActivity) getActivity()).getUrl();\n webTitle = rootView.findViewById(R.id.url_text);\n webTitle.setText(url);\n web_refresh = rootView.findViewById(R.id.web_refresh);\n web_refresh.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n web_refresh.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.fade_in));\n web_view.loadUrl(webTitle.getText()+\"\");\n }\n });\n\nif(url!= null) {\n web_view = rootView.findViewById(R.id.webViewFragment);\n progressBar = rootView.findViewById(R.id.progressBar);\n WebSettings webSettings = web_view.getSettings();\n webSettings.setJavaScriptEnabled(true);\n web_view.setWebChromeClient(new WebChromeClient() {\n public void onProgressChanged(WebView view, int progress) {\n if (progress < 100 && progressBar.getVisibility() == ProgressBar.GONE) {\n progressBar.setVisibility(ProgressBar.VISIBLE);\n }\n\n progressBar.setProgress(progress);\n if (progress == 100) {\n progressBar.setVisibility(ProgressBar.GONE);\n web_refresh.clearAnimation();\n }\n }\n });\n //webView.loadUrl(\"https://drivezy.com\");\n //title.setText();\n\n web_view.loadUrl(url);\n}\n\n return rootView;\n }", "public void setUrl(String url) {\n this.url = url;\n }", "public void setUrl(String url){\n\t\t_url=url;\n\t}", "public void setUrl( String url )\n {\n this.url = url;\n }", "public void setUrl( String url )\n {\n this.url = url;\n }", "public void setUrl(String url) {\r\n\t\tthis.url = url;\r\n\t}", "public void setUrl(String url) {\r\n\t\tthis.url = url;\r\n\t}", "public void setUrl(String url) {\n this.url = url;\n }", "public void setUrl(String url) {\n this.url = url;\n }", "public void setUrl(String url) {\n this.url = url;\n }", "public void setUrl(String url) {\n this.url = url;\n }", "public void setUrl(String url) {\n this.url = url;\n }", "public void setUrl(String url) {\n this.url = url;\n }", "public void setUrl(String url) {\n this.url = url;\n }", "public void setUrl(String url) {\n this.url = url;\n }", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n\n view.loadUrl(url);\n return true;\n\n }", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n\n view.loadUrl(url);\n return true;\n\n }", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n\n view.loadUrl(url);\n return true;\n\n }", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n\n view.loadUrl(url);\n return true;\n\n }", "public void setURL(String url);", "@Override\n\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\tview.loadUrl(url);\n\t\t\treturn true;\n\t\t}", "public final native void setUrl(String url) /*-{\n this.setUrl(url);\n }-*/;", "@Override\n\t public boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t \n\t view.loadUrl(url);\n\t return true;\n\t \n\t }", "public void setUrl(String url) {\n\t\tthis.url = url;\n\t}", "public void setUrl(String url) {\n\t\tthis.url = url;\n\t}", "public void setUrl(String url) {\n\t\tthis.url = url;\n\t}", "public void setUrl(String url) {\n\t\tthis.url = url;\n\t}", "public void setUrl(Uri url) {\n this.urlString = url.toString();\n }", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n view.loadUrl(url, extraHeaders);\n return true;\n }", "public void onPageFinished(WebView view, String url){\n wb.loadUrl(\"javascript:(function(){\"+\"document.getElementById('show').style.display ='none';\"+\"})()\");\n //Call to a function defined on my myJavaScriptInterface\n wb.loadUrl(\"javascript: window.CallToAnAndroidFunction.setVisible()\");\n }", "public void onLoadResource(WebView view, String url) {\n\n }", "private void goToUrl (String url) {\n Intent launchWebview = new Intent(this, ManualWebviewActivity.class);\n launchWebview.putExtra(\"url\", url);\n startActivity(launchWebview);\n }", "public void setUrl (java.lang.String url) {\r\n\t\tthis.url = url;\r\n\t}", "@Override\n public void onPageFinished(WebView view, String url) {\n progress.setVisibility(View.GONE);\n WebViewActivity.this.progress.setProgress(100);\n\n logToast(\"onPageFinished \" + url);\n super.onPageFinished(view, url);\n }", "public void setUrl(String url)\n {\n this.url = url;\n }", "public void setUrl(java.lang.String url) {\n this.url = url;\n }", "@Override\n\t\t\tpublic void onPageFinished(WebView view, String url) {\n\t\t\t\turl_load = url;\n\t\t\t\tLog.i(TAG, \"WEBVIEW FINISH== \" + url);\n\t\t\t\tview.loadUrl(\"javascript:window.injs.getHtmlContentOrImg(1,document.body.innerText)\");\n\t\t\t\tview.loadUrl(\"javascript:window.injs.getHtmlContentOrImg(2,document.getElementsByTagName('img')[0].src)\");\n\n\t\t\t\tview.evaluateJavascript(\"javascript:getShareInfo()\",\n\t\t\t\t\t\tnew ValueCallback<String>() {\n\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void onReceiveValue(String value) {\n\t\t\t\t\t\t\t\tif (value != null) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tvalue = value.replace(\"\\\\\", \"\");\n\t\t\t\t\t\t\t\t\t\tvalue = value.substring(1,\n\t\t\t\t\t\t\t\t\t\t\t\tvalue.length() - 1);\n\t\t\t\t\t\t\t\t\t\tLog.i(TAG, \" value== \" + value);\n\t\t\t\t\t\t\t\t\t\tJSONObject json = new JSONObject(value);\n\t\t\t\t\t\t\t\t\t\ttitle = json.optString(\"title\", \"\");\n\t\t\t\t\t\t\t\t\t\tdesc = json.optString(\"desc\", \"\");\n\t\t\t\t\t\t\t\t\t\timgUrl = json.optString(\"imgUrl\", \"\");\n\t\t\t\t\t\t\t\t\t\tlink = json.optString(\"link\", \"\");\n\t\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\tsuper.onPageFinished(view, url);\n\t\t\t}", "@Override\n public void onItemClick(String url) {\n RxBus2.getInstance().post(Constants.SHOW_WEBVIEW, url);\n RxBus3.getInstance().post(Constants.SHOW_WEBVIEW, url);\n }", "public native final void setUrl(String url)/*-{\n this.url = url;\n }-*/;", "@Override\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\treturn true;\n\t\t\t}", "@Override\n public void onPageFinished(android.webkit.WebView view, String url) {\n super.onPageFinished(view, url);\n progressBar5.setVisibility(View.GONE);\n }", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n if (!loadingFinished) {\n redirect = true;\n }\n\n loadingFinished = false;\n view.loadUrl(url);\n return true;\n }", "@Override\n\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\tview.loadUrl(url);\n\t\t\treturn super.shouldOverrideUrlLoading(view, url);\n\t\t}", "@Override\n public void onPageFinished(final WebView view, final String url) {\n super.onPageFinished(view, url);\n \n }", "public void setURL(String url) {\n\t\tthis.url = url;\n\t}", "@Override\n public void onPageFinished(WebView view, String url) {\n super.onPageFinished(view, url);\n progressBar.setVisibility(View.GONE);\n }", "public void loadingCommitted(WebView pView, WebFrame pFrame) {\n if (pFrame.equals(pView.mainFrame())) {\n String url = pView.mainFrameURL();\n int index = url.indexOf(\"://\");\n int start = index < 0 ? 0 : index + 3;\n addressField.setText(url.substring(start, url.endsWith(\"/\") ? url.length() - 1 : url.length()));\n }\n }", "@Override\n public void onPageFinished(WebView view, String url)\n {\n }", "@Override\n public void onAdShown(final String target){\n this.cordova.getActivity().runOnUiThread(new Runnable() {\n @Override\n public void run() {\n String event = \"javascript:cordova.fireDocumentEvent('onAdShown', {'zone':'\"+target+\"'})\";\n webView.loadUrl(event);\n }\n });\n }", "@Override\r\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\treturn super.shouldOverrideUrlLoading(web, url);\r\n\t\t\t}", "public void onButtonLoadUrl(View theButton){ \t\n \tEditText edit = (EditText)findViewById(R.id.editUrl);\n \tString url = edit.getText().toString();\n \tif (url.length()>0){\n \t\tbrowser.loadUrl(url);\n \t\toutputWindow.append(\"\\nLoading \"+url);\n \t\ttabhost.setCurrentTab(0);\n \t}else {\n \t\toutputWindow.append(\"\\nURL is null\");\n \t} \t \n }", "@Override\r\n\tpublic void onPageFinished(WebView view, String url) {\n\t\t\r\n\t\tsuper.onPageFinished(view, url);\r\n\t\t\r\n\t}", "public void setURL(String _url) { url = _url; }", "@Override\n\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\treturn true;\n\t\t}", "@Override\n public boolean shouldOverrideUrlLoading(WebView webView, String url) {\n webView.loadUrl(url);\n return true;\n }", "void onURLChosen(String url);", "@Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n\n return super.shouldOverrideUrlLoading(view, url);\n }", "@Override\n public void onClick(DialogInterface dialogInterface, int i) {\n Bundle bundle = new Bundle();\n bundle.putString(\"URL\", URL);\n\n ViewWebsiteFragment viewWebsiteFragment = new ViewWebsiteFragment();\n viewWebsiteFragment.setArguments(bundle);\n\n getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, viewWebsiteFragment).commit();\n }", "@Override\n public void loadUrl(Tab tab, String url) {\n loadUrl(tab, url, null);\n }", "@Override\n public void onPageFinished(WebView view, String url) {\n super.onPageFinished(view, url);\n loading.setVisibility(View.GONE);\n }", "private void openURL() {\n webview.loadUrl(\"http://192.168.0.116/webvitool/view/webvitool.php\");\n webview.requestFocus();\n }", "void setUrl(String url) {\n this.url = Uri.parse(url);\n }", "@Override\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\tif (url.startsWith(\"http://www.cognustechnology.com/\")) {\n\t\t\t\t\t// authorization complete hide webview for now.\n//\t\t\t\t\twebview.setVisibility(View.GONE);\n\n\t\t\t\t\tUri uri = Uri.parse(url);\n\t\t\t\t\tLoader loader = new Loader();\n\t\t\t\t\tloader.execute(uri);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn super.shouldOverrideUrlLoading(view, url);\n\t\t\t}", "@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n\t\tif (savedInstanceState != null) {\n\t\t\tmCurrentPosition = savedInstanceState.getInt(ARG_POSITION);\n\t\t\tmCurrentLink = savedInstanceState.getString(ARG_LINK);\n\t\t}\n\n\t\t// Inflate the layout for this fragment\n\t\tview = inflater.inflate(R.layout.browser, container, false);\n\n\t\t// //////////////\n\t\tintent = getActivity().getIntent();\n\t\tnewLink = intent.getStringExtra(\"newLink\");\n\n\t\t_webView = (WebView) view.findViewById(R.id.wv);\n\n\t\tWebSettings webSettings = _webView.getSettings();\n\t\twebSettings.setJavaScriptEnabled(true);\n\t\twebSettings.setLoadWithOverviewMode(true);\n\t\twebSettings.setPluginState(WebSettings.PluginState.ON);\n\t\t_webView.setInitialScale(1);\n\t\t_webView.getSettings().setBuiltInZoomControls(true);\n\t\t_webView.getSettings().setUseWideViewPort(true);\n\t\t_webView.getSettings().setDisplayZoomControls(false);\n\n\t\taddressEditText = (EditText) view.findViewById(R.id.web_address_edit_text);\n\t\t_goButton = (ImageButton) view.findViewById(R.id.web_go_button);\n\t\t_goButton.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (addressEditText.getText().toString().startsWith(HTTP)) {\n\t\t\t\t\t_webView.loadUrl(addressEditText.getText().toString());\n\t\t\t\t} else {\n\t\t\t\t\t_webView.loadUrl(HTTP + addressEditText.getText().toString());\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\taddressEditText.setOnEditorActionListener(new OnEditorActionListener() {\n\t\t\t@Override\n\t\t\tpublic boolean onEditorAction(TextView v, int actionId, KeyEvent event) {\n\t\t\t\tif (addressEditText.getText().toString().startsWith(HTTP)) {\n\t\t\t\t\t_webView.loadUrl(addressEditText.getText().toString());\n\t\t\t\t} else {\n\t\t\t\t\t_webView.loadUrl(HTTP + addressEditText.getText().toString());\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\n\t\tWebViewClient webClient = new WebViewClient() {\n\t\t\t@Override\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onPageStarted(WebView view, final String url, Bitmap favicon) {\n\t\t\t\tsuper.onPageStarted(view, url, favicon);\n\t\t\t\taddressEditText.post(new Runnable() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\taddressEditText.setText(url);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t_webView.setDownloadListener(new DownloadListener() {\n\t\t\t@Override\n\t\t\tpublic void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {\n\t\t\t\tboolean isExternalStorageConnected = false;// getExternalStorageController().isExtStorage();\n\n\t\t\t\tif (!isExternalStorageConnected) {\n\t\t\t\t\t// makeInfoNotification(MessagesManager.getTitle($insert_usb_to_download,\n\t\t\t\t\t// getResources().getString(R.string.insert_usb_to_download)));\n\t\t\t\t} else {\n\t\t\t\t\t// Intent intent = new Intent(WebActivity.this,\n\t\t\t\t\t// DownloadChooseActivity.class);\n\t\t\t\t\t// intent.putExtra(\"url\", url);\n\t\t\t\t\t// startActivityForResult(intent, DOWNLOAD_RESULTCODE);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t_webView.setWebViewClient(webClient);\n\t\t// _webView.setWebViewClient(new WebViewClient());\n\t\t_webView.setWebChromeClient(new WebChromeClient() {\n\t\t\t@Override\n\t\t\tpublic void onShowCustomView(View view,\n\t\t\t\t\tfinal WebChromeClient.CustomViewCallback callback) {\n\t\t\t\t// if a view already exists then immediately terminate the new\n\t\t\t\t// one\n\t\t\t\tif (mCustomView != null) {\n\t\t\t\t\tcallback.onCustomViewHidden();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Add the custom view to its container.\n\t\t\t\tfinal ImageButton fs = new ImageButton(getActivity());\n\t\t\t\tfs.setOnClickListener(new OnClickListener() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\tfs.setVisibility(View.GONE);\n\t\t\t\t\t\tonHideCustomView();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tGRAVITY_BOTTOM_RIGHT.rightMargin = 16;\n\t\t\t\tGRAVITY_BOTTOM_RIGHT.bottomMargin = 16;\n\n\t\t\t\tmCustomViewContainer.addView(view, COVER_SCREEN_GRAVITY_CENTER);\n\t\t\t\tmCustomViewContainer.addView(fs, GRAVITY_BOTTOM_RIGHT);\n\t\t\t\tmCustomView = view;\n\t\t\t\tmCustomViewCallback = callback;\n\n\t\t\t\t// hide main browser view\n\t\t\t\tmContentView.setVisibility(View.GONE);\n\n\t\t\t\t// Finally show the custom view container.\n\t\t\t\tmCustomViewContainer.setVisibility(View.VISIBLE);\n\t\t\t\tmCustomViewContainer.bringToFront();\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onHideCustomView() {\n\t\t\t\tif (mCustomView == null)\n\t\t\t\t\treturn;\n\n\t\t\t\t// Hide the custom view.\n\t\t\t\tmCustomView.setVisibility(View.GONE);\n\t\t\t\t// Remove the custom view from its container.\n\t\t\t\tmCustomViewContainer.removeView(mCustomView);\n\t\t\t\tmCustomView = null;\n\t\t\t\t// mCustomViewContainer.setVisibility(View.GONE);\n\t\t\t\tmCustomViewCallback.onCustomViewHidden();\n\n\t\t\t\t// Show the content view.\n\t\t\t\tmContentView.setVisibility(View.VISIBLE);\n\t\t\t\tmContentView.bringToFront();\n\t\t\t}\n\n\t\t\t// For Android 3.0+\n\t\t\tpublic void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {\n\t\t\t\t// mUploadMessage = uploadMsg;\n\t\t\t\t// final boolean isExternalStorageConnected =\n\t\t\t\t// getExternalStorageController().isExtStorage();\n\t\t\t\t//\n\t\t\t\t// runOnUiThread(new Runnable()\n\t\t\t\t// {\n\t\t\t\t//\n\t\t\t\t// @Override\n\t\t\t\t// public void run()\n\t\t\t\t// {\n\t\t\t\t// if(!isExternalStorageConnected)\n\t\t\t\t// {\n\t\t\t\t// //makeInfoNotification(MessagesManager.getTitle($insert_usb_to_upload,\n\t\t\t\t// getResources().getString(R.string.insert_usb_to_upload)));\n\t\t\t\t// mUploadMessage.onReceiveValue(null);\n\t\t\t\t// return;\n\t\t\t\t// }\n\t\t\t\t//\n\t\t\t\t// // Intent intent = new Intent(WebActivity.this,\n\t\t\t\t// UploadChooserActivity.class);\n\t\t\t\t// // startActivityForResult(intent, UPLOAD_RESULTCODE);\n\t\t\t\t// }\n\t\t\t\t// });\n\n\t\t\t}\n\n\t\t\t// For Android < 3.0\n\t\t\t@SuppressWarnings(\"unused\")\n\t\t\tpublic void openFileChooser(ValueCallback<Uri> uploadMsg) {\n\t\t\t\topenFileChooser(uploadMsg, \"\");\n\t\t\t}\n\n\t\t\t// For Android > 4.1\n\t\t\t@SuppressWarnings(\"unused\")\n\t\t\tpublic void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {\n\t\t\t\topenFileChooser(uploadMsg, acceptType);\n\t\t\t}\n\n\t\t});\n\n\t\tfinal ImageButton homeImageView = (ImageButton) view.findViewById(R.id.web_home_image_view);\n\t\thomeImageView.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t_webView.loadUrl(HOME_PAGE);\n\t\t\t}\n\t\t});\n\n\t\tfinal ImageButton webBackImageView = (ImageButton) view.findViewById(R.id.web_back_image_view);\n\t\twebBackImageView.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (_webView.canGoBack()) {\n\t\t\t\t\t_webView.goBack();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tfinal ImageButton webForwardImageView = (ImageButton) view.findViewById(R.id.web_forward_image_view);\n\t\twebForwardImageView.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (_webView.canGoForward()) {\n\t\t\t\t\t_webView.goForward();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tif (getActivity().getIntent().getExtras() != null) {\n\t\t\tString _url = getActivity().getIntent().getExtras()\n\t\t\t\t\t.getString(LINK_PARAM, null);\n\t\t\tif (_url != null) {\n\t\t\t\turl = _url;\n\t\t\t}\n\t\t}\n\t\t_webView.loadUrl(url);\n\t\treturn view;\n\t}", "@Override\r\n\t\t\tpublic void onPageFinished(WebView view, String url) {\n\t\t\t\tsuper.onPageFinished(view, url);\r\n\t\t\t}", "@Override\n\t\t\tpublic void onPageFinished(WebView view, String url) {\n\t\t\t\tsuper.onPageFinished(view, url);\n\t\t\t}" ]
[ "0.6792708", "0.6792708", "0.6529605", "0.5763028", "0.5763028", "0.57470095", "0.5640614", "0.5581258", "0.55769956", "0.55672425", "0.55518883", "0.55518883", "0.554965", "0.554965", "0.5536957", "0.5503245", "0.5484804", "0.5481258", "0.54758394", "0.5475565", "0.5475565", "0.5473296", "0.54663414", "0.5462635", "0.5447305", "0.54472536", "0.54472536", "0.54472536", "0.5443451", "0.5440952", "0.5440952", "0.5439902", "0.5435782", "0.54340637", "0.5428", "0.5423089", "0.54157287", "0.5413601", "0.5413601", "0.5410976", "0.5410976", "0.54097927", "0.54097927", "0.54097927", "0.54097927", "0.54097927", "0.54097927", "0.54097927", "0.54097927", "0.54028493", "0.54028493", "0.54028493", "0.54028493", "0.5397086", "0.5363278", "0.53309983", "0.53304964", "0.53283644", "0.53283644", "0.53283644", "0.53283644", "0.5327596", "0.53265965", "0.53204656", "0.5308443", "0.53049636", "0.53021383", "0.5301754", "0.5288927", "0.52855587", "0.5275548", "0.52751684", "0.5271627", "0.525179", "0.52421063", "0.5237882", "0.52350867", "0.52288073", "0.5203693", "0.5201381", "0.5201222", "0.52003974", "0.5194303", "0.51817626", "0.51697403", "0.51600474", "0.5153769", "0.5151936", "0.5148262", "0.51379913", "0.51343125", "0.51216453", "0.5120261", "0.5119175", "0.5115116", "0.51145995", "0.510927", "0.5107802", "0.5104462", "0.510432" ]
0.71359956
0
createNewWebView: This method creates a new WebView and adds it to the WebView container.
private void createNewWebView() { //Remove the webView from it's parent if the webView exists if(webView != null) { ViewGroup parent = (ViewGroup) webView.getParent(); parent.removeView(webView); } //Create a new WebView webView = new WebView(getContext()); webView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)); //Add the new WebView to the webViewContainer webViewContainer.addView(webView); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private WebView createWebView() {\n WebView webView = new WebView();\n webView.setContextMenuEnabled(false);\n\n WebEngine engine = webView.getEngine();\n // The files below must exist! Or pdf viewer no more!\n String url = new File(\"src/Resources/pdfjs_2.7.570/web/viewer.html\").toURI().toString();\n\n engine.setJavaScriptEnabled(true);\n engine.load(url);\n\n\n engine.getLoadWorker()\n .stateProperty()\n .addListener(\n new ChangeListener<>() {\n @Override\n public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {\n JSObject window = (JSObject) engine.executeScript(\"window\");\n window.setMember(\"java\", null);\n engine.executeScript(\"console.log = function(message){ try {java.log(message);} catch(e) {} };\");\n\n if (newValue == Worker.State.SUCCEEDED) {\n try {\n PDFDisplayer.this.pdfJsLoaded = true;\n\n if (PDFDisplayer.this.loadScript != null) {\n engine.executeScript(PDFDisplayer.this.loadScript);\n }\n\n engine.executeScript(PDFDisplayer.this.toExecuteWhenPDFJSLoaded);\n PDFDisplayer.this.toExecuteWhenPDFJSLoaded = null;\n observable.removeListener(this);\n } catch (RuntimeException e) {\n e.printStackTrace();\n throw new RuntimeException(e);\n }\n }\n }\n });\n return webView;\n }", "private void initWebView(){ \r\n WebEngine webEngine = viewerPane.getEngine();\r\n webEngine.load(\"http://www.google.com\");\r\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n {\n // Inflate the layout for this fragment\n View view = inflater.inflate(R.layout.fragment_browser, container, false);\n\n webViewContainer = (LinearLayout) view.findViewById(R.id.webViewContainer);\n\n //Add the previous WebView to the view if one exists.\n if(webView != null) {\n ViewGroup oldParent = (ViewGroup) webView.getParent();\n oldParent.removeView(webView);\n webViewContainer.addView(webView);\n } else {\n createNewWebView();\n }\n\n return view;\n }", "@Override\n\tpublic void initWebView(BBWebView webView) {\n\t\tthis._webView = webView;\n\t}", "private void setupWebView(){\n \t\n\t\twebView = (WebView) findViewById(R.id.webview);\n\t\twebView.getSettings().setJavaScriptEnabled(true);\n\t\t/** Create an WebViewClient to add and remove an progress dialog*/\n\t\twebView.setWebViewClient(new WebViewClient() {\n\t\t\t@Override\n\t\t\tpublic void onPageStarted(WebView view, String url, Bitmap favicon) {\n\t\t\t\tshowDialog(PROGRESS_DIALOG);\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onPageFinished(WebView view, String url) {\n\t\t\t\tremoveDialog(PROGRESS_DIALOG); \n\t\t\t}\n\t\t});\n\t\twebView.loadUrl(MAP_URL);\n\t}", "@SuppressWarnings(\"deprecation\")\n\t@SuppressLint({ \"SetJavaScriptEnabled\", \"NewApi\" })\n\tprivate void initWebview() {\n\t\twebView = (WebView) findViewById(AppUtility.getResourseIdByName(getApplicationContext().getPackageName(), \"id\", \"webView1\"));\n\n\t\twebView.setWebChromeClient(webChromeClient);\n\t\twebView.getSettings().setJavaScriptEnabled(true);\n\t\twebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n\t\twebView.getSettings().setDomStorageEnabled(true);\n\t\twebView.getSettings().setSupportZoom(false);\n\n\t\t// To enable web debugging for Android KitKat(API level 19) & above\n\t\tif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n\t\t\tWebView.setWebContentsDebuggingEnabled(true);\n\t\t}\n\t\t// ----------------------------------------------------------------\n\n\t\t// Done to facilitate debugging through tools such as Node JS as devices\n\t\t// running Jelly Bean and above were not supporting such debugging\n\t\tif (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN)\n\t\t\twebView.getSettings().setAllowUniversalAccessFromFileURLs(true);\n\n\t\t// TODO temp changes\n\t\twebView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);\n\t\t// -------------------------------------\n\n\t\twebView.setVerticalScrollBarEnabled(false);\n\t\twebView.setOverScrollMode(View.OVER_SCROLL_NEVER);\n\t\t// Defines the rendering priority for WebView.Improves performance in\n\t\t// rendering pages\n\t\twebView.getSettings().setRenderPriority(RenderPriority.HIGH);\n\t\t// Prevents the cache from loading. Improves performance in creating and\n\t\t// rendering pages\n\t\twebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);\n\t\t// Disabling hardware acceleration by default in Android 4.0+\n\t\tif (isICSOrHigher) {\n\t\t\twebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);\n\t\t}\n\n\t\tSmartJsInterface smartJsInterface = new SmartJsInterface(this);\n\t\twebView.addJavascriptInterface(smartJsInterface, \"appezAndroid\");\n\t\twebView.setWebViewClient(new SmartWebViewClient(this));\n\n\t\t// To restrict horizontal scrolling\n\t\twebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);\n\t\twebView.setBackgroundResource(AppUtility.getResourseIdByName(getApplicationContext().getPackageName(), \"drawable\", \"splash\"));\n\t\tif (getIntent().hasExtra(SmartConstants.CHECK_FOR_BACKGROUND)) {\n\t\t\twebViewDefaultImg = (ImageView) findViewById(AppUtility.getResourseIdByName(getApplicationContext().getPackageName(), \"id\", \"webview1bg\"));\n\t\t\tif (webViewDefaultImg != null) {\n\t\t\t\tif (getIntent().getBooleanExtra(SmartConstants.CHECK_FOR_BACKGROUND, false)) {\n\t\t\t\t\twebViewDefaultImg.setVisibility(View.VISIBLE);\n\t\t\t\t} else {\n\t\t\t\t\twebViewDefaultImg.setVisibility(View.INVISIBLE);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Added for detecting the show/hide of the soft keyboard\n\t\tfinal View activityRootView = findViewById(AppUtility.getResourseIdByName(getApplicationContext().getPackageName(), \"id\", \"frame_layout\"));\n\t\tactivityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {\n\t\t\t@Override\n\t\t\tpublic void onGlobalLayout() {\n\t\t\t\tint heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();\n\t\t\t\tLog.d(SmartConstants.APP_NAME, \"SmartViewActivity->initWebview->soft keyboard->heightDiff:\" + heightDiff);\n\t\t\t\tif (heightDiff > 100) {\n\t\t\t\t\t// if more than 100 pixels, its probably a keyboard...\n\t\t\t\t\tisSoftKeyboardShown = true;\n\t\t\t\t\tLog.d(SmartConstants.APP_NAME, \"SmartViewActivity->initWebview->soft keyboard shown\");\n\t\t\t\t} else {\n\t\t\t\t\tif (isSoftKeyboardShown) {\n\t\t\t\t\t\tisSoftKeyboardShown = false;\n\t\t\t\t\t\tLog.d(SmartConstants.APP_NAME, \"SmartViewActivity->initWebview->soft keyboard hidden\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t// ---------------------------------------\n\t}", "private void setupWebView() {\n\t\twebView = (WebView) findViewById(R.id.webview);\n\t\twebView.getSettings().setJavaScriptEnabled(true);\n\t\twebView.addJavascriptInterface(new JavaScriptInterface(this), \"Android\");\n\t\twebView.loadUrl(MAP_URL);\n\t}", "public void createPage(@NonNull WPEView wpeView, @NonNull Context context) {\n Log.d(LOGTAG, \"Create new Page instance for view \" + wpeView);\n if (m_pages == null) {\n m_pages = new IdentityHashMap<>();\n }\n assert (!m_pages.containsKey(wpeView));\n Page page = new Page(this, context, wpeView, m_pages.size());\n m_pages.put(wpeView, page);\n m_activeView = wpeView;\n if (m_webProcess != null) {\n m_webProcess.setActivePage(page);\n }\n loadPendingUrls(wpeView);\n }", "@SuppressLint(\"JavascriptInterface\")\nprivate void setupWebView(){ \n \n webView = (WebView) findViewById(R.id.webview01); \n webView.getSettings().setJavaScriptEnabled(true); \n webView.setWebViewClient(new WebViewClient()); \n webView.loadUrl(MAP_URL); \n \n /** Allows JavaScript calls to access application resources **/ \n webView.addJavascriptInterface(new JavaScriptInterface(), \"android\"); \n \n }", "public static void registerWebView(Activity activity, ObservableWebView webView, ObservableScrollViewCallbacks observableScrollViewCallbacks) {\n if (activity != null && hashMap.containsKey(activity)) {\n MaterialViewPagerAnimator animator = hashMap.get(activity);\n if (animator != null) {\n animator.registerWebView(webView, observableScrollViewCallbacks);\n }\n }\n }", "@Override public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_contentslist, container, false);\n //View tv = v.findViewById(R.id.text);\n //((TextView)tv).setText(mLabel != null ? mLabel : \"(no label)\");\n //tv.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.gallery_thumb));\n webView = (WebView)v.findViewById(ddoba.android.lwsoft.ddoba.R.id.webView);\n\n customViewContainer = (FrameLayout) v.findViewById(ddoba.android.lwsoft.ddoba.R.id.customViewContainer);\n mWebViewClient = new myWebViewClient();\n webView.setWebViewClient(mWebViewClient);\n\n mWebChromeClient = new myWebChromeClient();\n webView.setWebChromeClient(mWebChromeClient);\n\n //MainActivity.setWebViewSettings(webView);\n setwebsetting(webView);\n\n\n webView.loadUrl(\"http://www.dasibogi.com/\");\n return v;\n }", "@SuppressLint({ \"SetJavaScriptEnabled\", \"NewApi\" })\n\tprivate void init_webview() {\n\t\tmWebView = (WebView) findViewById(R.id.webView1);\n\t\tmWebView.getSettings().setJavaScriptEnabled(true);\n\t\tmWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);\n\t\tmWebView.setHorizontalScrollBarEnabled(true);\n\t\tmWebView.getSettings().setSupportZoom(true);\n\t\tmWebView.getSettings().setBuiltInZoomControls(true);\n\t\tmWebView.setInitialScale(50);\n\t\tmWebView.setHorizontalScrollbarOverlay(true);\n\t\tmWebView.getSettings().setUseWideViewPort(true);\n\t\tmWebView.getSettings().setLoadWithOverviewMode(true);\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n if (mWebView != null) {\n mWebView.destroy();\n }\n mWebView = new WebView(getActivity());\n \n mWebView.setWebViewClient(new WebViewClient() {\n \n \n public void onPageFinished(WebView view, String url1) {\n if(url1.contains(\"students.yale.edu/evalsearch\")){\n \t ((MainActivity) activity).userAuthenticated = true;\n \n \t onFinishCreateCourseFragment(); \n }\n }\n });\n mWebView.loadUrl(mUrl); //load the course evaluation search url to generate correct cookies.\n \n mIsWebViewAvailable = true;\n return mWebView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_web_view, container, false);\n ButterKnife.bind(this, view);\n\n getDataFromBundle();\n wvHomepage.setWebViewClient(new WebViewClient());\n wvHomepage.loadUrl(url);\n\n return view;\n }", "@SuppressLint(\"SetJavaScriptEnabled\")\n private void configWebView() {\n mWebView = new WebView(getApplicationContext());\n mWebViewContainer.addView(mWebView);\n WebSettings settings = mWebView.getSettings();\n\n // 设置无图模式\n //settings.setBlockNetworkImage(SPUtil.getBoolean(Constants.SETTING_NO_IMAGE));\n\n // 设置离线设置\n //boolean offline = SPUtil.getBoolean(Constants.SETTING_AUTO_DOWNLOAD);\n //settings.setAppCacheEnabled(offline);\n //settings.setDomStorageEnabled(offline);\n //settings.setDatabaseEnabled(offline);\n\n // 设置缓存模式\n //boolean netWorkAvailable = NetWorkUtil.isNetWorkAvailable(AppUtil.getAppContext());\n //settings.setCacheMode(netWorkAvailable ? WebSettings.LOAD_DEFAULT : WebSettings.LOAD_CACHE_ONLY);\n\n // 设置大号字体\n /* if (SPUtil.getBoolean(Constants.SETTING_BIG_FONT)) {\n settings.setMinimumFontSize(25);\n }*/\n\n // 激活java script\n settings.setJavaScriptEnabled(true);\n\n // 充满全屏\n settings.setLoadWithOverviewMode(true);\n\n // 适配移动端屏幕\n settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);\n\n // 支持缩放\n settings.setSupportZoom(true);\n settings.setBuiltInZoomControls(true);\n\n // 设置可以访问文件内容\n settings.setAllowContentAccess(true);\n\n // 设置夜景模式\n //mWebView.setDayOrNight(!isNightMode());\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_program_unggulan, container, false);\n wvPage1 = (WebView)v.findViewById(R.id.activity_main_webview);\n WebSettings settings = wvPage1.getSettings();\n settings.setJavaScriptEnabled(true);\n wvPage1.setWebViewClient(new MyWebViewClient());\n\n wvPage1.loadUrl(url);\n return v;\n }", "@Override\r\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n\t\t\tBundle savedInstanceState) {\n\t\tView view = inflater.inflate(R.layout.fragment_lesson_web_view, container,\r\n\t\t\t\tfalse);\r\n\t\tlessonWeb = (WebView) view.findViewById(R.id.webview);\r\n\t\tString sourceLesson = getArguments().getString(lessonWebUrl);\r\n\t\tlessonWeb.loadUrl(sourceLesson);\r\n\t\t\r\n\t\treturn view;\r\n\t}", "private void startWebView(String url)\n {\n Utility.freeMemory();\n mBinding.webView1.setWebViewClient(new WebViewClient() {\n ProgressDialog progressDialog;\n\n //If you will not use this method url links are opeen in new brower not in webview\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n view.loadUrl(url);\n return true;\n }\n\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon)\n {\n super.onPageStarted(view, url, favicon);\n if (progressDialog == null) {\n // in standard case YourActivity.this\n progressDialog = new ProgressDialog(AttachmentDisplay.this);\n progressDialog.setMessage(\"Loading. Please wait...\");\n progressDialog.setCancelable(false);\n progressDialog.show();\n }\n }\n\n public void onPageFinished(WebView view, String url) {\n try{\n if (progressDialog.isShowing()) {\n progressDialog.dismiss();\n progressDialog = null;\n }\n }catch(Exception exception){\n exception.printStackTrace();\n }\n }\n\n });\n\n // Javascript inabled on webview\n mBinding.webView1.getSettings().setJavaScriptEnabled(true);\n\n // Other webview options\n /*\n webView.getSettings().setLoadWithOverviewMode(true);\n webView.getSettings().setUseWideViewPort(true);\n webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);\n webView.setScrollbarFadingEnabled(false);\n webView.getSettings().setBuiltInZoomControls(true);\n */\n\n /*\n String summary = \"<html><body>You scored <b>192</b> points.</body></html>\";\n webview.loadData(summary, \"text/html\", null);\n */\n\n //Load url in webview\n mBinding.webView1.loadUrl(url);\n }", "YARRWebAppInterface(Context c, WebView webView) {\n mContext = c;\n mWebView = webView;\n }", "private WebView m25229c(Context context) {\n WebView webView = new WebView(context);\n webView.setLayoutParams(new LayoutParams(-1, -1));\n webView.setWebViewClient(new C57413(this));\n webView.loadUrl(this.webOptions.getUrl());\n return webView;\n }", "private void setUpWebView() {\n setWebViewClient(new MPulseInboxWebViewClient());\n setWebChromeClient(new MPulseInboxWebChromeClient());\n configureWebViewSettings();\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_webvitool);\n webview= findViewById(R.id.webviewweb);\n webview.getSettings().setJavaScriptEnabled(true);\n webview.setWebViewClient(new MyWebViewClient());\n openURL();\n }", "private void loadWeb() {\n\t\tweb.getSettings().setJavaScriptEnabled(true);\r\n\t\t//\r\n\t\tweb.setWebViewClient(new WebViewClient() {\r\n\t\t\t@Override\r\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\treturn super.shouldOverrideUrlLoading(web, url);\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onPageFinished(WebView view, String url) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tsuper.onPageFinished(view, url);\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onPageStarted(WebView view, String url, Bitmap favicon) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tsuper.onPageStarted(view, url, favicon);\r\n\t\t\t}\r\n\t\t});\r\n\t\tweb.loadUrl(url);\r\n\t}", "@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\twebview = new WebView(this);\n\t\t// Add progress bar\n\t\tgetWindow().requestFeature(Window.FEATURE_PROGRESS);\n\t\t// Enable Javascript\n\t\twebview.getSettings().setJavaScriptEnabled(true);\n\n\t\tfinal Activity activity = this;\n\t\twebview.setWebChromeClient(new WebChromeClient() {\n\t\t\tpublic void onProgressChanged(WebView view, int progress) {\n\t\t\t\tactivity.setProgress(progress * 1000);\n\t\t\t}\n\t\t});\n\t\twebview.setWebViewClient(new WebViewClient() {\n\t\t\t// Handle errors accordingly\n\t\t\tpublic void onReceivedError(WebView view, int errorCode,\n\t\t\t\t\tString description, String failingUrl) {\n\t\t\t\tToast.makeText(activity, \"Error Received:\" + description,\n\t\t\t\t\t\tToast.LENGTH_SHORT).show();\n\t\t\t}\n\t\t});\n\n\t\twebview.loadUrl(\"http://www.java.net\");\n\t\tsetContentView(webview);\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_terms_and_condition, container, false);\n\n\n webView = (WebView) view.findViewById(R.id.webView);\n // displaying content in WebView from html file that stored in assets folder\n webView.getSettings().setJavaScriptEnabled(true);\n //webView.loadUrl(\"file:///android_res/raw/\" + \"terms_and_condition.html\");\n if (AppController.isBaseUrl) {\n webView.loadUrl(AppController.devURL + AppController.terms_and_conditions);\n } else {\n webView.loadUrl(AppController.prodURL + AppController.terms_and_conditions);\n }\n return view;\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_web_view);\n\n webView = findViewById(R.id.webView);\n\n webView.setWebViewClient(new WebViewClient());\n webView.getSettings().setJavaScriptEnabled(true);\n webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n // webView.setWebChromeClient(new MyCustomChromeClient(this));\n// webView.setWebViewClient(new MyCustomWebViewClient(this));\n// webView.clearCache(true);\n// webView.clearHistory();\n// webView.getSettings().setJavaScriptEnabled(true);\n// webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n webView.loadUrl(\"https://uperfect.in/\");\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n WebView webView = (WebView) findViewById(R.id.webView);\n final TextView contentView = (TextView) findViewById(R.id.contentView);\n\n /* An instance of this class will be registered as a JavaScript interface */\n class MyJavaScriptInterface\n {\n private TextView contentView;\n\n public MyJavaScriptInterface(TextView aContentView)\n {\n contentView = aContentView;\n }\n\n @SuppressWarnings(\"unused\")\n\n public void processContent(String aContent)\n {\n final String content = aContent;\n contentView.post(new Runnable()\n {\n public void run()\n {\n contentView.setText(content);\n }\n });\n }\n }\n\n webView.getSettings().setJavaScriptEnabled(true);\n webView.addJavascriptInterface(new MyJavaScriptInterface(contentView), \"INTERFACE\");\n webView.setWebViewClient(new WebViewClient() {\n @Override\n public void onPageFinished(WebView view, String url)\n {\n view.loadUrl(\"javascript:window.INTERFACE.processContent(document.getElementsByTagName('body')[0].innerText);\");\n // view.addJavascriptInterface(new IJavascriptHandler(WebviewTest2Activity.this), \"Android\"); //if your class extends Activity\n view.getSettings().setJavaScriptEnabled(true);\n view.addJavascriptInterface(new MyJavaScriptInterface(contentView), \"HtmlViewer\");\n }\n });\n\n webView.loadUrl(\"https://html-online.com/editor/\");\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View root = inflater.inflate(R.layout.fragment_web, container, false);\n webView = root.findViewById(R.id.web_webView);\n webView.setWebViewClient(new WebViewClient());\n webView.loadUrl(\"https://www.google.com\");\n webView.setOnKeyListener(new View.OnKeyListener(){\n public boolean onKey(View v, int keyCode, KeyEvent event) {\n if (keyCode == KeyEvent.KEYCODE_BACK\n && event.getAction() == MotionEvent.ACTION_UP\n && webView.canGoBack()) {\n handler.sendEmptyMessage(1);\n return true;\n }\n return false;\n }\n });\n return root;\n }", "private void startWebView(String url) {\n\n webView.setWebViewClient(new WebViewClient() {\n Dialog progressDialog;\n\n //If you will not use this method url links are opeen in new brower not in webview\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n view.loadUrl(url);\n return true;\n }\n\n //Show loader on url load\n public void onLoadResource (WebView view, String url) {\n if (progressDialog == null) {\n // in standard case YourActivity.this\n progressDialog = Utils.showProgressDialog(getActivity());\n }\n }\n public void onPageFinished(WebView view, String url) {\n try{\n if (progressDialog.isShowing()) {\n Utils.cancelProgressDialog(progressDialog);\n }\n }catch(Exception exception){\n exception.printStackTrace();\n\n }\n }\n\n });\n\n // Javascript inabled on webview\n webView.getSettings().setJavaScriptEnabled(true);\n\n //Load url in webview\n webView.loadUrl(url);\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n if (rootView==null) {\n rootView = inflater.inflate(R.layout.fragment_about_scrolls, container, false);\n web_view = (WebView) rootView.findViewById(R.id.about_scrolls_web_view);\n final WebSettings webSettings = web_view.getSettings();\n webSettings.setJavaScriptEnabled(true);\n web_view.setWebViewClient(new myWebClient());\n web_view.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View view, MotionEvent motionEvent) {\n //Blank listener to disable long click text selection\n return true;\n }\n });\n web_view.setWebViewClient(new WebViewClient() {\n\n @Override\n public void onPageFinished(final WebView view, final String url) {\n super.onPageFinished(view, url);\n web_view.invalidate();\n }\n });\n }\n return rootView;\n }", "private void startWebView(String url) {\n\n webView.setWebViewClient(new WebViewClient() {\n\n //If you will not use this method url links are opeen in new brower not in webview\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n view.loadUrl(url);\n return true;\n }\n\n //Show loader on url load\n public void onLoadResource(WebView view, String url) {\n\n }\n\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon) {\n DialogClass.showDialog(LocationTrackerActivity.this, getResources().getString(R.string.please_wait));\n super.onLoadResource(view, url);\n super.onPageStarted(view, url, favicon);\n }\n\n public void onPageFinished(WebView view, String url) {\n DialogClass.dismissDialog(LocationTrackerActivity.this);\n isLoadComplete = true;\n super.onPageFinished(view, url);\n }\n\n @Override\n public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {\n DialogClass.dismissDialog(LocationTrackerActivity.this);\n super.onReceivedError(view, request, error);\n }\n });\n webView.loadUrl(url);\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View inflate = inflater.inflate(R.layout.fragment_gui_ge_xq, container, false);\n WebView webView= (WebView) inflate.findViewById(R.id.webView_gg);\n\n webView.getSettings().setJavaScriptEnabled(true);\n// webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);\n webView.loadUrl(\"http://product.suning.com/pds-web/product/graphicDetailsApp/0000000000/102295661/10051/R9000413/1.html\");\n return inflate;\n\n\n }", "private void webViewSettings(String url){\n this.registerForContextMenu(wV);\n wV.loadUrl(\"http://\"+url);\n WebIconDatabase.getInstance().open(getDir(\"icons\", MODE_PRIVATE).getPath());\n wV.getSettings().setJavaScriptEnabled(true);\n wV.getSettings().setBuiltInZoomControls(true);\n wV.getSettings().setSupportZoom(true);\n wV.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View v, MotionEvent event) {\n switch (event.getAction()) {\n case MotionEvent.ACTION_DOWN:\n case MotionEvent.ACTION_UP:\n if (!v.hasFocus()) {\n v.requestFocus();\n }\n break;\n }\n return false;\n }\n });\n wV.setWebChromeClient(new WebChromeClient() {\n\n @Override\n public void onReceivedIcon(WebView view, Bitmap icon) {\n favicon.setImageBitmap(icon);\n }\n\n @Override\n public void onReceivedTitle(WebView view, String title) {\n getWindow().setTitle(title);\n }\n });\n\n wV.setWebViewClient(new WebViewClient() {\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n\n\n\n return super.shouldOverrideUrlLoading(view, url);\n\n }\n\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon) {\n editUrl.setText(url);\n progress.setVisibility(View.VISIBLE);\n }\n\n @Override\n public void onPageFinished(WebView view, String url) {\n progress.setVisibility(View.INVISIBLE);\n\n //if not errors\n if(error==0){\n //insert historic\n dao.insertHistoric(MainActivity.this, wV.getUrl());\n }\n error=0;\n\n }\n\n @Override\n public void onReceivedError(WebView view, int errorCode, String description, String failUrl) {\n AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);\n builder.setMessage(description).setPositiveButton(\"OK\",null).setTitle(\"Web Page Error! \"+failUrl);\n builder.show();\n error = 1;\n\n\n }\n });\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_course, container, false);\n WebView mWebView = view.findViewById(R.id.courseWebView);\n // Enable Javascript\n WebSettings webSettings = mWebView.getSettings();\n webSettings.setJavaScriptEnabled(true);\n // 화면 비율\n webSettings.setUseWideViewPort(true);// wide viewport를 사용하도록 설정\n webSettings.setLoadWithOverviewMode(true);// 컨텐츠가 웹뷰보다 클 경우 스크린 크기에 맞게 조정\n // 웹뷰 멀티 터치 가능하게 (줌기능)\n //webSettings.setBuiltInZoomControls(true);// 줌 아이콘 사용\n webSettings.setSupportZoom(true);\n // Force links and redirects to open in the WebView instead of in a browser\n mWebView.setWebViewClient(new WebViewClient());\n mWebView.loadUrl(\"http://192.168.219.100:7000/E_LearningPage.jsp\");\n return view;\n }", "@Override\n public boolean onCreateWindow(WebView view, boolean isDialog,\n boolean isUserGesture, Message resultMsg) {\n\n WebView.HitTestResult result = view.getHitTestResult();\n String url = result.getExtra();\n\n if(url != null && url.indexOf(\"about:blank\")>-1){\n Intent intent = new Intent(Intent.ACTION_VIEW);\n intent.setData(Uri.parse(url));\n startActivity(intent);\n return true;\n }else{\n WebView newWebView = new WebView(MainActivity.this);\n view.addView(newWebView);\n WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;\n\n transport.setWebView(newWebView);\n resultMsg.sendToTarget();\n return true;\n }\n\n }", "public NKE_BrowserWindow(HashMap<String, Object> options, NKScriptValue jsvalue) {\n\n _id = NKScriptContextFactory.sequenceNumber++;\n\n this.jsValue = jsvalue;\n\n if (options == null)\n options = new HashMap<String, Object>();\n \n windowArray.put(_id, this);\n\n try {\n\n _webContents = new NKE_WebContents_AndroidWebView(this);\n\n // PARSE & STORE OPTIONS\n if (options.containsKey(NKE_BrowserWindow.Options.nkBrowserType))\n browserType = NKE_BrowserWindow.Type.valueOf((String) options.get(NKE_BrowserWindow.Options.nkBrowserType));\n else\n browserType = NKE_BrowserWindow.Type.WebView;\n\n final HashMap<String, Object> _options = options;\n\n switch (browserType) {\n case WebView:\n NKLogging.log(\"creating Native (Android WebView) Renderer\", NKLogging.Level.Info);\n\n NKApplication.UIHandler.post(new Runnable() {\n @Override\n public void run() {\n _webContents.createWebView(_id, _options);\n }\n });\n\n break;\n default:\n break;\n\n }\n } catch (Exception e) {\n NKLogging.log(e);\n }\n\n events.on(\"NKE.DidFinishLoad\", new NKEventHandler<String>() {\n protected void call(String event, String test) {\n jsValue.invokeMethod(\"emit\", new String[] { \"did-finish-load\" });\n }\n });\n\n }", "@Override\r\npublic void start(Stage arg0) throws Exception {\n\t\r\n\t webComponent = new WebView();\r\n webEngine=webComponent.getEngine();\r\n \r\n /* JSObject jsobj = (JSObject)webEngine.executeScript(\"window\");\r\n jsobj.setMember(\"android\", new HelloWorld());*/\r\n \r\n// Util.list.add(url);\r\n // loadUrl(url);\r\n // webComponent.getEngine().getLoadWorker().stateProperty().add\r\n System.out.println(\"RUN2\");\r\n webEngine.getLoadWorker().stateProperty()\r\n .addListener((obs, oldValue, newValue) -> {\r\n if (newValue == Worker.State.SUCCEEDED) {\r\n\r\n JSObject jsobj = (JSObject) webEngine.executeScript(\"window\");\r\n jsobj.setMember(\"android\", new HelloWorld());\r\n }\r\n });\r\n\t mainFrame = new ApplicationFrame(webEngine,webComponent);\r\n mainFrame.setVisible(true);\r\n System.out.println(\"RUN\");\r\n}", "@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n\t\tif (savedInstanceState != null) {\n\t\t\tmCurrentPosition = savedInstanceState.getInt(ARG_POSITION);\n\t\t\tmCurrentLink = savedInstanceState.getString(ARG_LINK);\n\t\t}\n\n\t\t// Inflate the layout for this fragment\n\t\tview = inflater.inflate(R.layout.browser, container, false);\n\n\t\t// //////////////\n\t\tintent = getActivity().getIntent();\n\t\tnewLink = intent.getStringExtra(\"newLink\");\n\n\t\t_webView = (WebView) view.findViewById(R.id.wv);\n\n\t\tWebSettings webSettings = _webView.getSettings();\n\t\twebSettings.setJavaScriptEnabled(true);\n\t\twebSettings.setLoadWithOverviewMode(true);\n\t\twebSettings.setPluginState(WebSettings.PluginState.ON);\n\t\t_webView.setInitialScale(1);\n\t\t_webView.getSettings().setBuiltInZoomControls(true);\n\t\t_webView.getSettings().setUseWideViewPort(true);\n\t\t_webView.getSettings().setDisplayZoomControls(false);\n\n\t\taddressEditText = (EditText) view.findViewById(R.id.web_address_edit_text);\n\t\t_goButton = (ImageButton) view.findViewById(R.id.web_go_button);\n\t\t_goButton.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (addressEditText.getText().toString().startsWith(HTTP)) {\n\t\t\t\t\t_webView.loadUrl(addressEditText.getText().toString());\n\t\t\t\t} else {\n\t\t\t\t\t_webView.loadUrl(HTTP + addressEditText.getText().toString());\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\taddressEditText.setOnEditorActionListener(new OnEditorActionListener() {\n\t\t\t@Override\n\t\t\tpublic boolean onEditorAction(TextView v, int actionId, KeyEvent event) {\n\t\t\t\tif (addressEditText.getText().toString().startsWith(HTTP)) {\n\t\t\t\t\t_webView.loadUrl(addressEditText.getText().toString());\n\t\t\t\t} else {\n\t\t\t\t\t_webView.loadUrl(HTTP + addressEditText.getText().toString());\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\n\t\tWebViewClient webClient = new WebViewClient() {\n\t\t\t@Override\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onPageStarted(WebView view, final String url, Bitmap favicon) {\n\t\t\t\tsuper.onPageStarted(view, url, favicon);\n\t\t\t\taddressEditText.post(new Runnable() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\taddressEditText.setText(url);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t_webView.setDownloadListener(new DownloadListener() {\n\t\t\t@Override\n\t\t\tpublic void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {\n\t\t\t\tboolean isExternalStorageConnected = false;// getExternalStorageController().isExtStorage();\n\n\t\t\t\tif (!isExternalStorageConnected) {\n\t\t\t\t\t// makeInfoNotification(MessagesManager.getTitle($insert_usb_to_download,\n\t\t\t\t\t// getResources().getString(R.string.insert_usb_to_download)));\n\t\t\t\t} else {\n\t\t\t\t\t// Intent intent = new Intent(WebActivity.this,\n\t\t\t\t\t// DownloadChooseActivity.class);\n\t\t\t\t\t// intent.putExtra(\"url\", url);\n\t\t\t\t\t// startActivityForResult(intent, DOWNLOAD_RESULTCODE);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t_webView.setWebViewClient(webClient);\n\t\t// _webView.setWebViewClient(new WebViewClient());\n\t\t_webView.setWebChromeClient(new WebChromeClient() {\n\t\t\t@Override\n\t\t\tpublic void onShowCustomView(View view,\n\t\t\t\t\tfinal WebChromeClient.CustomViewCallback callback) {\n\t\t\t\t// if a view already exists then immediately terminate the new\n\t\t\t\t// one\n\t\t\t\tif (mCustomView != null) {\n\t\t\t\t\tcallback.onCustomViewHidden();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Add the custom view to its container.\n\t\t\t\tfinal ImageButton fs = new ImageButton(getActivity());\n\t\t\t\tfs.setOnClickListener(new OnClickListener() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\tfs.setVisibility(View.GONE);\n\t\t\t\t\t\tonHideCustomView();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tGRAVITY_BOTTOM_RIGHT.rightMargin = 16;\n\t\t\t\tGRAVITY_BOTTOM_RIGHT.bottomMargin = 16;\n\n\t\t\t\tmCustomViewContainer.addView(view, COVER_SCREEN_GRAVITY_CENTER);\n\t\t\t\tmCustomViewContainer.addView(fs, GRAVITY_BOTTOM_RIGHT);\n\t\t\t\tmCustomView = view;\n\t\t\t\tmCustomViewCallback = callback;\n\n\t\t\t\t// hide main browser view\n\t\t\t\tmContentView.setVisibility(View.GONE);\n\n\t\t\t\t// Finally show the custom view container.\n\t\t\t\tmCustomViewContainer.setVisibility(View.VISIBLE);\n\t\t\t\tmCustomViewContainer.bringToFront();\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onHideCustomView() {\n\t\t\t\tif (mCustomView == null)\n\t\t\t\t\treturn;\n\n\t\t\t\t// Hide the custom view.\n\t\t\t\tmCustomView.setVisibility(View.GONE);\n\t\t\t\t// Remove the custom view from its container.\n\t\t\t\tmCustomViewContainer.removeView(mCustomView);\n\t\t\t\tmCustomView = null;\n\t\t\t\t// mCustomViewContainer.setVisibility(View.GONE);\n\t\t\t\tmCustomViewCallback.onCustomViewHidden();\n\n\t\t\t\t// Show the content view.\n\t\t\t\tmContentView.setVisibility(View.VISIBLE);\n\t\t\t\tmContentView.bringToFront();\n\t\t\t}\n\n\t\t\t// For Android 3.0+\n\t\t\tpublic void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {\n\t\t\t\t// mUploadMessage = uploadMsg;\n\t\t\t\t// final boolean isExternalStorageConnected =\n\t\t\t\t// getExternalStorageController().isExtStorage();\n\t\t\t\t//\n\t\t\t\t// runOnUiThread(new Runnable()\n\t\t\t\t// {\n\t\t\t\t//\n\t\t\t\t// @Override\n\t\t\t\t// public void run()\n\t\t\t\t// {\n\t\t\t\t// if(!isExternalStorageConnected)\n\t\t\t\t// {\n\t\t\t\t// //makeInfoNotification(MessagesManager.getTitle($insert_usb_to_upload,\n\t\t\t\t// getResources().getString(R.string.insert_usb_to_upload)));\n\t\t\t\t// mUploadMessage.onReceiveValue(null);\n\t\t\t\t// return;\n\t\t\t\t// }\n\t\t\t\t//\n\t\t\t\t// // Intent intent = new Intent(WebActivity.this,\n\t\t\t\t// UploadChooserActivity.class);\n\t\t\t\t// // startActivityForResult(intent, UPLOAD_RESULTCODE);\n\t\t\t\t// }\n\t\t\t\t// });\n\n\t\t\t}\n\n\t\t\t// For Android < 3.0\n\t\t\t@SuppressWarnings(\"unused\")\n\t\t\tpublic void openFileChooser(ValueCallback<Uri> uploadMsg) {\n\t\t\t\topenFileChooser(uploadMsg, \"\");\n\t\t\t}\n\n\t\t\t// For Android > 4.1\n\t\t\t@SuppressWarnings(\"unused\")\n\t\t\tpublic void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {\n\t\t\t\topenFileChooser(uploadMsg, acceptType);\n\t\t\t}\n\n\t\t});\n\n\t\tfinal ImageButton homeImageView = (ImageButton) view.findViewById(R.id.web_home_image_view);\n\t\thomeImageView.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t_webView.loadUrl(HOME_PAGE);\n\t\t\t}\n\t\t});\n\n\t\tfinal ImageButton webBackImageView = (ImageButton) view.findViewById(R.id.web_back_image_view);\n\t\twebBackImageView.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (_webView.canGoBack()) {\n\t\t\t\t\t_webView.goBack();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tfinal ImageButton webForwardImageView = (ImageButton) view.findViewById(R.id.web_forward_image_view);\n\t\twebForwardImageView.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (_webView.canGoForward()) {\n\t\t\t\t\t_webView.goForward();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tif (getActivity().getIntent().getExtras() != null) {\n\t\t\tString _url = getActivity().getIntent().getExtras()\n\t\t\t\t\t.getString(LINK_PARAM, null);\n\t\t\tif (_url != null) {\n\t\t\t\turl = _url;\n\t\t\t}\n\t\t}\n\t\t_webView.loadUrl(url);\n\t\treturn view;\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n {\n View view = inflater.inflate(R.layout.fragment_chat, container, false);\n\n w = (WebView)view.findViewById(R.id.wi);\n progressBar = (ProgressBar) view.findViewById(R.id.progressBar);\n w.setWebViewClient(new WebViewClient(){\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon) {\n super.onPageStarted(view, url, favicon);\n progressBar.setVisibility(View.VISIBLE);\n }\n\n @Override\n public void onPageFinished(WebView view, String url) {\n super.onPageFinished(view, url);\n progressBar.setVisibility(View.GONE);\n }\n });\n WebSettings ws = w.getSettings();\n ws.setJavaScriptEnabled(true);\n w.loadUrl(\"https://tawk.to/chat/5c3b502e494cc76b7872d77a/default\");\n w.getSettings().setJavaScriptEnabled(true);\n w.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n return view;\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_web_view);\n\n\t\tsetTitle(\"지식경제부 기술표준원\");\n\t\tgetActionBar().setDisplayHomeAsUpEnabled(true);\n\t\t// 액션바에서 뒤로가기 버튼을 생성하기 위해 선언.\n\n\t\t// webview.setWebViewClient(new WebClient()); // 응룡프로그램에서 직접 url 처리\n\n\t\twv = (WebView) findViewById(R.id.webview);\n\t\t\n\t\t// 이렇게 해야 Web이 App 바깥영역으로 나가지 않는다.\n\t\twv.setWebViewClient(new MyWebClient());\n\t\t\n\t\t// WebSetting 옵션\n\t\tWebSettings set = wv.getSettings();\n\t\tset.setJavaScriptEnabled(true);\n\t\tset.setBuiltInZoomControls(true);\t// 감압식 폰 화면 확대\n\t\twv.getSettings().setJavaScriptEnabled(true);\n\t\twv.loadUrl(\"http://www.kats.go.kr/mobile/main.do\");\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View mview=inflater.inflate(R.layout.fragment_smartgrid, container, false);\n mywebview=(WebView)mview.findViewById(R.id.web);\n mywebview.loadUrl(\"https://solarrooftop.gov.in/rooftop_calculator\");\n WebSettings webSettings=mywebview.getSettings();\n webSettings.setJavaScriptEnabled(true);\n mywebview.setWebViewClient(new WebViewClient());\n return mview;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_tv, container, false);\n WebView webView_video = view.findViewById(R.id.webView_video);\n String url = \"https://www.google.com/\";\n webView_video.loadUrl(url);\n// String header = \"<iframe width=\\\"\\\" height=\\\"480\\\" src=\\\"https://www.youtube.com/embed/MM4ShEnKw3A\\\" frameborder=\\\"0\\\" allow=\\\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\\\" allowfullscreen></iframe>\";\n// webView_video.loadData(header, \"text/html\", \"UTF-8\");\n webView_video.setWebViewClient(new WebViewClient());\n webView_video.getSettings().setJavaScriptEnabled(true);\n// webView_video.setWebViewClient(new WebViewClient(){\n// @Override\n// public boolean shouldOverrideUrlLoading(WebView view, String url){\n// view.loadUrl(url);\n// return false;\n// }\n// });\n return view;\n }", "private static void initFX(final JFXPanel fxPanel) {\n Group group = new Group();\n Scene scene = new Scene(group);\n fxPanel.setScene(scene);\n\n webView = new WebView();\n\n group.getChildren().add(webView);\n webView.setMinSize(300, 300);\n webView.setPrefSize(850, 600);\n webView.setMaxSize(850, 600);\n\n webView.getEngine().setJavaScriptEnabled(true); //allows us to run JS code\n\n //START\n webView.getEngine().setOnAlert(new EventHandler<WebEvent<String>>() {\n @Override\n public void handle(WebEvent<String> event) {\n JOptionPane.showMessageDialog(\n fxPanel,\n event.getData(),\n \"Alert Message\",\n JOptionPane.ERROR_MESSAGE);\n }\n });\n\n webView.getEngine().getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) ->\n {\n JSObject window = (JSObject) webView.getEngine().executeScript(\"window\");\n window.setMember(\"java\", bridge2);\n webView.getEngine().executeScript(\"console.log = function(message)\\n\" +\n \"{\\n\" +\n \" java.log(message);\\n\" +\n \"};\");\n });\n //END\n\n // Obtain the webEngine to navigate\n WebEngine webEngine = webView.getEngine();\n //solves Captcha problem\n //webEngine.setUserAgent(\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36\");\n webEngine.load(\"https://yandex.ru\"); //sets the start page for the application\n }", "@Override\n public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_web_view, container, false);\n ButterKnife.bind(this, view);\n if(savedInstanceState == null) {\n radioWebView.reset();\n if (getArguments() != null) {\n radioWebView.loadUrl(getArguments().getString(urlTag));\n if (holder.getTimeShiftPlayer() != null)\n radioWebView.setTimeshiftPlayer(holder.getTimeShiftPlayer());\n }\n }\n return view;\n }", "@Nullable\n @Override\n public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_condition, container, false);\n webView = v.findViewById(R.id.webView);\n webView.loadUrl(\"http://www.mazad-sa.net/ma5dom/api/webview\");\n return v;\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_article, container, false);\n\n mProgressBar = view.findViewById(R.id.progress_bar);\n mProgressBar.setVisibility(View.VISIBLE);\n\n mWebView = view.findViewById(R.id.web_view);\n WebSettings webSettings = mWebView.getSettings();\n webSettings.setJavaScriptEnabled(true);\n\n// WebViewClientImpl webViewClient = new WebViewClientImpl(getActivity());\n// mWebView.setWebViewClient(webViewClient);\n\n view.findViewById(R.id.image_view_back).setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n dismiss();\n }\n });\n\n mWebView.setWebViewClient(new WebViewClient() {\n @Override\n public void onPageFinished(WebView view, String url) {\n Log.e(TAG, \"onPageFinished: \");\n mPresenter.dismissProgressBar();\n }\n });\n\n Bundle bundle = getArguments();\n mPresenter = new ArticlePresenter(this);\n mPresenter.checkBundle(bundle);\n\n return view;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_fitbit_web_view, container, false);\n\n button = (Button) v.findViewById(R.id.launchChromeButton);\n button.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n launchNativeChrome();\n }\n });\n\n\n return v;\n }", "private void configWebViewToViewDirectly(){\r\n WebView webView = new WebView(this);\r\n webView.getSettings().setJavaScriptEnabled(true);\r\n webView.getSettings().setPluginState(WebSettings.PluginState.ON);\r\n webView.getSettings().setAllowFileAccess(true);\r\n Map<String, String> headers = new HashMap<>();\r\n headers.put(\"Cookie\", cookie);\r\n System.out.println(\"pdf url: \" + pdfUrl + \", cookie: \" + cookie);\r\n //webView.loadUrl(\"https://docs.google.com/gview?embedded=true&url=http://www.cs.brandeis.edu/~olga/publications/clouddb14-admission.pdf\");\r\n //setContentView(R.layout.activity_pdfviewer);\r\n WebViewClient wvc = new WebViewClient() {\r\n @Override\r\n public boolean shouldOverrideUrlLoading(WebView view, String url){\r\n Map<String, String> headers = new HashMap<>();\r\n headers.put(\"Cookie\", cookie);\r\n view.loadUrl(url, headers);\r\n return false;\r\n }\r\n @Override\r\n public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {\r\n\r\n try {\r\n //System.out.println(\"Got Cookie?: \"+request.getRequestHeaders().get(\"Cookie\"));\r\n DefaultHttpClient client = new DefaultHttpClient();\r\n Uri url = request.getUrl();\r\n //Uri url = Uri.parse(\"https://docs.google.com/gview?embedded=true&url=http://www.cs.brandeis.edu/~olga/publications/clouddb14-admission.pdf\");\r\n HttpGet httpGet = new HttpGet(url.toString());\r\n httpGet.setHeader(\"Cookie\", PDFViewer.this.cookie);\r\n httpGet.setHeader(HttpHeaders.USER_AGENT, \"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36\");\r\n HttpResponse httpReponse = client.execute(httpGet);\r\n\r\n Header contentType = httpReponse.getEntity().getContentType();\r\n Header encoding = httpReponse.getEntity().getContentEncoding();\r\n\r\n\r\n InputStream responseInputStream ;\r\n //responseInputStream = httpReponse.getEntity().getContent();\r\n\r\n if (request.getUrl().toString().equals(\"https://docs.google.com/favicon.ico\")){\r\n responseInputStream = httpReponse.getEntity().getContent();\r\n }\r\n else {\r\n responseInputStream = HttpRequests.getPDF(PDFViewer.this.pdfUrl, PDFViewer.this.cookie);\r\n }\r\n\r\n\r\n String contentTypeValue = null;\r\n String encodingValue = null;\r\n if (contentType != null) {\r\n contentTypeValue = contentType.getValue();\r\n }\r\n contentTypeValue = \"application/pdf\";\r\n System.out.println(\"ContentType: \"+contentTypeValue);\r\n System.out.println(\"encoding: \"+encodingValue);\r\n\r\n\r\n if (encoding != null) {\r\n encodingValue = encoding.getValue();\r\n }\r\n return new WebResourceResponse(contentTypeValue, encodingValue, responseInputStream);\r\n } catch (ClientProtocolException e) {\r\n //return null to tell WebView we failed to fetch it WebView should try again.\r\n return null;\r\n } catch (IOException e) {\r\n //return null to tell WebView we failed to fetch it WebView should try again.\r\n return null;\r\n }\r\n }\r\n };\r\n webView.setWebViewClient(wvc);\r\n webView.loadUrl(\"https://docs.google.com/gview?embedded=true&url=\" + pdfUrl, headers);\r\n setContentView(webView);\r\n System.out.println(\"Done~!\");\r\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.common_browser);\n mWebView = (WebView) findViewById(R.id.web_view);\n init();\n }", "public LeafletMapView() {\n super();\n\n this.getChildren().add(webView);\n }", "@Override\n\tpublic void initWebViewClient(BBWebViewChromeClient webViewClient) {\n\t\ttry {\n\t\t\tthis._webView.setWebChromeClient(webViewClient);\n\t\t} catch (Exception ex) {\n\t\t\t\n\t\t}\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_electro_potential, container, false);\n fordisplay = (WebView)view.findViewById(R.id.displayPotential);\n fordisplay.getSettings().setJavaScriptEnabled(true);\n fordisplay.getSettings().setBuiltInZoomControls(true);\n fordisplay.loadUrl(\"file:///android_asset/potential.html\");\n return view;\n }", "private void $$$setupUI$$$() {\n\t\tpanel_overview = new JPanel();\n\t\tpanel_overview.setLayout(new BorderLayout(0, 0));\n\t\twebView = new WebbrowserPanel();\n\t\tpanel_overview.add(webView, BorderLayout.CENTER);\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View fragmentView = inflater.inflate(R.layout.fragment_quiz_intro_nasilje, container, false);\n WebView webView = fragmentView.findViewById(R.id.webViewKviz1);\n webView.loadUrl(\"file:///android_asset/upute_kviz__nasilje.html\");\n unbinder = ButterKnife.bind(this, fragmentView);\n return fragmentView;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_tab2, container, false);\n\n //find webView layout\n\n //find id\n button1 = view.findViewById(R.id.buttonId1);\n button2 = view.findViewById(R.id.buttonId2);\n button3 = view.findViewById(R.id.buttonId3);\n button4 = view.findViewById(R.id.buttonId4);\n button5 = view.findViewById(R.id.buttonId5);\n button6 = view.findViewById(R.id.buttonId6);\n button7 = view.findViewById(R.id.buttonId7);\n button8 = view.findViewById(R.id.buttonId8);\n\n button1.setOnClickListener(this);\n button2.setOnClickListener(this);\n button3.setOnClickListener(this);\n button4.setOnClickListener(this);\n button5.setOnClickListener(this);\n button6.setOnClickListener(this);\n button7.setOnClickListener(this);\n button8.setOnClickListener(this);\n\n\n return view;\n }", "public static WebFragment newInstance(String url) {\n WebFragment fragment = new WebFragment();\n Bundle args = new Bundle();\n args.putString(ARG_URL, url);\n fragment.setArguments(args);\n return fragment;\n }", "@SuppressLint(\"SetJavaScriptEnabled\")\n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.r_main);\n\n WebView webView = (WebView) this.findViewById(R.id.webview);\n WebSettings webSettings = webView.getSettings();\n webSettings.setJavaScriptEnabled(true);\n webSettings.setBuiltInZoomControls(true);\n webView.requestFocusFromTouch();\n webView.setWebViewClient(new WebViewClient());\n webView.setWebChromeClient(new WebChromeClient());\n\n // Load the URL\n webView.loadUrl(\"http://10.0.2.2/crescenttech/graph/graph.php\");\n }", "public FXWebView(String url) {\n\t\t//Validate the passed in url\n\t\tURL u;\n\t\ttry {\n\t\t\tu = new URL(url);\n\t\t} catch (MalformedURLException e) {\n\t\t\tthrow new IllegalArgumentException(e);\n\t\t}\n\t\tthis.homeUrl = u.toExternalForm();\n\t\t\n\t\t//Construct the underlying scene\n\t\tcreateScene();\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.wbview1);\n \n //String rawHTML = \"<HTML>\"+ \n // \t \"<body><h1>Hello Android </h1></body>\"+ \n \t// \"</HTML>\";\n \n mWebView = (WebView) findViewById(R.id.webview);\n mWebView.getSettings().setJavaScriptEnabled(true);\n mWebView.setWebViewClient(new WebViewClient1()); \n //mWebView.loadData(rawHTML, \"text/HTML\", \"UTF-8\");\n \n mWebView.loadUrl(\"file:///android_asset/www/sunburst.html\");\n }", "boolean attachWebView(WebView webView, boolean screenshotsEnabled, boolean pullToRefreshEnabled) {\n if (webView.getParent() == refreshLayout) return false;\n\n refreshLayout.setEnabled(pullToRefreshEnabled);\n\n if (webView.getParent() instanceof TurbolinksSwipeRefreshLayout) {\n TurbolinksSwipeRefreshLayout previousRefreshLayout = (TurbolinksSwipeRefreshLayout) webView.getParent();\n TurbolinksView previousTurbolinksView = (TurbolinksView) previousRefreshLayout.getParent();\n\n if (screenshotsEnabled) previousTurbolinksView.screenshotView();\n previousRefreshLayout.removeView(webView);\n }\n\n // Set the webview background to match the container background\n if (getBackground() instanceof ColorDrawable) {\n webView.setBackgroundColor(((ColorDrawable) getBackground()).getColor());\n }\n\n refreshLayout.addView(webView);\n return true;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_web, container, false);\n initialize(view);\n return view;\n }", "@Override\n\tpublic void initWebViewClient(BBWebViewClient webViewClient) {\n\t\ttry {\n\t\t\tthis._webView.setWebViewClient(webViewClient);\n\t\t} catch (Exception ex) {\n\t\t\t\n\t\t}\n\t}", "WebkitRenderHelper(WebkitRenderer parent) {\n page = new QWebPage();\n view = new QWebView();\n view.setPage(page);\n window = new QMainWindow();\n window.setCentralWidget(view);\n\n // Import QWebSettings\n for (Map.Entry<QWebSettings.WebAttribute, Boolean> attr : parent.getAttributes().entrySet()) {\n page.settings().setAttribute(attr.getKey(), attr.getValue());\n }\n\n // Connect required event listeners\n page.loadFinished.connect(this, \"onLoadFinished(boolean)\");\n page.loadStarted.connect(this, \"onLoadStarted()\");\n page.networkAccessManager().sslErrors.connect(this, \"onSslErrors(com.trolltech.qt.network.QNetworkReply, java.util.List)\");\n\n // The way we will use this, it seems to be unesseccary to have Scrollbars enabled\n page.mainFrame().setScrollBarPolicy(Qt.Orientation.Horizontal, Qt.ScrollBarPolicy.ScrollBarAlwaysOff);\n page.mainFrame().setScrollBarPolicy(Qt.Orientation.Vertical, Qt.ScrollBarPolicy.ScrollBarAlwaysOff);\n\n page.settings().setUserStyleSheetUrl(new QUrl(\"data:text/css,html,body{overflow-y:hidden !important;}\"));\n\n // Show this widget\n window.show();\n }", "public WebView getWebView() {\n\t\treturn wv;\n\t}", "public BrowserPresenter create() {\n return new BrowserPresenter(context);\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n\n\n v = inflater.inflate(R.layout.fragment_blank, container, false);\n webView = v.findViewById(R.id.webv);\n if (activity!=null)\n\n ((MainActivity) activity).showDialog(false);\n\n\n alertDialog = new AlertDialog.Builder(activity)\n//set title\n//set message\n .setView(R.layout.loadind_dialog)\n // .setMessage(\"برجاء الانتظار وسيتم تحويلك تلقائيا\")\n//set positive button\n .setCancelable(false)\n .create();\n\n\n final String mimeType = \"text/html\";\n final String encoding = \"UTF-8\";\n String html = getArguments().getString(\"html\");\n\n\n // webView.setWebViewClient(new WebViewClient());\n\n webView.getSettings().setJavaScriptEnabled(true);\n webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);\n webView.loadDataWithBaseURL(\"\", html, mimeType, encoding, \"\");\n webView.addJavascriptInterface(new MyJavaScriptInterface(activity), \"HtmlViewer\");\n\n\n webView.setWebChromeClient(new WebChromeClient() {\n public boolean onConsoleMessage(ConsoleMessage cmsg) {\n\n /* process JSON */\n\n Log.e(\"console\",\"message is \"+cmsg.message());\n\n try {\n JSONObject jsonObject = new JSONObject(cmsg.message());\n System.out.println(\"json is \" + cmsg.message());\n int status = Integer.parseInt(jsonObject.getString(\"status\"));\n boolean success = (boolean) jsonObject.getBoolean(\"success\");\n\n if (status == 200 && success) {\n\n\n // ((MainActivity)activity).setPaymentSuccess(true);\n\n // ((MainActivity)activity).fragmentStack.replace(new OrderDoneFragment());\n\n\n\n } else {\n // ((MainActivity)activity).setPaymentSuccess(false);\n\n\n // ((MainActivity)activity).fragmentStack.pop();\n\n }\n\n } catch (JSONException e) {\n\n }\n\n\n return true;\n\n }\n });\n\n\n webView.setWebViewClient(new WebViewClient() {\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {\n\n // Log.d(\"webb \", \"shouldOverrideUrlLoading \" + request.getUrl().toString());\n\n return super.shouldOverrideUrlLoading(view, request);\n }\n\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, String url) {\n // Log.d(\"webb \", \"shouldOverrideUrlLoading \" + url);\n\n return super.shouldOverrideUrlLoading(view, url);\n }\n\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon) {\n super.onPageStarted(view, url, favicon);\n\n if (url.contains(\"handle-payment-response\"))\n webView.setVisibility(View.INVISIBLE);\n Log.d(\"webb \", \"onPageStarted \" + url);\n if (url.equals(\"http://www.mawared.badee.com.sa/api/v1/payment/return\")||url.contains(\".payfort.com/FortAPI/general/backToMerchant\")) {\n // Toast.makeText(activity, \"please wait\", Toast.LENGTH_SHORT).show();\n showDialog();\n //startActivity(new Intent(activity,MainActivity.class));\n }\n if (url.equals(BASE_URL+\"payments/status/failure\")) {\n ((MainActivity)activity).setPaymentSuccess(false);\n\n ((MainActivity) activity).fragmentStack.pop();\n\n }\n else if (url.equals(BASE_URL+\"payments/status/success\")){\n ((MainActivity)activity).setPaymentSuccess(true);\n\n ((MainActivity) activity).fragmentStack.pop();\n ((MainActivity) activity).fragmentStack.pop();\n\n }\n\n }\n\n @Override\n public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {\n super.onReceivedError(view, request, error);\n\n // Log.d(\"webb \", \"onReceivedError \" + error.getDescription() + error.getErrorCode());\n\n }\n\n\n @Nullable\n @Override\n public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {\n //Log.d(\"requestto\", request.getMethod() + \" \" + request.getUrl() + \" \" + request.getRequestHeaders().toString());\n\n\n return super.shouldInterceptRequest(view, request);\n }\n\n @Override\n public void onPageFinished(WebView view, String url) {\n // Toast.makeText(activity, \"is \"+url, Toast.LENGTH_SHORT).show();\n // Toast.makeText(activity, \"web \"+view.toString(), Toast.LENGTH_LONG).show();\n\n Log.d(\"webb \", \"onPageFinished \" + url);\n Log.d(\"webb \", \"webview \" + view.toString());\n if (url.equals(\"http://www.mawared.badee.com.sa/api/v1/payment/return\")||url.contains(\".payfort.com/FortAPI/general/backToMerchant\")) {\n // Toast.makeText(activity, \"please wait\", Toast.LENGTH_SHORT).show();\n showDialog();\n //startActivity(new Intent(activity,MainActivity.class));\n }\n\n Log.e(\"console\",\"url is \"+url);\n webView.loadUrl(\"javascript:console.log(document.body.getElementsByTagName('pre')[0].innerHTML);\");\n\n }\n });\n return v;\n }", "public void onCreate(Bundle bundle) {\n super.onCreate(bundle);\n setContentView((int) R.layout.activity_webview);\n this.mWebView = (WebView) findViewById(R.id.web_view);\n this.mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);\n this.mNoNetworkView = findViewById(R.id.no_network_view);\n this.mPdfUrl = getIntent().getStringExtra(\"pdf_url\");\n this.mWebView.getSettings().setJavaScriptEnabled(true);\n this.mWebView.loadUrl(String.format(GOOGLE_DOCS_PDF_VIEWER_BASE_URL, new Object[]{this.mPdfUrl}));\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_risk_inspection, container, false);\n initTitle(view, mTitle);\n WebView webView = (WebView) view.findViewById(R.id.risk_webview);\n CircleProgressBar bar = (CircleProgressBar) view.findViewById(R.id.risk_progressbar);\n initWebView(webView, bar, mUrl, new WebRiskInspectionJSInterface() {\n @JavascriptInterface\n @Override\n public void WebGetResult(String json) {\n if (BuildConfig.DEBUG) {\n Log.e(TAG, json);\n }\n RiskResult riskResult = RiskResult.parser(json);\n final String uri = Strings.getIntentUri(RiskInspectionFragment.class.getSimpleName(),\n Strings.INTENT_CONTENT, String.valueOf(riskResult.getData().getF2()));\n getActivity().runOnUiThread(new Runnable() {\n @Override\n public void run() {\n onButtonPressed(Uri.parse(uri));\n }\n });\n }\n });\n return view;\n }", "@DebugLog\n public void setWebView(WebViewData webViewData){\n webView.loadUrl(webViewData.getUrl());\n webView.setWebViewClient(webViewData.getWebViewClient());\n }", "public Parent toNode() {\n if (this.webView == null)\n return this.webView = createWebView();\n else\n return this.webView;\n }", "@SuppressLint(\"SetJavaScriptEnabled\")\n private void configureWebViewSettings() {\n WebSettings settings = getSettings();\n settings.setJavaScriptEnabled(true);\n settings.setAppCacheEnabled(true);\n settings.setDomStorageEnabled(true);\n settings.setBuiltInZoomControls(true);\n settings.setLoadWithOverviewMode(true);\n settings.setUseWideViewPort(true);\n settings.setSupportMultipleWindows(false); // to enable opening links which require opening a new tab\n settings.setLoadsImagesAutomatically(true);\n settings.setBuiltInZoomControls(true);\n }", "@SuppressLint(\"SetJavaScriptEnabled\")\n\t@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\ttxt_title = (TextView) findViewById(R.id.txt_title);\n\t\tselfActivity = this;\n\t\ttitleName = getIntent().getStringExtra(\"title\");\n\t\ttxt_title.setText(titleName);\n\t\tString url = getIntent().getStringExtra(\"url\");\n\t\tWebView wv = (WebView) findViewById(R.id.webview1);\n\t\t// Log.d(TAG,\"url=\"+url);\n\t\tif (url.startsWith(\"http://\")) {\n\t\t\t// 普通打开url\n\t\t\twv.loadUrl(url);\n\t\t} else {\n\t\t\t// 易宝相关的使用\n\t\t\twv.loadData(url, \"text/html\", \"UTF-8\");\n\t\t\tLog.d(TAG, \"url=\" + url);\n\t\t}\n\t\tWebSettings ws = wv.getSettings();\n\t\tws.setBuiltInZoomControls(true);\n\t\tws.setJavaScriptEnabled(true);\n\n\t\twv.setWebViewClient(new WebViewClient() {\n\t\t\t@Override\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t// view.loadUrl(url);\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onPageStarted(WebView view, String url, Bitmap favicon) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tsuper.onPageStarted(view, url, favicon);\n\t\t\t\tprogressDialogSet = new ProgressDialogSet();\n\t\t\t\tprogressDialogSet.setCon(selfActivity);\n\t\t\t\tprogressDialogSet.setMsg(\"正在请求数据,请稍后...\");\n\t\t\t\tprogressDialogSet.startProgress();\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onPageFinished(WebView view, String url) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tsuper.onPageFinished(view, url);\n\t\t\t\tif (progressDialogSet != null) {\n\t\t\t\t\tprogressDialogSet.stopProgress();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState)\n {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n\n mWebView = (WebView) findViewById(R.id.webview);\n mWebView.setWebViewClient(new BasicWebViewClient());\n mWebView.getSettings().setJavaScriptEnabled(true);\n mWebView.getSettings().setDomStorageEnabled(true);\n mWebView.getSettings().setAppCacheMaxSize(1024*1024*5);\n mWebView.getSettings().setAppCacheEnabled(true);\n \n mWebView.getSettings().setAppCachePath(\"/data/data/com.hcsn.kidbook.secondgrademath/cache\");\n mWebView.getSettings().setAllowFileAccess(true);\n \n// WebView myWebView = (WebView) findViewById(R.id.myWebView);\n mWebView.setBackgroundColor(Color.parseColor(\"#333333\"));\n \n mWebView.loadUrl(launchURL);\n }", "public void destroyWebView() {\n if (mWebView == null){\n return;\n }\n\n ((ViewGroup)mWebView.getParent()).removeView(mWebView);\n\n // Make sure you remove the WebView from its parent view before doing anything.\n mWebView.removeAllViews();\n\n mWebView.clearHistory();\n\n // NOTE: clears RAM cache, if you pass true, it will also clear the disk cache.\n // Probably not a great idea to pass true if you have other WebViews still alive.\n mWebView.clearCache(true);\n\n // Loading a blank page is optional, but will ensure that the WebView isn't doing anything when you destroy it.\n mWebView.loadUrl(\"about:blank\");\n\n mWebView.onPause();\n mWebView.removeAllViews();\n mWebView.destroyDrawingCache();\n\n // NOTE: This pauses JavaScript execution for ALL WebViews,\n // do not use if you have other WebViews still alive.\n // If you create another WebView after calling this,\n // make sure to call mWebView.resumeTimers().\n mWebView.pauseTimers();\n\n // NOTE: This can occasionally cause a segfault below API 17 (4.2)\n mWebView.destroy();\n\n // Null out the reference so that you don't end up re-using it.\n mWebView = null;\n }", "@Override\n\tprotected void onPostExecute(String result) {\n\t\tsuper.onPostExecute(result);\n\t\tsetupWebView();\n\t}", "public static WebXml newWebXml(WebXmlVersion theVersion)\n throws ParserConfigurationException\n {\n DocumentBuilder builder = createDocumentBuilder();\n DocumentType docType = null;\n if (theVersion != null)\n {\n docType = builder.getDOMImplementation().createDocumentType(\"web-app\",\n theVersion.getPublicId(), theVersion.getSystemId());\n }\n Document doc = builder.getDOMImplementation().createDocument(\"\", \"web-app\", docType);\n return new WebXml(doc);\n }", "@Override\r\n public void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.internet);\r\n bowser=(WebView)findViewById(R.id.webkit);\r\n \r\n //make the browser show the wikipedia article on ipods\r\n bowser.loadUrl(\"http://en.wikipedia.org/w/index.php?title=IPod&useformat=mobile\");\r\n \r\n }", "@SuppressLint({\"SetJavaScriptEnabled\"})\n public void a() {\n this.f20062a = new WebView(getContext());\n this.f20062a.setBackgroundColor(0);\n this.f20062a.setWebViewClient(new a());\n this.f20062a.getSettings().setUseWideViewPort(false);\n this.f20062a.getSettings().setJavaScriptEnabled(true);\n this.f20062a.addJavascriptInterface(this, \"ChatWebItemView\");\n WebSettings settings = this.f20062a.getSettings();\n if (TextUtils.isEmpty(this.f20064c)) {\n this.f20064c = settings.getUserAgentString() + SQLBuilder.BLANK + al.a().b();\n }\n settings.setUserAgentString(this.f20064c);\n addView(this.f20062a, new FrameLayout.LayoutParams(-1, com.garena.android.appkit.tools.b.d(R.dimen.dp150)));\n }", "public static BrowserHistoryNode addUrl(String webUrl) {\n if (BROWSER_HISTORY_LIST.isEmpty()) {\n BrowserHistoryNode firstItem = new BrowserHistoryNode(null, null, webUrl, 0);\n BROWSER_HISTORY_LIST.add(firstItem);\n return firstItem;\n } else {\n BrowserHistoryNode last = BROWSER_HISTORY_LIST.getLast();\n BrowserHistoryNode newNode = new BrowserHistoryNode(null, last, webUrl, BROWSER_HISTORY_LIST.size());\n BROWSER_HISTORY_LIST.addLast(newNode);\n last.setNext(newNode);\n BROWSER_HISTORY_LIST.set(last.getId(), last);\n return newNode;\n }\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\trequestWindowFeature(Window.FEATURE_PROGRESS);\n\t\tsetContentView(R.layout.lib_web);\n\t\tsetProgressBarVisibility(true);\n\t\tCrashApplication.getInstance().addActivity(this);\n\t\tbackButton = (ImageView) findViewById(R.id.lib_button_back);\n\t\ttextView = (TextView) findViewById(R.id.web_buyiyubi_title);\n\t\tweb = (WebView) findViewById(R.id.webView);\n\t\tbackButton.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t// TODO Auto-generated method stub\n//\t\t\t\tonBackPressed();\n\t\t\t\tfinish();\n\t\t\t}\n\t\t});\n\t\tweb.loadUrl(this.getIntent().getStringExtra(\"url\"));\n\n\t\ttextView.setText(this.getIntent().getStringExtra(\"title\"));\n//\t\ttextView.setText(\"购买爱语币\");\n\t\tWebSettings websettings = web.getSettings();\n\t\twebsettings.setJavaScriptEnabled(true);\n\t\twebsettings.setBuiltInZoomControls(true);\n\t\tweb.setWebViewClient(new WebViewClient() {\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\tview.loadUrl(url);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\t\tweb.setWebChromeClient(new WebChromeClient() {\n\t\t\t// Set progress bar during loading\n\t\t\tpublic void onProgressChanged(WebView view, int progress) {\n\t\t\t\tWeb.this.setProgress(progress * 100);\n\t\t\t}\n\t\t});\n\t\tweb.setDownloadListener(new DownloadListener() {\n\n\t\t\t@Override\n\t\t\t// TODO Auto-generated method stub\n\t\t\tpublic void onDownloadStart(String url, String userAgent,\n\t\t\t\t\t\t\t\t\t\tString contentDisposition, String mimetype,\n\t\t\t\t\t\t\t\t\t\tlong contentLength) {\n\t\t\t\tUri uri = Uri.parse(url);\n\t\t\t\tIntent intent = new Intent(Intent.ACTION_VIEW, uri);\n\t\t\t\tstartActivity(intent);\n\t\t\t}\n\t\t});\n\t}", "public android.renderscript.Element create() { throw new RuntimeException(\"Stub!\"); }", "@Override\n\t\t public void onPageFinished(WebView view, String url) {\n\t\t webView.loadUrl(\"javascript:HTMLOUT.processHTML(document.documentElement.outerHTML);\");\n\t\t }", "public static native Element createDom(String rawHtml) /*-{\r\n\t\t$wnd.Ext.DomHelper.createDom(rawHtml);\r\n\t}-*/;", "void continueWhenLoaded(WebView webView) {\n webView.setWebViewClient(new WebViewClient());\n }", "@Override\n public void onPageFinished(WebView view, String url) {\n browser.loadUrl(\"javascript:HtmlOut.processHTML\" +\n \"('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>');\");\n }", "private void createView() {\n\t\tTabWidget tWidget = (TabWidget) findViewById(android.R.id.tabs);\r\n\t\tshowLayout = (LinearLayout) LayoutInflater.from(this).inflate(\r\n\t\t\t\tR.layout.tab_layout, tWidget, false);\r\n\t\tImageView imageView = (ImageView) showLayout.getChildAt(0);\r\n\t\tTextView textView = (TextView) showLayout.getChildAt(1);\r\n\t\timageView.setImageResource(R.drawable.main_selector);\r\n\t\ttextView.setText(R.string.show);\r\n\r\n\t\taddLayout = (LinearLayout) LayoutInflater.from(this).inflate(\r\n\t\t\t\tR.layout.tab_layout, tWidget, false);\r\n\t\tImageView imageView1 = (ImageView) addLayout.getChildAt(0);\r\n\t\tTextView textView1 = (TextView) addLayout.getChildAt(1);\r\n\t\timageView1.setImageResource(R.drawable.add_selector);\r\n\t\ttextView1.setText(R.string.add_record);\r\n\r\n\t\tchartLayout = (LinearLayout) LayoutInflater.from(this).inflate(\r\n\t\t\t\tR.layout.tab_layout, tWidget, false);\r\n\t\tImageView imageView2 = (ImageView) chartLayout.getChildAt(0);\r\n\t\tTextView textView2 = (TextView) chartLayout.getChildAt(1);\r\n\t\timageView2.setImageResource(R.drawable.chart_selector);\r\n\t\ttextView2.setText(R.string.chart_show);\r\n\t}", "private void init() {\n\tTextView tvTopTitle = getViewById(R.id.tv_top_title);\n\ttvTopTitle.setText(\"提兑记录\");\n\tTextView tvLeftIcon = getViewById(R.id.tv_left_icon);\n\ttvLeftIcon.setOnClickListener(new OnClickListener() {\n\n\t @Override\n\t public void onClick(View arg0) {\n\t\t// TODO Auto-generated method stub\n\t\tfinish();\n\t }\n\t});\n\tfindViewById(R.id.tv_top_action).setVisibility(View.GONE);\n\n\tmWebView = getViewById(R.id.webview);\n\n\t// 设置WebView对JavaScript的支持\n\tmWebView.getSettings().setJavaScriptEnabled(true);\n\n\t// 先让 asyncHttp 加载所有数据, 再将内容交给webView渲染\n\t//\tHttpUtil.get(AppConstants.URL_PROFILE, new AsyncHttpResponseHandler() {\n\t//\n\t//\t @Override\n\t//\t public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {\n\t//\t\t// TODO Auto-generated method stub\n\t//\t\tString res = new String(arg2);\n\t//\t\tmWebView.loadDataWithBaseURL(null, res, \"text/html\", \"\", null);\n\t//\t }\n\t//\n\t//\t @Override\n\t//\t public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {\n\t//\t\t// TODO Auto-generated method stub\n\t//\t\tmWebView.loadDataWithBaseURL(null, \"加载出错,请重试\", \"text/html\", \"\", null);\n\t//\t }\n\t//\t});\n\n\t// 添加cookie 确保session能用\n\tCookieSyncManager.createInstance(this);\n\tCookieManager cookieManager = CookieManager.getInstance();\n\tString cookies = \"PHPSESSID=\" + MyApplication.PHPSESSID + \"\";\n\tcookieManager.setCookie(AppConstants.HOST, cookies);//cookies是在HttpClient中获得的cookie \n\tCookieSyncManager.getInstance().sync();\n\n\t//\n\n\t//自定义WebView的背景颜色\n\tmWebView.setBackgroundColor(Color.TRANSPARENT);//先设置背景色为transparent\n\tmWebView.setBackgroundResource(R.drawable.m);\n\n\tMWebViewClient mWebViewClient = new MWebViewClient(mWebView, getApplicationContext());\n\tmWebView.setWebViewClient(mWebViewClient);\n\t//\tMWebChromeClient mWebChromeClient = new MWebChromeClient(getApplicationContext());\n\t//\tmWebView.setWebChromeClient(mWebChromeClient);\n\t//添加JS调用Android(Java)的方法接口\n\t//\tMJavascriptInterface mJavascriptInterface = new MJavascriptInterface(getApplicationContext());\n\t//\tmWebView.addJavascriptInterface(mJavascriptInterface, \"WebViewFunc\");\n\n\t// 从assets目录下面的加载html\n\t//\tmWebView.loadUrl(\"file:///android_asset/web.html\");\n\t// 该方法需要设置cookie, 但是cookie由AsyncHttp存储着, 换成先由asyncHttp加载下所有的html内容再给webView\n\tmWebView.loadUrl(AppConstants.URL_WITHDRAW_LOGS);\n\n }", "public abstract void createWebsite();", "public Scene createScene() {\n\t\tmyRoot = new AnchorPane();\n\t\tmyTabs = new TabPane();\n\t\tButton newTab = new Button(CREATE_NEW_TAB);\n\t\tnewTab.setOnAction(event -> createNewTab());\n\t\t\n\t\tTabMainScreen mainScreen = new TabMainScreen(myResources.getString(WORKSPACE) + (myTabs.getTabs().size()));\n\t\tTabHelp help1 = new TabHelp(myResources.getString(BASIC_COMMANDS), HELP_TAB_TEXT1);\n\t\tTabHelp help2 = new TabHelp(myResources.getString(EXTENDED_COMMANDS), HELP_TAB_TEXT2);\n\t\t\n\t\tmyTabs.getTabs().addAll(mainScreen.getTab(myStage), help1.getTab(), help2.getTab());\n\t\t\n\t\tAnchorPane.setTopAnchor(myTabs, TABS_OFFSET);\n\t\tAnchorPane.setTopAnchor(newTab, NEWTAB_OFFSET);\n\t\t\n\t\tmyRoot.getChildren().addAll(myTabs, newTab);\n\t\n\t\tmyScene = new Scene(myRoot, windowHeight, windowWidth, Color.WHITE);\n\t\treturn myScene;\n\t}", "public void onPageFinished(WebView view, String url) {\n webView.loadUrl(\"javascript:HTMLOUT.processHTML(document.documentElement.outerHTML);\");\n }", "public ModuleFrame() {\n javafxPanel = new JFXPanel();\n initComponents();\n this.webViewParent.setLayout(new BorderLayout());\n this.webViewParent.add(javafxPanel, BorderLayout.CENTER);\n this.webViewParent.add(javafxPanel);\n \n this.setDefaultCloseOperation(HIDE_ON_CLOSE);\n }", "public static WebViewClient getWebViewClient(WebView webView) throws NoSuchFieldException, SecurityException, IllegalAccessException, ClassNotFoundException {\n Class callbackProxyClass = Class.forName(Constants.Classes.WEBKIT_CALLBACK_PROXY);\n Object callbackProxy = ReflectionUtils.getFieldValue(webView, WebView.class, Constants.Fields.CALLBACK_PROXY);\n WebViewClient webViewClient = (WebViewClient) ReflectionUtils.getFieldValue(callbackProxy, callbackProxyClass, Constants.Fields.WEBVIEW_CLIENT); return webViewClient;\n }", "@Override\r\n public void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n requestWindowFeature(Window.FEATURE_NO_TITLE);\r\n getWindow().setFormat(PixelFormat.RGBA_8888);\r\n setContentView(R.layout.webview);\r\n Log.i(\"webactivity\", \"webactivity\");\r\n \r\n //初始化界面元素\r\n webView = (WebView) findViewById(R.id.webView);\r\n //初始化界面数据\r\n Intent intent = getIntent();\r\n String fileAddress = intent.getStringExtra(\"webAddress\");\r\n //wenview初始化设置\r\n webView.setInitialScale(25);//为25%,最小缩放等级 \r\n //设置双击缩放网页\r\n \r\n webView.getSettings().setSupportZoom(true);\r\n webView.getSettings().setBuiltInZoomControls(true);\r\n webView.getSettings().setJavaScriptEnabled(true);//支持js\r\n\r\n //加载网页\r\n webView.loadUrl(fileAddress);\r\n \r\n\r\n }", "Page createPage();", "@SuppressLint(\"JavascriptInterface\")\n@SuppressWarnings(\"unchecked\")\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n\tsuper.onCreate(savedInstanceState);\n\tsetContentView(R.layout.vedio_web_view_layout);\n\tgetSupportActionBar().hide();\n\tcancel_btn = (ImageButton) findViewById(R.id.cancel_btn);\n\tvedioView = (WebView) findViewById(R.id.vedio_view_id);\n\t//Uri uri=Uri.parse(getIntent().getStringExtra(\"vedio_url\"));\n\tpd = new ProgressDialog(VedioWebView.this);\n\t//pd.setCancelable(false);\n\tpd.setMessage(\"Loading\");\n\tLog.e(\"Url \", getIntent().getStringExtra(\"vedio_url\"));//01-04 03:07:49.042: E/Url(4158): \n\tWebSettings webSettings = vedioView.getSettings();\n\n\tvedioView.addJavascriptInterface(new WebAppInterface(getApplicationContext()), \"Android\");\n\t webSettings.setJavaScriptEnabled(true);\n\t vedioView.requestFocusFromTouch();\n\tvedioView.setWebViewClient(new WebViewClient()\n\t\t\t{\n\n\t\t\t\t@Override\n\t\t\t\tpublic void onPageFinished(WebView view, String url) {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\tsuper.onPageFinished(view, url);\n\t\t\t\t\tpd.show();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void onPageStarted(WebView view, String url, Bitmap favicon) {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\tsuper.onPageStarted(view, url, favicon);\n\t\t\t\t\tpd.dismiss();\n\t\t\t\t}\n\t\t\n\t\t\t});\n\n\t//01-04 03:02:29.441: E/Url(3431): https://m.youtube.com/watch?v=UI72Wu6o_EE\n\n\t\n\t//10-30 18:18:33.408: E/Base URL(1779): https://m.youtube.com/embed/UI72Wu6o_EE\n//https://www.youtube.com/embed/xfLhdkkGUKo\n\t\n\t//10-30 16:59:33.510: E/Base URL(6790): https://www.youtube.com/watch/?v=q5-rZRKFQJA\n\n\t\n\t\n\t\n\t//Toast.makeText(mContext, \"URL \"+ newsList.get(position).getNews_feed_attach_url(), 1).show();\n\t\n\tLog.e(\"Base URL\", getIntent().getStringExtra(\"vedio_url\").replace(\"watch?v=\", \"embed/\").replace(\"//m.\", \"//www.\"));\n\n\tvedioView.loadUrl(getIntent().getStringExtra(\"vedio_url\").replace(\"watch?v=\", \"embed/\").replace(\"//m.\", \"//www.\"));\n\t\n\t\n\t\n\tbottom_layout = (LinearLayout) findViewById(R.id.bottom_layout);\n\t\n\tnewsList = AppConstants.newsList;\n\ttry\n\t{\n\t\tposition =Integer.parseInt(getIntent().getStringExtra(\"pos\"));\t\n\t}\n\tcatch(Exception e)\n\t{\n\t\t\n\t}\n\t\n\tcomment_relative_layout = (RelativeLayout) findViewById(R.id.comment_relative_layout);\n\t\n\t\n\t\n\tcomment_send_btn = (ImageButton) findViewById(R.id.comment_send_btn);\n\t\n\t\n\t\n\tlike_unlike_change_btn = (TextView) bottom_layout.findViewById(R.id.like_unlike_change_btn);\n\t\n\t\n\tcomment_edittxt = (EditText) bottom_layout.findViewById(R.id.comment_edittxt);\n\t\n\t\n\t\n\t\n\tcomment_btn = (TextView) bottom_layout.findViewById(R.id.comment_btn);\n\t\n\t\n\t\n\tlike_unlike_change_btn.setOnClickListener(onclick);\n\tcomment_btn.setOnClickListener(onclick);\n\t\n\t\n\tcomment_send_btn.setOnClickListener(onclick);\n\t\n\t path_list = (ArrayList<String>) getIntent().getSerializableExtra(\"path_list\");\n\t //Toast.makeText(getApplicationContext(), position+\" vedio url \"+newsList.get(position).getVedioUrl(), 1).show();\n\tif(isLoadAdapter == false)\n\t{\n\t\t\n\t\t\n\t\t\n\t\tisLoadAdapter = true;\n\t}\n\t\t\n\ttry\n\t{\n\t\tif(getIntent().getStringExtra(\"show_bottom\").equalsIgnoreCase(\"1\"))\n\t\t{\n\t\t\tbottom_layout.setVisibility(View.VISIBLE);\t\n\t\t\t//Toast.makeText(getApplicationContext(), \"status \"+newsList.get(position).getMyLikeStatus(), 1).show();\n\t\t\t\n\t\t\tif(newsList.get(position).getMyLikeStatus().equals(\"1\"))\n\t\t\t{\n\t\t\t\tlike_unlike_change_btn.setTextColor(Color.parseColor(\"#536CB5\"));\n\t\t\t\tlike_unlike_change_btn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.active_like_icon, 0, 0, 0);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\tString filename=path_list.get(image_pos) .substring(path_list.get(image_pos).lastIndexOf(\"/\")+1);\n\t\t\n\t\t\n\t\t\n\n\t\t \n\t\t \n\t\t \n\t\t\t\n\t}\n\tcatch(Exception e)\n\t{\n\t\t\n\t}\n try\n\t{\n\tif(Integer.parseInt(newsList.get(position).getCommentCount())!=0)\t\n\t{\n\t\tcomment_btn.setTextColor(Color.parseColor(\"#536CB5\"));\n\t\tcomment_btn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.active_comment_icon, 0, 0, 0);\n\t\n\t}\n\t}\n\tcatch(Exception e)\n\t{\n\t\n\t}\n\tcancel_btn.setOnClickListener(new OnClickListener() {\n\t\t\n\t\t@Override\n\t\tpublic void onClick(View v) {\n\t\t\t// TODO Auto-generated method stub\n\t\t\tfinish();\n\t\t}\n\t});\n\t\n}", "Browser create(ConnectionFactory connectionFactory) {\n return new BrowserImpl(connectionFactory);\n }", "@SuppressLint({\"HardwareIds\", \"SetJavaScriptEnabled\"})\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n global = (Global) getApplicationContext();\n this.setTitle(\"Cargando...\");\n android_id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);\n setContentView(R.layout.activity_web_view_ubu);\n\n if(savedInstanceState == null){\n url = Objects.requireNonNull(getIntent().getDataString()).replace(\"ubuassistant://\",\"\");\n }\n\n WebView myWebView = findViewById(R.id.webview);\n WebSettings webSettings = myWebView.getSettings();\n webSettings.setJavaScriptEnabled(true);\n myWebView.setWebViewClient(new WebViewClient() {\n @Override\n public void onPageFinished(WebView view, String url) {\n WebViewUBU.this.setTitle(view.getTitle());\n Log.w(\"Global\", global.getWords().get(0));\n }\n });\n myWebView.setDownloadListener(new DownloadListener() {\n @Override\n public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {\n Intent i = new Intent(Intent.ACTION_VIEW);\n i.setData(Uri.parse(url));\n startActivity(i);\n }\n });\n myWebView.loadUrl(url);\n\n Toolbar myToolbar = findViewById(R.id.my_toolbar);\n setSupportActionBar(myToolbar);\n Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n\n new logVisit().execute();\n\n }", "public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView((int) R.layout.activity_web_demo);\n this.wvDocReader = (WebView) findViewById(R.id.wvDocReader);\n String url = getIntent().getStringExtra(\"docUrl\");\n this.wvDocReader.getSettings().setJavaScriptEnabled(true);\n this.wvDocReader.loadUrl(url);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n\n getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,\n\n WindowManager.LayoutParams.FLAG_FULLSCREEN);\n\n\n setContentView(R.layout.activity_main);\n\n\n\n\n\n web = (WebView) findViewById(R.id.web);\n WebSettings webSettings = web.getSettings();\n // settings.setJavaScriptEnabled(true);\n\n\n //支持js\n web.getSettings().setJavaScriptEnabled(true);\n // 解决图片不显示\n web.getSettings().setBlockNetworkImage(false);\n if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n web.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);\n }\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\n StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();\n StrictMode.setVmPolicy(builder.build());\n }\n\n\n\n //设置WebView属性,能够执行Javascript脚本\n webSettings.setJavaScriptEnabled(true);\n //设置可以访问文件\n webSettings.setAllowFileAccess(true);\n //设置支持缩放\n webSettings.setBuiltInZoomControls(true);\n\n webSettings.setAppCacheEnabled(true);\n webSettings.setDomStorageEnabled(true);\n webSettings.supportMultipleWindows();\n webSettings.setAllowContentAccess(true);\n webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);\n webSettings.setUseWideViewPort(true);\n webSettings.setLoadWithOverviewMode(true);\n webSettings.setSavePassword(true);\n webSettings.setSaveFormData(true);\n webSettings.setJavaScriptCanOpenWindowsAutomatically(true);\n webSettings.setLoadsImagesAutomatically(true);\n\n web.loadUrl(urlAddress);\n\n web.setWebViewClient(new WebViewClient() {\n @TargetApi(Build.VERSION_CODES.LOLLIPOP)\n @Override\n public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request)\n {\n //返回false,意味着请求过程里,不管有多少次的跳转请求(即新的请求地址),均交给webView自己处理,这也是此方法的默认处理\n //返回true,说明你自己想根据url,做新的跳转,比如在判断url符合条件的情况下,我想让webView加载http://ask.csdn.net/questions/178242\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n if (request.getUrl().toString().contains(\"sina.cn\")){\n // view.loadUrl(\"http://ask.csdn.net/questions/178242\");\n return true;\n }\n }\n\n view.loadUrl(request.getUrl().toString());\n return true;\n }\n\n @Override\n public void onPageStarted(WebView view, String url, Bitmap favicon) {\n // TODO Auto-generated method stub\n super.onPageStarted(view, url, favicon);\n }\n\n @Override\n public void onPageFinished(WebView view, String url) {\n // TODO Auto-generated method stub\n super.onPageFinished(view, url);\n }\n });\n\n web.setWebChromeClient(new WebChromeClient() {\n @Override\n // onShowFileChooser详解 http://teachcourse.cn/2224.html\n public boolean onShowFileChooser(WebView webView,\n ValueCallback<Uri[]> filePathCallback,\n FileChooserParams fileChooserParams) {\n mUploadCallbackAboveL = filePathCallback;\n take();\n return true;\n }\n\n public void openFileChooser(ValueCallback<Uri> uploadMsg) {\n mUploadMessage = uploadMsg;\n take();\n }\n\n public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {\n mUploadMessage = uploadMsg;\n take();\n }\n\n public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {\n mUploadMessage = uploadMsg;\n take();\n }\n });\n\n\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n // Inflate the layout for this fragment\n View v = inflater.inflate(R.layout.fragment_share_flickr, container, false);\n WebView myWebView = v.findViewById(R.id.flickrWebView);\n myWebView.setWebViewClient(new WebViewClient());\n myWebView.loadUrl(flickrUrl);\n return v;\n }" ]
[ "0.68594086", "0.6245364", "0.6207987", "0.6092232", "0.60124415", "0.59145194", "0.5900355", "0.58363795", "0.57992285", "0.5759542", "0.57540196", "0.5677936", "0.5638471", "0.56369984", "0.562044", "0.5617539", "0.5612846", "0.5577562", "0.5528814", "0.55271643", "0.5518707", "0.5458974", "0.5444967", "0.5444608", "0.54394305", "0.53900886", "0.5385437", "0.53621197", "0.5358402", "0.53532165", "0.5347612", "0.5329747", "0.5313726", "0.5310581", "0.5296259", "0.5251771", "0.52101415", "0.5205317", "0.51838934", "0.5182386", "0.51816404", "0.5155532", "0.5125252", "0.51212466", "0.5112683", "0.5092439", "0.5088493", "0.5070994", "0.5036346", "0.5032184", "0.5029076", "0.50091815", "0.50053555", "0.50007254", "0.4989129", "0.49880695", "0.49854434", "0.49808496", "0.49790493", "0.4939252", "0.4939096", "0.4927326", "0.49106413", "0.49068344", "0.4897532", "0.4894474", "0.48871085", "0.48607227", "0.4842847", "0.4831415", "0.48300135", "0.48187485", "0.48146418", "0.4812944", "0.4805445", "0.4801688", "0.4797322", "0.47844404", "0.47721773", "0.47371197", "0.47328252", "0.47075647", "0.4706386", "0.46971107", "0.46929288", "0.46856028", "0.468519", "0.46796387", "0.4677005", "0.46752802", "0.46749872", "0.46749562", "0.46743572", "0.4667508", "0.46643227", "0.46597233", "0.46535754", "0.46532074", "0.46531144", "0.46492636" ]
0.8748387
0
TODO Autogenerated method stub
@Override public void actionPerformed(ActionEvent e) { Date date=new Date(); DateFormat timeFormat=new SimpleDateFormat("HH:mm:ss"); String time=timeFormat.format(date); ceas.setText("Ora curenta: "+time); }
{ "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}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "private stendhal() {\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\r\n\tpublic void dispase() {\n\r\n\t}", "@Override\n\tprotected void initialize() {\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 }", "@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.66708666", "0.65675074", "0.65229905", "0.6481001", "0.64770633", "0.64584893", "0.6413091", "0.63764185", "0.6275735", "0.62541914", "0.6236919", "0.6223816", "0.62017626", "0.61944294", "0.61944294", "0.61920846", "0.61867654", "0.6173323", "0.61328775", "0.61276996", "0.6080555", "0.6076938", "0.6041293", "0.6024541", "0.6019185", "0.5998426", "0.5967487", "0.5967487", "0.5964935", "0.59489644", "0.59404725", "0.5922823", "0.5908894", "0.5903041", "0.5893847", "0.5885641", "0.5883141", "0.586924", "0.5856793", "0.58503157", "0.58464456", "0.5823378", "0.5809384", "0.58089525", "0.58065355", "0.58065355", "0.5800514", "0.57912874", "0.57912874", "0.57912874", "0.57912874", "0.57912874", "0.57912874", "0.57896614", "0.5789486", "0.5786597", "0.5783299", "0.5783299", "0.5773351", "0.5773351", "0.5773351", "0.5773351", "0.5773351", "0.5760369", "0.5758614", "0.5758614", "0.574912", "0.574912", "0.574912", "0.57482654", "0.5732775", "0.5732775", "0.5732775", "0.57207066", "0.57149917", "0.5714821", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57132614", "0.57115865", "0.57045746", "0.5699", "0.5696016", "0.5687285", "0.5677473", "0.5673346", "0.56716853", "0.56688815", "0.5661065", "0.5657898", "0.5654782", "0.5654782", "0.5654782", "0.5654563", "0.56536144", "0.5652585", "0.5649566" ]
0.0
-1
/ \brief Handle the loop unroll optimization pragmas. / pragma unroll / pragma unroll unrollhintvalue / pragma unroll '(' unrollhintvalue ')' / pragma nounroll / / unrollhintvalue: / constantexpression / / Loop unrolling hints can be specified with 'pragma unroll' or / 'pragma nounroll'. 'pragma unroll' can take a numeric argument optionally / contained in parentheses. With no argument the directive instructs llvm to / try to unroll the loop completely. A positive integer argument can be / specified to indicate the number of times the loop should be unrolled. To / maximize compatibility with other compilers the unroll count argument can be / specified with or without parentheses. Specifying, 'pragma nounroll' / disables unrolling of the loop.
@Converted(kind = Converted.Kind.MANUAL_COMPILATION, source = "${LLVM_SRC}/llvm/tools/clang/lib/Parse/ParsePragma.cpp", line = 2078, FQN="(anonymous namespace)::PragmaUnrollHintHandler::HandlePragma", NM="_ZN12_GLOBAL__N_123PragmaUnrollHintHandler12HandlePragmaERN5clang12PreprocessorENS1_20PragmaIntroducerKindERNS1_5TokenE", cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.clang.parse/llvmToClangType ${LLVM_SRC}/llvm/tools/clang/lib/Parse/ParsePragma.cpp -nm=_ZN12_GLOBAL__N_123PragmaUnrollHintHandler12HandlePragmaERN5clang12PreprocessorENS1_20PragmaIntroducerKindERNS1_5TokenE") //</editor-fold> @Override public void HandlePragma(Preprocessor /*&*/ PP, PragmaIntroducerKind Introducer, Token /*&*/ Tok)/* override*/ { unique_ptr_array<Token> TokenArray = null; JavaCleaner $c$ = $createJavaCleaner(); try { // Incoming token is "unroll" for "#pragma unroll", or "nounroll" for // "#pragma nounroll". Token PragmaName = new Token(Tok); PP.Lex(Tok); PragmaLoopHintInfo /*P*/ Info = /*FIXME:*//*new (PP.getPreprocessorAllocator())*/ new PragmaLoopHintInfo(); if (Tok.is(tok.TokenKind.eod)) { // nounroll or unroll pragma without an argument. Info.PragmaName.$assign(PragmaName); Info.Option.startToken(); } else if ($eq_StringRef(PragmaName.getIdentifierInfo().getName(), /*STRINGREF_STR*/"nounroll")) { $c$.clean($out_DiagnosticBuilder$C_char$ptr$C($c$.track(PP.Diag(Tok.getLocation(), diag.warn_pragma_extra_tokens_at_eol)), /*KEEP_STR*/"nounroll")); return; } else { // Unroll pragma with an argument: "#pragma unroll N" or // "#pragma unroll(N)". // Read '(' if it exists. boolean ValueInParens = Tok.is(tok.TokenKind.l_paren); if (ValueInParens) { PP.Lex(Tok); } Token Option/*J*/= new Token(); Option.startToken(); if (ParseLoopHintValue(PP, Tok, new Token(PragmaName), new Token(Option), ValueInParens, $Deref(Info))) { return; } // In CUDA, the argument to '#pragma unroll' should not be contained in // parentheses. if (PP.getLangOpts().CUDA && ValueInParens) { $c$.clean($c$.track(PP.Diag(Info.Toks.$at(0).getLocation(), diag.warn_pragma_unroll_cuda_value_in_parens))); } if (Tok.isNot(tok.TokenKind.eod)) { $c$.clean($out_DiagnosticBuilder$C_char$ptr$C($c$.track(PP.Diag(Tok.getLocation(), diag.warn_pragma_extra_tokens_at_eol)), /*KEEP_STR*/"unroll")); return; } } // Generate the hint token. TokenArray = llvm.make_unique(new Token [] { new Token() }); TokenArray.$at(0).startToken(); TokenArray.$at(0).setKind(tok.TokenKind.annot_pragma_loop_hint); TokenArray.$at(0).setLocation(PragmaName.getLocation()); TokenArray.$at(0).setAnnotationEndLoc(PragmaName.getLocation()); TokenArray.$at(0).setAnnotationValue((reinterpret_cast(/*static_cast*/Object/*void P*/ .class, (Info)))); PP.EnterTokenStream($c$.track(new unique_ptr_array<Token>(JD$Move.INSTANCE, std.move(TokenArray))), 1, /*DisableMacroExpansion=*/ false); $c$.clean(); } finally { if (TokenArray != null) { TokenArray.$destroy(); } $c$.$destroy(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp\", line = 1508,\n FQN=\"llvm::LoopAccessInfo::analyzeLoop\", NM=\"_ZN4llvm14LoopAccessInfo11analyzeLoopEPNS_9AAResultsEPNS_8LoopInfoEPKNS_17TargetLibraryInfoEPNS_13DominatorTreeE\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZN4llvm14LoopAccessInfo11analyzeLoopEPNS_9AAResultsEPNS_8LoopInfoEPKNS_17TargetLibraryInfoEPNS_13DominatorTreeE\")\n //</editor-fold>\n private void analyzeLoop(AAResults /*P*/ AA, LoopInfo /*P*/ LI, \n /*const*/ TargetLibraryInfo /*P*/ TLI, \n DominatorTree /*P*/ DT) {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/include/llvm/Analysis/LoopAccessAnalysis.h\", line = 551,\n FQN=\"llvm::LoopAccessInfo::canVectorizeMemory\", NM=\"_ZNK4llvm14LoopAccessInfo18canVectorizeMemoryEv\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo18canVectorizeMemoryEv\")\n //</editor-fold>\n public boolean canVectorizeMemory() /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp\", line = 1753,\n FQN=\"llvm::LoopAccessInfo::isUniform\", NM=\"_ZNK4llvm14LoopAccessInfo9isUniformEPNS_5ValueE\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo9isUniformEPNS_5ValueE\")\n //</editor-fold>\n public boolean isUniform(Value /*P*/ V) /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp\", line = 1454,\n FQN=\"llvm::LoopAccessInfo::canAnalyzeLoop\", NM=\"_ZN4llvm14LoopAccessInfo14canAnalyzeLoopEv\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZN4llvm14LoopAccessInfo14canAnalyzeLoopEv\")\n //</editor-fold>\n private boolean canAnalyzeLoop() {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/include/llvm/Analysis/LoopAccessAnalysis.h\", line = 521,\n FQN=\"llvm::LoopAccessInfo::LoopAccessInfo\", NM=\"_ZN4llvm14LoopAccessInfoC1EOS0_\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZN4llvm14LoopAccessInfoC1EOS0_\")\n //</editor-fold>\n public LoopAccessInfo(JD$Move _dparam, final LoopAccessInfo /*&&*/LAI) {\n // : PSE(std::move(LAI.PSE)), PtrRtChecking(std::move(LAI.PtrRtChecking)), DepChecker(std::move(LAI.DepChecker)), TheLoop(LAI.TheLoop), NumLoads(LAI.NumLoads), NumStores(LAI.NumStores), MaxSafeDepDistBytes(LAI.MaxSafeDepDistBytes), CanVecMem(LAI.CanVecMem), StoreToLoopInvariantAddress(LAI.StoreToLoopInvariantAddress), Report(std::move(LAI.Report)), SymbolicStrides(std::move(LAI.SymbolicStrides)), StrideSet(std::move(LAI.StrideSet)) \n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/include/llvm/Analysis/LoopAccessAnalysis.h\", line = 613,\n FQN=\"llvm::LoopAccessInfo::hasStride\", NM=\"_ZNK4llvm14LoopAccessInfo9hasStrideEPNS_5ValueE\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo9hasStrideEPNS_5ValueE\")\n //</editor-fold>\n public boolean hasStride(Value /*P*/ V) /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/include/llvm/Analysis/LoopAccessAnalysis.h\", line = 531,\n FQN=\"llvm::LoopAccessInfo::operator=\", NM=\"_ZN4llvm14LoopAccessInfoaSEOS0_\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZN4llvm14LoopAccessInfoaSEOS0_\")\n //</editor-fold>\n public LoopAccessInfo /*&*/ $assignMove(final LoopAccessInfo /*&&*/LAI) {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/include/llvm/Analysis/LoopAccessAnalysis.h\", line = 559,\n FQN=\"llvm::LoopAccessInfo::getNumRuntimePointerChecks\", NM=\"_ZNK4llvm14LoopAccessInfo26getNumRuntimePointerChecksEv\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo26getNumRuntimePointerChecksEv\")\n //</editor-fold>\n public /*uint*/int getNumRuntimePointerChecks() /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp\", line = 1893,\n FQN=\"llvm::LoopAccessInfo::addRuntimeChecks\", NM=\"_ZNK4llvm14LoopAccessInfo16addRuntimeChecksEPNS_11InstructionE\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo16addRuntimeChecksEPNS_11InstructionE\")\n //</editor-fold>\n public std.pair<Instruction /*P*/ , Instruction /*P*/ > addRuntimeChecks(Instruction /*P*/ Loc) /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp\", line = 1972,\n FQN=\"llvm::LoopAccessLegacyAnalysis::getInfo\", NM=\"_ZN4llvm24LoopAccessLegacyAnalysis7getInfoEPNS_4LoopE\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZN4llvm24LoopAccessLegacyAnalysis7getInfoEPNS_4LoopE\")\n //</editor-fold>\n public /*const*/ LoopAccessInfo /*&*/ getInfo(Loop /*P*/ L) {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "public void unsetLoop()\n {\n synchronized (monitor())\n {\n check_orphaned();\n get_store().remove_attribute(LOOP$16);\n }\n }", "public static void main(String[] args) {\n\t\tint loopidx = 1\r\n\t\tint sum =0;\r\n\t\tfinal LAST_loop_IDX =10;\r\n\t}", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/include/llvm/Analysis/LoopAccessAnalysis.h\", line = 621,\n FQN=\"llvm::LoopAccessInfo::hasStoreToLoopInvariantAddress\", NM=\"_ZNK4llvm14LoopAccessInfo30hasStoreToLoopInvariantAddressEv\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo30hasStoreToLoopInvariantAddressEv\")\n //</editor-fold>\n public boolean hasStoreToLoopInvariantAddress() /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "public static LoopExpression loop(Expression body, LabelTarget breakTarget, LabelTarget continueTarget) { throw Extensions.todo(); }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp\", line = 1831,\n FQN=\"llvm::LoopAccessInfo::addRuntimeChecks\", NM=\"_ZNK4llvm14LoopAccessInfo16addRuntimeChecksEPNS_11InstructionERKNS_15SmallVectorImplISt4pairIPKNS_22RuntimePointerChecking16CheckingPtrGroupES8_EEE\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo16addRuntimeChecksEPNS_11InstructionERKNS_15SmallVectorImplISt4pairIPKNS_22RuntimePointerChecking16CheckingPtrGroupES8_EEE\")\n //</editor-fold>\n public std.pair<Instruction /*P*/ , Instruction /*P*/ > addRuntimeChecks(Instruction /*P*/ Loc, \n final /*const*/ SmallVectorImpl<std.pair</*const*/ RuntimePointerChecking.CheckingPtrGroup /*P*/ , /*const*/ RuntimePointerChecking.CheckingPtrGroup /*P*/ > > /*&*/ PointerChecks) /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "public final EObject ruleLoop() throws RecognitionException {\n EObject current = null;\n\n Token otherlv_0=null;\n Token otherlv_1=null;\n Token lv_i_2_0=null;\n Token otherlv_3=null;\n\n\n \tenterRule();\n\n try {\n // InternalMLRegression.g:1136:2: ( (otherlv_0= 'loop' otherlv_1= ':' ( (lv_i_2_0= RULE_INT ) ) otherlv_3= ';' ) )\n // InternalMLRegression.g:1137:2: (otherlv_0= 'loop' otherlv_1= ':' ( (lv_i_2_0= RULE_INT ) ) otherlv_3= ';' )\n {\n // InternalMLRegression.g:1137:2: (otherlv_0= 'loop' otherlv_1= ':' ( (lv_i_2_0= RULE_INT ) ) otherlv_3= ';' )\n // InternalMLRegression.g:1138:3: otherlv_0= 'loop' otherlv_1= ':' ( (lv_i_2_0= RULE_INT ) ) otherlv_3= ';'\n {\n otherlv_0=(Token)match(input,33,FOLLOW_4); \n\n \t\t\tnewLeafNode(otherlv_0, grammarAccess.getLoopAccess().getLoopKeyword_0());\n \t\t\n otherlv_1=(Token)match(input,12,FOLLOW_15); \n\n \t\t\tnewLeafNode(otherlv_1, grammarAccess.getLoopAccess().getColonKeyword_1());\n \t\t\n // InternalMLRegression.g:1146:3: ( (lv_i_2_0= RULE_INT ) )\n // InternalMLRegression.g:1147:4: (lv_i_2_0= RULE_INT )\n {\n // InternalMLRegression.g:1147:4: (lv_i_2_0= RULE_INT )\n // InternalMLRegression.g:1148:5: lv_i_2_0= RULE_INT\n {\n lv_i_2_0=(Token)match(input,RULE_INT,FOLLOW_6); \n\n \t\t\t\t\tnewLeafNode(lv_i_2_0, grammarAccess.getLoopAccess().getIINTTerminalRuleCall_2_0());\n \t\t\t\t\n\n \t\t\t\t\tif (current==null) {\n \t\t\t\t\t\tcurrent = createModelElement(grammarAccess.getLoopRule());\n \t\t\t\t\t}\n \t\t\t\t\tsetWithLastConsumed(\n \t\t\t\t\t\tcurrent,\n \t\t\t\t\t\t\"i\",\n \t\t\t\t\t\tlv_i_2_0,\n \t\t\t\t\t\t\"org.eclipse.xtext.common.Terminals.INT\");\n \t\t\t\t\n\n }\n\n\n }\n\n otherlv_3=(Token)match(input,13,FOLLOW_2); \n\n \t\t\tnewLeafNode(otherlv_3, grammarAccess.getLoopAccess().getSemicolonKeyword_3());\n \t\t\n\n }\n\n\n }\n\n\n \tleaveRule();\n\n }\n\n catch (RecognitionException re) {\n recover(input,re);\n appendSkippedTokens();\n }\n finally {\n }\n return current;\n }", "public static LoopExpression loop(Expression body, LabelTarget breakTarget) { throw Extensions.todo(); }", "@Test\n public void testVectorizationOpportunitiesWithSingleStatementLoops() throws Exception {\n final String program =\n \"float f()\\n\"\n + \"{\\n\"\n + \" float a = 1.0;\"\n + \" while (a > 2.0) float z = 3.0;\"\n + \" float b = 2.0;\"\n + \" float c = 3.0;\"\n + \" for (int i = 0; i < 100; i++) float w = 10.0;\"\n + \" return a;\\n\"\n + \"}\\n\";\n\n final String expectedFirst =\n \"float f()\\n\"\n + \"{\\n\"\n + \" vec3 GLF_merged3_0_1_1_1_1_1_2_1_1abc;\\n\"\n + \" float a = 1.0;\\n\"\n + \" GLF_merged3_0_1_1_1_1_1_2_1_1abc.x = a;\\n\"\n + \" while (GLF_merged3_0_1_1_1_1_1_2_1_1abc.x > 2.0) float z = 3.0;\"\n + \" float b = 2.0;\\n\"\n + \" GLF_merged3_0_1_1_1_1_1_2_1_1abc.y = b;\\n\"\n + \" float c = 3.0;\\n\"\n + \" GLF_merged3_0_1_1_1_1_1_2_1_1abc.z = c;\\n\"\n + \" for (int i = 0; i < 100; i++) float w = 10.0;\"\n + \" return GLF_merged3_0_1_1_1_1_1_2_1_1abc.x;\\n\"\n + \"}\\n\";\n\n TranslationUnit tu = ParseHelper.parse(program);\n List<VectorizeMutation> ops =\n new VectorizeMutationFinder(tu,\n new CannedRandom(0, 0, 0, 0, 0, 0, 0)).findMutations();\n assertEquals(1, ops.size());\n ops.get(0).apply();\n CompareAsts.assertEqualAsts(expectedFirst, tu);\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/include/llvm/Analysis/LoopAccessAnalysis.h\", line = 603,\n FQN=\"llvm::LoopAccessInfo::getInstructionsForAccess\", NM=\"_ZNK4llvm14LoopAccessInfo24getInstructionsForAccessEPNS_5ValueEb\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo24getInstructionsForAccessEPNS_5ValueEb\")\n //</editor-fold>\n public SmallVector<Instruction /*P*/ > getInstructionsForAccess(Value /*P*/ Ptr, \n boolean isWrite) /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "public final void mROLL() throws RecognitionException\n\t{\n\t\ttry\n\t\t{\n\t\t\tfinal int _type = AshvmLexer.ROLL;\n\t\t\tfinal int _channel = BaseRecognizer.DEFAULT_TOKEN_CHANNEL;\n\t\t\t// D:\\\\Programmieren\\\\projects\\\\ashvm\\\\Ashvm.g:741:6: ( 'roll' )\n\t\t\t// D:\\\\Programmieren\\\\projects\\\\ashvm\\\\Ashvm.g:741:8: 'roll'\n\t\t\t{\n\t\t\t\tthis.match(\"roll\");\n\n\t\t\t}\n\n\t\t\tthis.state.type = _type;\n\t\t\tthis.state.channel = _channel;\n\t\t}\n\t\tfinally\n\t\t{\n\t\t}\n\t}", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp\", line = 1901,\n FQN=\"llvm::LoopAccessInfo::collectStridedAccess\", NM=\"_ZN4llvm14LoopAccessInfo20collectStridedAccessEPNS_5ValueE\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZN4llvm14LoopAccessInfo20collectStridedAccessEPNS_5ValueE\")\n //</editor-fold>\n private void collectStridedAccess(Value /*P*/ MemAccess) {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "public static LoopExpression loop(Expression body) { throw Extensions.todo(); }", "public Snippet visit(LoopStatement n, Snippet argu) {\n\t\t Snippet _ret = new Snippet(\"\", \"\", null, false);\n\t int temp = currentBlock;\n\t\t\tcurrentBlock = ++blockId;\n\n\t n.nodeToken.accept(this, argu);\n\t n.nodeToken1.accept(this, argu);\n\t Snippet f2 = n.pointType.accept(this, argu);\n\t Snippet f3 = n.explodedSpecification.accept(this, argu);\n\t n.nodeToken2.accept(this, argu);\n\t Snippet f5 = n.identifier.accept(this, argu);\n\t n.nodeToken3.accept(this, argu);\n\n\t\t\tcurrentBlock = temp;\n\t\t\t//_ret.returnTemp = generateTabs(blockDepth)+\"for(\"+f2.returnTemp+f3.returnTemp+\" : \"+f5.returnTemp+\")\";//+f7.returnTemp;\n\t\t\t_ret.returnTemp = generateTabs(blockDepth)+\"for(int \"+f3.returnTemp+\"=0\"+\"; \"+f3.returnTemp+\" < \"+f5.returnTemp+\".length; \"+f3.returnTemp+\"++\"+\")\";\n\t\t\ttPlasmaCode+=_ret.returnTemp+\"\\n\";\n\t n.block.accept(this, argu);\n\t return _ret;\n\t }", "public void setCount(final int p0) {\n // This method could not be decompiled.\n // \n // Original Bytecode:\n // \n // 3: aload_3 \n // 4: monitorexit \n // 5: athrow \n // 6: aload_0 \n // 7: dup \n // 8: astore_3 \n // 9: monitorenter \n // 10: aload_0 \n // 11: getfield facade/characters/wmedef/TopicReferenceCountWME.count:I\n // 14: istore_2 \n // 15: aload_0 \n // 16: iload_1 \n // 17: putfield facade/characters/wmedef/TopicReferenceCountWME.count:I\n // 20: aload_3 \n // 21: monitorexit \n // 22: aload_0 \n // 23: getfield facade/characters/wmedef/TopicReferenceCountWME.__support:Ljava/beans/PropertyChangeSupport;\n // 26: ldc \"count\"\n // 28: iload_2 \n // 29: iload_1 \n // 30: invokevirtual java/beans/PropertyChangeSupport.firePropertyChange:(Ljava/lang/String;II)V\n // 33: return \n // Exceptions:\n // Try Handler\n // Start End Start End Type\n // ----- ----- ----- ----- ----\n // 3 5 3 6 Any\n // 10 22 3 6 Any\n // \n // The error that occurred was:\n // \n // java.util.ConcurrentModificationException\n // at java.util.ArrayList$Itr.checkForComodification(Unknown Source)\n // at java.util.ArrayList$Itr.next(Unknown Source)\n // at com.strobel.decompiler.ast.AstBuilder.convertLocalVariables(AstBuilder.java:2863)\n // at com.strobel.decompiler.ast.AstBuilder.performStackAnalysis(AstBuilder.java:2445)\n // at com.strobel.decompiler.ast.AstBuilder.build(AstBuilder.java:108)\n // at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:211)\n // at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:99)\n // at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethodBody(AstBuilder.java:782)\n // at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethod(AstBuilder.java:675)\n // at com.strobel.decompiler.languages.java.ast.AstBuilder.addTypeMembers(AstBuilder.java:552)\n // at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeCore(AstBuilder.java:519)\n // at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeNoCache(AstBuilder.java:161)\n // at com.strobel.decompiler.languages.java.ast.AstBuilder.createType(AstBuilder.java:150)\n // at com.strobel.decompiler.languages.java.ast.AstBuilder.addType(AstBuilder.java:125)\n // at com.strobel.decompiler.languages.java.JavaLanguage.buildAst(JavaLanguage.java:71)\n // at com.strobel.decompiler.languages.java.JavaLanguage.decompileType(JavaLanguage.java:59)\n // at com.strobel.decompiler.DecompilerDriver.decompileType(DecompilerDriver.java:330)\n // at com.strobel.decompiler.DecompilerDriver.decompileJar(DecompilerDriver.java:251)\n // at com.strobel.decompiler.DecompilerDriver.main(DecompilerDriver.java:126)\n // \n throw new IllegalStateException(\"An error occurred while decompiling this method.\");\n }", "public void setLoopMode(boolean loopMode);", "private static int reductionInt10(int[] x) {\n int sum = 0;\n // Amenable to complete unrolling.\n for (int i = 10; i <= 10; i++) {\n sum += x[i];\n }\n return sum;\n }", "private StatementNode wrapBodyWithControlVariableStep(WriteVariableNode assignment, StatementNode loopBody, ForDirection direction) throws VariableNotDeclaredException {\n if (direction == ForDirection.UP) {\n return loopBody.appendStatement(\n astFactory.createIncrementVariable(\n astFactory.createReadVariable(assignment.getVariableName())), getFrameDescriptor());\n\n } else if (direction == ForDirection.DOWN) {\n return loopBody.appendStatement(\n astFactory.createDecrementVariable(astFactory.createReadVariable(assignment.getVariableName())),\n getFrameDescriptor());\n } else {\n throw new RuntimeException(\"Unexpected loop direction \" + direction.toString());\n }\n }", "public void incrementLoopCount() {\n this.loopCount++;\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp\", line = 1932,\n FQN=\"llvm::LoopAccessInfo::print\", NM=\"_ZNK4llvm14LoopAccessInfo5printERNS_11raw_ostreamEj\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo5printERNS_11raw_ostreamEj\")\n //</editor-fold>\n public void print(final raw_ostream /*&*/ OS) /*const*/ {\n print(OS, 0);\n }", "public void setCount(int r1) {\n /*\n // Can't load method instructions: Load method exception: null in method: android.widget.OppoScroller.setCount(int):void, dex: in method: android.widget.OppoScroller.setCount(int):void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.widget.OppoScroller.setCount(int):void\");\n }", "public void fling(int r1, int r2, int r3, int r4, int r5, int r6, int r7, int r8) {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e6 in method: android.widget.OppoScroller.fling(int, int, int, int, int, int, int, int):void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.widget.OppoScroller.fling(int, int, int, int, int, int, int, int):void\");\n }", "@Override // kotlinx.coroutines.flow.FlowCollector\n /* Code decompiled incorrectly, please refer to instructions dump. */\n public java.lang.Object emit(java.lang.Object r9, kotlin.coroutines.Continuation r10) {\n /*\n r8 = this;\n boolean r0 = r10 instanceof kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.AnonymousClass2.AnonymousClass1\n if (r0 == 0) goto L_0x0013\n r0 = r10\n kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2$1 r0 = (kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.AnonymousClass2.AnonymousClass1) r0\n int r1 = r0.label\n r2 = -2147483648(0xffffffff80000000, float:-0.0)\n r3 = r1 & r2\n if (r3 == 0) goto L_0x0013\n int r1 = r1 - r2\n r0.label = r1\n goto L_0x0018\n L_0x0013:\n kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2$1 r0 = new kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2$1\n r0.<init>(r10)\n L_0x0018:\n java.lang.Object r10 = r0.result\n java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()\n int r2 = r0.label\n r3 = 2\n r4 = 1\n if (r2 == 0) goto L_0x005e\n if (r2 == r4) goto L_0x0044\n if (r2 != r3) goto L_0x003c\n java.lang.Object r8 = r0.L$6\n kotlinx.coroutines.flow.FlowCollector r8 = (kotlinx.coroutines.flow.FlowCollector) r8\n java.lang.Object r8 = r0.L$4\n kotlin.coroutines.Continuation r8 = (kotlin.coroutines.Continuation) r8\n java.lang.Object r8 = r0.L$2\n kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2$1 r8 = (kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.AnonymousClass2.AnonymousClass1) r8\n java.lang.Object r8 = r0.L$0\n kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2 r8 = (kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.AnonymousClass2) r8\n kotlin.ResultKt.throwOnFailure(r10)\n goto L_0x009b\n L_0x003c:\n java.lang.IllegalStateException r8 = new java.lang.IllegalStateException\n java.lang.String r9 = \"call to 'resume' before 'invoke' with coroutine\"\n r8.<init>(r9)\n throw r8\n L_0x0044:\n java.lang.Object r8 = r0.L$6\n kotlinx.coroutines.flow.FlowCollector r8 = (kotlinx.coroutines.flow.FlowCollector) r8\n java.lang.Object r9 = r0.L$5\n java.lang.Object r2 = r0.L$4\n kotlin.coroutines.Continuation r2 = (kotlin.coroutines.Continuation) r2\n java.lang.Object r4 = r0.L$3\n java.lang.Object r5 = r0.L$2\n kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2$1 r5 = (kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.AnonymousClass2.AnonymousClass1) r5\n java.lang.Object r6 = r0.L$1\n java.lang.Object r7 = r0.L$0\n kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2 r7 = (kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.AnonymousClass2) r7\n kotlin.ResultKt.throwOnFailure(r10)\n goto L_0x0084\n L_0x005e:\n kotlin.ResultKt.throwOnFailure(r10)\n kotlinx.coroutines.flow.FlowCollector r10 = kotlinx.coroutines.flow.FlowCollector.this\n kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1 r2 = r2\n kotlin.jvm.functions.Function2 r2 = r2.$action$inlined\n r0.L$0 = r8\n r0.L$1 = r9\n r0.L$2 = r0\n r0.L$3 = r9\n r0.L$4 = r0\n r0.L$5 = r9\n r0.L$6 = r10\n r0.label = r4\n java.lang.Object r2 = r2.invoke(r9, r0)\n if (r2 != r1) goto L_0x007e\n return r1\n L_0x007e:\n r7 = r8\n r4 = r9\n r6 = r4\n r8 = r10\n r2 = r0\n r5 = r2\n L_0x0084:\n r0.L$0 = r7\n r0.L$1 = r6\n r0.L$2 = r5\n r0.L$3 = r4\n r0.L$4 = r2\n r0.L$5 = r9\n r0.L$6 = r8\n r0.label = r3\n java.lang.Object r10 = r8.emit(r9, r0)\n if (r10 != r1) goto L_0x009b\n return r1\n L_0x009b:\n return r10\n */\n throw new UnsupportedOperationException(\"Method not decompiled: kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.AnonymousClass2.emit(java.lang.Object, kotlin.coroutines.Continuation):java.lang.Object\");\n }", "public void setLoopCount(int loopCount) {\n\t\tthis.loopCount = loopCount;\n\t}", "public void loop() {\n this.instructionList.restart();\t\n }", "private static Status loopTransformable(\n ImmutableMap<CSimpleDeclaration, TransformableArray> pTransformableArrayMap,\n TransformableLoop pLoop) {\n\n ImmutableSet<MemoryLocation> innerLoopDeclarations =\n pLoop.getInnerLoopDeclarations().stream()\n .map(MemoryLocation::forDeclaration)\n .collect(ImmutableSet.toImmutableSet());\n MemoryLocation loopIndexMemLoc =\n MemoryLocation.forDeclaration(pLoop.getIndex().getVariableDeclaration());\n\n EdgeDefUseData.Extractor defUseDataExtractor = EdgeDefUseData.createExtractor(true);\n for (CFAEdge edge : pLoop.getInnerLoopEdges()) {\n\n Set<MemoryLocation> arrayMemoryLocations = new HashSet<>();\n\n // non-transformable arrays in a transformable loop make the loop non-transformable\n for (CSimpleDeclaration arrayDeclaration : ArrayAccess.findArrayOccurences(edge)) {\n if (!pTransformableArrayMap.containsKey(arrayDeclaration)) {\n return Status.UNCHANGED;\n }\n\n arrayMemoryLocations.add(MemoryLocation.forDeclaration(arrayDeclaration));\n }\n\n EdgeDefUseData edgeDefUseData = defUseDataExtractor.extract(edge);\n for (MemoryLocation def : edgeDefUseData.getDefs()) {\n if (!innerLoopDeclarations.contains(def)\n && !arrayMemoryLocations.contains(def)\n && !def.equals(loopIndexMemLoc)) {\n return Status.UNCHANGED;\n }\n }\n\n // any pointee def make a loop non-transformable\n if (!edgeDefUseData.getPointeeDefs().isEmpty()) {\n return Status.UNCHANGED;\n }\n }\n\n return Status.PRECISE;\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/include/llvm/Analysis/LoopAccessAnalysis.h\", line = 595,\n FQN=\"llvm::LoopAccessInfo::getReport\", NM=\"_ZNK4llvm14LoopAccessInfo9getReportEv\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo9getReportEv\")\n //</editor-fold>\n public /*const*/ Optional<LoopAccessReport> /*&*/ getReport() /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "public final void rule__MLRegression__LoopAssignment_5() throws RecognitionException {\n\n \t\tint stackSize = keepStackSize();\n \t\n try {\n // InternalMLRegression.g:2557:1: ( ( ruleLoop ) )\n // InternalMLRegression.g:2558:2: ( ruleLoop )\n {\n // InternalMLRegression.g:2558:2: ( ruleLoop )\n // InternalMLRegression.g:2559:3: ruleLoop\n {\n before(grammarAccess.getMLRegressionAccess().getLoopLoopParserRuleCall_5_0()); \n pushFollow(FOLLOW_2);\n ruleLoop();\n\n state._fsp--;\n\n after(grammarAccess.getMLRegressionAccess().getLoopLoopParserRuleCall_5_0()); \n\n }\n\n\n }\n\n }\n catch (RecognitionException re) {\n reportError(re);\n recover(input,re);\n }\n finally {\n\n \trestoreStackSize(stackSize);\n\n }\n return ;\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/include/llvm/Analysis/LoopAccessAnalysis.h\", line = 599,\n FQN=\"llvm::LoopAccessInfo::getDepChecker\", NM=\"_ZNK4llvm14LoopAccessInfo13getDepCheckerEv\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo13getDepCheckerEv\")\n //</editor-fold>\n public /*const*/ MemoryDepChecker /*&*/ getDepChecker() /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "public boolean eliminateLoop(){ return false; }", "public static void main(String[] args) {\n\n int oldCapacity = 4;\n System.out.println(oldCapacity + (oldCapacity >> 1));\n\n /*Solution solution = new Solution();\n// System.out.println(solution.numRollsToTarget(2, 6, 7));\n\n int[] ints = solution.loudAndRich(new int[][]{\n *//* {1, 0},\n {2, 1},\n {3, 1},\n {3, 7},\n {4, 3},\n {5, 3},\n {6, 3}\n }, new int[]{3, 2, 5, 4, 6, 1, 7, 0});*//*\n\n }, new int[]{0, 1});\n Printer.print(ints);*/\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/include/llvm/Analysis/LoopAccessAnalysis.h\", line = 630,\n FQN=\"llvm::LoopAccessInfo::getPSE\", NM=\"_ZNK4llvm14LoopAccessInfo6getPSEEv\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm14LoopAccessInfo6getPSEEv\")\n //</editor-fold>\n public /*const*/ PredicatedScalarEvolution /*&*/ getPSE() /*const*/ {\n throw new UnsupportedOperationException(\"EmptyBody\");\n }", "public static void main(String[] args) {\n\t\tSystem.out.println(\"Reviewing loops\");\n\t}", "@BinderThread\n public void setRoll(float roll) {\n this.roll = -roll;\n }", "public abstract void reverseRange(int index, int count, int stride);", "protected void backwardNumCodePoints(int r1) {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e5 in method: android.icu.impl.coll.CollationDataBuilder.DataBuilderCollationIterator.backwardNumCodePoints(int):void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.icu.impl.coll.CollationDataBuilder.DataBuilderCollationIterator.backwardNumCodePoints(int):void\");\n }", "void mo54447l(int i);", "public void fling(int r1, int r2, int r3, int r4, int r5, int r6, int r7, int r8, int r9, int r10) {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00ea in method: android.widget.OppoScroller.fling(int, int, int, int, int, int, int, int, int, int):void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.widget.OppoScroller.fling(int, int, int, int, int, int, int, int, int, int):void\");\n }", "@Converted(kind = Converted.Kind.AUTO_NO_BODY,\n source = \"${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp\", line = 1981,\n FQN=\"llvm::LoopAccessLegacyAnalysis::print\", NM=\"_ZNK4llvm24LoopAccessLegacyAnalysis5printERNS_11raw_ostreamEPKNS_6ModuleE\",\n cmd=\"jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.analysis/llvmToClangType ${LLVM_SRC}/llvm/lib/Analysis/LoopAccessAnalysis.cpp -nm=_ZNK4llvm24LoopAccessLegacyAnalysis5printERNS_11raw_ostreamEPKNS_6ModuleE\")\n //</editor-fold>\n public void print(final raw_ostream /*&*/ OS) /*const*//* override*/ {\n print(OS, (/*const*/ Module /*P*/ )null);\n }", "public static void main(String[] args) {\n\t\n\t\tfor (int i=100;i>300;i-=5) {\n\t\t\tSystem.out.println(i+\" hello world\");\n\t\t\n\t}\n\t\t\n\t\t//not: eger sart kismi bizim artisimiza gore hep true verirse loop sonsuz\n\t\t//donguye girer.\n\t\t\n\t\t//loopta artis degeri pozitif oldugu gibi negatif de olabilir.\n\t\t\n\t\t//eger loopun sarti hic true olmazsa loop body hic devreye girmez\n\t\t\n\t\t\n\n\t}", "void roll(int pins);", "public void setLoopInterval(int loopInterval)\r\n {\r\n this.loopInterval = loopInterval;\r\n }", "private static void testLongLoop() {\n test(1000 * 1000 * 1000);\n //uncomment the following line to see the hand-written cache performance\n //testManual( 1000 * 1000 * 1000 );\n }", "private static void testLongLoop() {\n test(1000 * 1000 * 1000);\n //uncomment the following line to see the hand-written cache performance\n //testManual( 1000 * 1000 * 1000 );\n }", "public void testUnconditionalBreakDirective()\n {\n assertEvalEquals(\"1\", \"#foreach($i in [1..5])$i#break #end\");\n }", "protected void forwardNumCodePoints(int r1) {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e5 in method: android.icu.impl.coll.CollationDataBuilder.DataBuilderCollationIterator.forwardNumCodePoints(int):void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.icu.impl.coll.CollationDataBuilder.DataBuilderCollationIterator.forwardNumCodePoints(int):void\");\n }", "ForLoopRule createForLoopRule();", "private int[] inc(int[] a)\n {\n int tI = a.length - 1;\n long m = 0;\n\n m = (((long)a[tI]) & IMASK) + 1L;\n a[tI--] = (int)m;\n m >>>= 32;\n\n while (tI >= 0 && m != 0)\n {\n m += (((long)a[tI]) & IMASK);\n a[tI--] = (int)m;\n m >>>= 32;\n }\n\n return a;\n }", "private int[] inc(int[] a)\n {\n int tI = a.length - 1;\n long m = 0;\n\n m = (((long)a[tI]) & IMASK) + 1L;\n a[tI--] = (int)m;\n m >>>= 32;\n\n while (tI >= 0 && m != 0)\n {\n m += (((long)a[tI]) & IMASK);\n a[tI--] = (int)m;\n m >>>= 32;\n }\n\n return a;\n }", "public void startScroll(int r1, int r2, int r3, int r4) {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00ea in method: android.widget.OppoScroller.startScroll(int, int, int, int):void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.widget.OppoScroller.startScroll(int, int, int, int):void\");\n }", "public static void main(String[] args) {\n Long sum = 0L;\n for (long i = 0; i < Integer.MAX_VALUE; i++) {\n sum += i;\n }\n System.out.println(sum);\n}", "public Integer getLoopCounter(Loop lp){\n\t\treturn loopCounter.get(lp);\n\t}", "private static native void PeiLinNormalization_0(long I_nativeObj, long T_nativeObj);", "UnpivotInClauseArg createUnpivotInClauseArg();", "@Override\n public void visit(LoopControlNode loopControlNode) {\n }", "public void startScroll(int r1, int r2, int r3, int r4, int r5) {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e6 in method: android.widget.OppoScroller.startScroll(int, int, int, int, int):void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.widget.OppoScroller.startScroll(int, int, int, int, int):void\");\n }", "public void setLoop(boolean loop)\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.SimpleValue target = null;\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(LOOP$16);\n if (target == null)\n {\n target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(LOOP$16);\n }\n target.setBooleanValue(loop);\n }\n }", "public Arginfo visit(WhileStatement n, Arginfo argu) {\n Arginfo _ret=null;\n \n int var1=labelctr++;\n int var2=labelctr++;\n System.out.println(\" L\"+var1+\" NOOP\");\n System.out.print(\"CJUMP \");\n \n n.f0.accept(this, argu);\n n.f1.accept(this, argu);\n n.f2.accept(this, argu);\n \n System.out.println(\" L\"+var2+\" \");\n \n n.f3.accept(this, argu);\n n.f4.accept(this, argu);\n System.out.println(\"JUMP L\"+var1+\"\\nL\"+var2+\" NOOP\\n\");\n return _ret;\n }", "public void mo442d() {\n long j;\n long j2;\n int i;\n long j3;\n boolean z;\n C0245a[] aVarArr;\n int i2;\n int i3;\n C3683c<? super U> cVar = this.f472a;\n int i4 = 1;\n while (!mo443e()) {\n C0211f<U> fVar = this.f477f;\n long j4 = this.f482m.get();\n boolean z2 = j4 == Long.MAX_VALUE;\n if (fVar != null) {\n j = 0;\n while (true) {\n long j5 = 0;\n Object obj = null;\n while (true) {\n if (j4 == 0) {\n break;\n }\n Object e_ = fVar.mo386e_();\n if (!mo443e()) {\n if (e_ == null) {\n obj = e_;\n break;\n }\n cVar.onNext(e_);\n j++;\n j5++;\n j4--;\n obj = e_;\n } else {\n return;\n }\n }\n if (j5 != 0) {\n if (z2) {\n j4 = Long.MAX_VALUE;\n } else {\n j4 = this.f482m.addAndGet(-j5);\n }\n }\n if (j4 == 0 || obj == null) {\n break;\n }\n }\n } else {\n j = 0;\n }\n boolean z3 = this.f478g;\n C0211f<U> fVar2 = this.f477f;\n C0245a[] aVarArr2 = (C0245a[]) this.f481j.get();\n int length = aVarArr2.length;\n if (!z3 || ((fVar2 != null && !fVar2.mo384b()) || length != 0)) {\n if (length != 0) {\n i = i4;\n long j6 = this.f485p;\n int i5 = this.f486q;\n if (length <= i5 || aVarArr2[i5].f462a != j6) {\n if (length <= i5) {\n i5 = 0;\n }\n int i6 = i5;\n for (int i7 = 0; i7 < length && aVarArr2[i6].f462a != j6; i7++) {\n i6++;\n if (i6 == length) {\n i6 = 0;\n }\n }\n this.f486q = i6;\n this.f485p = aVarArr2[i6].f462a;\n i5 = i6;\n }\n int i8 = i5;\n z = false;\n int i9 = 0;\n while (true) {\n if (i9 >= length) {\n aVarArr = aVarArr2;\n break;\n } else if (!mo443e()) {\n C0245a aVar = aVarArr2[i8];\n Object obj2 = null;\n while (!mo443e()) {\n C0212g<U> gVar = aVar.f467f;\n if (gVar == null) {\n aVarArr = aVarArr2;\n i2 = length;\n } else {\n aVarArr = aVarArr2;\n i2 = length;\n long j7 = 0;\n while (j2 != 0) {\n try {\n obj2 = gVar.mo386e_();\n if (obj2 == null) {\n break;\n }\n cVar.onNext(obj2);\n if (!mo443e()) {\n j2--;\n j7++;\n } else {\n return;\n }\n } catch (Throwable th) {\n Throwable th2 = th;\n C0171b.m584b(th2);\n aVar.dispose();\n this.f479h.mo516a(th2);\n if (!this.f474c) {\n this.f483n.mo407a();\n }\n if (!mo443e()) {\n mo439b(aVar);\n i9++;\n i3 = i2;\n z = true;\n } else {\n return;\n }\n }\n }\n if (j7 != 0) {\n j2 = !z2 ? this.f482m.addAndGet(-j7) : Long.MAX_VALUE;\n aVar.mo433a(j7);\n }\n if (!(j2 == 0 || obj2 == null)) {\n aVarArr2 = aVarArr;\n length = i2;\n }\n }\n boolean z4 = aVar.f466e;\n C0212g<U> gVar2 = aVar.f467f;\n if (z4 && (gVar2 == null || gVar2.mo384b())) {\n mo439b(aVar);\n if (!mo443e()) {\n j++;\n z = true;\n } else {\n return;\n }\n }\n if (j2 == 0) {\n break;\n }\n int i10 = i8 + 1;\n i3 = i2;\n i8 = i10 == i3 ? 0 : i10;\n i9++;\n length = i3;\n aVarArr2 = aVarArr;\n }\n return;\n } else {\n return;\n }\n }\n this.f486q = i8;\n this.f485p = aVarArr[i8].f462a;\n j3 = j;\n } else {\n i = i4;\n j3 = j;\n z = false;\n }\n if (j3 != 0 && !this.f480i) {\n this.f483n.mo408a(j3);\n }\n if (z) {\n i4 = i;\n } else {\n i4 = addAndGet(-i);\n if (i4 == 0) {\n return;\n }\n }\n } else {\n Throwable a = this.f479h.mo515a();\n if (a != C0315e.f669a) {\n if (a == null) {\n cVar.onComplete();\n } else {\n cVar.onError(a);\n }\n }\n return;\n }\n }\n }", "public final void rule__Loop__Group__3() throws RecognitionException {\n\n \t\tint stackSize = keepStackSize();\n \t\n try {\n // InternalMLRegression.g:2248:1: ( rule__Loop__Group__3__Impl )\n // InternalMLRegression.g:2249:2: rule__Loop__Group__3__Impl\n {\n pushFollow(FOLLOW_2);\n rule__Loop__Group__3__Impl();\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 long skip(long r1) throws java.io.IOException {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e5 in method: com.android.org.conscrypt.OpenSSLBIOSource.ByteBufferInputStream.skip(long):long, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.android.org.conscrypt.OpenSSLBIOSource.ByteBufferInputStream.skip(long):long\");\n }", "public static void main(String[] args) {\n version1WhileLoop();\n version1DoWhileLoop();\n version1ForLoop();\n version2ForLoop();\n version3ForLoop();\n }", "UnpivotInClauseArgs createUnpivotInClauseArgs();", "private void Perform_LPM_III()\n {\n int zindex = get_z();\n int d = Utils.GetOperand_XXXXXXX11111XXXX(mMBR);\n int wordlocation = zindex >> 1;\n\n try\n {\n if (Utils.bit0(zindex))\n set_reg(d,(program_memory[wordlocation] & 0xff00) >> 8);\n else\n set_reg(d,program_memory[wordlocation] & 0x00ff);\n }\n catch (RuntimeException e) { } \n inc_z();\n clockTick();\n clockTick();\n return;\n }", "public void xsetLoop(org.apache.xmlbeans.XmlBoolean loop)\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.XmlBoolean target = null;\n target = (org.apache.xmlbeans.XmlBoolean)get_store().find_attribute_user(LOOP$16);\n if (target == null)\n {\n target = (org.apache.xmlbeans.XmlBoolean)get_store().add_attribute_user(LOOP$16);\n }\n target.set(loop);\n }\n }", "@Test(timeout = 4000)\n public void test034() throws Throwable {\n ClassWriter classWriter0 = new ClassWriter((-1267));\n String[] stringArray0 = new String[4];\n stringArray0[0] = \"LocalVariableTypeTable\";\n stringArray0[1] = \"QL\";\n stringArray0[2] = \"LocalVariableTypeTable\";\n stringArray0[3] = \"LocalVariableTypeTable\";\n MethodWriter methodWriter0 = new MethodWriter(classWriter0, (-2431), \"QL\", \"LocalVariableTypeTable\", \"RuntimeInvisibleAnnotations\", stringArray0, false, false);\n methodWriter0.visitIincInsn((-1267), 2684);\n }", "public void unCover() {\n linkLR();\n DataNode tmp = this.U;\n while (tmp != this) {\n //select each row and go through all the left nodes and link from respective columns.\n DataNode l = tmp.L;\n while (l!= tmp) {\n l.linkUD();\n l.C.count++;\n l = l.L;\n }\n tmp = tmp.U;\n }\n }", "public void setLoop(boolean loop) {\n this.loop = loop;\n }", "public long getUnsignedIntLE(int index)\r\n/* 781: */ {\r\n/* 782:790 */ recordLeakNonRefCountingOperation(this.leak);\r\n/* 783:791 */ return super.getUnsignedIntLE(index);\r\n/* 784: */ }", "public void setLOD(int r1) {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e5 in method: android.renderscript.AllocationAdapter.setLOD(int):void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.renderscript.AllocationAdapter.setLOD(int):void\");\n }", "void mo32046rn(int i);", "@Override public void init_loop() {\n loop_cnt_++;\n }", "private void ssMergeBackward(int r19, int[] r20, int r21, int r22, int r23, int r24, int r25) {\n /*\n r18 = this;\n r0 = r18;\n r4 = r0.SA;\n r17 = r24 - r23;\n r5 = r21 + r17;\n r17 = r24 - r23;\n r0 = r20;\n r1 = r21;\n r2 = r23;\n r3 = r17;\n ssBlockSwap(r0, r1, r4, r2, r3);\n r16 = 0;\n r17 = r5 + -1;\n r17 = r20[r17];\n if (r17 >= 0) goto L_0x0071;\n L_0x001d:\n r16 = r16 | 1;\n r17 = r5 + -1;\n r17 = r20[r17];\n r17 = r17 ^ -1;\n r12 = r19 + r17;\n L_0x0027:\n r17 = r23 + -1;\n r17 = r4[r17];\n if (r17 >= 0) goto L_0x0078;\n L_0x002d:\n r16 = r16 | 2;\n r17 = r23 + -1;\n r17 = r4[r17];\n r17 = r17 ^ -1;\n r13 = r19 + r17;\n L_0x0037:\n r17 = r24 + -1;\n r15 = r4[r17];\n r6 = r24 + -1;\n r8 = r5 + -1;\n r10 = r23 + -1;\n L_0x0041:\n r0 = r18;\n r1 = r25;\n r14 = r0.ssCompare(r12, r13, r1);\n if (r14 <= 0) goto L_0x009b;\n L_0x004b:\n r17 = r16 & 1;\n if (r17 == 0) goto L_0x0063;\n L_0x004f:\n r7 = r6 + -1;\n r17 = r20[r8];\n r4[r6] = r17;\n r9 = r8 + -1;\n r17 = r4[r7];\n r20[r8] = r17;\n r17 = r20[r9];\n if (r17 < 0) goto L_0x01a9;\n L_0x005f:\n r16 = r16 ^ 1;\n r8 = r9;\n r6 = r7;\n L_0x0063:\n r7 = r6 + -1;\n r17 = r20[r8];\n r4[r6] = r17;\n r0 = r21;\n if (r8 > r0) goto L_0x007f;\n L_0x006d:\n r20[r8] = r15;\n r6 = r7;\n L_0x0070:\n return;\n L_0x0071:\n r17 = r5 + -1;\n r17 = r20[r17];\n r12 = r19 + r17;\n goto L_0x0027;\n L_0x0078:\n r17 = r23 + -1;\n r17 = r4[r17];\n r13 = r19 + r17;\n goto L_0x0037;\n L_0x007f:\n r9 = r8 + -1;\n r17 = r4[r7];\n r20[r8] = r17;\n r17 = r20[r9];\n if (r17 >= 0) goto L_0x0094;\n L_0x0089:\n r16 = r16 | 1;\n r17 = r20[r9];\n r17 = r17 ^ -1;\n r12 = r19 + r17;\n r8 = r9;\n r6 = r7;\n goto L_0x0041;\n L_0x0094:\n r17 = r20[r9];\n r12 = r19 + r17;\n r8 = r9;\n r6 = r7;\n goto L_0x0041;\n L_0x009b:\n if (r14 >= 0) goto L_0x00fb;\n L_0x009d:\n r17 = r16 & 2;\n if (r17 == 0) goto L_0x00b5;\n L_0x00a1:\n r7 = r6 + -1;\n r17 = r4[r10];\n r4[r6] = r17;\n r11 = r10 + -1;\n r17 = r4[r7];\n r4[r10] = r17;\n r17 = r4[r11];\n if (r17 < 0) goto L_0x01a5;\n L_0x00b1:\n r16 = r16 ^ 2;\n r10 = r11;\n r6 = r7;\n L_0x00b5:\n r7 = r6 + -1;\n r17 = r4[r10];\n r4[r6] = r17;\n r11 = r10 + -1;\n r17 = r4[r7];\n r4[r10] = r17;\n r0 = r22;\n if (r11 >= r0) goto L_0x00e3;\n L_0x00c5:\n r9 = r8;\n L_0x00c6:\n r0 = r21;\n if (r0 >= r9) goto L_0x00d9;\n L_0x00ca:\n r6 = r7 + -1;\n r17 = r20[r9];\n r4[r7] = r17;\n r8 = r9 + -1;\n r17 = r4[r6];\n r20[r9] = r17;\n r9 = r8;\n r7 = r6;\n goto L_0x00c6;\n L_0x00d9:\n r17 = r20[r9];\n r4[r7] = r17;\n r20[r9] = r15;\n r10 = r11;\n r8 = r9;\n r6 = r7;\n goto L_0x0070;\n L_0x00e3:\n r17 = r4[r11];\n if (r17 >= 0) goto L_0x00f3;\n L_0x00e7:\n r16 = r16 | 2;\n r17 = r4[r11];\n r17 = r17 ^ -1;\n r13 = r19 + r17;\n r10 = r11;\n r6 = r7;\n goto L_0x0041;\n L_0x00f3:\n r17 = r4[r11];\n r13 = r19 + r17;\n r10 = r11;\n r6 = r7;\n goto L_0x0041;\n L_0x00fb:\n r17 = r16 & 1;\n if (r17 == 0) goto L_0x0113;\n L_0x00ff:\n r7 = r6 + -1;\n r17 = r20[r8];\n r4[r6] = r17;\n r9 = r8 + -1;\n r17 = r4[r7];\n r20[r8] = r17;\n r17 = r20[r9];\n if (r17 < 0) goto L_0x01a1;\n L_0x010f:\n r16 = r16 ^ 1;\n r8 = r9;\n r6 = r7;\n L_0x0113:\n r7 = r6 + -1;\n r17 = r20[r8];\n r17 = r17 ^ -1;\n r4[r6] = r17;\n r0 = r21;\n if (r8 > r0) goto L_0x0124;\n L_0x011f:\n r20[r8] = r15;\n r6 = r7;\n goto L_0x0070;\n L_0x0124:\n r9 = r8 + -1;\n r17 = r4[r7];\n r20[r8] = r17;\n r17 = r16 & 2;\n if (r17 == 0) goto L_0x019f;\n L_0x012e:\n r6 = r7;\n L_0x012f:\n r7 = r6 + -1;\n r17 = r4[r10];\n r4[r6] = r17;\n r11 = r10 + -1;\n r17 = r4[r7];\n r4[r10] = r17;\n r17 = r4[r11];\n if (r17 < 0) goto L_0x019c;\n L_0x013f:\n r16 = r16 ^ 2;\n r10 = r11;\n r6 = r7;\n L_0x0143:\n r7 = r6 + -1;\n r17 = r4[r10];\n r4[r6] = r17;\n r11 = r10 + -1;\n r17 = r4[r7];\n r4[r10] = r17;\n r0 = r22;\n if (r11 >= r0) goto L_0x0171;\n L_0x0153:\n r0 = r21;\n if (r0 >= r9) goto L_0x0166;\n L_0x0157:\n r6 = r7 + -1;\n r17 = r20[r9];\n r4[r7] = r17;\n r8 = r9 + -1;\n r17 = r4[r6];\n r20[r9] = r17;\n r9 = r8;\n r7 = r6;\n goto L_0x0153;\n L_0x0166:\n r17 = r20[r9];\n r4[r7] = r17;\n r20[r9] = r15;\n r10 = r11;\n r8 = r9;\n r6 = r7;\n goto L_0x0070;\n L_0x0171:\n r17 = r20[r9];\n if (r17 >= 0) goto L_0x018e;\n L_0x0175:\n r16 = r16 | 1;\n r17 = r20[r9];\n r17 = r17 ^ -1;\n r12 = r19 + r17;\n L_0x017d:\n r17 = r4[r11];\n if (r17 >= 0) goto L_0x0193;\n L_0x0181:\n r16 = r16 | 2;\n r17 = r4[r11];\n r17 = r17 ^ -1;\n r13 = r19 + r17;\n r10 = r11;\n r8 = r9;\n r6 = r7;\n goto L_0x0041;\n L_0x018e:\n r17 = r20[r9];\n r12 = r19 + r17;\n goto L_0x017d;\n L_0x0193:\n r17 = r4[r11];\n r13 = r19 + r17;\n r10 = r11;\n r8 = r9;\n r6 = r7;\n goto L_0x0041;\n L_0x019c:\n r10 = r11;\n r6 = r7;\n goto L_0x012f;\n L_0x019f:\n r6 = r7;\n goto L_0x0143;\n L_0x01a1:\n r8 = r9;\n r6 = r7;\n goto L_0x00ff;\n L_0x01a5:\n r10 = r11;\n r6 = r7;\n goto L_0x00a1;\n L_0x01a9:\n r8 = r9;\n r6 = r7;\n goto L_0x004f;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: io.netty.handler.codec.compression.Bzip2DivSufSort.ssMergeBackward(int, int[], int, int, int, int, int):void\");\n }", "public LoopKillAndroidModel(VolatileMethodSummary body, TypeSafeInstructionFactory insts,\n SSAValueManager paramManager, Iterable<? extends Entrypoint> entryPoints) {\n super(body, insts, paramManager, entryPoints);\n }", "public void setLoop(boolean loop) {\n\t\tthis.loop = loop;\n\t}", "void visitForLoopNode(ForLoopNode node);", "public void abortAnimation() {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e3 in method: android.widget.OppoScroller.abortAnimation():void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.widget.OppoScroller.abortAnimation():void\");\n }", "public void decrementLoopCounter() throws EndTaskException {\n\t\tgoToLoopCounter();\n\t\tpickBeeper();\n\t\tgoToBeeperStock();\n\t\tputBeeper();\n\t}", "private native void buildTemplate(long i, long j);", "public final void mT__82() throws RecognitionException {\r\n try {\r\n int _type = T__82;\r\n int _channel = DEFAULT_TOKEN_CHANNEL;\r\n // ../org.openmodelica.modelicaml.editor.xtext.modification.ui/src-gen/org/openmodelica/modelicaml/editor/xtext/modification/ui/contentassist/antlr/internal/InternalModification.g:79:7: ( 'loop' )\r\n // ../org.openmodelica.modelicaml.editor.xtext.modification.ui/src-gen/org/openmodelica/modelicaml/editor/xtext/modification/ui/contentassist/antlr/internal/InternalModification.g:79:9: 'loop'\r\n {\r\n match(\"loop\"); \r\n\r\n\r\n }\r\n\r\n state.type = _type;\r\n state.channel = _channel;\r\n }\r\n finally {\r\n }\r\n }", "@javax.annotation.Nullable\n /* renamed from: a */\n /* Code decompiled incorrectly, please refer to instructions dump. */\n private final com.google.android.gms.internal.ads.alc m16975a(@javax.annotation.Nullable android.content.Context r4, boolean r5, boolean r6) {\n /*\n r3 = this;\n com.google.android.gms.internal.ads.ark<java.lang.Boolean> r0 = com.google.android.gms.internal.ads.aru.f11765Q\n com.google.android.gms.internal.ads.ars r1 = com.google.android.gms.internal.ads.aoq.m14620f()\n java.lang.Object r0 = r1.mo14695a(r0)\n java.lang.Boolean r0 = (java.lang.Boolean) r0\n boolean r0 = r0.booleanValue()\n r1 = 0\n if (r0 != 0) goto L_0x0014\n return r1\n L_0x0014:\n boolean r0 = com.google.android.gms.common.util.C3563o.m12763b()\n if (r0 != 0) goto L_0x001b\n return r1\n L_0x001b:\n com.google.android.gms.internal.ads.ark<java.lang.Boolean> r0 = com.google.android.gms.internal.ads.aru.f11773Y\n com.google.android.gms.internal.ads.ars r2 = com.google.android.gms.internal.ads.aoq.m14620f()\n java.lang.Object r0 = r2.mo14695a(r0)\n java.lang.Boolean r0 = (java.lang.Boolean) r0\n boolean r0 = r0.booleanValue()\n if (r0 != 0) goto L_0x0040\n com.google.android.gms.internal.ads.ark<java.lang.Boolean> r0 = com.google.android.gms.internal.ads.aru.f11771W\n com.google.android.gms.internal.ads.ars r2 = com.google.android.gms.internal.ads.aoq.m14620f()\n java.lang.Object r0 = r2.mo14695a(r0)\n java.lang.Boolean r0 = (java.lang.Boolean) r0\n boolean r0 = r0.booleanValue()\n if (r0 != 0) goto L_0x0040\n return r1\n L_0x0040:\n if (r5 == 0) goto L_0x0045\n if (r6 == 0) goto L_0x0045\n return r1\n L_0x0045:\n java.lang.Object r5 = r3.f13322a\n monitor-enter(r5)\n android.os.Looper r6 = android.os.Looper.getMainLooper() // Catch:{ all -> 0x007f }\n if (r6 == 0) goto L_0x007d\n if (r4 != 0) goto L_0x0051\n goto L_0x007d\n L_0x0051:\n com.google.android.gms.internal.ads.akx r6 = r3.f13331j // Catch:{ all -> 0x007f }\n if (r6 != 0) goto L_0x005c\n com.google.android.gms.internal.ads.akx r6 = new com.google.android.gms.internal.ads.akx // Catch:{ all -> 0x007f }\n r6.<init>() // Catch:{ all -> 0x007f }\n r3.f13331j = r6 // Catch:{ all -> 0x007f }\n L_0x005c:\n com.google.android.gms.internal.ads.alc r6 = r3.f13330i // Catch:{ all -> 0x007f }\n if (r6 != 0) goto L_0x006f\n com.google.android.gms.internal.ads.alc r6 = new com.google.android.gms.internal.ads.alc // Catch:{ all -> 0x007f }\n com.google.android.gms.internal.ads.akx r0 = r3.f13331j // Catch:{ all -> 0x007f }\n com.google.android.gms.internal.ads.zzang r1 = r3.f13328g // Catch:{ all -> 0x007f }\n com.google.android.gms.internal.ads.ck r4 = com.google.android.gms.internal.ads.C3712cg.m16480a(r4, r1) // Catch:{ all -> 0x007f }\n r6.<init>(r0, r4) // Catch:{ all -> 0x007f }\n r3.f13330i = r6 // Catch:{ all -> 0x007f }\n L_0x006f:\n com.google.android.gms.internal.ads.alc r4 = r3.f13330i // Catch:{ all -> 0x007f }\n r4.mo14478a() // Catch:{ all -> 0x007f }\n java.lang.String r4 = \"start fetching content...\"\n com.google.android.gms.internal.ads.C3900je.m17433d(r4) // Catch:{ all -> 0x007f }\n com.google.android.gms.internal.ads.alc r4 = r3.f13330i // Catch:{ all -> 0x007f }\n monitor-exit(r5) // Catch:{ all -> 0x007f }\n return r4\n L_0x007d:\n monitor-exit(r5) // Catch:{ all -> 0x007f }\n return r1\n L_0x007f:\n r4 = move-exception\n monitor-exit(r5) // Catch:{ all -> 0x007f }\n throw r4\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.google.android.gms.internal.ads.C3883io.m16975a(android.content.Context, boolean, boolean):com.google.android.gms.internal.ads.alc\");\n }", "@Override\n public void unshift_native(ThreadContext tc) {\n if (start < 1) {\n int n = 8;\n int i;\n\n /* grow the array */\n int origElems = elems;\n set_size_internal(tc, elems + n);\n\n /* move elements and set start */\n memmove(slots, n, 0, origElems);\n start = n;\n elems = origElems;\n\n /* clear out beginning elements */\n for (i = 0; i < n; i++)\n slots[i] = 0.0;\n }\n\n /* Now do the unshift */\n start--;\n tc.native_type = ThreadContext.NATIVE_NUM;\n slots[start] = tc.native_n;\n elems++;\n }", "@Override\r\n\tpublic void multLocal(ShaderVar var) {\n\t}", "public static void main (String[]args) {\n for (int i = 10; i >= 1; i--) {\n System.out.println(i);\n }\n }", "public final void ruleLoop() throws RecognitionException {\n\n \t\tint stackSize = keepStackSize();\n \t\n try {\n // InternalMLRegression.g:616:2: ( ( ( rule__Loop__Group__0 ) ) )\n // InternalMLRegression.g:617:2: ( ( rule__Loop__Group__0 ) )\n {\n // InternalMLRegression.g:617:2: ( ( rule__Loop__Group__0 ) )\n // InternalMLRegression.g:618:3: ( rule__Loop__Group__0 )\n {\n before(grammarAccess.getLoopAccess().getGroup()); \n // InternalMLRegression.g:619:3: ( rule__Loop__Group__0 )\n // InternalMLRegression.g:619:4: rule__Loop__Group__0\n {\n pushFollow(FOLLOW_2);\n rule__Loop__Group__0();\n\n state._fsp--;\n\n\n }\n\n after(grammarAccess.getLoopAccess().getGroup()); \n\n }\n\n\n }\n\n }\n catch (RecognitionException re) {\n reportError(re);\n recover(input,re);\n }\n finally {\n\n \trestoreStackSize(stackSize);\n\n }\n return ;\n }", "public static void main(String[] args) {\n\t\tint num=10;\n\t\tSystem.out.println(trailzerofun(num));\n\n\t\t\n\t}", "public final void rule__Loop__Group__0__Impl() throws RecognitionException {\n\n \t\tint stackSize = keepStackSize();\n \t\n try {\n // InternalMLRegression.g:2179:1: ( ( 'loop' ) )\n // InternalMLRegression.g:2180:1: ( 'loop' )\n {\n // InternalMLRegression.g:2180:1: ( 'loop' )\n // InternalMLRegression.g:2181:2: 'loop'\n {\n before(grammarAccess.getLoopAccess().getLoopKeyword_0()); \n match(input,33,FOLLOW_2); \n after(grammarAccess.getLoopAccess().getLoopKeyword_0()); \n\n }\n\n\n }\n\n }\n catch (RecognitionException re) {\n reportError(re);\n recover(input,re);\n }\n finally {\n\n \trestoreStackSize(stackSize);\n\n }\n return ;\n }", "private static boolean forLoopParts_3_1_0(PsiBuilder b, int l) {\n if (!recursion_guard_(b, l, \"forLoopParts_3_1_0\")) return false;\n boolean r;\n Marker m = enter_section_(b);\n r = consumeToken(b, SEMICOLON);\n r = r && forLoopParts_3_1_0_1(b, l + 1);\n r = r && forLoopParts_3_1_0_2(b, l + 1);\n exit_section_(b, m, null, r);\n return r;\n }", "private void nocompressedUnPack()throws UnpackException,ZipEndException{\n skipByte();\n //get the len\n long LEN = 0x00;\n byte byte0 = getByte();\n byte byte1 = getByte();\n byte byte2 = getByte();\n byte byte3 = getByte();\n LEN |= byte1;\n LEN |= (byte0 << 8);\n LEN &= 0X0000ffff;\n// LEN |= (byte2<<24);\n// LEN |= (byte3<<16);\n int l = 0;\n try{\n for (long num = 0; num < LEN ; num ++){\n outputStoredByte(getByte());\n }\n }catch (IOException e){\n e.printStackTrace();\n }\n }", "public void emitImul() {\n\t\tlines.append(\"imul\\n\");\n\t}", "int ibclr (int ud);" ]
[ "0.5606103", "0.52594495", "0.51983297", "0.5153845", "0.5077572", "0.505675", "0.49199542", "0.47896683", "0.47611496", "0.47218588", "0.46893626", "0.46626496", "0.46617863", "0.45743474", "0.44910493", "0.4463295", "0.44499615", "0.4444467", "0.4403976", "0.43412364", "0.43285182", "0.43236908", "0.4307314", "0.4229492", "0.42045602", "0.4198989", "0.41946056", "0.41658837", "0.4154885", "0.41481492", "0.41074184", "0.4096664", "0.40889943", "0.40420324", "0.40372887", "0.40291986", "0.40196463", "0.40174755", "0.4016452", "0.40121523", "0.40079644", "0.399798", "0.39924762", "0.39920118", "0.39821833", "0.39788193", "0.39730337", "0.3972444", "0.3962176", "0.39534336", "0.3927022", "0.39165452", "0.39165452", "0.39164123", "0.39156863", "0.39149255", "0.3913879", "0.3913879", "0.39134786", "0.3911991", "0.39084673", "0.39075464", "0.38995242", "0.38874242", "0.38835582", "0.3876911", "0.38705617", "0.38702106", "0.38695237", "0.3866361", "0.38545263", "0.3845948", "0.38399807", "0.38271472", "0.38233548", "0.38209793", "0.38191643", "0.3818082", "0.37992826", "0.37708312", "0.37652898", "0.37519285", "0.37510318", "0.37490538", "0.37476867", "0.37468028", "0.37454855", "0.3740965", "0.3734853", "0.37281132", "0.37240735", "0.37199998", "0.37168458", "0.3712317", "0.37121934", "0.37051222", "0.37047914", "0.37008277", "0.36948538", "0.36902323" ]
0.5776365
0
/ Add integer n to the end of the list.
@Override public void add(int n) { values[size] = n; //add value to the list size++; //increment size if (size == values.length){ //if the list is full expand it resize(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void addAt(int n, int index) throws IndexOutOfBoundsException {\n\t\tif(checkIndex(index, size+1)) { //check if index is valid\n\t\t\tfor (int i=size; i>index; i--) {\n\t\t\t\tvalues[i] = values[i-1]; //move every value one step right until index\n\t\t\t}\n\t\t\tvalues[index] = n; //place the new value at index\n\t\t\tsize++; //increment size\n\t\t\tif (size == values.length) { //if the list is full expand it\n\t\t\t\tresize();\n\t\t\t}\t\t\t\n\t\t}else {\n\t\t\tthrow new IndexOutOfBoundsException(\"Highest index: \" + size);\n\t\t}\t\n\t}", "public void add(double n){\n list [index] = n;\n index ++;\n if (index==length){\n if(!hasFilled){\n hasFilled = true;\n }\n index=0;\n }\n }", "public void insertAtTail(int n){\n singlyListNode newNode = new singlyListNode(n, null);\n if (this.head == null){\n this.head = newNode;\n this.tail = this.head;\n }else{\n this.tail.setNextNode(newNode);\n this.tail = newNode;\n }\n this.listSize ++;\n }", "@Override\r\n\tpublic void AddItem(int n) {\n\t\tSystem.out.println(\"ADDED:\" + n);\r\n\r\n\t}", "public void add(E e) {\n if (n == list.length) { grow(); }\n list[n++] = e;\n }", "public void addNewItems(int n){\n\t\tint newindex = -1;\n\t\tfor (int i=0; i<5; ++i)\n\t\t\tfor (int index : indexSets.get(i).all())\n\t\t\t\tnewindex = Math.max(newindex, index);\n\t\tnewindex++;\n\t\tint added = 0;\n\t\tDate old = new Date(0);\n\t\twhile (newindex < AllCards.length() && (added < n || n == 0)){\n\t\t\t// Examine card here to decide if you want it\n\t\t\tCard c = AllCards.getCard(newindex);\n\t\t\tif (c.getEnglish().charAt(0) != '*'){\n\t\t\t\tindexSets.get(0).add(newindex);\n\t\t\t\ttimestamps.put(newindex, old);\n\t\t\t\tadded++;\n\t\t\t}\t\t\n\t\t\tnewindex++;\t\t\t\n\t\t}\n\t}", "public void addToCurrentNumberOfRegisterPushed(int n) {\n currentNumberOfRegisterPushed += n;\n if (currentNumberOfRegisterPushed > maxNumberOfRegisterPushed) {\n maxNumberOfRegisterPushed = currentNumberOfRegisterPushed;\n }\n }", "public void offer(int num){\n if(tail == fixedSize - 1) {\n List<Object> newList = new ArrayList<>();\n newList.add(num);\n //save next new list at tail\n tailList.add(newList);\n tailList = (List<Object>) tailList.get(tail);\n tail = 0;\n }else{ //not in last index,then directly add it;\n tailList.add(num);\n }\n count++;\n tail++;\n }", "public void add(int i, T t) {\n if (size == elements.length) // checks potential overflow\n ensureCapacity(); // increase capacity\n size++; // increment size of list\n if (i < 0 || i >= size) // if there is no index i in list\n throw new IndexOutOfBoundsException(\"Treated index: \" + i + \" | Size of the Dynamic Array \" + size()); // cause IndexOutOfBoundException\n for (int j = size - 1; j > i; j--) { // treat elements of list with indexes in range [i+1, n]\n elements[j] = elements[j - 1]; // element shifts to right\n }\n elements[i] = t; // store element at index i\n }", "public final void addLast(Node n) {\n this.tail.set(n);\n this.tail = n;\n this.size++;\n }", "public void grow(int n) {\r\n\t\t// implementation not shown\r\n\t}", "public void insertAtEnd(int val)\n {\n List nptr = new List(val, null, null); \n if(start == null)\n {\n start = nptr;\n end = start;\n }\n else\n {\n nptr.setListPrev(end);\n end.setListNext(nptr);\n end = nptr;\n }\n size++;\n }", "public void addAtTail(int val) {\n addAtIndex(size, val);\n }", "public void addAtTail(int val) {\n addAtIndex(size, val);\n }", "private static List<Integer> addOnePlus(List<Integer> input) {\n\n\t\tint size = input.size();\n\t\tinput.set(size-1, input.get(size-1)+1);//last element of input is updated/replaced by (original value + 1)\n\n\t\tfor(int i=size-1; i>0 && input.get(i)==10; i--) {\n\t\t\tinput.set(i, 0);\n\t\t\tinput.set(i-1, input.get(i-1)+1);\n\t\t}\n\n\t\tif(input.get(0) == 10) {\n\t\t\tinput.set(0, 0);\n\t\t\tinput.add(0, 1);//add 1 at index0 ,shift all elements after to right\n\t\t}\n\n\t\treturn input;//this modifies the original input\n\t}", "public void addBlockList(int n) {\n BlockList.add(n);\r\n }", "public void addToTail(int i)\r\n\t{\r\n\t\tNode add = new Node(i, null);\r\n\t\t\r\n\t\t// checks if the list is empty then adds value to tail.\r\n\t\tif(start == null)\r\n\t\t{\r\n\t\t\tstart = add;\r\n\t\t}\r\n\t\t\r\n\t\t// checks if the last value is null then adds value to tail.\r\n\t\tif(end == null)\r\n\t\t{\r\n\t\t\tend = add;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\t// if there are more values in SLL.\r\n\t\tend.next = add;\r\n\t\tend = add;\r\n\t}", "void add(int index, int value) {\n int[] newItems = new int[size++];\n\n System.arraycopy(items, 0, newItems, 0, index);\n\n newItems[index] = value;\n\n System.arraycopy(items, index, newItems, index + 1, items.length - index);\n\n items = newItems;\n }", "void add(int n);", "private void add( int n ) {\r\n Card card = cards.get( n );\r\n if ( !card.isFaceUp() ) {\r\n card.toggleFace();\r\n push( card );\r\n ++this.moveCount;\r\n }\r\n }", "public void addAtIndex(int index, int val) {\n if (index > size) return;\n //Add at head\n if (index <= 0) {\n addAtHead(val);\n }\n //Add at end\n else if (index == size) {\n addAtTail(val);\n } else {\n ListNode newNode = new ListNode(val);\n ListNode curr = head;\n //Add somewhere in between\n for (int i = 0; i < index - 1; i++) {\n curr = curr.next;\n }\n newNode.next = curr.next;\n curr.next = newNode;\n size++;\n }\n }", "public void addElement(Integer e){\n list.add(e);\n }", "public void add(int x)\n {\n int arrayLength = list.length; // get size of array\n if (length == arrayLength)\n {\n list = Arrays.copyOf(list, 100 + list.length);\n list[length] = x;\n length++;\n\n } else\n {\n list[length] = x;\n length++;\n }\n }", "public void add(int index, Object value) {\n if (index > _size) {\n throw new ListIndexOutOfBoundsException(\"Error\");\n }\n ListNode node = new ListNode(value);\n if (index == 0) {\n node.next = start;\n start = node;\n } else {\n ListNode prev = start;\n for (int i = 0; i<index - 1; i++ ) {\n prev = prev.next;\n }\n ListNode temp = prev.next;\n prev.next = node;\n node.next = temp;\n } \n _size++;\n }", "public void insert(int n) {\n\n // Fill in the blank here.\n\tif(!contains(n)){\n\t\telements[size] = n;\n\t\tsize++;\n\t}\n System.out.println(\"Inserting \" + n + \"...\");\n }", "public void add(Object o){\n if (n<sequence.length){\n// sequence[n]=o;\n// n++;\n sequence[n++]=o;\n }\n }", "public void addAtTail(int val) {\n addAtIndex(this.size, val);\n }", "public void add(int index, E e) {\n resize();\n for(int i = size-1; i >= index; i--) {\n list[i+1] = list[i];\n }\n list[index] = e;\n size++;\n }", "public void insert(int value){\n linkedList.insertLast(value);\n }", "@Override // com.google.android.gms.internal.firebase_ml.zzsq, java.util.List, java.util.AbstractList\n public final /* synthetic */ void add(int i, Long l) {\n zzk(i, l.longValue());\n }", "public void add(NestedInteger ni) {\n this.list.add(ni);\n }", "public void push(int n) {\n\n if (size() == values.length) {\n resize();\n }\n\n for (int i = 0; i < size() + 1; i++) {\n //System.out.println(i + \" out of \" + this.size + \" v: \" + this.values[i]);\n if (this.values[i] == 0) {\n //System.out.println(this.values[i] + \" = empty space found, adding\");\n this.values[size()] = n;\n break;\n }\n }\n this.size++;\n\n }", "public void insertAtHead(int n){\n singlyListNode newNode = new singlyListNode(n, null);\n if (this.head == null){\n this.head = newNode;\n this.tail = this.head;\n }else{\n newNode.setNextNode(this.head);\n this.head = newNode;\n }\n this.listSize ++;\n }", "public void increment(double n) {\r\n\t\tthis.value += n;\r\n\t}", "public void listLastNumber(List<Integer> list, int number) {\n list.add(0, number);\n System.out.println(list);\n }", "public void add(int number) {\n for(int num : list) set.add(num + number);\n list.add(number);\n }", "void add(int value) {\n size++;\n\n int[] newItems = new int[size];\n\n System.arraycopy(items, 0, newItems, 0, items.length);\n\n newItems[newItems.length - 1] = value;\n\n items = newItems;\n }", "public void addValue(List<Integer> list, int number) {\n list.add(number);\n System.out.println(list);\n }", "public void addValue(int i) {\n value = value + i;\n }", "public void addNumber(int number) {\n totalNumber += number;\n availableNumber += number;\n }", "@Override\n public void add(int index, E value) {\n this.rangeCheck(index);\n if (this.values.length == this.index) {\n this.grow();\n }\n this.modCount++;\n System.arraycopy(this.values, index, this.values, index + 1, this.size() - index);\n this.values[index] = value;\n this.index++;\n }", "public void add(NestedInteger ni) {\n\t\tif (this.list == null) {\n\t\t\tthis.list = new ArrayList<>();\n\t\t}\n\t\tthis.list.add(ni);\n\t}", "public void add(DJNode n) {\n\t\tif (next == heap.length) {\n\t\t\tresize();\n\t\t}\n\n\t\theap[next] = n;\n\t\tfloatNode();\n\t\tnext++;\n\t}", "public void add(int data) { // Big O -> O(1)\n\n\t\tNode temp = new Node(data);\n\t\tif(tail != null) { // if there is a tail, it adds after the tail.\n\t\t\ttail.next = temp;\n\t\t\ttemp.prev = tail;\n\t\t\t}\n\t\ttail = temp; // the added node is the new tail, regardless of \n\t\t\t\t\t//whether the list was empty or not\n\t\tif(head == null) { // if there is no head, the new node is the new head as well\n\t\t\thead = temp;\n\t\t\t}\n\t\tsize++; \n\t}", "public void add(int element);", "public void addCount(ArrayList<Character> sequence, int n) {\n \tString s = Integer.toString(n);\n \tfor(int i = 0; i < s.length(); i++) {\n \t\tsequence.add(s.charAt(i));\n \t}\n \treturn;\n }", "public void add(int num) {\n // if the array is not large enough, an array of twice\n // the capacity is created\n if (count + 1 > list.length) {\n int[] temp = new int[list.length * 2];\n for (int i = 0; i < list.length; i++) {\n temp[i] = list[i];\n }\n list = temp;\n temp = null;\n }\n \n // add the element to the array and increment the count\n list[count++] = num;\n }", "void append(int value) {\n\t\tNode n = new Node(value);\n\t\tif (length == 0) {\n\t\t\thead = n;\n\t\t\ttail = n;\n\t\t} else {\n\t\t\ttail.next = n;\n\t\t\ttail = n;\n\t\t}\n\t\tlength++;\n\t\t//print();\n\t}", "public void addLast(Item item){\r\n\t\tif (item == null) throw new NullPointerException();\r\n\t\tif (n == list.length){resize(2*list.length);}\r\n\t\tif(isEmpty()){prior=list.length-1;first=0;last=0;latter=0;}\r\n\t\tlist[latter++]=item;\r\n\t\t last=latter-1;\r\n\t\t if(latter==list.length){latter=0;}\r\n\t\t n++;}", "public void addVertices(int n);", "public void addAtIndex(int index, int val) {\n if(index>size || index<0)\n return;\n ListNode ptr=new ListNode(val);\n ListNode p=head,follow=head;\n int count=0;\n while (p!=null && count!=index){\n count++;\n follow=p;\n p=p.next;\n }\n if(p==head) {\n if(p == null) {\n head = ptr;\n tail=ptr;\n }\n else {\n ptr.next = head;\n head = ptr;\n }\n size++;\n }\n else if(p==tail){\n ptr.next=p;\n follow.next=ptr;\n size++;\n }\n else if(p==null){\n follow.next=ptr;\n tail=ptr;\n size++;\n }\n else {\n ptr.next = p;\n follow.next = ptr;\n size++;\n }\n }", "public void add(Node n){\n Node after = head.next;\n head.next = n;\n n.next = after;\n n.prev = head;\n after.prev = n;\n return;\n }", "public void append(int data) {\r\n ListNode temp = head;\r\n while(temp.next !=null) {\r\n temp = temp.next;\r\n }\r\n ListNode new_node = new ListNode(data);\r\n temp.next=new_node;\r\n }", "public void addAtIndex(int index, int val) {\n if (index < 0 || index > size) {\n return;\n }\n Node prev = dummyHead;\n for (int i = 0; i < index; i++) {\n prev = prev.next;\n }\n prev.next = new Node(val, prev.next);\n size++;\n }", "public void add()\n {\n set(++ current);\n }", "public void add(int v) {\n if (empty) {\n x = v;\n empty = false;\n }\n else {\n if (next == null) {\n next = new Lista(v);\n }\n else {\n Lista iter = new Lista(this);\n while (iter.next != null) {\n iter = iter.next;\n }\n iter.next = new Lista(v);\n } \n }\n }", "private void addNodeAtTheEnd(int data) {\n ListNode newNode = new ListNode(data);\n if (head == null) {\n head = newNode;\n return;\n }\n ListNode current = head;\n while (current.next != null) {\n current = current.next;\n }\n current.next = newNode;\n }", "@Override\n public void add(int index, int element) {\n Entry newElement = new Entry(element);\n Entry tmp = getEntry(index);\n newElement.next = tmp;\n newElement.previous = tmp.previous;\n tmp.previous.next = newElement;\n tmp.previous = newElement;\n size++;\n }", "public void add(E s,int index) {\t//O(n)\r\n\t\t//checks if the index is valid\r\n\t\tif(index>=0 && index<=size) {\t//index is valid\r\n\t\t\t//checks if there is any space left in the array\r\n\t\t\tif(size>=capacity)\r\n\t\t\t\tresize(this.capacity*2);\t//increases size of the array\r\n\t\t\tfor (int k=size-1; k>=index;k--) {\t//shifting element\r\n\t\t\t\tlist[k+1]=list[k];\r\n\t\t\t}\r\n\t\t\tlist[index]=s;\t//add element to the index\r\n\t\t\tsize++;\t//increases size\r\n\t\t} else {\t//index is not valid\r\n\t\t\tSystem.out.println(\"index \"+index+\" is out or range!\");\r\n\t\t}\r\n\t}", "final void add(int elt) {\n if (contents == null)\n return;\n if (n == contents.length) {\n int[] new_contents = new int[2*n+1];\n //@ assert n < new_contents.length;\n arraycopy(contents, 0, new_contents, 0, n);\n contents = new_contents;\n }\n if (n < 0 || n >= contents.length) \n return;\n contents[n]=elt;\n n++;\n }", "public void addAtTail(int val) {\n ListNode curr = new ListNode(val);\n size++;\n if (size == 0) {\n head = curr;\n tail = curr;\n }\n tail.next = curr;\n tail = curr;\n }", "public TempList(int n, T elem) {\n list = new ArrayList<T>(n > 0 ? n : 0);\n while (n > 0) {\n list.add(elem);\n n--;\n }\n }", "public void addAtIndex(int idx, Node node) {\n if (!checkIndexBounds(idx)) {\n return;\n }\n\n Node pre = getNodeBeforeIndex(idx);\n Node curr = pre.next;\n pre.next = node;\n node.next = curr;\n this.length++;\n }", "public void add(int kn) {\n\t\tif(this.size > this.N-1) {\n\t\t\tsetNDouble(N);\n\t\t}\n//\t\tSystem.out.println(this.n + \" \" + this.size);\n\t\tarray[this.size] = kn;\n\t\tthis.size++;\n\t}", "@Override\n public void addLast(Item i) {\n resize();\n items[nextLast] = i;\n size += 1;\n nextLast = moveForward(nextLast, 1);\n }", "public void insertAtTrail(singlyListNode n){\n if (this.head == null){\n this.head = n;\n this.tail = this.head;\n }else{\n this.tail.setNextNode(n);\n this.tail = n;\n }\n this.listSize ++;\n }", "void addAll(intList list, int index) throws IllegalAccessException;", "public void append(Integer data) {\n\t\t// Construct a node tmp and make null as the next pointer:Step1\n\t\tListNode tmp = new ListNode(data, null);\n\n\t\tif (!isEmpty()) {\n\t\t\t// make next pointer of tail as tmp :Step2\n\t\t\t tail.next = tmp;// tmp is new tail\n\t\t\t\n\t\t} else {\n\t\t\t// but if list is empty then the temp is the only element \n\t\t\t//and is new tail as wells as head[see next statement executed]\t\n\t\t\tthis.head = tmp;\n\t\t}\n\t\tthis.tail = tmp; // now make tmp the new tail:Step2\n\t\n\t\tlength++;\n\t}", "public void add(int index, int value) {\n\t\t\tif(index < 0 || index > size) {\n\t\t\t\tthrow new IndexOutOfBoundsException(\"index\" + index);\n\t\t\t}\n\t\t\tensureCapacity(size + 1);\n\t\t\tfor(int i = size; i > index; i--) {\n\t\t\t\telementData[size] = elementData[i - 1];\n\t\t\t}\n\t\t\telementData[index] = value;\n\t\t\tsize++;\n\t\t}", "public void addAtTail(int val) {\n ListNode ptr=new ListNode(val);\n if(tail==null)\n head = ptr;\n else\n tail.next = ptr;\n tail = ptr;\n size++;\n // display();\n }", "public void add(int number) {\n numbers.put(number, numbers.getOrDefault(number, 0)+1);\n }", "private void addToPT(int n, String x) {\n\t\twhile (pT.size() < n + 1)\n\t\t\tpT.add(new ArrayList<String>());\n\t\tpT.get(n).add(x);\n\t}", "public void add(int i, int k) {\n for (int m = i + 1; m <= count; m++) {\n values[m] = values[m-1];\n }\n values[i] = k;\n count++;\n }", "private static List<Integer> addOne(List<Integer> input) {\n\n\t\tList<Integer> copy = new ArrayList<>();\n\t\tcopy.addAll(input);\n\n\t\tint size = copy.size();\n\t\tcopy.set(size-1, input.get(size-1)+1);//last element of input is updated/replaced by (original value + 1)\n\n\t\tfor(int i=size-1; i>0 && copy.get(i)==10; i--) {\n\t\t\tcopy.set(i, 0);\n\t\t\tcopy.set(i-1, copy.get(i-1)+1);\n\t\t}\n\n\t\tif(copy.get(0) == 10) {\n\t\t\tcopy.set(0, 0);\n\t\t\tcopy.add(0, 1);//add 1 at index0 ,shift all elements after to right\n\t\t}\n\n\t\treturn copy;//this NOT modifies the original input\n\t}", "public void add(final T data, final int index) {\n if (index < 0 || index > numElement + 1) {\n throw new IndexOutOfBoundsException();\n }\n Node<T> newNode = new Node<>(data);\n if (index == 0) {\n prepend(data);\n } else if (index == numElement) {\n append(data);\n }\n Node<T> iterator = head;\n for (int currentIndex = 0; currentIndex < index - 1; currentIndex++) {\n iterator = iterator.getNext();\n }\n newNode.setNext(iterator.getNext());\n iterator.setNext(newNode);\n numElement++;\n }", "public synchronized void addLast(DoubleLinkedListNodeInt node) {\n\t\tnode.setNext(tail);\n\t\tnode.setPrev(tail.getPrev());\n\t\tnode.getPrev().setNext(node);\n\t\ttail.setPrev(node);\n\t\tnode.setOwnerList(this);\n\t\tsize++;\n\t}", "public void addLast(Item x);", "public void add(T element, int index) {\n int counter = 0;\n Node<T> newNode = new Node(element);\n Node<T> current = itsFirstNode;\n\t\tif (current == null) {\n\t\t\tthrow new NoSuchElementException(\"Beyond size of list or list empty\");\n\t\t}\n\t\twhile (current.getNextNode() != null ) {\n\t\t\tif ((counter == index - 1) || (index == 0)) {\n\t\t\t\tbreak;\n\t\t\t}\t\n\t\t\tcurrent = current.getNextNode();\n\t\t\tcounter++;\n\t\t}\n\t\ttry {\n\t\t\tif (index == 0) {\n\t\t\t\taddAsFirst(newNode);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnewNode.setNextNode(current.getNextNode());\n\t\t\t\t(newNode.getNextNode()).setPriorNode(newNode);\n\t\t\t\tcurrent.setNextNode(newNode);\n\t\t\t\tnewNode.setPriorNode(current);\n\t\t\t}\n\t\t}\n\t\tcatch (NullPointerException e) {\n\t\t\t// NullPointer is fine\n\t\t}\n size++;\n }", "@Override\n public void add(int index, T t) {\n checkIfArrayFull();\n\n if(index >= arrayList.length) {\n System.out.println(\"The index is out of bounds for this list\");\n System.exit(-1);\n }\n\n Object ob = arrayList[index];\n arrayList[index] = t;\n\n Object ob2;\n\n /*The loop cycles through the array starting at index. ob2 is given the value of arrayList at i+1 position.\n The arrayList at i+1 position is assigned the value of ob. Then the ob variable is assigned the value of ob2. */\n for(int i = index; i < arrayList.length - 1; i++) {\n ob2 = arrayList[i+1];\n arrayList[i+1] = ob;\n ob = ob2;\n }\n\n elementsInArray++;\n }", "public void add(int value) {\n\t \tensureCapacity(size+ 1);\n\t \telementData[size] = value;\n\t \tsize++;\n\t }", "public void add(T data, int index) {\n\t\tif (index < 0 || index > this.size) {\n\t\t\tthrow new ArrayIndexOutOfBoundsException();\n\t\t} else if (index == size) {\n\t\t\tthis.add(data);\n\t\t} else if (index == 0) {\n\t\t\tthis.addFirst(data);\n\t\t} else {\n\t\t\tListNode<T> previousElement = goToIndex(index - 1);\n\t\t\tListNode<T> currentElement = goToIndex(index);\n\t\t\tListNode<T> newElement = new ListNode<T>(data, currentElement);\n\t\t\tpreviousElement.setNext(newElement);\n\t\t\tthis.size++;\n\t\t}\n\t}", "public void add(int item) {\r\n if (!contains(item)) {\r\n items[NumItems++] = item;\r\n } else if (NumItems == MAX_LIST) {\r\n throw new ListFullException(\"List is full\");\r\n }\r\n }", "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 add(int data) {\n\t\t// Its a first element\n\t\tif (head == null && tail == null) {\n\t\t\tNode newNode = getNewNode(data);\n\t\t\thead = tail = newNode;\n\t\t\treturn;\n\t\t}\n\t\t// This will add to the end of list with time complexity -O(1)\n\t\tNode newNode = getNewNode(data);\n\t\ttail.next = newNode;\n\t\tnewNode.prev = tail;\n\t\ttail = newNode;\n\t}", "public void add(NestedInteger ni);", "private void addNodeAtIndex(int data, int index) {\n ListNode newNode = new ListNode(data);\n if (head == null) {\n head = newNode;\n return;\n }\n int count = 0;\n ListNode current = head;\n while (count < index - 1) {\n count++;\n current = current.next;\n }\n newNode.next = current.next;\n current.next = newNode;\n }", "@Override\n public void add(int i, Node<T> e)\n {\n if(i > size + 1) return; //to add node at the end of list use i = size + 1\n if(lastNode == null) //initialize lastNode\n {\n lastNode = e;\n updateFirstNode();\n size++;\n }\n \n //Adding node at the start\n else if(i <= 1)\n {\n if(lastNode.getNext() == null) // only 1 element in list\n e.setNext(lastNode); \n else \n e.setNext(lastNode.getNext());\n \n lastNode.setNext(e);\n updateFirstNode();\n size++; \n }\n \n //Adding node at the end or somewhere in the middle\n else\n {\n if(lastNode.getNext() == null && i == size + 1)\n {\n e.setNext(lastNode);\n lastNode.setNext(e);\n }\n \n //Iterates to i position and add node\n //if i position is last node then set node as new last node\n else\n {\n NodeIterator<T> iterator = new NodeIterator<>(firstNode, (i == size + 1)? i - 1 : i, 1);\n Node prev = iterator.getEnd();\n Node temp = prev.getNext();\n\n e.setNext(temp);\n prev.setNext(e);\n }\n \n //If adding node as last node\n if(i == size + 1) lastNode = e;\n updateFirstNode();\n size++;\n }\n }", "public void addAtIndex(int index, int val) {\n if (index > this.size) {\n return;\n }\n\n if (index < 0) {\n index = 0;\n }\n\n ListNode pred = this.head;\n\n for (int i = 0; i < index; ++i) {\n pred = pred.next;\n }\n\n ListNode node = new ListNode(val);\n node.next = pred.next;\n pred.next = node;\n\n this.size++;\n }", "public void append(int data){\n\t\tif (this.head == null)\n\t\t\tthis.head = new Node(data);\n\t\telse {\n\t\t\tNode current = this.head;\n\t\t\twhile (current.next != null){\n\t\t\t\tcurrent = current.next;\n\t\t\t}\n\t\t\tcurrent.next = new Node(data);\n\t\t}\n\t}", "void add(int idx, float incr);", "public void add(int index, T data) {\n\t\tif(index > size() || index < 0) {\n\t\t\tthrow new IndexOutOfBoundsException(\"Illegal index: \" + index);\n\t\t}\n\t\t\n\t\tLinkedListNode<T> temp = head.getNext();\n\t\tint i = 0;\n\t\twhile(true) {\n\t\t\tif(temp == null) {\n\t\t\t\tthrow new InternalError(\"add(int index, T data) iterates past the end\");\n\t\t\t}\n\t\t\tif(index == i) {\n\t\t\t\tLinkedListNode<T> toAdd = new LinkedListNode<T>(temp, temp.getPrevious(), data);\n\t\t\t\ttemp.getPrevious().setNext(toAdd);\n\t\t\t\ttemp.setPrevious(toAdd);\n\t\t\t\tmodcount++;\n\t\t\t\tnodeCount++;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ti++;\n\t\t\ttemp = temp.getNext();\n\t\t}\n\t}", "public void addAtIndex(int index, int data)\n {\n Node newNode = new Node(data);\n Node oldNode = head;\n\n for (int i=1;i<size;i++)\n {\n if (i == index)\n {\n Node myNode = oldNode.next;\n oldNode.next = newNode;\n newNode.next = myNode;\n break;\n }\n oldNode = oldNode.next;\n }\n size++ ;\n }", "public int addOrderedList(int number) {\n\t\tint index;\n\n\t\tif (olist.traverse(number) == 1) {\n\t\t\tindex = olist.returnPos(number);\n\t\t\tSystem.out.println(\"number will be added at\" + index);\n\n\t\t\tolist.insertAt(number, index);\n\n\t\t\tcount++;\n\n\t\t} else if (olist.traverse(number) == 0) {\n\t\t\tolist.deleteElement(number);\n\t\t\tcount--;\n\n\t\t}\n\n\t\treturn count;\n\n\t}", "public void addLast(int data) //O(n)\n\t{\n\t\tSinglyLinkedListNode currentNode = head;\n\t\tif(head == null)\n\t\t{\n\t\t\taddFront(data);\n\t\t}\n\t\telse\n\t\t{\n\t\t\twhile(true)\n\t\t\t{\n\t\t\t\tif(currentNode.getNext() != null)\n\t\t\t\t{\n\t\t\t\t\tcurrentNode = currentNode.getNext();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tSinglyLinkedListNode newNode = new SinglyLinkedListNode();\n\t\t\t\t\tcurrentNode.setNext(newNode);\n\t\t\t\t\tnewNode.setData(data);\n\t\t\t\t\tnewNode.setNext(null);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "int addElement(int list, int data) {\n\t\treturn insertElement(list, -1, data);\n\t}", "public ListNode removeNthFromEnd(ListNode list, int n)\r\n {\r\n ListNode head = new ListNode();\r\n head.next = list;\r\n ListNode prev = head;\r\n ListNode after = head;\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (after.next == null && i < n)\r\n {\r\n return head.next;\r\n }\r\n after = after.next;\r\n }\r\n while (after.next != null)\r\n {\r\n prev = prev.next;\r\n after = after.next;\r\n }\r\n prev.next = prev.next.next;\r\n return head.next;\r\n }", "public void addAfter(E val, int idx) throws IndexOutOfBoundsException {\n addNodeAfter(new SinglyLinkedList.Node<>(val), idx);\n }", "public void addAtIndex(int index, int val) {\n if (index < 0 || index > size) return;\n\n Node node = head;\n\n for (int i = 0; i < index; i++) {\n node = node.next;\n }\n\n Node newNode = new Node(val);\n newNode.next = node.next;\n newNode.next.prev = newNode;\n node.next = newNode;\n newNode.prev = node;\n size++;\n }", "public void add(int i) {\n\t\t\tthis.val =i;\n\t\t\t\n\t\t}", "public void add(int value) {\n m_value += value;\n }" ]
[ "0.7470894", "0.7011506", "0.6771368", "0.67385787", "0.666767", "0.6576538", "0.65513873", "0.6516539", "0.6422277", "0.6408514", "0.6356899", "0.63500315", "0.6300876", "0.6300876", "0.6292585", "0.62853754", "0.62828183", "0.6274899", "0.6273893", "0.62552536", "0.6205434", "0.61853844", "0.61785865", "0.6164938", "0.6154807", "0.6149313", "0.61345017", "0.6084529", "0.6061607", "0.60454214", "0.6030452", "0.60243315", "0.6014838", "0.6003782", "0.59974235", "0.5995128", "0.5993614", "0.5993268", "0.59915006", "0.5990791", "0.59678775", "0.59351057", "0.5924906", "0.5914519", "0.59100866", "0.59095424", "0.58973366", "0.58864", "0.5884726", "0.5882521", "0.58733267", "0.58713573", "0.58564407", "0.5848096", "0.5841728", "0.58364815", "0.5833826", "0.5832782", "0.58296806", "0.58237183", "0.5822412", "0.58188933", "0.58159953", "0.58150506", "0.58101285", "0.58079255", "0.5801284", "0.58006084", "0.5797047", "0.57963556", "0.5792621", "0.5776612", "0.5769418", "0.5764729", "0.5760437", "0.57589686", "0.57491034", "0.57422686", "0.5737997", "0.5731709", "0.57309973", "0.5725816", "0.5723482", "0.572295", "0.57209474", "0.57138574", "0.5708877", "0.5707139", "0.5702685", "0.5701219", "0.5700296", "0.56943506", "0.56929964", "0.5691874", "0.5687663", "0.56851274", "0.5674968", "0.566234", "0.56613463", "0.5660101" ]
0.77114564
0
/ Inserts integer n at position index. Shifts the element currently at that position (if any) and any subsequent elements to the right.
@Override public void addAt(int n, int index) throws IndexOutOfBoundsException { if(checkIndex(index, size+1)) { //check if index is valid for (int i=size; i>index; i--) { values[i] = values[i-1]; //move every value one step right until index } values[index] = n; //place the new value at index size++; //increment size if (size == values.length) { //if the list is full expand it resize(); } }else { throw new IndexOutOfBoundsException("Highest index: " + size); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void insert(int index, T element);", "public void insert(int n) {\n\n // Fill in the blank here.\n\tif(!contains(n)){\n\t\telements[size] = n;\n\t\tsize++;\n\t}\n System.out.println(\"Inserting \" + n + \"...\");\n }", "void insert(int idx, int val);", "public void insert(int index, T value) {\n extend();\n for (int i = this.list.length-1; i >index; i--) {\n this.list[i] = this.list[i-1];\n }\n this.list[index] = value;\n this.size++;\n }", "public void insert(int n) {\n\n\t\tif (pos == size)\n\t\t\tresize();\n\n\t\theap[pos] = n;\n\t\tpos++;\n\t\tcurrentSize++;\n\n\t\tint child = pos - 1;\n\t\tint parent = child / 2;\n\n\t\twhile (heap[parent] < heap[child] && parent > 0) {\n\t\t\tint temp = heap[parent];\n\t\t\theap[parent] = heap[child];\n\t\t\theap[child] = temp;\n\n\t\t\tchild = parent;\n\t\t\tparent = child / 2;\n\t\t}\n\n\t}", "public void insertAtIndex(E toInsert, int atIndex) {\n\t\tfor(int x = numElements; x > atIndex; x--) {\n\t\t\telements[x] = elements[x-1];\n\t\t}\n\t\telements[atIndex] = toInsert;\n\t\tnumElements++;\n\t\tresize();\n\t}", "public void insert(int n) {\n if (size == capacity) {\n Integer[] grow = new Integer[capacity *= 2];\n System.arraycopy(heap, 0, grow, 0, heap.length);\n heap = grow;\n }\n\n // Insert new element\n heap[size] = n;\n\n // Move element to correct spot\n int currPos = size++, parentPos;\n while (heap[currPos] > heap[parentPos = getParentIdx(currPos)]) {\n swap(currPos, parentPos);\n currPos = parentPos;\n }\n }", "public void insertElementAt(Object obj, int index);", "public void insertByRightShift(Object elem, int pos) {\r\n if (pos > 0 || pos < size) {\r\n if (size == cir.length) {\r\n resizeStartUnchanged(cir.length + 3);\r\n }\r\n int nshift = size - pos;\r\n int from = ((start + size) - 1) % cir.length;\r\n int to = (from + 1) % cir.length;\r\n for (int i = 0; i < nshift; i++) {\r\n cir[to % cir.length] = cir[from % cir.length];\r\n to = from;\r\n from--;\r\n if (from < 0) {\r\n from = cir.length - 1;\r\n }\r\n }\r\n cir[(start + pos) % cir.length] = elem;\r\n // System.out.println(size);\r\n size++;\r\n }\r\n }", "public void insert(int index, int data) {\n\n // double the Vector if it's full\n if (isFull())\n doubleSize();\n\n // Exception: index out of range\n if (index > dataSize)\n throw new IllegalStateException();\n\n // Move items 1 step forward\n if (index != dataSize)\n moveRight(index);\n\n // Place the item at the specified position\n array[index] = data;\n dataSize++;\n }", "public void insert(int val)\n {\n try\n {\n a[index++] = val;\n n=index;\n }\n catch(Exception e)\n {\n System.out.println(�e.getMessage�);\n }\n }", "public void insert(int index, int value) {\n\t\tSystem.out.println(\"Top here is : \" + top);\n\t\tif (index < top && index > -1) {\n\t\t\tint tmp = top;\n\t\t\twhile (tmp != index - 1) {\n\t\t\t\tarr[tmp + 1] = arr[tmp];\n\t\t\t\ttmp--;\n\n\t\t\t}\n\t\t\ttop++;\n\t\t\tarr[index] = value;\n\t\t}else{\n\t\t\tinsert(value);\n\t\t}\n\n\t}", "public void insert(int i) {\n\t\tif (top > -2 && top < size - 1) {\n\t\t\ttop += 1;\n\t\t\tarr[top] = i;\n\t\t} else if (top == size - 1) {\n\t\t\tsize *= 2;\n\t\t\ttop += 1;\n\t\t\tarr = Arrays.copyOf(arr, size);\n\t\t\tarr[top] = i;\n\t\t}\n\t}", "public void insert(int index,int value)\n {\n System.out.println(\"data size\"+data.length);\n if(size==initialCapacity){\n resize();\n }\n \n \n \n for(int j=size-1;j>=index;j--){\n //j initial position is last element\n // j needs to move till\n //start from last element and change to next position\n \n data[j+1]=data[j]; \n }\n// // Copy up\n// for (int j = size; j > index; j--) {\n// data[j] = data[j-1];\n// }\n data[index]=value;\n size++;\n }", "public void insertByRightShift(Object elem, int pos){\n if(size==cir.length){\n resizeStartUnchanged(cir.length+3);\n }\n int nshift=size-pos;\n int from=(start+size-1)%cir.length;\n int to=(from+1)%cir.length;\n for(int i=0;i<nshift;i++){\n cir[to]=cir[from];\n to=from;\n from--;\n if(from==-1){\n from=cir.length-1;\n }\n }\n int index=(start+pos)%cir.length;\n cir[index]=elem;\n size++;\n }", "public void insert( int x) \r\n {\r\n h[++N] = x;\r\n siftUp( N);\r\n }", "private void insert(int pos, T elem) {\n for (int i = size; i >= pos + 1; i--) {\n arr[i] = arr[i-1];\n }\n arr[pos] = elem;\n }", "public void insertElementAt(Replicated obj, int index)\r\n\t{\n\t\tinsert(obj, index);\r\n\t}", "public void shiftUp(int index) {\n\t\tint value = elements[index];\n\t\twhile (index != 0) {\n\t\t\tint parent = (index - 1) >>> 1;\n\t\t\tint parentValue = elements[parent];\n\t\t\tif (comparator.compare(parentValue, value) <= 0) {\n\t\t\t\telements[index] = value;\n\t\t\t\tat[value] = index;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telements[index] = parentValue;\n\t\t\tat[parentValue] = index;\n\t\t\tindex = parent;\n\t\t}\n\t\telements[0] = value;\n\t\tat[value] = 0;\n\t}", "void insert(int index, T value) throws ListException;", "private void insertValue(int index, int value) {\n\n\t\tfor (int i = this.array.length - 1; i > index; i--) {\n\t\t\tthis.array[i] = this.array[i - 1];\n\t\t}\n\n\t\tthis.array[index] = value;\n\t\tcount++;\n\t\tSystem.out.println(\"이동 횟수는 : \" + (count - (index + 1)));\n\t\tthis.showArray();\n\n\t}", "@Override\r\n public void insert(int index, Copiable value) throws IndexRangeException {\r\n if (index >= 0 && index <= count) {\r\n if (list.length == count) {\r\n Copiable[] list2 = new Copiable[2 * list.length];\r\n for (int k = 0; k < list.length; k++) {\r\n list2[k] = list[k];\r\n }\r\n list = list2;\r\n }\r\n for (int i = count; i > index; i--) {\r\n list[i] = list[i - 1];\r\n }\r\n list[index] = value;\r\n count++;\r\n } else {\r\n throw new IndexRangeException(0, count, index);\r\n }\r\n }", "void insert(T value, int position);", "public void insert(Item item, int i){\n assert (count+1<=capacity);\n\n assert (i+1>=1&&i+1<=capacity);\n\n i+=1;\n\n data[i] = item;\n count++;\n\n indexes[count] = i;\n rev[i] = count;\n\n shiftUp(count);\n }", "public void insertRight( long j ) {\n if ( end == max - 1 ) {\n end = -1;\n }\n Array[++end] = j;\n nItems++;\n }", "public void add(int index, E x) {\n\t\tif (index < 0 || index > mSize) // == mSize allowed\n\t\t\tthrow new IndexOutOfBoundsException();\n\n\t\tif (size() == 0)\n\t\t\taddFirst(x);\n\t\telse {\n\t\t\taddBefore(getNode(index, 0, size()), x);\n\t\t\tmSize++;\n\t\t\tmodCount++;\n\t\t}\n\t}", "private static void insert(int[] array, int rightIndex, int value) {\n int index = 0;\n for (index = rightIndex; index >= 0 && value < array[index]; index--) {\n array[index + 1] = array[index];\n }\n array[index + 1] = value;\n }", "public void insert(int n)\n {\n if (this._size == 0){\n this._leader = n;\n }\n \n if (this.contains(n)){\n System.out.println(\"Cluster \");\n System.out.println(this._elems);\n System.out.println(\"already contains element \" + n);\n throw new IllegalArgumentException(\"Element is already present!\");\n }\n \n this._elems.add(n);\n this._size++;\n }", "private int increment(int index) {\n\t\treturn (++index < this.capacity) ? index : 0;\n\t}", "public void insertNodeToTheGivenIndex(int index, int data){\n int size = size(); // for performance improvement!\n\n //Index validation\n checkIndex(index);\n\n if(index==0){\n addNodeToTheStart(data);\n }else if(index==size){\n addNodeToTheEnd(data);\n }\n //Important\n Node newNode = new Node(data);\n Node current = head;\n Node previous = null;\n int i = 0;\n while(i<index){\n previous = current; //Update previous Node in the loop!\n current = current.next;\n i++;\n }\n newNode.next = current;\n assert previous != null;\n previous.next = newNode;\n }", "public void insertValueAtIndex(int value, int index) {\n if (arraySize < 50 && index < arraySize) {\n theArray[index] = value;\n }\n }", "public ListNode insertNth(ListNode head, int index, int value){\n\t\tListNode current = head;\n\t\tListNode target = new ListNode(value);\n\t\t\n\t\tif(head == null){\n\t\t\tthrows new IllegalAugumentException(\"Empty List\");\n\t\t}\n\t\twhile(current != null){\n\t\t\tfor(int count = 0; count < index; count++){\n\t\t\t\tcurrent = current.next;\n\t\t\t}\t\n\t\t}\n\t\tif(current == null){\n\t\t\tthrows new IndexOutOfBoundException();\n\t\t}\n\t\ttarget.next = current.next;\n\t\tcurrent.next = node;\n\t\t\n\t\treturn head;\t\t\t\t\n\t}", "void add(int index, int value) {\n int[] newItems = new int[size++];\n\n System.arraycopy(items, 0, newItems, 0, index);\n\n newItems[index] = value;\n\n System.arraycopy(items, index, newItems, index + 1, items.length - index);\n\n items = newItems;\n }", "private void appendToInsertionOrder(final int index, final int effectiveCapacity) {\n\t\tif ( _lastInsertOrderIndex == effectiveCapacity ) {\n\t\t\tcompactInsertionOrderIndices();\n\t\t}\n\t\t_lastInsertOrderIndex++;\n\t\t_indicesByInsertOrder[_lastInsertOrderIndex] = index;\n\t}", "public void insert(int i, T obj);", "private void addAtIndex(int index, FoodItem item) {\n // store the \"pushed\" forward item\n FoodItem toMoveNext = this._stock[index];\n // and set the new item in index\n this._stock[index] = new FoodItem(item);\n\n // \"push\" forward in the array each item, until no more items to push.\n for (int i = index+1; i < _noOfItems+1; i++) {\n FoodItem tempToMoveNext = _stock[i];\n _stock[i] = toMoveNext;\n toMoveNext = tempToMoveNext;\n }\n\n // we added a new item for _stock, so now increase the noOfItem:\n this._noOfItems++;\n }", "@Override\n public void add(int index, E value) {\n // todo: Students must code\n ensureCapacity();\n int pos = calculate(index); // True position in array\n\n // if there are no elements, set head to the position (index 0, position ??)\n // *protects against divide by zero in modulus*\n if(size() == 0) {\n data[pos] = value;\n head = pos;\n tail = pos;\n // tail = (pos+1)%data.length;\n }\n // if the logical position is the head, then insert right before head and reassign head-variable\n // *tail stays the same*\n else if(index == 0) {\n int i = (head-1);\n if (i < 0) i = data.length-1;\n head = i;\n data[head] = value;\n }\n else{\n // shift all array contents after pos right 1\n for(int i = (pos + size() - index); i > pos; i--)\n data[i % data.length] = data[(i-1) % data.length];\n data[pos] = value;\n tail = (tail + 1) % data.length;\n }\n curSize++;\n }", "void add(int index, T element);", "void add(int index, T element);", "@Override\n public void add(final int index, final T element) {\n this.checkIndexToAdd(index);\n\n if (this.size > this.data.length - 1) {\n this.doubleArraySizeBy(2);\n }\n\n for (int i = this.size; i > index; i--) {\n this.data[i] = this.data[i - 1];\n }\n\n this.data[index] = element;\n this.size++;\n }", "public static int insert(int M, int N, int i, int j) {\n\t\tint a = (-1) << j;\n\t\tint b = (-1) >>> (32 - i);\n\t\tint mask = a | b;\n\t\tN = N & mask;\n\t\tM = M << i;\n\t\treturn N | M;\n\t}", "public abstract void add(T element, int index);", "public void add(int index, int value) {\n\t\t\tif(index < 0 || index > size) {\n\t\t\t\tthrow new IndexOutOfBoundsException(\"index\" + index);\n\t\t\t}\n\t\t\tensureCapacity(size + 1);\n\t\t\tfor(int i = size; i > index; i--) {\n\t\t\t\telementData[size] = elementData[i - 1];\n\t\t\t}\n\t\t\telementData[index] = value;\n\t\t\tsize++;\n\t\t}", "public void add(E s,int index) {\t//O(n)\r\n\t\t//checks if the index is valid\r\n\t\tif(index>=0 && index<=size) {\t//index is valid\r\n\t\t\t//checks if there is any space left in the array\r\n\t\t\tif(size>=capacity)\r\n\t\t\t\tresize(this.capacity*2);\t//increases size of the array\r\n\t\t\tfor (int k=size-1; k>=index;k--) {\t//shifting element\r\n\t\t\t\tlist[k+1]=list[k];\r\n\t\t\t}\r\n\t\t\tlist[index]=s;\t//add element to the index\r\n\t\t\tsize++;\t//increases size\r\n\t\t} else {\t//index is not valid\r\n\t\t\tSystem.out.println(\"index \"+index+\" is out or range!\");\r\n\t\t}\r\n\t}", "public void push(int n) {\n\n if (size() == values.length) {\n resize();\n }\n\n for (int i = 0; i < size() + 1; i++) {\n //System.out.println(i + \" out of \" + this.size + \" v: \" + this.values[i]);\n if (this.values[i] == 0) {\n //System.out.println(this.values[i] + \" = empty space found, adding\");\n this.values[size()] = n;\n break;\n }\n }\n this.size++;\n\n }", "public void insertChildAt(WSLNode node, int index) {\n\t\tchildren.insertElementAt(node, index);\n\t}", "public boolean insertValueAtIndex( int value, int index ) {\n if( size >= theList.length ) {\n expandTheList();\n } else if( index > size ) {\n size = index;\n } else if( index < 0 ) {\n throw new ArrayIndexOutOfBoundsException( \"The index value is too small\");\n } else {\n size++;\n for(int i = size - 1; i > index; i--){\n theList[i] = theList[i-1];\n }\n theList[index] = value;\n }\n return true;\n }", "public void addToCurrentNumberOfRegisterPushed(int n) {\n currentNumberOfRegisterPushed += n;\n if (currentNumberOfRegisterPushed > maxNumberOfRegisterPushed) {\n maxNumberOfRegisterPushed = currentNumberOfRegisterPushed;\n }\n }", "public void insertElementAt(Object obj, int index)\n {\n try {element.insertElementAt(obj, index);}\n catch (Exception e) {\n throw new IllegalArgumentException\n (\"VectorLinearList.insertElementAt: \" +\n \"index must be between 0 and size\");\n }\n }", "public void add(int index, E e) {\n resize();\n for(int i = size-1; i >= index; i--) {\n list[i+1] = list[i];\n }\n list[index] = e;\n size++;\n }", "void incrementCardPositionsInArgumentAtOrPastIndex(@NonNull UUID argumentId, short index);", "public void addNewItems(int n){\n\t\tint newindex = -1;\n\t\tfor (int i=0; i<5; ++i)\n\t\t\tfor (int index : indexSets.get(i).all())\n\t\t\t\tnewindex = Math.max(newindex, index);\n\t\tnewindex++;\n\t\tint added = 0;\n\t\tDate old = new Date(0);\n\t\twhile (newindex < AllCards.length() && (added < n || n == 0)){\n\t\t\t// Examine card here to decide if you want it\n\t\t\tCard c = AllCards.getCard(newindex);\n\t\t\tif (c.getEnglish().charAt(0) != '*'){\n\t\t\t\tindexSets.get(0).add(newindex);\n\t\t\t\ttimestamps.put(newindex, old);\n\t\t\t\tadded++;\n\t\t\t}\t\t\n\t\t\tnewindex++;\t\t\t\n\t\t}\n\t}", "@Override\n public void add(int index, int element) {\n Entry newElement = new Entry(element);\n Entry tmp = getEntry(index);\n newElement.next = tmp;\n newElement.previous = tmp.previous;\n tmp.previous.next = newElement;\n tmp.previous = newElement;\n size++;\n }", "public void insertAtPos(singlyListNode n, int position){\n singlyListNode ptr = this.head;\n int previous = position - 1;\n //find insertion position\n for (int i = 0 ; i < this.listSize; i ++){\n if (i == position){\n singlyListNode temp = ptr.getNextNode();\n ptr.setNextNode(n);\n n.setNextNode(temp);\n break;\n }\n ptr = ptr.getNextNode();\n }\n this.listSize ++;\n }", "public void insert(Integer x) {\n pq[++N] = x;\n swim(N);\n }", "static void primitiveRightShift(int[] a, int len, int n) {\n int n2 = 32 - n;\n for (int i=len-1, c=a[i]; i > 0; i--) {\n int b = c;\n c = a[i-1];\n a[i] = (c << n2) | (b >>> n);\n }\n a[0] >>>= n;\n }", "@Override\n\tpublic void insert(Object data, int index) throws IndexOutOfBoundsException {\n\n\t\tif (index >= size() || index < 0) {\n\t\t\tthrow new IndexOutOfBoundsException();\n\t\t}\n\n\t\tNode newNode = new Node(data);\n\t\tif (index == 0) {\n\t\t\tnewNode.setNext(head);\n\t\t\thead = newNode;\n\t\t} else {\n\t\t\tNode currentNode = head;\n\t\t\tint currentIndex = 0; // current index\n\t\t\twhile (currentNode != null && currentIndex < index - 1) {\n\t\t\t\tcurrentNode = currentNode.getNext();\n\t\t\t\tcurrentIndex++;\n\t\t\t}\n\t\t\tNode previousNode = currentNode; // set the previous node come before the node at the current index\n\t\t\tNode nextNode = currentNode.getNext(); // set the next node to go after the one we are adding\n\t\t\tpreviousNode.setNext(newNode);\n\t\t\tnewNode.setNext(nextNode);\n\t\t}\n\t\tsize++;\n\n\t}", "public native String insertItemBefore(String newItem, Number index);", "@Override\n public void add(int index, T element){\n if(index < 0 || index > size()){\n throw new NullPointerException();\n }else if(isEmpty() || index == size()){\n add(element);\n } else if(index == 0){\n prepend(element);\n } else{\n DLLNode<T> newNode = new DLLNode<T>(element);\n DLLNode<T> rightNode = getCurrentNode(index);\n DLLNode<T> leftNode = rightNode.previous;\n leftNode.successor = newNode;\n newNode.previous = leftNode;\n newNode.successor = rightNode;\n rightNode.previous = newNode;\n }\n }", "public void add(T element, int pos);", "@Override\n public void insertAtAnyPosition(T value, int index) {\n Node<T> new_node = new Node<>(value);\n if(index < 0)\n throw new IndexOutOfBoundsException();\n else if(index == 0){\n new_node.next = start;\n start = new_node;\n }else{\n Node<T> previous = start;\n for(int i =0;i<index-1;i++)\n {\n previous = previous.next;\n }\n Node<T> curr = previous.next;\n new_node.next = curr;\n previous.next = new_node;\n }\n\n }", "public void insertAt(int index,int data){\n Node node =new Node();\n node.data=data;\n node.next=null;\n\n if (index == 0) {\n insertAtStart(data);\n }\n\n\nelse{\n Node n = head;\n for (int i=0; i < index-1;i++){\n n =n.next;\n }\n node.next =n.next;\n n.next = node;\n\n}}", "@Override\n public void insertAt(T data, int index) {\n if(index > -1 && index <= getSize()) {\n\n if(index == 0){\n this.addToFront(data);\n return;\n }\n if(index == getSize() + 1) {\n this.addToEnd(data);\n return;\n }\n\n Node<T> dataNode = new Node<T>();\n dataNode.setData(data);\n\n int position= 0;\n Node<T> tempData = this.head;\n while(tempData.getNext() != null){\n tempData = tempData.getNext();\n if(position == index - 1 ) {\n //Pointing newly added node, to the one pointed to by element at position = index-1\n dataNode.setNext(tempData.getNext());\n\n tempData.setNext(dataNode);\n break;\n }\n position++;\n }\n }else {\n throw new IndexOutOfBoundException(\"Cannot add Node at provided location\");\n }\n }", "public static native int InsertAt(long lpjFbxArrayVector2, int pIndex, long pElement);", "public static void insert (int[] values, int pos, int newInt) {\n\t\tif (pos < 0 || pos >= values.length) {\n\t\t\treturn;\n\t\t}\n\t\tfor (int i =values.length-1;i>pos;i--){\n\t\t\tvalues[i]=values[i-1];\t\n\t\t}\n\t\tvalues[pos]=newInt;\n\t}", "public void insertAtPos(int val , int pos)\n {\n List nptr = new List(val, null, null); \n if (pos == 1)\n {\n insertAtStart(val);\n return;\n } \n List ptr = start;\n for (int i = 2; i <= size; i++)\n {\n if (i == pos)\n {\n List tmp = ptr.getListNext();\n ptr.setListNext(nptr);\n nptr.setListPrev(ptr);\n nptr.setListNext(tmp);\n tmp.setListPrev(nptr);\n }\n ptr = ptr.getListNext(); \n }\n size++ ;\n }", "private int advance(int[] n, int i) {\n i += n[i];\n i%=len;\n while (i<0) i+=len;\n return i;\n }", "public void insert(int newItem){\n itemArray[count] = newItem;\n count++;\n }", "public void add(final T data, final int index) {\n if (index < 0 || index > numElement + 1) {\n throw new IndexOutOfBoundsException();\n }\n Node<T> newNode = new Node<>(data);\n if (index == 0) {\n prepend(data);\n } else if (index == numElement) {\n append(data);\n }\n Node<T> iterator = head;\n for (int currentIndex = 0; currentIndex < index - 1; currentIndex++) {\n iterator = iterator.getNext();\n }\n newNode.setNext(iterator.getNext());\n iterator.setNext(newNode);\n numElement++;\n }", "@Override\n public void add(int index, E value) {\n this.rangeCheck(index);\n if (this.values.length == this.index) {\n this.grow();\n }\n this.modCount++;\n System.arraycopy(this.values, index, this.values, index + 1, this.size() - index);\n this.values[index] = value;\n this.index++;\n }", "void insert(Object value, int position);", "public void addAtIndex(int index, int val) {\n if (index < 0 || index > size) {\n return;\n }\n Node prev = dummyHead;\n for (int i = 0; i < index; i++) {\n prev = prev.next;\n }\n prev.next = new Node(val, prev.next);\n size++;\n }", "public synchronized void insertElementAt(WModelObject object, int index)\n\t{\n\t\tm_elements.insertElementAt(object, index);\n\t}", "public void insert(Object data, int index){\r\n enqueue(data);\r\n }", "private static void insertionSort(int[] array, int n) {\n \t\n \tfor (int index = 1; index < n; index++) {\n \t\tint temp = array[index];\n \t\tint j = index;\n\n\t\t\tint finalPosition = binarySearch(array, temp, 0, j - 1);\n\n \t\twhile (j > finalPosition) {\n \t\t\tarray[j] = array[j - 1];\n \t\t\tj -= 1;\n \t\t}\n \t\tarray[j] = temp;\n \t}\n }", "public void insertAtAnyPoint(int index, int data) {\n\t\tNode node = new Node(); // defining random node\n\t\tnode.data = data; // putting data on it\n\t\tnode.next = null;\n\t\tNode n = head; // initial node\n\t\tif(index == 0){\n\t\t\tinsertAtStart(data);\n\t\t}else{\n\t\tfor (int i = 0; i < index-1; i++) {\n\t\t\tn = n.next;\n\t\t}\n\t\tnode.next = n.next;\n\t\tn.next = node;\n\t\t}\n\t}", "public void add( int index, Comparable newVal ) { \n \t//checks if there is a meaningful value at index\n \tif (index> _lastPos){\n\t System.out.println(\"No meaningful int at index\");\n \t} else {\n\t //If _data is full, increase length of _data\n\t if (_size == _data.length) {\n\t\texpand();\n\t }\t\t\n\t //copies everything before index from _data to temp \n\t for (int i = _lastPos; i >= index; i--) {\n\t\t_data[i+1]= _data[i];\n\t }\n\t _data[index]= newVal;\n\t _size++;\n\t _lastPos++;\n\t}//end else\n\t \n }", "public void setElementAt(int n, Object ob) {\r\n\t\telements.set(n, ob);\r\n\t}", "@Override\n public void add(int index, T element) {\n Object[] newArray = new Object[size + 1];\n for (int i = 0; i < index; i++) {\n newArray[i] = data[i];\n }\n newArray[index] = element;\n for (int i = index + 1; i < newArray.length; i++) {\n newArray[i] = data[i - 1];\n }\n data = newArray;\n size++;\n }", "public void add(int i, T t) {\n if (size == elements.length) // checks potential overflow\n ensureCapacity(); // increase capacity\n size++; // increment size of list\n if (i < 0 || i >= size) // if there is no index i in list\n throw new IndexOutOfBoundsException(\"Treated index: \" + i + \" | Size of the Dynamic Array \" + size()); // cause IndexOutOfBoundException\n for (int j = size - 1; j > i; j--) { // treat elements of list with indexes in range [i+1, n]\n elements[j] = elements[j - 1]; // element shifts to right\n }\n elements[i] = t; // store element at index i\n }", "public static void insert(Comparable[] arr, int n) \n\t{\n\t\tif (arr != null && n > 1)\n\t\t {\n\t\t\tif (n > arr.length)\n\t\t\t\tn = arr.length;\n\t\t}\n\t\tfor (int i = 1; i < n; i++) \n\t\t{ //complexity is n in the best case, complexity is n squared in the worst case\n\t\t\tfor (int j = i; j > 0 && arr[j].compareTo(arr[j-1]) < 0; j--) //complexity of 1 in the best case, complexity of i in the worst case\n\t\t\t\tswap(arr, j, j-1);\t//complexity of 1\n\t\t}\n\t}", "public void addBefore(E val, int idx) throws IndexOutOfBoundsException {\n addNodeBefore(new SinglyLinkedList.Node<>(val), idx);\n }", "public static void insertSort(int[] a, int n){\n // 插入排序,把数组分为已排序区和未排序区,依次把未排序中的元素插入的已排序中\n\n for (int i = 1; i < n ; ++i){\n // 遍历已排序区,找到已排序中符合要求的位置\n // value 待插入的数据\n int value = a[i];\n // j = 已排序的区间索引前一位\n int j = i-1;\n for (;j>=0;--j){\n\n // System.out.printf(\"\\n[%s : %s]\", Arrays.stream(a).boxed().collect(Collectors.toList()).subList(0,i).toString(),Arrays.stream(a).boxed().collect(Collectors.toList()).subList(i,n).toString());\n if (a[j] > value){\n // 大于待插入的数据的都自觉往后移动一位\n a[j+1] = a[j];\n move++;\n }else {\n // 中止 当前j为目标位置\n break;\n }\n }\n a[j+1] = value;\n }\n }", "public void add(int index, E element);", "public void add(int index, Object element) {\r\n addBefore(element, (index == size ? header : entry(index)));\r\n }", "public void insertChild(XMLElement child, int index)\n/* */ {\n/* 422 */ if (child == null) {\n/* 423 */ throw new IllegalArgumentException(\"child must not be null\");\n/* */ }\n/* 425 */ if ((child.getLocalName() == null) && (!this.children.isEmpty())) {\n/* 426 */ XMLElement lastChild = (XMLElement)this.children.lastElement();\n/* 427 */ if (lastChild.getLocalName() == null) {\n/* 428 */ lastChild.setContent(lastChild.getContent() + \n/* 429 */ child.getContent());\n/* 430 */ return;\n/* */ }\n/* */ }\n/* 433 */ child.parent = this;\n/* 434 */ this.children.insertElementAt(child, index);\n/* */ }", "public void enqueue(int n) {\n\t\tif (isFull()) throw new IllegalStateException(\"Queue is full!\");\n\t\tsize++;\n\t\tbq[tail++] = n;\n\t\t// efficient memory storage w/ wraparound\n\t\tif (tail == bq.length) tail = 0;\n\t}", "void add(int index, Object element);", "private void add( int n ) {\r\n Card card = cards.get( n );\r\n if ( !card.isFaceUp() ) {\r\n card.toggleFace();\r\n push( card );\r\n ++this.moveCount;\r\n }\r\n }", "public void addAtIndex(int index, int data)\n {\n Node newNode = new Node(data);\n Node oldNode = head;\n\n for (int i=1;i<size;i++)\n {\n if (i == index)\n {\n Node myNode = oldNode.next;\n oldNode.next = newNode;\n newNode.next = myNode;\n break;\n }\n oldNode = oldNode.next;\n }\n size++ ;\n }", "public Integer mutate(int index);", "@Override\n\tpublic void add(int index, Object e) throws IndexOutOfBoundsException\n\t{\n\t\t//just to check if the index is valid\n\t\tif ( index < 0 || index > size )\n \t\tthrow new IndexOutOfBoundsException();\n\t\t//check arraylist size\n\t\tif (size == myArray.length)\n\t\t\tresizeUp();\n\t\t//move all the proceeding elements to make room for the desired element\n\t\tfor ( int i = size; i > index; i-- )\n \t\tmyArray[i] = myArray[i-1];\n \t//plug the element\n\t\tmyArray[index] = e;\n \t++this.size;\n\n\t\t\n\t}", "private static void addChildAt(\n ReactShadowNode parentNode,\n ReactShadowNode childNode,\n int index,\n int prevIndex) {\n if (index <= prevIndex) {\n throw new RuntimeException(\n \"Invariant failure, needs sorting! \" + index + \" <= \" + prevIndex);\n }\n\n parentNode.addChildAt(childNode, index);\n }", "private void setRight(int index, Node n) {\n \t\t// TODO Complete this method!\n \t\tsetNode(getRightOf(index), n);\n \t}", "public void addAtIndex(int index, int val) {\n if(index==0) {\n addAtHead(val);\n return;\n }\n if(index==len) {\n addAtTail(val);\n return;\n }\n if(index>0 && index<len) {\n SingleNode cur = new SingleNode(val,null);\n SingleNode pre = head;\n for(int i=0; i<index-1; i++) {\n pre = pre.next;\n }\n cur.next = pre.next;\n pre.next = cur;\n len++;\n }\n }", "public void add(T element, int index) {\n int counter = 0;\n Node<T> newNode = new Node(element);\n Node<T> current = itsFirstNode;\n\t\tif (current == null) {\n\t\t\tthrow new NoSuchElementException(\"Beyond size of list or list empty\");\n\t\t}\n\t\twhile (current.getNextNode() != null ) {\n\t\t\tif ((counter == index - 1) || (index == 0)) {\n\t\t\t\tbreak;\n\t\t\t}\t\n\t\t\tcurrent = current.getNextNode();\n\t\t\tcounter++;\n\t\t}\n\t\ttry {\n\t\t\tif (index == 0) {\n\t\t\t\taddAsFirst(newNode);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnewNode.setNextNode(current.getNextNode());\n\t\t\t\t(newNode.getNextNode()).setPriorNode(newNode);\n\t\t\t\tcurrent.setNextNode(newNode);\n\t\t\t\tnewNode.setPriorNode(current);\n\t\t\t}\n\t\t}\n\t\tcatch (NullPointerException e) {\n\t\t\t// NullPointer is fine\n\t\t}\n size++;\n }", "private int plusOne(int index) {\n if (index + 1 >= array.length) {\n return 0;\n } else {\n return index + 1;\n }\n }", "@Override\n public void insertar(int index, T elemento) {\n if (raiz == null) {\n raiz = new NodoBAVL<>(elemento);\n }\n insertarOrdenado(raiz, elemento, index);\n }", "public void add (int index, E item)\n {\n if (index < 0 || index > size) {\n throw new\n IndexOutOfBoundsException(Integer.toString(index));\n }\n if (index == 0)\n addFirst(item);\n else {\n Node<E> node = getNode(index - 1);\n addAfter(node, item);\n }\n }", "private void setNode(int index, Node n) {\n \t\twhile (index + 1 >= contents.size()) {\n \t\t\tcontents.add(null);\n \t\t}\n \t\tcontents.set(index, n);\n \t}" ]
[ "0.65930134", "0.64544755", "0.63916796", "0.63383687", "0.6256032", "0.6231789", "0.61832154", "0.6167304", "0.6146583", "0.6123166", "0.6105506", "0.61019045", "0.609385", "0.60279727", "0.6019832", "0.597033", "0.5928052", "0.5917745", "0.59160525", "0.58963346", "0.5864332", "0.5863584", "0.5851675", "0.58465016", "0.5838351", "0.5830524", "0.58226275", "0.5808052", "0.5794656", "0.57926327", "0.5791848", "0.5782137", "0.57682174", "0.5765535", "0.5758973", "0.57580554", "0.5740499", "0.5729936", "0.5729936", "0.57233083", "0.57182646", "0.571048", "0.57081735", "0.57030404", "0.5700091", "0.5697863", "0.56955963", "0.5692698", "0.5691995", "0.568925", "0.56733394", "0.56636715", "0.5652732", "0.5650382", "0.5649788", "0.56495637", "0.5634005", "0.5612492", "0.5610445", "0.5606314", "0.56026506", "0.5597385", "0.5597357", "0.55901754", "0.5587841", "0.55835146", "0.55798954", "0.5565327", "0.5563826", "0.55626005", "0.55521655", "0.55347186", "0.55213684", "0.55211955", "0.551211", "0.5507683", "0.55048746", "0.55046254", "0.55023664", "0.55017877", "0.5486329", "0.547495", "0.54741746", "0.5468952", "0.54681504", "0.5465794", "0.5458588", "0.5448517", "0.54466444", "0.54385334", "0.54287463", "0.5421936", "0.5421356", "0.54193467", "0.5417033", "0.54138184", "0.5405732", "0.5393306", "0.5388231", "0.5388168" ]
0.6936122
0
/ Remove integer at position index.
@Override public void remove(int index) throws IndexOutOfBoundsException { if(checkIndex(index, size)) { //check if index is valid for (int i=index; i<size; i++) { values[i] = values[i+1]; //move every value one step left until index (which is overwritten) } size--; //decrement size }else { throw new IndexOutOfBoundsException("Highest index: " + size); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void remove(int index);", "int remove(int idx);", "void remove( int index );", "public Type remove(int index);", "void remove(int idx);", "void remove(int index);", "void remove(int index);", "void remove(int index);", "void remove(int index);", "public void remove(int index) {\n\n\t}", "public void removeElementAt(int index);", "@Override\r\n\tpublic void removeToIndex(int index) {\n\t}", "public void remove( int index ) {\n\tif (index > _lastPos)\n\t System.out.println(\"No meaningful value at index\");\n\telse {for (int i= index; i < _lastPos; i++){\n\t\t_data[i]= _data[i+1];\n\t }\n\t _size--;\n\t _lastPos--;\n\t}\n }", "public void removeIndex(int i) {\n // YOUR CODE HERE\n }", "@ZenCodeType.Method\n default void remove(int index) {\n \n doesNot(\"support removal by index\");\n }", "public E remove(int index);", "abstract void remove(int index);", "T remove(int index);", "T remove(int index);", "public abstract T remove(int index);", "E remove(int i) throws IndexOutOfBoundsException;", "@Override\n public final Integer remove(final int index) {\n // Verify that the specified index is valid\n if (!checkRange(index)) {\n throw new IndexOutOfBoundsException();\n } else {\n final int temp = arrayList[index];\n // Shift all elements after the removed elements down\n for (int i = index; i < (size - 1); i++) {\n arrayList[i] = arrayList[i + 1];\n arrayList[i + 1] = 0;\n }\n size--;\n return temp;\n\n }\n }", "E remove(int i ) throws IndexOutOfBoundsException;", "@Override\n\tpublic int remove(int n) {\n\t\treturn 0;\n\t}", "public native String removeItem(Number index);", "public void removeObject(int i);", "public abstract void remove(int pos) throws IndexOutOfBoundsException;", "public Object remove (int i)\r\n {\r\n }", "void remove(int index) {\n\t\tfor (int i = index; i < array.length - 1; i++) {\n\t\t\tarray[i] = array[i + 1];\n\t\t}\n\t\tint[] temp = new int[array.length - 1];\n\t\tfor (int i = 0; i < array.length - 1; i++) {\n\t\t\ttemp[i] = array[i];\n\t\t}\n\t\tint lastValue = array[array.length - 1];// index starts @ 0, so its the\n\t\t\t\t\t\t\t\t\t\t\t\t// array.length - 1 to account\n\t\t\t\t\t\t\t\t\t\t\t\t// for the 0\n\t\tarray = temp;\n\n\t}", "public abstract E remove(int index);", "public int remove(int index) {\n // Gracefully handle items beyond end\n final int size = mItems.size();\n index = constrain(index, 0, size - 1);\n\n mItems.remove(index);\n return index;\n }", "public void remove(int index)\r\n\t{\r\n\t\tif(index<0 || index >=n)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Invalid index\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tfor(int i=index;i<n;i++)\r\n\t\t\t{\r\n\t\t\t\ta[i]=a[i+1];\r\n\t\t\t}\r\n\t\t\tn--;\r\n\t\t}\t\t\r\n\t}", "@Override\n public E remove(int index) {\n // todo: Students must code\n int pos = calculate(index);\n\n E temp = data[pos];\n data[pos] = null;\n if(pos == head)\n head = (head+1) % data.length;\n else if(pos == tail)\n tail = (tail-1) % data.length;\n else {\n // shift all array contents after pos left 1\n for(int i = pos; i < (pos + curSize-index-1); i++)\n data[calculate(i)] = data[calculate(i+1)];\n tail = (tail-1) % data.length;\n }\n curSize--;\n return temp;\n }", "@Override\n\tpublic E remove(int index) {\n\t\trangeCheck(index);\n\t\t\n\t\treturn remove(node(index));\n\t}", "public Object remove(int index){\n\t\tif(index < listSize){\n\t\t\tObject o = myArrayList[index];\n\t\t\tmyArrayList[index] = null;\n\t\t\tint temp = index;\n\t\t\twhile(temp < listSize){\n\t\t\t\tmyArrayList[temp] = myArrayList[temp+1];\n\t\t\t\tmyArrayList[temp+1] = 0;\n\t\t\t\ttemp++;\n\t\t\t}\n\t\t\tlistSize --;\n\t\t\treturn o;\n\t\t}else{\n\t\t\tthrow new ArrayIndexOutOfBoundsException();\n\t\t}\n\t}", "@Override\n public E remove(int index) {\n this.rangeCheck(index);\n this.modCount++;\n E oldValue = (E) this.values[index];\n int numMoved = this.index - index - 1;\n if (numMoved > 0) {\n System.arraycopy(this.values, index + 1, this.values, index, numMoved);\n }\n this.values[--this.index] = null;\n return oldValue;\n }", "boolean remove(int pos);", "@Override\n\tpublic T remove(int index) {\n\t\t// TODO check if index is withing the correct range\n\t\t// If not, return null\n\t\t// otherwise , do the same as above\n\t\tif (index >= 0 && index < size) {\n\t\t\tT item = data[index];\n\t \t\tfor(int i=index;i<size-1;i++)\n\t \t\t\tdata[i] = data[i+1];\n\t \t\tsize--;\n\t \t\treturn item;\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\n\t}", "@Test\n public void deleteByIndex(){\n List <Integer> list = new ArrayList<>();\n list.add(1);\n list.add(2);\n list.add(3);\n list.add(4);\n list.add(5);\n assertEquals(1,(int)list.get(0));\n\n list.remove(0);\n assertEquals(2,(int)list.get(0));\n }", "private void deleteElement(int index) {\n Object[] first = new Object[index];\n System.arraycopy(this.container, 0, first, 0, index);\n\n Object[] second = new Object[this.container.length - index - 1];\n System.arraycopy(this.container, index + 1, second, 0, second.length);\n\n this.container = new Object[this.container.length];\n System.arraycopy(first, 0, this.container, 0, first.length);\n System.arraycopy(second, 0, this.container, index, second.length);\n\n this.position--;\n }", "public void remove(int index) {\n\t\tpoints.remove(index);\n\t}", "public E remove(int idx) {\n\n\t\tE retVal = remove(getNode(idx));\n\n\t\tmSize--;\n\t\tmodCount++;\n\n\t\treturn retVal;\n\t}", "@Override\n public int remove(int index) {\n checkIndex(index);\n Entry tmp = getEntry(index);\n int result = tmp.value;\n tmp.previous.next = tmp.next;\n tmp.next.previous = tmp.previous;\n size--;\n return result;\n }", "public void remove(int index)\n {\n numItems--;\n items[index] = null;\n }", "public E remove (int index)\n { E item;\n if (index < 0 || index >= size) {\n throw new\n IndexOutOfBoundsException(Integer.toString(index));\n }\n if (index == 0)\n item = removeFirst( );\n else {\n Node<E> node = getNode(index - 1);\n item = removeAfter(node);\n }\n return item; // return the deleted value\n }", "private void removeAtIndex(int index) {\n // save the last item\n FoodItem toMoveBack = this._stock[this._noOfItems-1];\n // make it null\n this._stock[this._noOfItems-1] = null;\n // for each item until the index to remove from:\n for (int i = this._noOfItems-2; i > index-1; i--) {\n // save the last moved back temporarily\n FoodItem tempToMoveBack = toMoveBack;\n // assign to the next iteration item to move back\n toMoveBack = this._stock[i];\n // move back the item for current iteration\n this._stock[i] = tempToMoveBack;\n }\n // we removed an item - so let's decrease the item counter.\n this._noOfItems--;\n }", "public T remove(int idx) {\n\t\tint index = (idx << 1);\n\t\tnvPairs.remove(index);\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tT result = (T) nvPairs.remove(index); // same index, as things shifted in previous remove\n\t\treturn result;\n\t}", "public void removeAt(int index) {\n\n // Exceptional case\n if (index >= dataSize)\n throw new IllegalStateException();\n\n moveLeft(index);\n dataSize -= 1;\n }", "public void removeIndex(int i)\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n get_store().remove_element(INDEX$12, i);\r\n }\r\n }", "public E remove(int index)\r\n {\r\n checkValidIndex(index);\r\n ListIterator<E> itr = listIterator(index);\r\n E result = itr.next();\r\n itr.remove();\r\n return result;\r\n }", "public void remove(int idx) {\r\n\t\tcards.remove(idx);\r\n\t}", "private final void fastRemove(final int index) {\r\n\t\tfinal int numMoved = this.size - index - 1;\r\n\t\tif (numMoved > 0) {\r\n\t\t\tSystem.arraycopy( this.elementData, index + 1, this.elementData, index, numMoved );\r\n\t\t}\r\n\t\tthis.elementData[--this.size] = null; // Let gc do its work\r\n\t}", "@Override\n public T remove(int index) {\n T removed = array[index];\n for (int i = index + 1; i < array.length; i++) {\n array[i] = array[i + 1];\n }\n this.size = size - 1;\n return removed;\n }", "public U remove(int idx){\r\n\t \tif ((idx < 0)|| (idx > numElems-1))\r\n\t \t\tthrow new IndexOutOfBoundsException();\r\n\t \tint i = idx;\r\n\t \t@SuppressWarnings(\"unchecked\")\r\n\t\t\tU data = (U) array[i];\r\n\t \t//Same shift algorithm as other remove method\r\n\t \twhile(i<numElems-1){\r\n\t \t\tarray[i]= array[i+1];\r\n\t \t\ti++;\r\n\t \t}\r\n\t \t//Not sure if needed: set last element to null after shift\r\n\t \tarray[numElems-1] = null;\r\n\t \tnumElems--;\r\n\t \treturn data;\r\n\t }", "public void remove(int index) {\n\t\t// checks range\n\t\tcheckRange(index);\n\t\t// creates new JS array\n\t\tarray.remove(index);\n\t}", "public E remove(int index){\n if (index < 0 || index >= size){\n throw new ArrayIndexOutOfBoundsException(index);\n }\n E returnValue = theData[index];\n for (int i = index + 1; i < size; i++) {\n theData[i - 1] = theData[i];\n }\n size--;\n return returnValue;\n }", "public void remove(int index) {\n items.remove(index);\n }", "@Override\n // average-case complexity: O(n), since it always needs to shift n-amount\n // of element, where n is propotional to the list/input size\n public void remove(int index) {\n if (arr.length * SHRINK_THRESHOLD > size)\n arr = resize(arr, SHRINK_FACTOR);\n \n // remove the item at the specified index and shift everything right of\n // the given index 1 step to the left\n for (int i = index; i < size-1; i++) {\n arr[i] = arr[i+1];\n }\n // remove the previous last item and then decrement the size\n arr[--size] = null;\n }", "public T remove(int index) {\n chk();\n return list.remove(index);\n }", "void remove(int index)\n\t{\n\t\t//Create a temporary array\n\t\tint[] temp=new int[inputArray.length-1];\n\t\t\n\t\t//Copy all the elements before the element at position index into the temporary array\n\t\tfor(int i = 0; i < index; i++)\n\t\t{\n\t\t\ttemp[i] = inputArray[i];\n\t\t}\n\t\t\n\t\t//Copy all the elements after the element at position index into the temporary array\n\t\tfor(int i = index+1; i < inputArray.length; i++)\n\t\t{\n\t\t\ttemp[i-1] = inputArray[i];\n\t\t}\n\t\t\n\t\t//Make the temporary array as the new array\n\t\tinputArray = temp;\n\t}", "public T remove(int index) {\n\n if (index >= size) {\n throw new IndexOutOfBoundsException(\"Index: \" + index + \", Size: \" + size);\n }\n\n T oldValue = myList[index];\n int value = size - index - 1;\n\n if (value > 0) {\n System.arraycopy(myList, index + 1, myList, index, value);\n }\n System.out.println(\"one \" + size);\n myList[--size] = null;\n System.out.println(\"two \" + size);\n\n return oldValue;\n }", "@Override\n public void delete(Integer index) {\n if(index > lastIndex)\n throw new IllegalArgumentException(); // only for tests\n stack.push(arr[index]);\n stack.push(index + arr.length+1);\n for (int i=index+1; i<lastIndex + 1; i++){\n arr[i-1] = arr[i];\n }\n lastIndex = lastIndex - 1;\n }", "public void remove(int index) {\r\n\t\t//checks if the index is valid\r\n\t\tif(index>=0 && index<=size) {\r\n\t\t\tfor (int k=index;k<size;k++) {\t//shifting element\r\n\t\t\t\tlist[k]=list[k+1];\r\n\t\t\t}\r\n\t\t\tsize--;\t\t//decreases size\r\n\t\t\t//checks if the size of array is not 0 and less than 25% of the capacity of the array\r\n\t\t\tif (size!=0 && capacity/size >=4)\r\n\t\t\t\tresize(this.capacity/2);\t//decreasing size of array\r\n\t\t} else {\t//index is not valid\r\n\t\t\tSystem.out.println(\"index \"+index+\" is out or range!\");\r\n\t\t}\r\n\t}", "public void remove(int index) {\n\t\t\tcheckIndex(index);\n\t\t\tfor(int i = index; i < size - 1; i++) {\n\t\t\t\telementData[i] = elementData[i + 1];\n\t\t\t}\n\t\t}", "public E remove(int index) {\n\t\tif (index < 0 || index >= this.size()) {\n\t\t\tthrow new IndexOutOfBoundsException(\"Index is out of bounds\");\n\t\t}\n\t\tE removed = get(index);\n\t\t// Loop to shift elements left\n\t\tfor (int i = index; i < size(); i++) {\n\t\t\tlist[i] = list[i + 1];\n\t\t}\n\t\treturn removed;\n\t}", "public void removeItem(int idx)\n\t{\n\t\titemList.remove(idx);\n\t\t\n\t}", "String delete(int index);", "@Test\r\n\tpublic void testRemoveByIndex() {\r\n\t\tAssert.assertNull(list.remove(100));\r\n\t\tAssert.assertTrue(list.get(5).equals(list.remove(5)));\r\n\t\tAssert.assertEquals(14, list.size());\r\n\t}", "@Override\r\n\tpublic T remove(int index) {\n\t\treturn this._list.remove(index);\r\n\t}", "@Override\n public T remove(int index) {\n if (index < 0 || index > size) {\n throw new IndexOutOfBoundsException(\"Index out of bounds exception.\");\n }\n\n T oldValue = (T) data[index];\n int move = index - size - 1;\n if (move > 0) {\n System.arraycopy(data, index + 1, data, index, move);\n }\n\n data[--size] = null;\n return oldValue;\n }", "public void remove(int index) {\n for (int i = index; i < this.list.length-1; i++) {\n this.list[i]=this.list[i+1];\n }\n this.size--;\n }", "public void remove(int index) {\n\t\tif (index < 0 || index >= size) {\n\t\t\tthrow new IndexOutOfBoundsException(\"Cannot remove value with invalid index.\");\n\t\t}\n\n\t\tshiftBackArray(index);\n\t\tsize--;\n\t}", "public E remove(int index)\n {\n if (index >= 0 && index < size) {\n E temp = data[index]; // element to return\n\n // shift all elements to the right down by 1 index\n for (int i = index; i < size - 1; i++)\n data[i] = data[i+1];\n \n size--;\n return temp;\n } else\n throw new NoSuchElementException();\n }", "public static native long RemoveAt(long lpjFbxArrayVector2, int pIndex);", "public T remove(int index) {\n return null;\n }", "public Object remove(int index) {\r\n Entry e = entry(index);\r\n remove(e);\r\n return e.element;\r\n }", "@Override\n public synchronized E remove(int index) {\n E result = this.get(index);\n if (index < this.size() - 1) {\n System.arraycopy(this.container, index + 1, this.container, index, this.size() - (index + 1));\n }\n this.container[--this.pointer] = null;\n return result;\n }", "void removeKey(int i);", "public int removeByIndex(int removeIndex) \n\t{\n\t\tif (removeIndex < arraySize && removeIndex > -1)\n\t\t{\n\t\t\tint element = array[removeIndex];\n\t\t\tfor (int index = removeIndex + 1; index < arraySize; index++)\n\t\t\t{\n\t\t\t\tarray[index - 1] = array[index];\n\t\t\t}\n\t\t\tarraySize--;\n\t\t\treturn element;\n\t\t}\t\n\t\tSystem.out.println(\"Syntax error, element not found.\");\n\t\treturn -1;\n\t\n\t}", "public E remove(int index){\n if (index > maxIndex || index < 0){\n return null;\n }\n\n E res = (E) array[index];\n\n //deleting element\n array[index] = null;\n\n //shifting other elements\n for (int i = index; i < maxIndex ; i++) {\n array[i] = array[i+1];\n }\n\n --maxIndex;\n\n return res;\n }", "private int remove(int index){\n\t\tremovedItem=heap[index];\n\t\theap[index]=INFINITE;\n\t\tshiftUp(index);\n\t\treturn extractMax();\n\t}", "@Override\r\n\tpublic Score remove(int i) throws IndexOutOfBoundsException {\r\n\t\t//when i is less than zero or greater than size()-1\r\n\t\tif (i < 0 || i > size() - 1)\r\n\t\t\tthrow new IndexOutOfBoundsException();\r\n\t\tScore a = scoreList[i];\r\n\t\tfor (int j = i; j < numItems - 1; j++) {\r\n\t\t\tscoreList[j] = scoreList[j + 1];\r\n\t\t}\r\n\t\tnumItems--;\r\n\t\treturn a;\r\n\t}", "@Override // com.google.android.gms.internal.firebase_ml.zzsq, java.util.List, java.util.AbstractList\n public final /* synthetic */ Long remove(int i) {\n zzpu();\n zzci(i);\n long[] jArr = this.zzbqi;\n long j = jArr[i];\n int i2 = this.size;\n if (i < i2 - 1) {\n System.arraycopy(jArr, i + 1, jArr, i, (i2 - i) - 1);\n }\n this.size--;\n ((AbstractList) this).modCount++;\n return Long.valueOf(j);\n }", "void delete (int index);", "@Override\n\tpublic int delete(Integer i) {\n\t\treturn 0;\n\t}", "protected void removeByIndex(int index) {\n int h = head;\n int t = tail;\n size = size - 1;\n int present = dequeue.length - 1;\n int offset = (index - h) & present;\n int finish = (tail - index) & present;\n\n if (offset < finish) {\n if (h <= index) {\n System.arraycopy(dequeue, h, dequeue, h + 1, offset);\n } else {\n System.arraycopy(dequeue, 0, dequeue, 1, index);\n dequeue[0] = dequeue[present];\n System.arraycopy(dequeue, h, dequeue, h + 1, present - h);\n }\n dequeue[h] = null;\n head = (h + 1) & present;\n } else {\n if (index < t) {\n System.arraycopy(dequeue, index + 1, dequeue, index, finish);\n tail = t - 1;\n } else {\n System.arraycopy(dequeue, index + 1, dequeue, index, present - index);\n dequeue[present] = dequeue[0];\n System.arraycopy(dequeue, 1, dequeue, 0, t);\n tail = (t - 1) & present;\n }\n }\n }", "@Override\n public void remove(int no) throws Exception {\n \n }", "void remove (int offset, int size);", "public AnyType remove( int index ) throws IndexOutOfBoundsException {\n \n return removeNode( index ).getData();\n \n }", "@Override\n\tpublic E remove(int index) {\n\t\treturn null;\n\t}", "public void removeAt(int pos)\n {\n for (int i = pos; i < length - 1; i++)\n {\n list[i] = list[i + 1];\n }\n length--;\n }", "public void remove(int index) {\n\t\tif ((index < 1) || (index > size))\n\t\t\tthrow new IllegalArgumentException();\n\t\telse{\n\t\t\tremove(getNode(index));\n\t\t\t}\n\t}", "public Object remove(final int index) {\n if (checkIfInvalidIndex(index)) {\n throw new IndexOutOfBoundsException();\n }\n Node<T> iterator = head;\n if (index == 0) {\n head = head.getNext();\n } else {\n Node<T> previous = null;\n for (int currentIndex = 0; currentIndex < index; currentIndex++) {\n previous = iterator;\n iterator = iterator.getNext();\n }\n if (previous != null) {\n previous.setNext(iterator.getNext());\n }\n }\n numElement--;\n return iterator.getData();\n }", "public void deleteIndex(int index) {\n if (index < arraySize) {\n for (int i = index; i < arraySize - 1; i++) {\n theArray[i] = theArray[i + 1];\n }\n arraySize--;\n }\n }", "public void removeByTodoInteger(int todoInteger);", "public void removeAt(int index){\n E[] array2 = (E[]) new Object[capacity*2];\n int j=0;\n for(int i=0;i<size;i++){\n if(i!=index) {\n array2[j] = array[i];\n j++;\n }\n }\n array=array2;\n size--;\n }", "public T remove(int pos)\n {\n T el = _objs[pos];\n for (Integer i = pos; i < _size - 1; ++i)\n {\n _objs[i] = _objs[i + 1];\n }\n _size--;\n return el;\n }", "@Override\n public E remove(int index) {\n\t E first = _store[index];\n\t _store[index] = null;\n\t for( int i = index; i< _size-1;i++) {\n\t\t _store[i]=_store[i+1];\n\t }\n\t_store[_size-1]=null;\n\t _size -=1;\n\t \n\t\t \n\treturn first;\n }", "private void remove(int index){\r\n \tkeys[index] = null;\r\n \tvals[index] = null;\r\n deleteCheck(index);\r\n }", "public void removeAtIndexFor(int index, int size) {\r\n int start = offset + index + size;\r\n int end = offset + count;\r\n ArrayUtils.shiftDown(objects, size, start, end, false);\r\n count -= size;\r\n }" ]
[ "0.80787224", "0.7996718", "0.79905903", "0.7974822", "0.7949502", "0.79488903", "0.79488903", "0.79488903", "0.79488903", "0.7869996", "0.7729775", "0.7697985", "0.7679724", "0.7665845", "0.76424354", "0.75824976", "0.7581751", "0.7560606", "0.7560606", "0.74417335", "0.7417861", "0.7348749", "0.7324254", "0.73192257", "0.7312354", "0.7301394", "0.728057", "0.7222424", "0.7218622", "0.7203869", "0.7124667", "0.71130735", "0.71090454", "0.7083042", "0.70342267", "0.70297784", "0.6986811", "0.694116", "0.6929568", "0.6926633", "0.6923893", "0.690683", "0.6896148", "0.6890732", "0.68895626", "0.6873854", "0.68481225", "0.6837939", "0.6830309", "0.68276876", "0.6827196", "0.68230176", "0.68228734", "0.68085825", "0.6805959", "0.68050635", "0.679059", "0.67877245", "0.67841214", "0.6783613", "0.6780532", "0.67684686", "0.67644566", "0.67446905", "0.6741371", "0.67328554", "0.6732852", "0.67296165", "0.67104816", "0.6700789", "0.66966826", "0.66959965", "0.66888314", "0.6684744", "0.66824853", "0.66769505", "0.6676316", "0.6674798", "0.6670808", "0.6661877", "0.6634303", "0.6628371", "0.6627109", "0.6621405", "0.66201603", "0.66147876", "0.6608396", "0.6607881", "0.65970606", "0.6591081", "0.658543", "0.6583917", "0.6582853", "0.657608", "0.65710545", "0.6569927", "0.656549", "0.6560949", "0.65593266", "0.65556973" ]
0.6856492
46
/ Get integer at position index.
@Override public int get(int index) throws IndexOutOfBoundsException { if(checkIndex(index, size)) { //check if index is valid return values[index]; //return the value at index }else { throw new IndexOutOfBoundsException("Highest index: " + size); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int get(int index);", "public int getPosition(int index);", "public int getIndex(int position);", "public int get(int position) {\n return Integer.MIN_VALUE;\n }", "abstract int get(int index);", "public int get(int index) {\n\t\treturn r[index];\n\t}", "public int getPos(int index) {\r\n return pos[index];\r\n }", "int get(int idx);", "public Integer getPosition();", "public int getIndex();", "public int getIndex();", "public int getIndex();", "public int getIndex() {\n\t\treturn index & 0xffff;\n\t}", "public int getInt(int index)\r\n/* 372: */ {\r\n/* 373:386 */ ensureAccessible();\r\n/* 374:387 */ return _getInt(index);\r\n/* 375: */ }", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int get(int index)\n\t{\n\t\treturn inputArray[index];\n\t}", "public int getInt(int index) throws ArrayIndexOutOfBoundsException\n\t{\n\t\treturn bytes[index] & 0xFF;\n\t}", "public int getIndex()\n {\n return getInt(\"Index\");\n }", "public int i(int index) {\n if (get(index) == null) return 0;\n return this.adapter.get(index).intValue();\n }", "public int getInteger(int pos) {\n return Tuples.toInteger(getObject(pos));\n }", "public int getDigit(int index){\n\t\tif (index+1 > data.length){\n\t\t\tSystem.out.println(\"index out of bounds\");\n\t\t}\n\t\treturn index;\n\t\t\n\t}", "public int integerVarAt(int index) {\n\t\treturn storage[index];\n\t}", "public int getDigit(int index) {\n\t\tif(index >= 0&&index < data.length) {\n\t\t\treturn data[index];\n\t\t}else {\n\t\t\tSystem.out.println(\" the index is out of bounds\");\n\t\t\treturn 0;\n\t\t}\n\t}", "public int get(int i)\n {\n if(integerList != null)\n return integerList[i];\n else\n return -1;\n }", "protected int _getInt(int index)\r\n/* 378: */ {\r\n/* 379:392 */ return HeapByteBufUtil.getInt(this.array, index);\r\n/* 380: */ }", "@Override\r\n\tpublic int getInt(int pos) {\n\t\treturn buffer.getInt(pos);\r\n\t}", "public final int getIndex(){\n return index_;\n }", "public int get(int index) {\n return array[index];\n }", "public Integer get(int index){\n return list.get(index);\n }", "public int getValue() {\r\n return index;\r\n }", "public int getElementAtIndex(int index){\r\n return mArray[index];\r\n }", "private int getDigit(int index) {\n return getDigit(number, index);\n }", "public int get(int index) {\n\t checkIndex(index);\n\t return elementData[index];\n\t }", "public int get(int index)\n\t{\n\t\tif (index > -1 && index < arraySize)\n\t\t{\n\t\t\treturn array[index];\n\t\t} else \n\t\t{\n\t\t\tSystem.out.println(\"Syntax error.\");\n\t\t}\t\t\n\t\treturn -1;\n\t}", "public static int getIntAt(int number, int index){\n\n String numberString = Integer.toString(number);\n int digitAtIndex = Integer.parseInt(Character.toString(numberString.charAt(index)));\n return digitAtIndex;\n }", "public int getIndex(\n )\n {return index;}", "protected abstract int readInternal(int index);", "public int get(int index) {\n\t\treturn nodeAt(index).data;\n\t}", "public int getInteger(int index)\r\n\t{\r\n\t\tint i = 0;\r\n\r\n\t\t// Calculate the needed size and offset of the int within the binary string.\r\n\t\tint size = intSize - (signedInt ? 1 : 0);\r\n\t\tint offset = intSize * index;\r\n\r\n\t\t// This loop uses simple bit operations to turn the boolean array into an int.\r\n\t\tfor (int a = 0; a < size; a++)\r\n\t\t\ti |= (binary[a + offset] ? 1 : 0) << a;\r\n\r\n\t\t// If the int is signed, flip the value based on the state of the last binary\r\n\t\t// bit.\r\n\t\tif (signedInt)\r\n\t\t\tif (binary[intSize - 1 + offset])\r\n\t\t\t\ti = -i;\r\n\r\n\t\treturn i;\r\n\t}", "public int getIntLE(int index)\r\n/* 383: */ {\r\n/* 384:397 */ ensureAccessible();\r\n/* 385:398 */ return _getIntLE(index);\r\n/* 386: */ }", "public int getIndex() {\r\n \t\t\treturn index;\r\n \t\t}", "public abstract int getIndex();", "public Integer getInteger(final int index) {\n Object returnable = this.get(index);\n if (returnable == null) {\n return null;\n }\n if (returnable instanceof String) {\n /* A String can be used to construct a BigDecimal. */\n returnable = new BigDecimal((String) returnable);\n }\n return ((Number) returnable).intValue();\n }", "@Override\n public int get(int index) {\n checkIndex(index);\n return getEntry(index).value;\n }", "public int getIndex()\n {\n return index;\n }", "public int getDigit(int index) {\n\t\tif (index < 0 || index > data.length - 1) {\n\t\t\tSystem.out.println(\"cease this buffoonery.\");\n\t\t\tthrow new IllegalArgumentException();\n\t\t}\n\t\treturn data[index];\n\t}", "public int getPosition();", "public int getElement(int index){\n if(index <0 || index >= array.length){\n throw new RuntimeException(\"Array index out of bound\");\n }\n return array[index];\n }", "public Object get(int index);", "public Object get(int index);", "int getItem(int index);", "private int getIndex() {\n\t\treturn this.index;\r\n\t}", "public int get(int i) {\n\t\tassert i < size();\n\t\treturn arr[i];\n\t}", "Object get(int index);", "Object get(int index);", "public int getIndex()\n {\n return m_index;\n }", "public Integer get(int index) {\r\n return dice.get(index);\r\n }", "public long getElem(int index) {\r\n return a[index];\r\n }", "int index();", "public abstract long getIndex();", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getValueAtIndex(int index) {\n if (index < arraySize)\n return theArray[index];\n\n return 0;\n }", "public int getDigit(int position) {\r\n return array[position];\r\n }", "public int getIndex() {\r\n return _index;\r\n }", "public int getIndex() {\r\n return _index;\r\n }", "public synchronized final int getIndex() {\r\n return f_index;\r\n }", "public Integer getIndex() {\n return index;\n }", "byte get(int index);", "public int getIndex() {\n \t\treturn index;\n \t}", "public int get(final int index) {\n return mFactorBase[index];\n }", "public int getIndex() {\n return index;\n }", "public int getInt(int index) {\n if (index < 0 || index >= size) {\n throw new IndexOutOfBoundsException(\"Invalid index: \" + index);\n }\n\n int startIndex = index * bitNum;\n int blockIndex = startIndex / BLOCK_SIZE;\n int bitIndex = startIndex % BLOCK_SIZE;\n int x = vector[blockIndex];\n\n x >>>= bitIndex;\n int b = Math.min(bitNum, BLOCK_SIZE - bitIndex);\n x &= (1 << b) - 1;\n\n if (b < bitNum) {\n x |= vector[blockIndex + 1] << b;\n x &= (1 << bitNum) - 1;\n }\n\n return x;\n }", "public int getIndex(){\r\n \treturn index;\r\n }", "public int index();", "short getKeyIx();", "public final int getPos() { return i; }", "public Integer getIdx() {\r\n\t\treturn idx;\r\n\t}", "public java.lang.Integer getPosition() {\n return position;\n }", "@JsOverlay\n\tpublic final int getIndex() {\n\t\t// checks if there is the property\n\t\tif (ObjectType.UNDEFINED.equals(JsHelper.get().typeOf(this, \"index\"))) {\n\t\t\treturn Undefined.INTEGER;\n\t\t}\n\t\treturn getNativeIndex();\n\t}", "public int getIndex()\n {\n return index;\n }", "public int PositionGet();", "private int getInt(int location) {\n return intArray[location];\n }", "public int getElement(int index) {\r\n\t\t//Defensive\r\n\t\tif (index < 0) {\r\n\t\t\tthrow new IllegalArgumentException(\"Index less than zero\");\r\n\t\t}\r\n\t\tif (index >= getLength()) {\r\n\t\t\tthrow new IllegalArgumentException(\"Index out of upper bound\");\r\n\t\t}\r\n\t\tif (getLength() <= 0) {\r\n\t\t\tthrow new IllegalArgumentException(\"The array does not yet exist\");\r\n\t\t}\r\n\t\t\r\n\t\treturn getNodeAt(index).value;\r\n\t}", "int getIndex() {\n\t\treturn index;\n\t}" ]
[ "0.79232043", "0.769951", "0.7545292", "0.75045764", "0.74318033", "0.74086285", "0.7310804", "0.72438896", "0.72170836", "0.71823573", "0.71823573", "0.71823573", "0.7172445", "0.71525216", "0.71292144", "0.71292144", "0.71292144", "0.71292144", "0.71292144", "0.71292144", "0.71292144", "0.71292144", "0.71292144", "0.71292144", "0.71292144", "0.71292144", "0.71292144", "0.7121548", "0.70298576", "0.70200026", "0.6971475", "0.6968388", "0.69675934", "0.69654036", "0.693786", "0.69165546", "0.69147915", "0.69145495", "0.68936694", "0.687821", "0.6873974", "0.68549955", "0.6850874", "0.6850261", "0.68381023", "0.6829076", "0.68182343", "0.6804572", "0.6801214", "0.67849785", "0.6764426", "0.6741181", "0.6735097", "0.67308605", "0.6726803", "0.6721176", "0.6720144", "0.6715573", "0.6711887", "0.6693943", "0.66892385", "0.66892385", "0.6687871", "0.668538", "0.6683905", "0.66803217", "0.66803217", "0.6680145", "0.66609395", "0.6654457", "0.66523784", "0.6646835", "0.6645565", "0.6645565", "0.6645565", "0.6645565", "0.6645565", "0.6645565", "0.6644012", "0.6643451", "0.6633175", "0.6633175", "0.66274154", "0.6626493", "0.66263086", "0.66256434", "0.66170835", "0.6615782", "0.6608385", "0.6590056", "0.6589814", "0.65806764", "0.6579251", "0.6574034", "0.65739566", "0.6573572", "0.65616566", "0.65581393", "0.6550256", "0.6545341", "0.6544812" ]
0.0
-1
/ Find position of integer n, otherwise return 1
@Override public int indexOf(int n) { int returnInt = -1; for (int i=0; i<size; i++) { if(values[i] == n) returnInt = i; } return returnInt; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static int search(int[] arr, int n, int x, int k) {\n\t\tint i = 0;\n\t\twhile (i < n) {\n\n\t\t\t// If x is found at index i\n\t\t\tif (arr[i] == x)\n\t\t\t\treturn i;\n\n\t\t\t// Jump the difference between\n\t\t\t// current array element and x\n\t\t\t// divided by k We use max here\n\t\t\t// to make sure that i moves\n\t\t\t// at-least one step ahead.\n\t\t\ti = i + Math.max(1, Math.abs(arr[i] - x) / k);\n\n\t\t}\n\n\t\tSystem.out.println(\"number is not\" + \" present!\");\n\n\t\treturn -1;\n\t}", "public int findPosition(int num) {\n\t\t\n\t\tString s = new Integer(num).toString();\n\t\tSystem.out.println(\"After converting input number to string: \" + s);\n\t\t\n\t\tint i = 0, j = 0;\n\t\tint m = s.length(), n = input.length();\n\t\t\n\t\tfor(i = 0; i <= n - m; i++) {\n\t\t\tj = 0;\n\t\t\twhile(j < m && input.charAt(i + j) == s.charAt(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif(j == m) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\t\t\n\t\t\n\t\treturn -1;\n\t}", "private int getPositionInList(Node n) \n\t//PRE: Node n is initialized\n\t//POST: FCTVAL == the position of the Node n in the list\n\t{\n\t\tNode<T> tmp = start;\n\t\tint count = 0;\t//set counter variable to keep track of position\n\t\twhile(tmp != n) //while current node != to node being searched for\n\t\t{\n\t\t\tif(count > length) //make sure position is not greater than max size of list\n\t\t\t{\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tcount++;\t//increment position\n\t\t\ttmp = tmp.next;\t//move to next element\n\t\t}\n\t\treturn count;\t//return count which is the position of the node n in the list\n\t}", "private long getNthUglyNo(long n) {\n\t\tlong i = 1;\n\n\t\t// ugly number count\n\t\tlong count = 1;\n\n\t\twhile (n > count) {\n\t\t\ti++;\n\t\t\tif (isUgly(i) == 1) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn i;\n\t}", "public static int getNthIntValue(String line, int n) {\n // Split the string by non-digits,\n String[] split = RegEx.NOT_NUMBERS.split(RegEx.WITH_NOT_NUMBERS.matcher(line).replaceFirst(Normal.EMPTY));\n if (split.length >= n) {\n return parseIntOrDefault(split[n - 1], 0);\n }\n return 0;\n }", "public int findNthDigit(int n) {\n int len = 1, i = 1;\n long range = 9;\n while (n > len * range) {\n n -= len * range;\n len++;\n range *= 10;\n i *= 10;\n }\n i += (n - 1) / len;\n String s = Integer.toString(i);\n return Character.getNumericValue(s.charAt((n - 1) % len));\n }", "static int findInteger(int arr[], int n) \n { \n int neg = 0, pos = 0; \n int sum = 0; \n \n for (int i = 0; i < n; i++) \n { \n sum += arr[i]; \n \n // If negative, then increment \n // neg count. \n if (arr[i] < 0) \n neg++; \n \n // Else increment pos count.. \n else\n pos++; \n } \n \n return (sum / Math.abs(neg - pos)); \n }", "public static int firstRepeated(int[] arr, int n) {\n int min = Integer.MAX_VALUE;\n for (int i = 0; i < n - 1; i++) {\n int index = LinearSearch.iterative(arr, i + 1, n - 1, arr[i]);\n if (index != -1) {\n if (i < min) {\n min = i;\n }\n }\n }\n if (min == Integer.MAX_VALUE) {\n return -1;\n } else {\n return min + 1;\n }\n }", "int indexOf(int val);", "public int nth(int n) {\r\n int count = -1;\r\n BTNode currentPos = root;\r\n\r\n if (n < 0 || n >= Nodes(currentPos)) throw new NoSuchElementException();\r\n\r\n // loop iterates through the tree (using currentPos = currentPost.left), until it finds\r\n // an item which; the sum of its left nodes is less than n\r\n while (currentPos != null){\r\n int countNodes = Nodes(currentPos.left)+1+count;\r\n if (countNodes > n && Nodes(currentPos.left) != 0) {\r\n currentPos = currentPos.left;\r\n\r\n }\r\n\r\n // if countNodes is less than n, updates a count, then breaks the loop if count == n\r\n else {\r\n count += Nodes(currentPos.left);\r\n count++;\r\n if (count == n)\r\n break;\r\n currentPos = currentPos.right;\r\n }\r\n\r\n }\r\n\r\n\r\n return (int) (currentPos.data);\r\n }", "private int getPosition(node a, node n)\n {\n \tnode childOfa = n;\n \twhile(childOfa.parent != a)\n \t\tchildOfa = childOfa.parent;\n \t\n \tif (a.children == childOfa)\n \t\treturn 0;\n \telse return 1;\n }", "static long closer(int arr[], int n, long x)\n {\n int index = binarySearch(arr,0,n-1,(int)x); \n return (long) index;\n }", "public int findNum(int x){\n\t\t\tif(this.list.length == 0){\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn findNumRec(x, 0, list.length-1);\n\t\t}", "public static int getPosition(int toFind, ArrayList<Integer> arr) {\n int leftBound = 0;\n int rightBound = arr.size() - 1;\n int lastOk = -1;\n int mid;\n while (leftBound <= rightBound) {\n mid = (leftBound + rightBound) / 2;\n if (arr.get(mid) == toFind) {\n return mid;\n } else {\n if (arr.get(mid) < toFind) {\n leftBound = mid + 1;\n } else {\n rightBound = mid - 1;\n }\n }\n }\n return -1;\n }", "public static int searchXElement(int n) {\n if (inicio != null) { // Verifica se a lista e vazia\n auxiliar = inicio; // Aponta o auxiliar para o inicio\n for (int i = 0; i < n - 1; i++) {\n auxiliar = auxiliar.getNext(); // Aponta o auxiliar para o\n // proximo ate chegar a posicao\n // desejada\n }\n \n return auxiliar.getInfo();// Retorna a info do node buscado\n }\n return 0;\n }", "public IntegerValue indexOf(Position position) {\n\t\tIntegerValue sum = IntegerValue.zero();\n\t\tIntegerValue intPos = ((IntegerPos) position).asIntegerVar();\n\t\tStepper stepper = myRegion.simpleRegions(myOrdering);\n\t\ttry {\n\t\t\tIntegerRegion region;\n\t\t\twhile ((region = (IntegerRegion) stepper.fetch()) != null) {\n\t\t\t\tif (region.hasIntMember(intPos)) {\n\t\t\t\t\treturn sum.plus(intPos.minus(((IntegerPos) region.chooseOne(myOrdering)).asIntegerVar()).abs());\n\t\t\t\t} else {\n\t\t\t\t\tsum = sum.plus(region.count());\n\t\t\t\t}\n\t\t\t\tstepper.step();\n\t\t\t}\n\t\t} finally {\n\t\t\tstepper.destroy();\n\t\t}\n\t\tthrow new AboraRuntimeException(AboraRuntimeException.NOT_IN_TABLE);\n\t\t/*\n\t\tudanax-top.st:12709:IntegerArrangement methodsFor: 'accessing'!\n\t\t{IntegerVar} indexOf: position {Position}\n\t\t\t\"Return the index of position into my Region according to my OrderSpec.\"\n\t\t\t| sum {IntegerVar} intPos {IntegerVar} |\n\t\t\tsum _ IntegerVar0.\n\t\t\tintPos _ (position cast: IntegerPos) asIntegerVar.\n\t\t\t(myRegion simpleRegions: myOrdering) forEach: \n\t\t\t\t[:region {IntegerRegion} |\n\t\t\t\t(region hasIntMember: intPos)\n\t\t\t\t\tifTrue: [^sum + (intPos - ((region chooseOne: myOrdering) cast: IntegerPos) asIntegerVar) abs]\n\t\t\t\t\tifFalse: [sum _ sum + region count]].\n\t\t\tHeaper BLAST: #NotInTable.\n\t\t\t^ -1 \"compiler fodder\"!\n\t\t*/\n\t}", "public static int pivotInteger_fast(int n) {\n int total = n * (n + 1) / 2;\n\n double sqrt = Math.sqrt(total);\n\n int x = (int) sqrt;\n\n return sqrt == x ? x : -1;\n }", "private byte getIndex(int n) {\r\n\t\tint originalN = n;\r\n\t\tif (n < Constants.DIMENSION - 1) {\r\n\t\t\tdo {\r\n\t\t\t\tn = Constants.getRandom().nextInt(Constants.DIMENSION);\r\n\t\t\t//} while (n > Constants.FIELD_DIMENSION - 1);\r\n\t\t\t//} while ((n < originalN) || (n > Constants.FIELD_DIMENSION - 1));\r\n\t\t\t} while ((n == originalN) || (n > Constants.DIMENSION - 1));\r\n\t\t}\r\n\t\treturn (byte) n;\r\n\t}", "public Pair<Integer> get_pos(int n)\n {\n \t int row=(n-1)/3;\n \t int col=(n-1)%3;\n \t return new Pair<Integer>(row,col);\n }", "protected final int internalFind(int paramInt)\n/* */ {\n/* 200 */ int i = computeSlot(paramInt);\n/* 201 */ while (this.m_flagTable[i] != false) {\n/* 202 */ if (paramInt == this.m_keyTable[i]) {\n/* 203 */ return i;\n/* */ }\n/* 205 */ i = stepSlot(i);\n/* */ }\n/* 207 */ return -i - 1;\n/* */ }", "public int find(int element) {\r\n\t\tint i = 1;\r\n\t\tfor (; i < list.length && list[i]!= -1; i++) {\r\n\t\t\tif (element==list[i]) {\r\n\t\t\t\tcurrentPosition = i;\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\tcurrentPosition = i;\r\n\t\treturn 101;\r\n\t}", "public int valuePosition(int[] arr, int x) {\n for (int i = 0; i < arr.length; i++)\n if (arr[i] == x) {\n return i;\n }\n return x;\n }", "public static int pivotInteger(int n) {\n int total = n * (n + 1) / 2;\n\n int sum = 0;\n\n for (int i = 1; i <= n; i++) {\n sum += i;\n\n if ((total + i) % 2 == 0 && (total + i) / 2 == sum) {\n return i;\n }\n }\n\n return -1;\n }", "private static int getDigit(final int input, final int n) {\n if (n <= 0) {\n return N_TOO_LOW;\n }\n if (input < Math.pow(10, n - 1)) {\n return DIGIT_NOT_FOUND;\n }\n return (int) Math.floor((input % (int) Math.pow(10, n)) / Math.pow(10, n - 1));\n }", "int getPosition() {\n\n for (int i = 0; i < numbers.length; i++) {\n\n if (numbers[i] == \"0\") {\n\n Toast.makeText(getApplicationContext(), (CharSequence) (\"Position: \" + new Integer(i).toString()), Toast.LENGTH_SHORT).show();\n return i;\n }\n }\n return 0;\n }", "public int sequentialSearch(int[] array, int number){\n for(int i = 0; i < array.length; i++){\r\n // did I find it?\r\n if(array[i] == number){\r\n // tell them where\r\n return i;\r\n }\r\n }\r\n // didn't find it\r\n return -1;\r\n }", "@Override\n\tpublic int find(int pValueToFind) {\n\t\tfor (int n = 0; n < pointer; ++n) {\n\t\t\tif (values[n] == pValueToFind) {\n\t\t\t\t// this returns the index position\n\t\t\t\treturn n;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public int match(int n){\n if(n == random){\n return 0;\n }\n else if(Math.abs(random - n) < Math.abs(random - temp)){\n return 1;\n }\n else{\n return -1;\n }\n }", "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 }", "public int search(long n, int head, int tail) {\n if (head == tail)\n return head;\n int mid = (head + tail) / 2;\n long midValue = list.get(mid);\n if (n <= midValue) {\n return search(n, head, mid);\n } else {\n return search(n, mid + 1, tail);\n }\n }", "public static long findNum(long m) {\n if (m > 0 && m < Long.MAX_VALUE) {\n /**\n * Algo:\n *\n * (1 pow 3) = 1 ---> this will be the case, if input \"m\" is 1 (then result \"n\" = 1)\n * (2 pow 3) + (1 pow 3) = 9 ---> if input \"m\" is 9 (then result \"n\" = 2)\n * (3 pow 3) + (2 pow 3) + (1 pow 3) = 36 ---> if input \"m\" is 36 (then result \"n\" = 3)\n * (4 pow 3) + (3 pow 3) + (2 pow 3) + (1 pow 3) = 100 ---> if input \"m\" is 100 (then result \"n\" = 4)\n *\n *\n * Let's start with counter i = 1;\n * calculate m - (i pow 3), then if result is 0 then n = i\n *\n * Example, consider m = 9,\n * store m in some variable ---> result = 9\n * calculate result - (1 pow 3) = 8, then return i if result = 0, if not increment i\n * calculate result - (2 pow 3) = 0, then return i if result = 0, if not increment i\n *\n * continue this loop until result = 0, in any step if result < 0, then exit from loop and return -1\n */\n\n long result = m;\n for (int i = 1; i < Integer.MAX_VALUE; i++) {\n result = result - ((long) Math.pow(i, 3));\n if (result < 0) {\n break;\n } else if (result == 0) {\n return i;\n }\n }\n\n }\n return -1;\n }", "public int findNet(Model n) {\r\n int num = -1;\r\n for (int i = 0; i < models.size(); i++) {\r\n if (getModel(i) == n) {\r\n return i;\r\n }\r\n }\r\n return num;\r\n }", "boolean contains(int n);", "private int searchPosition(int num, int index){\n\n\t\tif(getBoxs().get(index).getNumBoxInt() == num){\n return getBoxs().indexOf(getBoxs().get(index));\n\n }else{\n return searchPosition(num, index + 1);\n\n }\n\t\t\t\n\t\t\n\t}", "private static int nthUglyNumber(int n) {\n if (n == 0) {\n return 1;\n }\n\n int[] dp = new int[n];\n dp[0] = 1;\n int index2 = 0, index3 = 0, index5 = 0;\n for (int i = 1; i < n; i++) {\n dp[i] = Math.min(2 * dp[index2], Math.min(3 * dp[index3], 5 * dp[index5]));\n System.out.println(dp[i]);\n if (dp[i] == 2 * dp[index2]) {\n index2++;\n }\n\n if (dp[i] == 3 * dp[index3]) {\n index3++;\n }\n\n if (dp[i] == 5 * dp[index5]) {\n index5++;\n }\n }\n\n return dp[n - 1];\n }", "private int getInt(int n) {\n if (n < 0)\n return 0;\n if (n >= mag.length)\n return signInt();\n\n int magInt = mag[mag.length-n-1];\n\n return (signum >= 0 ? magInt :\n (n <= firstNonzeroIntNum() ? -magInt : ~magInt));\n }", "public static long findNb(long m) {\n\n long res = -1, i = 0, sum = 0;\n\n while (sum < m) {\n\n i++;\n sum += i * i * i;\n\n if (sum == m) {\n res = i;\n break;\n }\n }\n\n return res;\n }", "public int find(int value) {\n \t\tfor (int i=0; i<data.length; i++) {\n \t\t\tif (data[i]==value) return i;\n \t\t}\n \t\t\t\n \t\treturn -1;\n \t}", "public int getIndex(int position);", "public static BigInteger getNth(long n)\n {\n if (n == 0 || n == 1) { return BigInteger.valueOf(n); }\n else { return power(atom, n - 1)[0][0]; } \n }", "private int getNthNotExcludedNumber(int nth,Set<Integer> excludedNumbers) {\n\t\tint result = -1;\r\n\t\twhile (nth >= 0) {\r\n\t\t\tresult++;\r\n\t\t\tif (excludedNumbers.contains(result)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t} else {\r\n\t\t\t\tnth--;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "public static int binary_search(int[] array, int n, int value)\n {\n int low = 0;\n while (low <= n) {\n int middle = (low + n) / 2;\n if (value == array[middle]) {\n return middle;\n }\n else if (value < array[middle]) {\n n = middle - 1;\n }\n else {\n low = middle + 1;\n }\n }\n return -1;\n \n }", "protected int findPosKey(KeyType key) {\n int kthOddNumber = 1;\n int index = myHashKey(key);\n\n while ((mArray[index].state != EMPTY) &&\n (mArray[index].data.equals(key))) {\n index += kthOddNumber;\n kthOddNumber += 2;\n if (index >= mTableSize) {\n index -= mTableSize;\n }\n }\n return index;\n }", "static\nint\nfindPivot(\nint\narr[], \nint\nn) \n{ \n\nint\ni; \n\nfor\n(i = \n0\n; i < n; i++) \n\n{ \n\nif\n(arr[i] > arr[(i + \n1\n) % n]) \n\nreturn\ni; \n\n} \n\nreturn\n0\n; \n}", "private static int findMissingNumber( int[] a, int n) {\n int result = 0;\n for(int i=1; i<(n+1)+1; i++) {\n result = result ^ i;\n }\n for(int i=0; i<a.length; i++) {\n result = result ^ a[i];\n }\n return result;\n }", "private int rightmostDip() {\n for (int i = n - 2; i >= 0; i--) {\n if (index[i] < index[i + 1]) {\n return i;\n }\n }\n return -1;\n }", "public int indexPosition(int i) {\n \t\tint min=0; int max=data.length;\n \t\twhile (min<max) {\n \t\t\tint mid=(min+max)>>1;\n \t\t\tint mi=data[mid];\n \t\t\tif (i==mi) return mid;\n \t\t\tif (i<mi) {\n \t\t\t\tmax=mid;\n \t\t\t} else {\n \t\t\t\tmin=mid+1;\n \t\t\t}\n \t\t}\n \t\treturn -1;\n \t}", "int fibonacciNumberFinder(int n){\n if (n <= 1){\n return n;\n }\n return fibonacciNumberFinder(n - 1) + fibonacciNumberFinder(n - 2);\n }", "private static int determineSequence(int n) {\n\n // If the value is 1 or 2 (base case)\n if (n == 1 || n == 2) {\n return 1;\n } else {\n return determineSequence(n - 1) + determineSequence(n - 2);\n }\n }", "private int findPos( AnyType x )\n {\n int offset = 1;\n int currentPos = myhash( x );\n \n while( array[ currentPos ] != null &&\n !array[ currentPos ].key.equals( x ) )\n {\n currentPos += offset; // Linear probing.\n if( currentPos >= array.length )\n currentPos -= array.length;\n }\n \n return currentPos;\n }", "private int findPosition(int[] src, int start, int end, int key) {\n\t\tif (end < start || start < 0)\n\t\t\treturn -1;\n\n\t\tfor (int i = start; i <= end; i++) {\n\t\t\tif (src[i] == key) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t} \n\n\t\treturn -1;\n\t}", "public int nthUglyNumber(int n) {\n TreeSet<Long> set = new TreeSet<>();\n set.add(1L);\n long current = 1;\n for(int i = 0; i < n; i++){\n current = set.pollFirst();\n set.add(current*2);\n set.add(current*3);\n set.add(current*5);\n }\n return (int)current;\n }", "public int solve(int n) {\n return n & ~(n - 1);\n }", "public long getIndex(long number) {\r\n\t\tlong digit;\r\n\t\tlong divide=number/div;\r\n\t\tdigit=divide%radix;\r\n\t\treturn digit;\r\n\t}", "private int findAvailableNo() {\n\t\t//TODO: Maybe add a check that a number doesn't already exist even though it is almost impossible\n\t\tboolean notfound = true;\n\t\tint number = 0;\n\t\tnumber = RANDOM_NUMBER.nextInt(Integer.MAX_VALUE);\n\t\t\n\t\treturn number;\n\t}", "public int firstBadVersion(int n) {\n if (n == 0) {\n return 0;\n } else if (n == 1) {\n if (isBadVersion(n)) {\n return n;\n } else {\n return 0;\n }\n } else {\n int index = Integer.MAX_VALUE;\n int start = 1, end = n;\n\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (isBadVersion(mid)) {\n if (mid < index) {\n index = mid;\n }\n end = mid;\n } else {\n start = mid;\n }\n }\n\n if (isBadVersion(start)) {\n if (start < index) {\n index = start;\n }\n }\n\n if (isBadVersion(end)) { // start + 1 = end\n if (end < index) {\n index = end;\n }\n }\n\n return index;\n }\n }", "default int findIndexOfNext(int vidxa, int vidxb) {\n for (int i = 0, n = getNextCount(vidxa); i < n; i++) {\n if (vidxb == getNext(vidxa, i)) {\n return i;\n }\n }\n return -1;\n }", "protected int t(int n) {\r\n\t\treturn Math.floorDiv(n * (n - 1), 2);\r\n\t}", "public static int nthIndexOf(String str, String substr, int n) {\n int pos = -1;\n while (n > 0) {\n if (pos >= str.length()) {\n return -1;\n }\n if ((pos = str.indexOf(substr, pos + 1)) == -1) {\n break;\n }\n n--;\n }\n return pos;\n }", "public static int findIdxOfGreatestValueLesserThanOrEqualToN(long[] a, long n) {\n\t\tint lo = 0;\n\t\tint hi = a.length - 1;\n\t\t// int loops = 0;\n\t\twhile (lo <= hi) {\n\t\t\t// ++loops;\n\t\t\t// Key is in a[lo..hi] or not present.\n\t\t\tint mid = lo + (hi - lo) / 2;\n\t\t\tif (n < a[mid]) hi = mid - 1;\n\t\t\telse if (n > a[mid]) lo = mid + 1;\n\t\t\telse return mid; // Equality Match!\n\t\t}\n\t\t// System.err.println(\"k: \" + n + \", loops: \" + loops);\n\t\tif (hi < 0) return -1; // Less than lowest\n\t\telse if (lo >= a.length) return a.length - 1; // Greater than highest\n\t\telse return hi; // Greatest lower element\n\t}", "public int find(int p) {\n\t\tvalidate(p);\n\t\twhile (p != id[p])\n\t\t\tp = id[p];\n\t\treturn p;\n\t}", "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}", "int toIndex(int x, int y);", "public int findMagicIndex(int[] nums) {\n int res = -1;\n for(int i = 0 ; i < nums.length ; i++){\n if(nums[i] == i){\n res = i;\n break;\n }\n }\n return res;\n }", "public Integer getPosition();", "private int goalEntry0ind(int r, int c) {\n if (r == N - 1 && c == N - 1) return 0;\n else return N * r + c + 1;\n }", "private int find(Account account) { \n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif(account.equals(accounts[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}", "public int indexOf(Fraction x)\r\n\t{\r\n\t\tfor(int i=0;i<n;i++)\r\n\t\t\tif(x.gettu()==a[i].gettu() && x.getmau()==a[i].getmau())\r\n\t\t\t\treturn i;\r\n\t\treturn -1;\r\n\t}", "public RTWLocation firstN(int n);", "public static int equilibriumPoint(long arr[], int n) {\n long sum=0;\n for(int i=0;i<n;++i){\n sum+=arr[i];\n }\n long right=0;\n for(int i=n-1;i>=0;i--){\n if(right==sum-(arr[i]+right))\n return i+1;\n right+=arr[i];\n }\n return -1;\n }", "public int getPosition(int data) {\n\t\t// go looking for the data\n\t\tListNode temp = head;\n\t\tint pos = 0;\n\t\twhile (temp != null) {\n\t\t\tif (temp.getData() == data) {\n\t\t\t\t// return the position if found\n\t\t\t\treturn pos;\n\t\t\t}\n\t\t\tpos += 1;\n\t\t\ttemp = temp.getNext();\n\t\t}\n\t\t// else return -1\n\t\treturn Integer.MIN_VALUE;\n\t}", "protected int findNonEmptyPosition() {\n\t\t\twhile (!set.bv[++indice]) {\n\t\t\t}\n\t\t\treturn indice;\n\t\t}", "static int find(int decimal_number) \r\n { \r\n if (decimal_number == 0) \r\n return 0; \r\n \r\n else\r\n \r\n return (decimal_number % 2 + 10 * \r\n find(decimal_number / 2)); \r\n }", "public static int getLeftMostSetBitPosition(int integer){\n\t\t\n\t\tint ret = -1 ;\n\t\tif(integer < 0){\n\t\t\treturn Integer.SIZE -1 ;\n\t\t}\n\t\t\n\t\twhile(integer > 0){\n\t\t\tret++;\n\t\t\tinteger = integer >> 1;\n\t\t}\n\t\t\n\t\treturn ret ;\n\t\t\n\t}", "public int findKthNumber(int m, int n, int k) {\n int low = 1, high = m * n + 1, mid;\n\n while (low < high) {\n mid = low + ((high - low) >> 1);\n if (count(mid, m, n) >= k) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n return high;\n }", "public static int findIndex(int[] arr, int t) {\n\t\tint len = arr.length;\n\n\t\treturn IntStream.range(0, len).filter(i -> t == arr[i]).findAny().orElse(-1);\n\t}", "static int findPos(int []arr, int key)\n\t{\n\t\tint low=0, high =1;\n\t\tint val =arr[0];\n\t\t\n\t\twhile(val<key)\n\t\t{\n\t\t\tlow= high; //// store previous high check that 2*h doesn't exceeds array length to prevent ArrayOutOfBoundException\n\t\t\tif (2*high < arr.length -1)\n\t\t\t\thigh =2*high;\n\t\t\telse\n\t\t\t\thigh =arr.length -1;\n\t\t\t\n\t\t\tval = arr[high];\n\t\t}\n\t\treturn binarySearch(arr,low,high,key);\n\t}", "public int getPosition(int data) {\n\t\tListNode temp = head;\n\t\tint pos = 0;\n\t\twhile (temp != null) {\n\t\t\tif (temp.getData() == data) {\n\t\t\t\treturn pos;\n\t\t\t}\n\t\t\tpos += 1;\n\t\t\ttemp = temp.getNext();\n\t\t}\n\t\treturn Integer.MIN_VALUE;\n\t}", "public int Search(int key)\n {\n for(int i=0; i<n; i++)\n {\n if(a[i]==key)\n return 1;\n }\n return 0;\n }", "private int findPos(String x) {\n\t int offset = 1;\n\t int currentPosition = myhash(x);\n\t \n\t while (array[currentPosition] != null && !array[currentPosition].element.getContent().equals(x)) {\n\t currentPosition += offset; // Compute ith probe\n\t offset += 2;\n\t if(currentPosition >= array.length)\n\t currentPosition -= array.length;\n\t }\n\t \n\t return currentPosition;\n\t }", "public int nextInt(int n) {\n return 0;\n }", "private int findPosition(int id) {\n\t\tfor (int i = 0; i < numOfNode; i++) {\n\t\t\tif (node[i].id == id) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "private int getPos(int key, int index) {\n\t\t// Each bucket contains a list.\n\t\tList<Integer> temp = set[index];\n\t\tif (temp == null) {\n\t\t\treturn -1;\n\t\t}\n\t\t// Iterate all the elements in the bucket to find the target key.\n\t\tfor (int i = 0; i < temp.size(); i++) {\n\t\t\tif (temp.get(i) == key) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public int getPosition(int data) {\n DoublyLinkedList temp = head;\n int pos = 0;\n while (temp != null) {\n if (temp.getData() != data) {\n pos += 1;\n temp = temp.getNext();\n } else {\n // as the specific node is found, return it.\n return pos;\n }\n }\n return Integer.MIN_VALUE;\n }", "public int getPlayerPieceIndexByPosition(Position position) {\n for (int i = 0; i < playerPiecePositions.length; i++) {\n if (playerPiecePositions[i].equals(position)) {\n return i;\n }\n }\n return -1;\n }", "private int firstNonzeroIntNum() {\n \tif (firstNonzeroIntNum == -2) {\n \t // Search for the first nonzero int\n \t int i;\n \t for (i=magnitude.length-1; i>=0 && magnitude[i]==0; i--)\n \t\t;\n \t firstNonzeroIntNum = magnitude.length-i-1;\n \t}\n \treturn firstNonzeroIntNum;\n }", "public int findIntegers(int n) {\n int[][]template=new int[32][2];\n\n //when the max length the array is one, we know that whether the max bit is one or zero, the arr value is 1\n template[1][0]=1;\n template[1][1]=1;\n\n for (int i = 2; i < 32; i++) {\n template[i][0]=template[i-1][0]+template[i-1][1];\n template[i][1]=template[i-1][0];\n }\n\n int answ=0;\n int pre=0;\n\n //we need to change n to binary expression\n List<Integer>binaryExpression=new ArrayList<>();\n int current=n;\n while (current!=0)\n {\n binaryExpression.add(current&1);\n current=current>>1;\n }\n for (int i = binaryExpression.size()-1; i>=0; i--) {\n Integer currentBit = binaryExpression.get(i);\n for (int j = 0; j < currentBit; j++) {\n answ+=template[i+1][j];\n }\n if (currentBit==1&&pre==1)\n {\n break;\n }\n pre=currentBit;\n if (i==0)\n {\n answ++;\n }\n }\n return answ;\n }", "public static int search(int[] a, int x) {\n int lo = 0;\n int hi = a.length;\n \n while (lo < hi) { // step 1\n // INVARIANT: if a[j]==x then lo <= j < hi; // step 3\n int i = (lo + hi)/2; // step 4\n if (a[i] == x) {\n return i; // step 5\n } else if (a[i] < x) {\n lo = i+1; // step 6\n } else {\n hi = i; // step 7\n }\n }\n return -1; // step 2\n }", "static int findOneMissingNumber(int a[]) {\n int number = 0;\n int size = a.length;\n for (int i = 0; i < size; i++)\n number ^= ((i + 1) ^ a[i]);\n number ^= (size + 1);\n return number;\n }", "public static int next(int n)\n { \n int x = 0;\n if(n%2 == 0)\n {\n return n/2;\n }\n else\n {\n return (3*n)+1;\n }\n }", "public int get(int position) {\n return Integer.MIN_VALUE;\n }", "private int getNum() {\r\n int i = currentNum.incrementAndGet();\r\n if (i < 0)\r\n i = -i;\r\n return i % n;\r\n }", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();" ]
[ "0.6702505", "0.6510095", "0.6482469", "0.64503", "0.64342654", "0.64057696", "0.6404258", "0.6316163", "0.6270715", "0.6254468", "0.6219619", "0.6206394", "0.6172619", "0.61610544", "0.607459", "0.606535", "0.60534596", "0.6044915", "0.60419464", "0.5994878", "0.59829664", "0.5979667", "0.5975299", "0.59635085", "0.5932399", "0.5920761", "0.5914372", "0.5885506", "0.58848214", "0.58762044", "0.58743495", "0.5872671", "0.5864118", "0.5863574", "0.58625066", "0.58548194", "0.5851523", "0.5847129", "0.5842086", "0.5834798", "0.5825359", "0.58101475", "0.5794265", "0.5789612", "0.578778", "0.57853484", "0.57827294", "0.5780768", "0.57735705", "0.57629675", "0.5749245", "0.57462394", "0.5741155", "0.5739854", "0.5733861", "0.57276016", "0.5723687", "0.5723065", "0.5720809", "0.571746", "0.57167727", "0.57126653", "0.571251", "0.5709215", "0.57058907", "0.5705277", "0.56993", "0.56943923", "0.56867427", "0.5683906", "0.56819284", "0.5679351", "0.5676632", "0.56691045", "0.56674165", "0.56568325", "0.56559235", "0.5654554", "0.5653045", "0.5650842", "0.5648129", "0.5645633", "0.56425875", "0.5642273", "0.56394213", "0.5637253", "0.5636577", "0.5635446", "0.563004", "0.5621843", "0.56213623", "0.56130993", "0.5612706", "0.5612706", "0.5612706", "0.5612706", "0.5612706", "0.5612706", "0.5612706", "0.5612706" ]
0.6909466
0
if checkbox is checked
@Override public void dismiss() { if(chk.isChecked()){ //make file languageFixed.txt File setting = null; setting = makeDirectory(external_path+"/OurMenu/setting/"); makeFile(setting, external_path+"/OurMenu/setting/tutorialNo.txt"); } super.dismiss(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean getIsChecked();", "boolean isChecked();", "boolean isChecked();", "public boolean CheckBox() {\n if (AseguradoCulpable.isSelected()) {\n return true;\n } else {\n return false;\n }\n }", "private boolean checkBox() {\n if(ToSCheckBox.isSelected()) { return true; }\n else {\n errorMessage.setText(\"Please check that you have read and agree to \" +\n \"the Terms of Service agreement.\");\n return false;\n }\n }", "public boolean isSelected() {\n return checkbox.isSelected();\n }", "public Boolean isChecked(){\n return aSwitch.isChecked();\n }", "@Override\n\tpublic boolean isChecked() {\n\t\treturn ischecked;\n\t}", "public boolean isChecked() {\r\n\t\treturn getCheck().isSelected();\r\n\t}", "@Override \r\n public void onCheckedChanged(CompoundButton buttonView, \r\n boolean isChecked) {\n if(isChecked){ \r\n Log.d(TAG, \"Selected\");\r\n }else{ \r\n Log.d(TAG, \"NO Selected\");\r\n } \r\n }", "boolean getCheckState();", "@Override\n\tpublic boolean isChecked() {\n\t\treturn checked;\n\t}", "private boolean checkSingleCheckBox (int checkBoxId) {\n CheckBox checkbox = (CheckBox) findViewById(checkBoxId);\n return checkbox.isChecked();\n }", "public void checkbox() {\r\n\t\tcheckBox.click();\r\n\t}", "CheckBox getCk();", "boolean getVisible(ActionEvent event) {\n JCheckBox box = (JCheckBox) event.getSource();\n return box.isSelected();\n }", "private boolean checkboxQuestion() {\n CheckBox detectiveCheck = (CheckBox) findViewById(R.id.greatest_detective);\n CheckBox greatestCheck = (CheckBox) findViewById(R.id.dark_knight);\n CheckBox boyWonderCheck = (CheckBox) findViewById(R.id.boy_wonder);\n CheckBox manOfSteelCheck = (CheckBox) findViewById(R.id.man_of_steel);\n\n boolean detectiveCheckChecked = detectiveCheck.isChecked();\n boolean greatestCheckChecked = greatestCheck.isChecked();\n boolean boyWonderCheckChecked = boyWonderCheck.isChecked();\n boolean manOfSteelCheckChecked = manOfSteelCheck.isChecked();\n\n return detectiveCheckChecked && greatestCheckChecked && !boyWonderCheckChecked && !manOfSteelCheckChecked;\n\n }", "@Override\n public void onCheck(boolean isChecked) {\n Log.e(\"isChecked\", \"onCheck: isChecked=\" + isChecked);\n }", "@Override\n public void onCheck(boolean isChecked) {\n Log.e(\"isChecked\", \"onCheck: isChecked=\" + isChecked);\n }", "public Boolean getCheckBox() {\n return (Boolean) getAttributeInternal(CHECKBOX);\n }", "public void toglecheckbox(CheckBox ch){\n\t if(ch.isChecked()){\n\t ch.setText(\"This is my business card\");\n\t isyourcard = \"yes\";\n\t }else{\n\t ch.setText(\"This is not my business card\");\n\t isyourcard = \"no\";\n\t }\n\t }", "public boolean checkbox(String identifier) {\n WebElement input = getCheckbox(identifier);\n\n return input.isSelected();\n }", "public boolean isChecked() {\n return checked;\n }", "@Override\n public void onCheck(boolean isChecked) {\n Log.e(\"isChecked\", \"onCheck: isChecked=\" + isChecked);\n }", "boolean isCheckedOut();", "boolean isSelected();", "boolean isSelected();", "boolean isSelected();", "public void onCheckboxClicked(View view) {\n boolean aprendido = ((CheckBox) view).isChecked();\n\n // Check which checkbox was clicked\n switch (view.getId()) {\n case R.id.checkboxAprendido:\n if (aprendido == true) {\n // Put some meat on the sandwich\n break;\n }\n }\n }", "@Override\n public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n if (isChecked) {\n\n } else {\n\n }\n }", "public void onCheckboxClicked(View view) {\n boolean checked = ((CheckBox) view).isChecked();\n\n // Check which checkbox was clicked\n switch(view.getId()) {\n case R.id.checkbox_termos:\n if (checked) {\n termosAceitos = true;\n }else {\n termosAceitos = false;\n }\n break;\n }\n }", "public boolean isChecked()\n\t{\n\t\treturn checked;\n\t}", "@Override\n\t\t\tpublic boolean checkPreconditions(){\n\t\t\t\treturn topLevelCheckbox.getSelection();\n\t\t\t}", "@Override\n\t\t\tpublic boolean checkPreconditions(){\n\t\t\t\treturn topLevelCheckbox.getSelection();\n\t\t\t}", "@Override\n\t\t\tpublic boolean checkPreconditions(){\n\t\t\t\treturn topLevelCheckbox.getSelection();\n\t\t\t}", "public void onCheckboxClicked(View view) {\n checked = ((CheckBox) view).isChecked();\n\n // Check which checkbox was clicked\n switch(view.getId()) {\n case R.id.checkBox2:\n if (checked)\n {\n email_confirmation.setChecked(false);\n email_notification.setChecked(false);\n emailPref = \"No\";\n\n }\n else\n {\n emailPref = \"Yes\";\n email_confirmation.setChecked(true);\n email_notification.setChecked(true);\n }\n break;\n\n }\n }", "public void onCheckboxClicked(View view) {\n boolean checked = ((CheckBox) view).isChecked();\n\n // Check which checkbox was clicked\n switch (view.getId()) {\n case R.id.cb_cod:\n if (cb_cod.isChecked()) {\n cod = \"1\";\n } else {\n cod = \"0\";\n }\n\n\n break;\n }\n }", "public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n if (isChecked) {\n\n // Set the appropriate text for the Checkbox\n cb.setText(\"This checkbox is: checked\");\n\n // Log checked message\n Log.i(TAG, \"onCheckedChanged: This checkbox is: checked\");\n\n } else { // If the Checkbox isn't checked ...\n\n // Set the appropriate text for the Checkbox\n cb.setText(\"This checkbox is: unchecked\");\n\n // Log unchecked message\n Log.i(TAG, \"onCheckedChanged: This checkbox is: unchecked\");\n\n }\n }", "@Override\n public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n RowData data = (RowData) viewHolder.chkBox.getTag();\n if (isChecked) {\n\n checkBoxState.set(data.position, true);\n Log.i(tag, \"cursor.getPosition(true) with onChecked Listener : \" + data.position);\n }\n else {\n checkBoxState.set(data.position, false);\n Log.i(tag, \"cursor.getPosition(false) with onChecked Listener : \" + data.position);\n }\n }", "public void setChecked()\n\t{\n\t\tchecked = true;\n\t}", "public void checkbox(String identifier, boolean value) {\n WebElement input = getCheckbox(identifier);\n boolean current = input.isSelected();\n\n if (value != current) {\n input.click();\n }\n\n if (value) {\n Graphene.waitGui().until().element(input).is().selected();\n } else {\n Graphene.waitGui().until().element(input).is().not().selected();\n }\n }", "public boolean isChecked () {\n // declaring local variables\n WebElement webElement;\n String className;\n boolean returnValue = true;\n\n if (isStubbed()) {\n log(\"=== This checkbox's locator is currently stubbed out. Returning value '\" + returnValue + \"' ===\");\n } else {\n // getting the web element with the default timeout\n webElement = getWebElement();\n\n returnValue = webElement.isSelected();\n }\n\n return returnValue;\n }", "private void rdnamActionPerformed(java.awt.event.ActionEvent evt) {\n if( rdnam.isSelected())\n { \n gt= true;\n }\n \n \n }", "@Override\n public void onCheckedChanged(CompoundButton arg0, boolean arg1) {\n if (arg1 == true) {\n }\n { //Do something\n kc.setChecked(false);\n }\n //do something else\n lbButton = true;\n\n }", "@Override\n public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n if(isChecked) {\n Toast.makeText(SettingsActivity.this, getString(R.string.gpu_on), Toast.LENGTH_LONG).show();\n }\n else {\n Toast.makeText(SettingsActivity.this, getString(R.string.gpu_off), Toast.LENGTH_LONG).show();\n }\n\n Log.v(\"GPU=\", \"\" + isChecked);\n }", "public boolean isChecked() {\n\t\treturn checked;\n\t}", "@JsProperty boolean getChecked();", "@Override\n public void onCheckedChanged(CompoundButton buttonView,\n boolean isChecked) {\n LoginActivity.this.isChecked=isChecked;\n if(isChecked){\n\n }else{\n\n }\n }", "private static boolean checkbox(WebElement element, String sLog, WebElement ajax, int nMaxWaitTime,\n\t\t\tboolean bException, CheckBox checkbox)\n\t{\n\t\t// Is check box enable/selected?\n\t\tboolean bEnabled = Framework.isElementEnabled(element);\n\t\tboolean bChecked = Framework.isElementSelected(element);\n\n\t\t// Does user want to skip taking action?\n\t\tif (checkbox.skip)\n\t\t{\n\t\t\tString sMessage = \"Check box for '\" + sLog + \"' was skipped. The check box was \";\n\t\t\tif (bEnabled)\n\t\t\t\tsMessage += \"enabled\";\n\t\t\telse\n\t\t\t\tsMessage += \"disabled\";\n\n\t\t\tif (bChecked)\n\t\t\t\tsMessage += \" and selected\";\n\t\t\telse\n\t\t\t\tsMessage += \" and not selected\";\n\n\t\t\tLogs.log.info(sMessage);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Do we need to take action based on current state?\n\t\t\tboolean bTakeAction = false;\n\t\t\tif (checkbox.check)\n\t\t\t{\n\t\t\t\tif (bChecked)\n\t\t\t\t\tLogs.log.info(\"Check box for '\" + sLog + \"' was already selected\");\n\t\t\t\telse\n\t\t\t\t\tbTakeAction = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (bChecked)\n\t\t\t\t\tbTakeAction = true;\n\t\t\t\telse\n\t\t\t\t\tLogs.log.info(\"Check box for '\" + sLog + \"' was already unselected\");\n\t\t\t}\n\n\t\t\t// Only click the check box if it is necessary to make it the desired state by the user\n\t\t\tif (bTakeAction)\n\t\t\t{\n\t\t\t\treturn click(element, sLog, ajax, nMaxWaitTime, bException);\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "@Override\n public void onCheckedChanged(CompoundButton arg0, boolean arg1) {\n if (arg1 == true) {\n }\n { //Do something\n li.setChecked(false);\n }\n //do something else\n kgButton = true;\n }", "private void setCheckBoxChecked() {\n grupoRespuestasUnoMagnitudes.check(radioChecked[0]);\n grupoRespuestasDosMagnitudes.check(radioChecked[1]);\n grupoRespuestasTresMagnitudes.check(radioChecked[2]);\n grupoRespuestasCuatroMagnitudes.check(radioChecked[3]);\n grupoRespuestasCincoMagnitudes.check(radioChecked[4]);\n grupoRespuestasSeisMagnitudes.check(radioChecked[5]);\n grupoRespuestasSieteMagnitudes.check(radioChecked[6]);\n grupoRespuestasOchoMagnitudes.check(radioChecked[7]);\n grupoRespuestasNueveMagnitudes.check(radioChecked[8]);\n grupoRespuestasDiezMagnitudes.check(radioChecked[9]);\n }", "@Step(\"Select and assert checkboxes\")\n public void selectCheckBox() {\n //http://selenide.org/javadoc/3.5/com/codeborne/selenide/SelenideElement.html\n $(\"label:contains('Water')\").scrollTo();\n $(\"label:contains('Water')\").setSelected(true);\n $(\".label-checkbox:contains('Water') input\").shouldBe(checked);\n logList.add(CHECKBOX1.toString());\n $(\".label-checkbox:contains('Wind')\").scrollTo();\n $(\".label-checkbox:contains('Wind')\").setSelected(true);\n $(\".label-checkbox:contains('Wind') input\").shouldBe(checked);\n logList.add(CHECKBOX2.toString());\n }", "private boolean checkQuestion6() {\n CheckBox answer1CheckBox = (CheckBox) findViewById(R.id.q_6_answer_1);\n CheckBox answer2CheckBox = (CheckBox) findViewById(R.id.q_6_answer_2);\n CheckBox answer3CheckBox = (CheckBox) findViewById(R.id.q_6_answer_3);\n if (answer1CheckBox.isChecked() && answer2CheckBox.isChecked() && answer3CheckBox.isChecked()) {\n return true;\n }\n return false;\n }", "public void tickCheckBox() {\r\n\t\tcheckBox = driver.findElement(checkBoxSelector);\r\n\t\tcheckBox.click();\r\n\t\t\r\n\t}", "public boolean asFragment() {\n\t\treturn jCheckBoxCff.isSelected();\n\t}", "boolean hasSelectedTransport()\n {\n for(JCheckBoxMenuItem item : transportMenuItems.values())\n {\n if(item.isSelected())\n return true;\n }\n\n return false;\n }", "public void checkedMode(boolean b) {\n setSelected(shellBot.checkBox(\"Run in checked mode\"), b);\n }", "@Override\r\n\t\t\tpublic void onCheckedChanged(CompoundButton buttonView,\r\n\t\t\t\t\tboolean isChecked) {\n\t\t\t\tif(isChecked){\r\n\t //update the status of checkbox to checked\r\n\t \r\n\t checkedItem.set(p, true);\r\n\t idList.set(p,id);\r\n\t item.set(p, friend);\r\n\t nameList.set(p, name);\r\n\t }else{\r\n\t //update the status of checkbox to unchecked\r\n\t checkedItem.set(p, false);\r\n\t idList.set(p,null);\r\n\t item.set(p, null);\r\n\t nameList.set(p, null);\r\n\t }\r\n\t\t\t}", "public Boolean getIsCheck()\r\n\t{\r\n\t\treturn isCheck;\r\n\t}", "@Override\n public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n checkBox_seleccionados[position] = holder.chkItem.isChecked();\n }", "@Override\n\t\t\t\t\tpublic void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n\t\t\t\t\t\tContainer element = (Container) viewHolder.ckBox.getTag();\n\t\t\t\t\t\telement.setSelected(buttonView.isChecked());\n\t\t\t\t\t}", "@Override\n public void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (requestCode == Constants.DATA_ENTERED) { //check if data entered\n if (resultCode == RESULT_OK) { //if the result code is ok\n boolean checked = data.getBooleanExtra(Constants.SELECT, false); //checked or not checked boolean\n\n //if checkbox is checked\n if (checked) {\n Toast.makeText(ActivityOne.this, Constants.AGREE, Toast.LENGTH_LONG).show(); //display toast on activity one\n } else {\n Toast.makeText(this, Constants.DISAGREE, Toast.LENGTH_LONG).show(); //display toast on activity one\n }\n }\n }\n }", "public void checkOrUnCheckCheckAllCheckBox(boolean isCheck) {\n try {\n waitForVisibleElement(eleCheckAllCheckBox, \"'CheckAll' check box\");\n hoverElement(eleCheckAllCheckBox, \"Hover 'CheckAll' check box\");\n if (isCheck) {\n if (!eleCheckAllCheckBox.isSelected()) {\n clickElement(eleCheckAllCheckBox, \"Check on 'CheckAll' checkbox\");\n } else {\n clickElement(eleCheckAllCheckBox, \"Un check on 'CheckAll' checkbox\");\n clickElement(eleCheckAllCheckBox, \"Check on 'CheckAll' checkbox\");\n }\n NXGReports.addStep(\"Check on 'CheckAll' check box in ToDo page complete\", LogAs.PASSED, null);\n } else {\n if (eleCheckAllCheckBox.isSelected()) {\n clickElement(eleCheckAllCheckBox, \"Un Check on 'CheckAll' checkbox\");\n } else {\n clickElement(eleCheckAllCheckBox, \"Un check on 'CheckAll' checkbox\");\n clickElement(eleCheckAllCheckBox, \"Check on 'CheckAll' checkbox\");\n }\n NXGReports.addStep(\"UnCheck on 'CheckAll' check box in ToDo page complete\", LogAs.PASSED, null);\n }\n } catch (AssertionError e) {\n AbstractService.sStatusCnt++;\n NXGReports.addStep(\"TestScript Failed: Can not check/uncheck 'CheckAll' check box in ToDo page\", LogAs.FAILED,\n new CaptureScreen(CaptureScreen.ScreenshotOf.BROWSER_PAGE));\n }\n }", "@Override\n public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n }", "private boolean checkQuestion6() {\n chkBox3_Q6 = (CheckBox) findViewById(R.id.chkBox3_Q6);\n chkBox2_Q6 = (CheckBox) findViewById(R.id.chkBox2_Q6);\n chkBox1_Q6 = (CheckBox) findViewById(R.id.chkBox1_Q6);\n if (chkBox3_Q6.isChecked() && !chkBox1_Q6.isChecked() && chkBox2_Q6.isChecked()) {\n return true;\n }\n return false;\n }", "@Override\n public void onCheckedChanged(CompoundButton buttonView,\n boolean isChecked) {\n }", "@Override\n public void onCheckedChanged(CompoundButton buttonView,\n boolean isChecked) {\n if(isChecked){\n //选中\n jumpFlag = 0;\n iv_choose_type.setImageDrawable(getResources().getDrawable(R.mipmap.login_switch_on));\n }else{\n //未选中\n jumpFlag = 1;\n iv_choose_type.setImageDrawable(getResources().getDrawable(R.mipmap.login_switch_off));\n }\n }", "public void verifyCheckAllCheckBoxIsCheckOrUncheck(boolean isCheck) {\n waitForVisibleElement(eleCheckAllCheckBox, \"CheckAll check box\");\n if (isCheck) {\n if (!eleCheckAllCheckBox.isSelected()) {\n AbstractService.sStatusCnt++;\n NXGReports.addStep(\"TestScript Failed: CheckAll check box do not auto check in ToDo page\", LogAs.FAILED,\n new CaptureScreen(CaptureScreen.ScreenshotOf.BROWSER_PAGE));\n return;\n }\n } else {\n if (eleCheckAllCheckBox.isSelected()) {\n AbstractService.sStatusCnt++;\n NXGReports.addStep(\"TestScript Failed: CheckAll check box do not auto uncheck in ToDo page\", LogAs.FAILED,\n new CaptureScreen(CaptureScreen.ScreenshotOf.BROWSER_PAGE));\n return;\n }\n }\n if (isCheck) {\n NXGReports.addStep(\"'CheckAll' check box is check when check all check box in ToDo page\", LogAs.PASSED, null);\n } else {\n NXGReports.addStep(\"'CheckAll' check box is uncheck when uncheck all check box in ToDo page\", LogAs.PASSED, null);\n }\n }", "private CheckBox getCheckbox_recommended() {\n\t\treturn checkbox_recommended;\n\t}", "@Override\n public void onCheckedChanged(CompoundButton buttonView,\n boolean isChecked) {\n\n\n\n }", "private boolean checkAnswerOne() {\n CheckBox correctAnswer1Q1 = findViewById(R.id.qs1Ans1);\n CheckBox correctAnswer2Q1 = findViewById(R.id.qs1Ans3);\n correctAnswer1Q1.setTextColor(Color.parseColor(\"green\"));\n correctAnswer2Q1.setTextColor(Color.parseColor(\"green\"));\n return ((correctAnswer1Q1.isChecked()) && (correctAnswer2Q1.isChecked()));\n }", "private JCheckBox getCheck() {\r\n\t\tif (check == null)\r\n\t\t\tcheck = new JCheckBox();\r\n\t\treturn check;\r\n\t}", "public Object getCheckedValue();", "public Boolean getIsselected() {\n return isselected;\n }", "public Boolean getIsselected() {\n return isselected;\n }", "void onCheckedTriStateChanged(TriStateCheckBox triStateCheckBox, State state);", "public static void checkCheckBox(String objXPath, String objName) throws InterruptedException, IOException{\n\t\tif(driver.findElement(By.xpath(objXPath)).isDisplayed())\n\n\t\t\tif(!(driver.findElement(By.xpath(objXPath)).isSelected())){\n\t\t\t\tdriver.findElement(By.xpath(objXPath)).click();\n\t\t\t\tUpdate_Report( \"Pass\", \"Check box \", objName+\" is checked \");\n\t\t\t}else{\n\t\t\t\tUpdate_Report( \"Pass\", \"Check box \", objName+\" is already checked.\");\n\t\t\t}\n\t\telse\n\t\t{\n\t\t\tUpdate_Report( \"Fail\", \"checkCheckBox \", objName+\" does not exist, please check the application\");\n\n\t\t}\n\n\t}", "public boolean isSelected();", "public boolean isSelected();", "private boolean checkQuestion9() {\n chkBox1_Q9 = (CheckBox) findViewById(R.id.chkBox1_Q9);\n chkBox2_Q9 = (CheckBox) findViewById(R.id.chkBox2_Q9);\n chkBox3_Q9 = (CheckBox) findViewById(R.id.chkBox3_Q9);\n if (chkBox1_Q9.isChecked() && chkBox2_Q9.isChecked() && chkBox3_Q9.isChecked()) {\n return true;\n }\n return false;\n }", "@Override\n\tpublic void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n\t\t\n\t}", "@Override\n\tpublic void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n\t\t\n\t}", "public static boolean isCheckboxChecked(WebElement element) {\n\t\tboolean isChecked = false;\n\t\ttry {\n\t\t\tlogger.info(\"getting class of received element \"\n\t\t\t\t\t+ element.getAttribute(\"class\"));\n\t\t\tif (element.getAttribute(\"class\").contains(\"selected\")) {\n\t\t\t\tlogger.info(\"check box is checked\");\n\t\t\t\tisChecked = true;\n\t\t\t} else {\n\t\t\t\tisChecked = false;\n\t\t\t}\n\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(\"Some exception ocurred while finding if Region Checkbox is checked or not \"\n\t\t\t\t\t+ e.getMessage());\n\t\t}\n\t\treturn isChecked;\n\t}", "@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n }", "@Override\n public void setValue(Object value) {\n if (Boolean.valueOf(String.valueOf(value)) != checkboxElement.isSelected()) {\n select();\n }\n }", "public void onChecked(View check, View emailTxt, View passwordTxt) {\n\n email = ((EditText) emailTxt).getText().toString();\n password = ((EditText) passwordTxt).getText().toString();\n CheckBox checkbox = ((CheckBox) check);\n\n if (checkbox.isChecked() && (!email.isEmpty() && !password.isEmpty())) {\n new SharedPreference_Login(activity).saveDetail(email, password);\n } else {\n new SharedPreference_Login(activity).removeDetails();\n checkbox.setChecked(false);\n// Toast.makeText(activity,\"please checking arrivals!!!\",Toast.LENGTH_LONG).show();\n }\n\n\n }", "public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n\t\t\t\t\tToast.makeText(getContext(), \"Checked \" + isChecked + \"Position \" + position, Toast.LENGTH_LONG).show();\n\t\t\t\t\tif(isChecked){\n\t\t\t\t\t\tlistItems.get(position).setChecked(true);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tlistItems.get(position).setChecked(false);\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t}", "@Override\r\n\t\t\tpublic void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n\t\t\t\tif (isChecked){\r\n\t\t\t\t\tsp.edit().putBoolean(\"theft\", true).commit();\r\n\t\t\t\t\tcb_set.setText(\"防盗保护开启\");\r\n\t\t\t\t}else{\r\n\t\t\t\t\tsp.edit().putBoolean(\"theft\", false).commit();\r\n\t\t\t\t\tcb_set.setText(\"防盗保护没有开启\");\r\n\t\t\t\t}\r\n\t\t\t}", "void onCheckedChanged(Chip chip, boolean isChecked);", "@Override\n public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n mTarea.setEntregada(isChecked);\n }", "public void onCheckboxClicked(View view) {\n boolean checked = ((CheckBox) view).isChecked();\n\n // Check which checkbox was clicked\n switch(view.getId()) {\n case R.id.LED1:\n if (checked) {\n Toast.makeText(getApplicationContext(), \"LED1 ON\", Toast.LENGTH_SHORT).show();\n } else {\n Toast.makeText(getApplicationContext(), \"LED1 OFF\", Toast.LENGTH_SHORT).show();\n }\n case R.id.LED2:\n if (checked) {\n Toast.makeText(getApplicationContext(), \"LED2 ON\", Toast.LENGTH_SHORT).show();\n } else {\n Toast.makeText(getApplicationContext(), \"LED2 OFF\", Toast.LENGTH_SHORT).show();\n }\n case R.id.LED3:\n if (checked) {\n Toast.makeText(getApplicationContext(), \"LED3 ON\", Toast.LENGTH_SHORT).show();\n } else {\n Toast.makeText(getApplicationContext(), \"LED2 OFF\", Toast.LENGTH_SHORT).show();\n }\n case R.id.LED4:\n if (checked) {\n Toast.makeText(getApplicationContext(), \"LED4 ON\", Toast.LENGTH_SHORT).show();\n } else {\n Toast.makeText(getApplicationContext(), \"LED4 OFF\", Toast.LENGTH_SHORT).show();\n }\n\n break;\n // TODO: Veggie sandwich\n }\n }", "public void check () {\n // declaring local variables\n WebElement webElement;\n\n if (isStubbed()) {\n log(\"=== This checkbox's locator is currently stubbed out. ===\");\n } else {\n // getting the web element of the check box with the default timeout\n // and then check its status\n\n int MAXRETRIES = 3;\n int tries = 1;\n while (!this.isChecked() && tries <= MAXRETRIES) {\n // need to give a second for the browser to catch up with the web driver\n //sleep(1, TimeUnit.SECONDS);\n\n // Directly get the web element since we know that it exists and is displayed\n webElement = getWebElement ();\n this.clickWebElement (webElement);\n\n\n\n\n tries++;\n if (this.isChecked() == false)\n {\n sleep(1, TimeUnit.SECONDS);\n }\n }\n }\n }", "public void checkTos1()\n\t{\n\t\tdriver.findElement(_tosCheckbox1).click();\n\t\tlog.info(\"Clicked TOS\");\n\t}", "protected void checkBoxIfInPreference(CheckBox preference) {\n SharedPreferences preferences = getApplicationContext().getSharedPreferences(\"Preferences\", Context.MODE_PRIVATE);\n if (preferences.getBoolean(String.valueOf(preference.getId()), false)) {\n preference.setChecked(true);\n }\n }", "public ArrayList<JCheckBox> getCheckBox() {\n\t\treturn check;\n\t}", "public boolean isSelected(){\r\n return selected;\r\n }", "private JCheckBox getJCheckBox() {\r\n\t\tif (jCheckBox == null) {\r\n\t\t\tjCheckBox = new JCheckBox();\r\n\t\t\tjCheckBox.setBounds(new Rectangle(15, 291, 107, 21));\r\n\t\t\tjCheckBox.setText(\"Write to file\");\r\n\t\t\tjCheckBox.setToolTipText(\"If checked, biclustering results will be stored in the selected path\");\r\n\t\t\tjCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {\r\n\t\t\t\tpublic void stateChanged(javax.swing.event.ChangeEvent e) {\r\n\t\t\t\t\tif(jCheckBox.isSelected())\t\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\ttry{\r\n\t\t\t\t\t\t\tBufferedReader pathReader=new BufferedReader(new FileReader(\"es/usal/bicoverlapper/data/groupsPath.txt\"));\r\n\t\t\t\t\t\t\tdefaultPath=pathReader.readLine();\r\n\t\t\t\t\t\t\t}catch(IOException ex){System.err.println(\"pathReader has no information\"); defaultPath=\"\";}\r\n\t\t\t\t\t\tjCheckBox1.setEnabled(true);\r\n\t\t\t\t\t\tjButton.setEnabled(true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\tdefaultPath=\"\";\r\n\t\t\t\t\t\tjButton.setEnabled(false);\r\n\t\t\t\t\t\tjCheckBox1.setEnabled(false);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn jCheckBox;\r\n\t}", "private boolean isEnableConfigBtn() {\n int count = mAutoItemArray.size();\n for (int i = 0; i < count; i++) {\n ListViewItem item = mAutoItemArray.get(i);\n if (item.mNeedCheckBox && item.mIsChecked) {\n return true;\n }\n }\n return false;\n }", "private boolean checkQuestion5() {\n chkBox1_Q5 = (CheckBox) findViewById(R.id.chkBox1_Q5);\n chkBox2_Q5 = (CheckBox) findViewById(R.id.chkBox2_Q5);\n chkBox3_Q5 = (CheckBox) findViewById(R.id.chkBox3_Q5);\n if (chkBox1_Q5.isChecked() && chkBox2_Q5.isChecked() && !chkBox3_Q5.isChecked()) {\n return true;\n }\n return false;\n }", "boolean hasArtilleryFactorySelected();", "public static boolean getCheckboxParameter( HttpServletRequest request, String paramName ) {\n String temp = request.getParameter(paramName);\n if( temp != null && temp.equals(\"on\") ) {\n return true;\n } else {\n return false;\n }\n }" ]
[ "0.7760456", "0.77407336", "0.77407336", "0.767281", "0.74489737", "0.72649205", "0.71424454", "0.71346676", "0.71315557", "0.7023457", "0.6926001", "0.69115245", "0.68999016", "0.6887886", "0.6842006", "0.6809848", "0.6765498", "0.67618716", "0.6740939", "0.6739916", "0.67358994", "0.67170256", "0.66945064", "0.66791856", "0.6652702", "0.66470057", "0.66470057", "0.66470057", "0.66390586", "0.663714", "0.6616364", "0.6588889", "0.6576131", "0.6576131", "0.6576131", "0.6573891", "0.6521418", "0.6494793", "0.6483652", "0.6455022", "0.64429504", "0.64338934", "0.64301103", "0.64239055", "0.6408672", "0.6400111", "0.6389812", "0.6381584", "0.63813", "0.63716996", "0.6364918", "0.63519037", "0.63451016", "0.6331682", "0.63113225", "0.63034225", "0.62943786", "0.6291543", "0.6267115", "0.6254951", "0.6233337", "0.6229133", "0.6224822", "0.6219428", "0.6219318", "0.6210644", "0.62029463", "0.61873573", "0.6179426", "0.6178908", "0.6169875", "0.616987", "0.6161386", "0.61609465", "0.61609465", "0.61553115", "0.6155127", "0.615019", "0.615019", "0.6149797", "0.61475253", "0.61475253", "0.6146596", "0.6137812", "0.6118858", "0.61161715", "0.6101261", "0.6100389", "0.60776854", "0.6064668", "0.60589707", "0.60427505", "0.6036586", "0.603375", "0.6031782", "0.60269773", "0.6017819", "0.6016376", "0.60128427", "0.6006647", "0.59971344" ]
0.0
-1
Spring Data JPA repository for the Countries entity.
@SuppressWarnings("unused") @Repository public interface CountriesRepository extends JpaRepository<Countries,Long> { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Repository\npublic interface ICountryRepository extends JpaRepository<Country, String> {\n\n Country findByCode(String code);\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface CountryRepository extends JpaRepository<Country,Long> {\n Long countByCountryCode(Integer countryCode);\n Country findByCountryName(String countryName);\n}", "@Repository\npublic interface DistrictCountryRepository extends JpaRepository<DistrictCountry, String> {\n}", "@Repository\npublic interface IProvinceRepository extends JpaRepository <ProvinceEntity, Integer> {\n\n /**\n *\n * <p>Return the provinces searches by country and ordened by name.\n *\n * @return Return the province list.\n * */\n List<ProvinceEntity> findAllByCountry (CountryEntity country);\n\n ProvinceEntity findByName (String name);\n}", "public interface CountryRepository extends CrudRepository<Country, Integer> {\r\n\r\n}", "@Repository\npublic interface CountryRepository extends JpaRepository<Country, CountryId> {\n\n Optional<Country> findByCountryName(CountryName countryName);\n\n}", "@Repository\npublic interface CountryDAO extends JpaRepository<Country, Integer> {\n\n /**\n * This method is used to get all countries.\n *\n * @return List\n * @see Country\n */\n @Query(\"select c from Country c order by c.name\")\n List<Country> getAllCountries();\n\n}", "@Override\n\tpublic List<String> findAllCountries() {\n\t\treturn theCountryRepository.findAllCountries();\n\t}", "@Autowired\n public void setCountryRepository(CountryRepository countryRepository) {\n this.countryRepository = countryRepository;\n }", "public Country findByCode(String code);", "public interface CountryRepository extends GraphRepository<Country>, RelationshipOperationsRepository<Country> {\n\t\n\t\n\t@Query(\"start n=node:__types__(className='app.model.Country') where n.name = {0} return n limit 1\")\n\tpublic Country findByName(String name);\n\t\n\t@Query(\"start airport=node({0}) match airport-[:LOCATED_IN]-country return country\")\n\tpublic Country findByAirport(long airportId);\n\t\n\t@Query(\"start n=node:__types__(className='app.model.Country') return n order by n.name skip {1} limit {0}\")\n\tpublic List<Country> findAll(int limit, int skip);\n\t\n\t\n}", "@RequestMapping(value = \"/countries\", method = RequestMethod.GET)\n public List<Country> countries() {\n return dictionaryService.findAllCountries();\n }", "@RequestMapping(value = \"/country\", method = RequestMethod.GET)\n public List<CountryCustomerCount> customersInCountry() {\n return customerRepository.customerInCountry();\n }", "public CountryResource(CountryRepository repository) {\n this.repository = repository;\n }", "@Repository\npublic interface CityRepository extends JpaRepository<City, Long> {\n}", "public interface CountryRepository extends JpaRepository<Country, Integer>, JpaSpecificationExecutor {\n\n}", "public interface DistrictRepository extends PagingAndSortingRepository<District, Long>{\n Iterable<District> findAllByCountry(Country country);\n}", "List<ProvinceEntity> findAllByCountry (CountryEntity country);", "@Repository\npublic interface ContinentRepository extends CrudRepository<Continent, Long> {\n public Continent findByContinentNameThai(String continentNameThai);\n public Continent findByContinentNameEnglish(String continentNameEnglish);\n\n}", "@Override\n\tpublic List<Country> getCountries() {\n\t\tCountryRootObject countryRootObject = restTemplate.getForObject(urlForDatabaseCountries(), CountryRootObject.class);\n\n\t\treturn countryRootObject.getResponse().getItems();\n\t}", "public interface CityRepository extends JpaRepository<CityEntity, Long>{\n}", "@GetMapping(\"/all\")\n public List<Country> getAll(){\n return countryRepository.findAll();\n }", "public interface CidadeRepository extends JpaRepository<Cidade, Long> {\n\t\n\tList<Cidade> findByEstadoCodigo(Long estadoCodigo);\n}", "@Repository\npublic interface LocationRepository extends JpaRepository<Location, Long> {\n}", "@Query(\"select c from Country c order by c.name\")\n List<Country> getAllCountries();", "@Repository\npublic interface DistrictRepository extends JpaRepository<District, Long> {}", "public interface LabelRepository extends JpaRepository<Label, String> {\n}", "public Country findByName(String name);", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface LocationsRepository extends JpaRepository<Locations, Long> {\n\n}", "List<Country> listCountries();", "Observable<List<CountryEntity>> fetchAllCountries();", "public List<Country> getAll() throws Exception;", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface EventLanguageRepository extends JpaRepository<EventLanguage, Long> {\n\t\n}", "public interface LanguageRepository extends JpaRepository<Language, Integer> {\n\n List<Language> findAllByOrderByNameAsc();\n\n Language findByName(Languages name);\n\n}", "public interface CountryDao {\n List<Country> findAll();\n Country findByCode(String code);\n\n void save(Country country);\n void update(Country country);\n void delete(Country country);\n}", "public interface ProvinceRepository extends MongoRepository<Province, String> {\n\n}", "public List<Country> getCountries()\n {\n return countries;\n }", "@Repository\npublic interface LocationRepository extends CrudRepository<Location, Long> {\n\n}", "@Test\n\tpublic void findByCountryShouldReturnContinent() {\n\t\tList<Destination> destinations = destinationRepository.findByCountry(\"Spain\");\n\t\tassertThat(destinations).hasSize(1);\n\t\tassertThat(destinations.get(0).getContinent()).isEqualTo(\"Europe\");\n\t}", "public interface CountryService {\n\t\n\t/**\n\t * Gets the countries.\n\t *\n\t * @return the countries\n\t */\n\tpublic List<Country> getCountries();\n\t\n\t/**\n\t * Find by id.\n\t *\n\t * @param id the id\n\t * @return the country\n\t */\n\tpublic Country findById(Long id);\n\t\n\t/**\n\t * Find by name.\n\t *\n\t * @param name the name\n\t * @return the list\n\t */\n\tpublic List<Country> findByName(String name);\n\t\n\t\n\t\n\t/**\n\t * Gets the country by id or name.\n\t *\n\t * @param id the id\n\t * @param name the name\n\t * @return the country by id or name\n\t */\n\tpublic Object getCountryByIdOrName(Long id, String name);\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface MunicipioRepository extends JpaRepository<Municipio, Long> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface PmCorMeasureStatesRepository extends JpaRepository<PmCorMeasureStates, Long> {\n PmCorMeasureStates findByCode(String code);\n\n}", "public interface CurrencyRepository extends JpaRepository<Currency, Long> {\n\n}", "@Scheduled(cron = \"0 0 0 ? * ?\")\n public void updateCountryRepository() {\n final String url = \"https://restcountries.eu/rest/v2/all\";\n\n try {\n RestTemplate restTemplate = new RestTemplate();\n JsonNode result = restTemplate.getForObject(url, JsonNode.class);\n // Convert json to country set\n Set<Country> newCountries = new HashSet<>();\n for (JsonNode countryJson : result) {\n String name = countryJson.get(\"name\").asText();\n String isoCode = countryJson.get(\"alpha3Code\").asText();\n\n newCountries.add(new Country(isoCode, name));\n }\n\n // Add all new countries to database\n // Use countryRepository.add(country)\n for (Country country : newCountries) {\n countryRepository.save(country);\n }\n\n // Remove all countries not in newCountries\n for (Country country : countryRepository.findAll()) {\n if (!newCountries.contains(country)) {\n countryRepository.delete(country);\n }\n }\n System.getLogger(\"SystemEvents\").log(System.Logger.Level.INFO,\"Country repository updated\");\n\n } catch(RestClientException e) {\n System.getLogger(\"SystemEvents\").log(System.Logger.Level.ERROR,\"Country repository failed to update\");\n System.getLogger(\"SystemEvents\").log(System.Logger.Level.TRACE, e.getMessage());\n }\n }", "public interface CountryService {\n\n List<City> getCitiesByRegion(int rig_id);\n List<Region> getRegionsByCountry(int con_id);\n List<Country> getCountries();\n List<CityData> searchCities(String name, int limit, int pageNo);\n CityData addCityData(PostCityData postCityData);\n\n}", "public interface AddressesRepository extends JpaRepository<Addresses,Long> {\n\n}", "@Repository\npublic interface ClientTypeRepository extends JpaRepository<ClientType, Integer> {\n\n}", "public interface LocationRepository extends CrudRepository<Location, Integer> {\n\n}", "void fetchCountryInformation();", "@RequestMapping(value = \"/getCountries\", method = RequestMethod.GET, produces = \"application/json\")\n @ResponseBody\n public SPResponse getCountries(@RequestParam(defaultValue = \"en_US\") String locale) {\n \n locale = LocaleHelper.isSupported(locale);\n \n String countryList = countryListMap.get(locale);\n \n if (countryList == null) {\n String fileName = null;\n if (Constants.DEFAULT_LOCALE.equalsIgnoreCase(locale)) {\n fileName = \"countryList.json\";\n } else {\n fileName = \"countryList_\" + locale.toString() + \".json\";\n }\n \n ObjectMapper mapper = new ObjectMapper();\n try {\n Resource resource = resourceLoader.getResource(\"classpath:\" + fileName);\n Countries readValue = mapper.readValue(resource.getFile(), Countries.class);\n countryList = mapper.writeValueAsString(readValue);\n } catch (Exception e) {\n LOG.error(\"error occurred retreving the country list for the locale \" + locale + \": file :\"\n + fileName, e);\n Resource resource = resourceLoader.getResource(\"classpath:countryList.json\");\n Countries readValue;\n try {\n readValue = mapper.readValue(resource.getFile(), Countries.class);\n countryList = mapper.writeValueAsString(readValue);\n } catch (IOException e1) {\n LOG.error(\"Error occurred while getting the country list\", e1);\n }\n }\n \n if (countryList == null) {\n countryList = MessagesHelper.getMessage(\"countries.list\");\n } else {\n countryListMap.put(locale, countryList);\n }\n }\n return new SPResponse().add(\"countries\", countryList);\n }", "public interface CategoryRepository extends JpaRepository<Category, Integer> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface DistrictRepository extends JpaRepository<District,Long> {\n\t\n\tpublic List<District> findByStateId(Long id);\n\t\n\t\n\t\n\n \n}", "@GetMapping(\"/country\")\n public List<ReadableCountry> getCountry(@ApiIgnore Language language, HttpServletRequest request) {\n MerchantStore merchantStore = storeFacade.getByCode(request);\n return countryFacade.getListCountryZones(language, merchantStore);\n }", "public Country findByIso2(String iso2);", "public List<Job> findByCountry(String country);", "public LiveData<List<CountryEntity>> getCountries() {\n return mObservableCountries;\n }", "public interface PegawaiRepository extends JpaRepository<Pegawai, Long> {\n\n\n}", "@Repository\npublic interface ClienteRepository extends JpaRepository<Cliente, String>{\n\n}", "@RequestMapping(value = \"/getCountries.abhi\")\n\tpublic List<CountryTO> getCountries(Model model, HttpServletRequest request) {\n\n\t\treturn addressService.getAllActiveCountries();\n\n\t}", "public interface CategoryRepository extends JpaRepository<Category, Long> {\n}", "@Repository\npublic interface ClinicRepository extends JpaRepository<Clinic, Long> {\n}", "@Override\n\tpublic List<City> findCityByCountryCode(String countryCode) {\n\t\treturn null;\n\t}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface RefGeoCommuneRepository extends JpaRepository<RefGeoCommune, Long> {\n}", "@Repository\npublic interface CouponRepository extends CrudRepository <Coupon, Long> {\n\n}", "@Repository\npublic interface AuthorityRepository extends JpaRepository<Authority, String> {\n\n}", "@Repository\npublic interface ContactRepository extends JpaRepository<Contact, Long> {\n}", "@Repository\npublic interface AuthorityRepository extends JpaRepository<Authority, String>{\n}", "@Transactional(readOnly = true) \n public List<CountryState> findAll() {\n log.debug(\"Request to get all CountryStates\");\n List<CountryState> result = countryStateRepository.findAllByDelStatusIsFalse();\n\n return result;\n }", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface ChipsAdminRepository extends JpaRepository<ChipsAdmin, Long> {}", "interface NetworkRepository extends JpaRepository<Network, Long> {\n\n}", "@Repository\npublic interface CategoryRepository extends JpaRepository<Category,Long> {\n\n\n\n}", "@Component\r\npublic interface CategoriiRepository extends JpaRepository<Categorie, Long> {\r\n Categorie findByNume(String categorie);\r\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface WaPersonalAddressRepository extends JpaRepository<WaPersonalAddress, Long> {\n}", "@Repository\npublic interface TableRegionRepository extends JpaRepository<TableRegion, Long> {\n\n List<TableRegion> findAll();\n\n TableRegion findById(Long id);\n\n TableRegion findByTrMark(int mark);\n}", "public interface OperationAreaRepository extends JpaRepository<OperationArea, Long> {\n \n /* A version to fetch List instead of Page to avoid extra count query. */\n List<OperationArea> findAllBy(Pageable pageable);\n \n List<OperationArea> findByProvinceAreaLikeIgnoreCase(String nameFilter);\n\n\n\n\n // For lazy loading and filtering\n List<OperationArea> findByProvinceAreaLikeIgnoreCase(String nameFilter, Pageable pageable);\n\n long countByProvinceAreaLikeIgnoreCase(String nameFilter);\n\n\n}", "@SuppressWarnings(\"unchecked\")\n\t@Override\n\t public List<Country> listCountry(){\n\t Session session = factory.openSession();\n\t Transaction tx = null;\n\t List<Country> countries = null;\n\t \n\t tx = session.beginTransaction();\n\t Query query = session.createQuery(\"FROM Country\");\n\t //countries = (List<Country>)session.createQuery(\"FROM Country\");\n\t countries = (List<Country>)query.list();\n\t \n\t System.out.print(\"Currency: \" );\n\t \n\t tx.commit();\n\t return countries;\n\t }", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "@Repository\npublic interface ChampionshipRepository extends JpaRepository<Championship, Long> {\n}", "public interface AdUnitDistrictRepository extends JpaRepository<AdUnitDistrict, Long> {\n\n \n}", "public interface ContactDepartmentRepository extends LookupRepository<ContactDepartment> {\n\n}", "Country getCountry();", "@Repository\npublic interface CustomerRepository extends JpaRepository<Customer, Integer>{\n\n}", "@Repository\npublic interface RidingTerrainRepository extends JpaRepository<RidingTerrain, Long>{\n \n}", "@Repository\npublic interface PersonaRepository extends JpaRepository<Persona, Integer> {\n \n}", "public interface OrderRepository extends JpaRepository<Order, String> {\n}", "public interface CountryService {\n\t\n\t/**\n\t * Gets the Country by id.\n\t *\n\t * @param id the id\n\t * @return the country by id\n\t * @throws Exception\n\t */\n\tpublic Country getById(Integer id) throws Exception;\n\t\n\t/**\n\t * Gets all the Countries.\n\t *\n\t * @return all the Countries\n\t * @throws Exception\n\t */\n\tpublic List<Country> getAll() throws Exception;\n\t\n\t/**\n\t * Insert.\n\t *\n\t * @param name the name\n\t * @return the country\n\t * @throws TransactionException the transaction exception\n\t */\n\tpublic Country insert(String name) throws TransactionException;\n\t\n\t/**\n\t * Update.\n\t *\n\t * @param country the country\n\t * @return Country country\n\t * @throws TransactionException the transaction exception\n\t */\n\tpublic Country update(Country country) throws TransactionException;\n\t\n\t/**\n\t * Delete.\n\t *\n\t * @param country the country\n\t * @throws TransactionException the transaction exception\n\t */\n\tpublic void delete(Country country) throws TransactionException;\n}", "public interface UniversidadRepository extends CrudRepository<Universidad,String> {\n\n List<Universidad> findAll();\n\n}", "public int getCountryId();", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n\n Authority findByName(String name);\n\n}", "@Repository\npublic interface KontaktJpaRepository extends JpaRepository<Kontakte, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface CategorieRessourcesRepository extends JpaRepository<CategorieRessources, Long> {\n}", "@GetMapping(\"/list\")\n\tpublic String findAllCountries(Model model ){\n\t List<countriesEntity> lista= countriesService.findAllCountries();\n\t model.addAttribute(\"lista\", lista);\n\t return \"countries/findAllCountries\";\n\t}", "@Repository\npublic interface ClientRepository extends JpaRepository<Client, Long> {\n}" ]
[ "0.7212006", "0.7122927", "0.69572914", "0.682766", "0.6717692", "0.66761494", "0.6664336", "0.66011715", "0.6566933", "0.6457214", "0.6421044", "0.6402304", "0.6321221", "0.63030255", "0.62880456", "0.62232447", "0.62215996", "0.6198281", "0.6137156", "0.6103196", "0.60414314", "0.60010844", "0.59412265", "0.59361815", "0.5914145", "0.5907827", "0.5883139", "0.5838111", "0.58377564", "0.5819417", "0.57732505", "0.5768269", "0.5726845", "0.5722683", "0.57223785", "0.56984997", "0.5692997", "0.5683348", "0.5666311", "0.5653605", "0.56324613", "0.5602668", "0.55993307", "0.5598324", "0.55957633", "0.5579405", "0.55787873", "0.5574663", "0.557375", "0.5552579", "0.55430007", "0.5541644", "0.5540068", "0.55357075", "0.5528755", "0.5528693", "0.55171156", "0.5511992", "0.5497099", "0.5493873", "0.54911387", "0.54845136", "0.54839116", "0.5471858", "0.54702234", "0.54560775", "0.54464006", "0.54398715", "0.54320633", "0.54118955", "0.5410376", "0.5408665", "0.5403685", "0.5396334", "0.5395855", "0.53879005", "0.538298", "0.538298", "0.538298", "0.538298", "0.538298", "0.538298", "0.538298", "0.538298", "0.53826636", "0.53776026", "0.53722745", "0.5367645", "0.53587425", "0.5354981", "0.5353158", "0.53444606", "0.5338777", "0.53371656", "0.53347975", "0.53244287", "0.5320246", "0.5315593", "0.5310825", "0.53001326" ]
0.6697531
5
Function for tanh, hyperbolic tangent. Uses Math.tanh, no approximation.
@Override public double f(double x) { return Math.tanh(x); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static double tanh(double x) {\n if (Double.isNaN(x)) return Double.NaN;\n double result = (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x));\n if (Double.isNaN(result))\n return (x < 0) ? -1.0 : 1.0;\n return result;\n }", "public static double \t\ttanh(double _x) {\n\t\treturn sinh(_x) / cosh(_x);\n\t}", "public double tan(double number);", "private double hypTan(double x){\n\t\t//System.out.print(\".\");\n\t\treturn (Math.tanh(k*x)*0.5) + 0.5;\t\n\t}", "@Override\r\n\tpublic double f(double x) {\n\t\treturn FastMath.tanh(x); // RMSE: 1.2677143077504636, Took: 38.617s\r\n\t}", "public static Matrix tanh(Matrix matrix)\n {\n double[][] M = matrix.getArray();\n int row = matrix.getRowDimension(), col = matrix.getColumnDimension();\n Matrix X = new Matrix(row, col);\n double[][] C = X.getArray();\n double val = 1.0;\n for (int i = 0; i < row; i++)\n {\n for (int j = 0; j < col; j++)\n {\n val = Math.exp(M[i][j]);\n val = (val * val - 1.0) / (val * val + 1.0);\n C[i][j] = val;\n }\n }\n return X;\n }", "E tan(final E n);", "public final void tan() {\n\t\tif (size > 0) {\n\t\t\tpush(Math.tan(pop()));\n\n\t\t}\n\t}", "public static Expression tan(final Expression value) {\n return new Expression(\"$tan\", value);\n }", "@Test\n\tvoid tanTestWithDegreeInput() throws CustomException {\n\t\tdouble input = 30;\n\t\tdouble actual = 0.5773502691896257;\n\t\tdouble result = TrigLib.tan(input);\n\t\tassertNotEquals(result, actual, \"Output is not as expected as input is not converted to radians\");\n\t}", "private static double ArcTan(double x) // Using a Chebyshev-Pade approximation\n {\n double x2=x*x;\n return (0.7162721433f+0.2996857769f*x2)*x/(0.7163164576f+(0.5377299313f+0.3951620469e-1f*x2)*x2);\n }", "public double tanDefIntDeg(double a, double b) {\n a = a * RADIAN;\n b = b * RADIAN;\n double fa, fb;\n fb = (this.a * (Math.log(1.0 / Math.pow(Math.cos(this.b * b + this.c), 2)))\n + this.d * (2 * this.b * b - PI)) / (2 * this.b);\n fa = (this.a * (Math.log(1.0 / Math.pow(Math.cos(this.b * a + this.c), 2)))\n + this.d * (2 * this.b * a - PI)) / (2 * this.b);\n return fb - fa;\n }", "@Test\n\tvoid tanTestWithRadiansInput() throws CustomException {\n\t\tdouble input = 0.5235987755982988;\n\t\tdouble actual = 0.5773502691896257;\n\t\tdouble result = TrigLib.tan(input);\n\t\tassertEquals(result, actual, \"Output is as expected as input is in radians\");\n\t}", "public double tanIntEvalDeg(double x) {\n x = x * RADIAN;\n double temp;\n temp = (this.a * (Math.log(1.0 / Math.pow(Math.cos(this.b\n * x + this.c), 2))));\n return temp;\n }", "public static double \t\tatanh(double _x) {\n\t\tdouble sgn = 1.0D;\n\t\tif(_x < 0.0D) {\n\t\t\tsgn = -1.0D;\n\t\t\t_x = -_x;\n\t\t}\n\n\t\tassertFalse(_x > 1.0D, \"atanh real number argument (\" + sgn * _x + \") must be >= -1 and <= 1\");\n\n\t\treturn 0.5D * sgn * (Math.log(1.0D + _x) - Math.log(1.0D - _x));\n\t}", "public double tanSlope(double x) {\n double temp1, temp2, temp3;\n temp1 = this.a * this.b;\n temp2 = this.b * x + this.c;\n temp3 = Math.pow(1.0 / (Math.cos(temp2)), 2);\n this.tanslope = temp1 * temp3;\n return this.tanslope;\n\n }", "public double tanEvalDeg(double x) {\n x = x * RADIAN;\n double temp;\n temp = this.a * Math.tan(this.b * x + this.c) + this.d;\n return temp;\n }", "public double derivative(double input) {\n\t\treturn (1 - Math.pow(Math.tanh(input), 2));\n\t}", "public double tanSlopeDeg(double x) {\n x = x * RADIAN;\n double temp1, temp2, temp3;\n temp1 = this.a * this.b;\n temp2 = this.b * x + this.c;\n temp3 = Math.pow(1.0 / (Math.cos(temp2)), 2);\n this.tanslope = temp1 * temp3;\n return this.tanslope;\n\n }", "@Test\n\tvoid tanTestWithConvertingToRadians() throws CustomException {\n\t\tdouble input = 30;\n\t\tdouble actual = 0.5773502691896257;\n\t\tdouble result1 = TrigLib.toRadians(input);\n\t\tdouble result = TrigLib.tan(result1);\n\t\tassertEquals(result, actual, \"Output is as expected as input is converted to radians\");\n\t}", "public double tanSlope(double x) {\n this.tanSlope(x);\n return this.tanslope;\n }", "double cosTheta();", "public static Expression atanh(final Expression value) {\n return new Expression(\"$atanh\", value);\n }", "public double h_function(Node node, Node targetNode, boolean isTime){\n double h = node.location.distance(targetNode.location);\n if(isTime) h = h/110;\n return h;\n // distance between two Nodes\n }", "public double addTanSlope(double x) {\n this.addDif();\n this.addtanslope = this.daa * x * x + this.dba * x + this.dca;\n return this.addtanslope;\n\n }", "private final Point tangent1G1(Point a, Point b, Point c) {\n\t\t// horizontale volgorde: a ... b ... c\n\t\tif (a.X() < b.X() && c.X() > b.X()) {\n\t\t\tPoint temp = c.minus(a);\n\t\t\tdouble rico = temp.Y() / temp.X(); // kan nooit nul zijn\n\t\t\tdouble d1 = b.X() - a.X();\n\t\t\ttemp = new Point((int) Math.floor(-d1), (int) Math.floor(-rico * d1\n\t\t\t\t\t+ 0.5)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// horizontale volgorde: c ... b ... a\n\t\telse if (a.X() > b.X() && c.X() < b.X()) {\n\t\t\tPoint temp = a.minus(c);\n\t\t\tdouble rico = temp.Y() / temp.X(); // kan nooit nul zijn\n\t\t\tdouble d1 = a.X() - b.X();\n\t\t\ttemp = new Point((int) Math.floor(d1), (int) Math.floor(rico * d1\n\t\t\t\t\t+ 0.5)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// verticale volgorde: a ... b ... c\n\t\telse if (a.Y() > b.Y() && c.Y() < b.Y()) {\n\t\t\tPoint temp = a.minus(c);\n\t\t\tdouble ricoInv = temp.X() / temp.Y(); // kan nooit nul zijn\n\t\t\tdouble d1 = a.Y() - b.Y();\n\t\t\ttemp = new Point((int) Math.floor(ricoInv * d1 + 0.5), (int) Math\n\t\t\t\t\t.floor(d1)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// verticale volgorde: c ... b ... a\n\t\telse if (a.Y() < b.Y() && c.Y() > b.Y()) {\n\t\t\tPoint temp = c.minus(a);\n\t\t\tdouble ricoInv = temp.X() / temp.Y(); // kan nooit nul zijn\n\t\t\tdouble d1 = b.Y() - a.Y();\n\t\t\ttemp = new Point((int) Math.floor(-ricoInv * d1 + 0.5), (int) Math\n\t\t\t\t\t.floor(-d1)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// Beide tangentpunten liggen in eenzelfde kwadrant van het vlak t.o.v.\n\t\t// het punt b --> nu worden de eindpunten van de vector ac verplaatst,\n\t\t// overeenkomstig met de oorspronkelijke afstand tot b.\n\t\t//\n\t\t// Bvb.: a en c liggen onder b, a ligt verder van b dan c\n\t\t// --> het eerste eindpunt van de vector ac zal ook onder b\n\t\t// komen te liggen, het andere eindpunt zal boven b liggen.\n\t\telse {\n\t\t\t// verticale volgorde: b ... a ... c\n\t\t\tif (a.Y() > c.Y() && a.Y() <= b.Y()) {\n\t\t\t\tPoint temp = a.minus(c);\n\t\t\t\tdouble factor = (b.Y() - a.Y()) / (b.Y() - c.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: a ... c ... b\n\t\t\telse if (a.Y() > c.Y() && c.Y() >= b.Y()) {\n\t\t\t\tPoint temp = a.minus(c);\n\t\t\t\tdouble factor = 1.0 - (c.Y() - b.Y()) / (a.Y() - b.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: c ... a ... b\n\t\t\telse if (c.Y() > a.Y() && a.Y() >= b.Y()) {\n\t\t\t\tPoint temp = c.minus(a);\n\t\t\t\tdouble factor = (a.Y() - b.Y()) / (c.Y() - b.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(-temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(-temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: b ... c ... a\n\t\t\telse if (c.Y() > a.Y() && c.Y() <= b.Y()) {\n\t\t\t\tPoint temp = c.minus(a);\n\t\t\t\tdouble factor = 1.0 - (b.Y() - c.Y()) / (b.Y() - a.Y());\n\n\t\t\t\ttemp = new Point((int) Math.floor(-temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(-temp.Y() * factor + 0.5)).plus(b);\n\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}", "public double calculateHyperbolicSine(double angle);", "E atan(final E n);", "public void changeTanOriginal() {\n this.changeTan(aorg, borg, corg, dorg, yorg);\n }", "public void changeTan(double a, double b, double c, double d, double y) {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.y = y;\n }", "private final Point tangent2G1(Point a, Point b, Point c) {\n\t\t// horizontale volgorde: a ... b ... c\n\t\tif (a.X() < b.X() && c.X() > b.X()) {\n\t\t\tPoint temp = c.minus(a);\n\t\t\tdouble rico = temp.Y() / temp.X();\n\t\t\tdouble d1 = c.X() - b.X();\n\t\t\ttemp = new Point((int) Math.floor(d1), (int) Math.floor(rico * d1\n\t\t\t\t\t+ 0.5)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// horizontale volgorde: c ... b ... a\n\t\telse if (a.X() > b.X() && c.X() < b.X()) {\n\t\t\tPoint temp = a.minus(c);\n\t\t\tdouble rico = temp.Y() / temp.X();\n\t\t\tdouble d1 = b.X() - c.X();\n\t\t\ttemp = new Point((int) Math.floor(-d1), (int) Math.floor(-rico * d1\n\t\t\t\t\t+ 0.5)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// verticale volgorde: a ... b ... c\n\t\telse if (a.Y() > b.Y() && c.Y() < b.Y()) {\n\t\t\tPoint temp = a.minus(c);\n\t\t\tdouble ricoInv = temp.X() / temp.Y();\n\t\t\tdouble d1 = b.Y() - c.Y();\n\t\t\ttemp = new Point((int) Math.floor(-ricoInv * d1 + 0.5), (int) Math\n\t\t\t\t\t.floor(-d1)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// verticale volgorde: c ... b ... a\n\t\telse if (a.Y() < b.Y() && c.Y() > b.Y()) {\n\t\t\tPoint temp = c.minus(a);\n\t\t\tdouble ricoInv = temp.X() / temp.Y();\n\t\t\tdouble d1 = c.Y() - b.Y();\n\t\t\ttemp = new Point((int) Math.floor(ricoInv * d1 + 0.5), (int) Math\n\t\t\t\t\t.floor(d1)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// Beide tangentpunten liggen in eenzelfde kwadrant van het vlak t.o.v.\n\t\t// het punt b --> nu worden de eindpunten van de vector ac verplaatst,\n\t\t// overeenkomstig met de oorspronkelijke afstand tot b.\n\t\t//\n\t\t// Bvb.: a en c liggen onder b, a ligt verder van b dan c\n\t\t// --> het eerste eindpunt van de vector ac zal ook onder b\n\t\t// komen te liggen, het andere eindpunt zal boven b liggen.\n\t\telse {\n\t\t\t// verticale volgorde: b ... a ... c\n\t\t\tif (a.Y() > c.Y() && a.Y() <= b.Y()) {\n\t\t\t\tPoint temp = a.minus(c);\n\t\t\t\tdouble factor = 1.0 - (b.Y() - a.Y()) / (b.Y() - c.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(-temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(-temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: a ... c ... b\n\t\t\telse if (a.Y() > c.Y() && c.Y() >= b.Y()) {\n\t\t\t\tPoint temp = a.minus(c);\n\t\t\t\tdouble factor = (c.Y() - b.Y()) / (a.Y() - b.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(-temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(-temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: c ... a ... b\n\t\t\telse if (c.Y() > a.Y() && a.Y() >= b.Y()) {\n\t\t\t\tPoint temp = c.minus(a);\n\t\t\t\tdouble factor = 1.0 - (a.Y() - b.Y()) / (c.Y() - b.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: b ... c ... a\n\t\t\telse if (c.Y() > a.Y() && c.Y() <= b.Y()) {\n\t\t\t\tPoint temp = c.minus(a);\n\t\t\t\tdouble factor = (b.Y() - c.Y()) / (b.Y() - a.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}", "public Tangent(double a, double b, double c, double d, double y) {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.y = y;\n this.aorg = a;\n this.borg = b;\n this.corg = c;\n this.dorg = d;\n this.yorg = y;\n }", "public double getTheta(){\n return Math.atan(this.y / this.x);\n }", "@org.junit.Test\n public void getTangentTestCurve2() {\n BezierCurve curve = new BezierCurve(new Vector(10, 20), new Vector(20, 20));\n assertEquals(0, curve.getTangent(0).dot(new Vector(0, 1)), 0);\n assertEquals(0, curve.getTangent(1).dot(new Vector(0, 1)), 0);\n }", "public double theta() { return Math.atan2(y, x); }", "@Test\n public void test25() throws Throwable {\n Complex complex0 = new Complex((-4594.967), 2587.341);\n Complex complex1 = complex0.tan();\n Complex complex2 = complex0.pow(complex1);\n Complex complex3 = complex0.sqrt();\n Complex complex4 = complex3.atan();\n double double0 = complex3.abs();\n Complex complex5 = complex0.exp();\n Complex complex6 = complex4.sqrt();\n Complex complex7 = complex4.conjugate();\n Complex complex8 = complex0.sin();\n }", "public static Matrix tan(Matrix matrix)\n {\n double[][] M = matrix.getArray();\n int row = matrix.getRowDimension(), col = matrix.getColumnDimension();\n Matrix X = new Matrix(row, col);\n double[][] C = X.getArray();\n for (int i = 0; i < row; i++)\n {\n for (int j = 0; j < col; j++)\n {\n C[i][j] = Math.tan(M[i][j]);\n }\n }\n return X;\n }", "@org.junit.Test\n public void getTangentTestCurve3() {\n BezierCurve curve = new BezierCurve(new Vector(10, 20), new Vector(15, 20), new Vector(20, 20));\n assertEquals(0, curve.getTangent(0).dot(new Vector(0, 1)), 0);\n assertEquals(0, curve.getTangent(0.5).dot(new Vector(0, 1)), 0);\n assertEquals(0, curve.getTangent(1).dot(new Vector(0, 1)), 0);\n }", "@Override\n\tpublic double tinhTienAn() {\n\t\tdouble tienAn = canNang * 0.05;\n\t\treturn tienAn;\n\t}", "@Override\n public INDArray getActivation(INDArray in, boolean training) {\n //Modify array \"in\" inplace to transform it with the activation function\n // h(x) = 1.7159*tanh(2x/3)\n Nd4j.getExecutioner().execAndReturn(new Tanh(in.muli(2/3.0)));\n in.muli(1.7159);\n return in;\n }", "public static double teraHertzToHertz(final double teraHertz) {\n return teraHertz * HERTZ_PER_TERAHERTZ;\n }", "public interface Trigonometric<E> {\n\n /**\n * Returns the sine of a number.\n * @param n element\n * @return sine\n */\n E sin(final E n);\n\n /**\n * Returns the cosine of a number.\n * @param n element\n * @return cosine\n */\n E cos(final E n);\n\n /**\n * Returns the tangent of a number.\n * @param n element\n * @return tangent\n */\n E tan(final E n);\n\n /**\n * Returns the cotangent of a number.\n * @param n element\n * @return tangent\n */\n E cot(final E n);\n\n /**\n * Returns the arcsine of a number.\n * @param n element\n * @return arcsine\n */\n E asin(final E n);\n\n /**\n * Returns the arccosine of a number.\n * @param n element\n * @return cosine\n */\n E acos(final E n);\n\n /**\n * Returns the arctangent of a number.\n * @param n element\n * @return tangent\n */\n E atan(final E n);\n}", "public double subTanSlope(double x) {\n this.subDif();\n this.subtanslope = this.das * x * x + this.dbs * x + this.dcs;\n return this.subtanslope;\n\n }", "void heal(Heros h);", "private double cost(double[] h, double[] y){\n return (1.0/h.length) * matrix.subtract( matrix.multiply(matrix.multiply(-1,y),matrix.log\n (h)),matrix.multiply(matrix.subtract(matrix.ones(y.length),y),matrix.log(matrix.subtract(matrix.ones\n (h.length),h))) );\n }", "public static double cauchy() {\r\n return Math.tan(Math.PI * (uniform() - 0.5));\r\n }", "public double evalH(double f, double g) {\n double h ;\n h = 1.0 - Math.sqrt(f / g);\n return h;\n }", "public static double sigmoid(double x) {\n if (Double.isNaN(x)) return Double.NaN;\n return 1 / (1 + Math.exp(-x));\n }", "public double homoscedasticT(double m1, double m2, double v1, double v2, double n1, double n2) {\r\n return (m1 - m2) / FastMath.sqrt(((1.0d / n1) + (1.0d / n2)) * ((((n1 - 1.0d) * v1) + ((n2 - 1.0d) * v2)) / ((n1 + n2) - 2.0d)));\r\n }", "double tirer();", "@org.junit.Test\n public void getTangentTestOnePointCurve() {\n BezierCurve onePointCurve = new BezierCurve(new Vector(10, 20));\n assertEquals(new Vector(), onePointCurve.getTangent(0));\n assertEquals(new Vector(), onePointCurve.getTangent(1));\n }", "@Test\n public void test30() throws Throwable {\n Complex complex0 = new Complex((-2344.147405730839), 0.0);\n Complex complex1 = complex0.tanh();\n Complex complex2 = complex1.sin();\n Complex complex3 = complex0.createComplex(0.0, 0.0);\n Complex complex4 = complex1.multiply(0.0);\n Complex complex5 = complex0.tanh();\n Complex complex6 = complex0.subtract(complex1);\n int int0 = complex6.hashCode();\n Complex complex7 = complex0.atan();\n Complex complex8 = complex0.tan();\n ComplexField complexField0 = complex7.getField();\n Complex complex9 = complex6.sinh();\n Complex complex10 = complex0.add(complex6);\n Complex complex11 = complex7.exp();\n Complex complex12 = complex8.log();\n Complex complex13 = complex4.negate();\n Complex complex14 = complex7.sinh();\n Complex complex15 = complex3.atan();\n }", "public static double sigmoid(double x) {\r\n return 1 / (1 + Math.pow(Math.E, (-x)));\r\n }", "public double derivativeSigmoid(double x){\n return sigmoid(x) * (1 - sigmoid(x));\n }", "private double activationFunction(double input){\n double temp = 1 + Math.exp(-1 * input * this.sigmoidFactor);\n double result = (double)1/temp;\n return result;\n }", "public double headingTo(GeoPoint gp) {\n // Implementation hints:\n // 1. You may find the mehtod Math.atan2() useful when\n // implementing this method. More info can be found at:\n // http://docs.oracle.com/javase/8/docs/api/java/lang/Math.html\n //\n // 2. Keep in mind that in our coordinate system, north is 0\n // degrees and degrees increase in the clockwise direction. By\n // mathematical convention, \"east\" is 0 degrees, and degrees\n // increase in the counterclockwise direction.\n\n // I will put this point in the (0,0) and compute the atan2 on the\n // diifernce between them.\n checkRep();\n double x = (gp.latitude - this.latitude) * KM_PER_DEGREE_LATITUDE;\n double y = (gp.longitude - this.longitude) * KM_PER_DEGREE_LONGITUDE;\n double theta = Math.toDegrees(Math.atan2(x, y));\n theta = theta < 0 ? 360 + theta : theta;\n if (theta >= 0 && theta <= 90)\n return 90 - theta;\n return 360 - (theta - 90);\n }", "public atan( ) {\n super(1);\n }", "private double getSigmoidValue( double x )\n\t{\n\t\treturn (1 / (1 + Math.exp( -x )));\n\t}", "@Override\n\tpublic double tinhTienLai() {\n\t\tdouble tienLai=0;\n\t\tif(soThangGui>=kyHan){\n\t\t\t tienLai=soTienGui*laiSuat*soThangGui;\n\t\t}\n\t\treturn tienLai;\n\t}", "public static double hertzToTeraHertz(final double hertz) {\n return hertz / HERTZ_PER_TERAHERTZ;\n }", "@org.junit.Test\n public void getTangentTestRoundedCurve3() {\n BezierCurve curve = new BezierCurve(new Vector(10, 20), new Vector(15, 20), new Vector(15, 30));\n assertEquals(0, curve.getTangent(0).dot(new Vector(0, 1)), 0);\n assertTrue(curve.getTangent(0.5).dot(new Vector(1, 0)) > 0);\n assertTrue(curve.getTangent(0.5).dot(new Vector(0, 1)) > 0);\n assertEquals(0, curve.getTangent(1).dot(new Vector(1, 0)), 0);\n }", "double getHeadingDiff(double init_h) {\n double curr_h = getHeading();\n double diff_h = init_h - curr_h;\n if( diff_h>=360.0 ) diff_h -= 360.0;\n else if( diff_h<=-360.0 ) diff_h += 360.0;\n return diff_h ;\n }", "private double Sigmoid (double Net) {\r\n\t\treturn 1/(1+Math.exp(-Net));\r\n\t}", "private static double hpToEz(double hp) {\n return 1.015 + Math.cos(Math.toRadians(89.038 + hp));\n }", "public static double SigmoidDerivative(double x) {\n return Sigmoid(x)*(1-Sigmoid(x));\n }", "public HyperbolicTangentThresholdModel(double p_k){\n\t\tsuper(p_k);\n\t}", "protected double h(Point point) {\r\n Point goalPoint=getGoalNode().getPoint();\r\n return getHeuristicFunction().computeHeuristic(point.getCoordinate(),\r\n goalPoint.getCoordinate());\r\n }", "public T cos(T value);", "double normalizeHeading(double h) {\n double nh = h;\n if( h>-180 && h<180 ) {\n } else if( h <= -180 ) {\n nh = h+360;\n } else if( h > 180 ) {\n nh = h-360;\n }\n return nh;\n }", "double calculateAxon(ActivationFunction activationFunction);", "public static double cauchy() {\n return Math.tan (Math.PI * ( uniform() - 0.5 ) );\n }", "public double derivativeCustomSigmoid(double x){\n return (1.0/(mArgB - mArgA)) * (customSigmoid(x) - mArgA) * (mArgB - customSigmoid(x));\n }", "public static double megaHertzToHertz(final double megaHertz) {\n return megaHertz * HERTZ_PER_MEGAHERTZ;\n }", "@Test\n public void fastSigmoidAlternativeLooksAlright()\n {\n TextPlot.plotf(x -> fastSigmoidAlternative(x), -5, 5, 0, 1, 100, 40);\n TextPlot.plotf(x -> fastSigmoidAlternative(x, 0, 1), -5, 5, 0, 1, 100, 40);\n TextPlot.plotf(x -> fastSigmoidAlternative(x, -1, 0), -5, 5, -1, 0, 100, 40);\n TextPlot.plotf(x -> fastSigmoidAlternative(x, -7, 3), -5, 5, -7, 3, 100, 40);\n }", "@Test\n public void test36() throws Throwable {\n Complex complex0 = new Complex((-699.847402808), (-699.847402808));\n Complex complex1 = complex0.tanh();\n Complex complex2 = complex1.sqrt1z();\n Complex complex3 = complex0.tanh();\n Complex complex4 = complex0.sin();\n int int0 = complex0.hashCode();\n Complex complex5 = complex1.exp();\n boolean boolean0 = complex1.equals(complex1);\n Complex complex6 = complex1.log();\n Complex complex7 = complex6.add(complex0);\n double double0 = complex7.getArgument();\n Complex complex8 = complex1.atan();\n Complex complex9 = complex0.cosh();\n Complex complex10 = complex7.subtract(complex1);\n Complex complex11 = complex8.conjugate();\n Complex complex12 = complex7.add(complex0);\n double double1 = complex0.abs();\n Complex complex13 = complex7.multiply(0.0);\n Complex complex14 = complex11.multiply(complex13);\n Complex complex15 = complex11.sqrt1z();\n Complex complex16 = complex8.tan();\n double double2 = complex12.getArgument();\n Complex complex17 = complex0.divide(complex12);\n try { \n complex12.nthRoot(0);\n } catch(IllegalArgumentException e) {\n //\n // cannot compute nth root for null or negative n: 0\n //\n assertThrownBy(\"org.apache.commons.math.MathRuntimeException\", e);\n }\n }", "@Override\n\tpublic void tanCongKeXau() {\n\n\t}", "boolean onHeading(double speed, double angle, double PCoeff) {\n double error ;\n double steer ;\n boolean onTarget = false ;\n double leftSpeed;\n double rightSpeed;\n\n // determine turn power based on +/- error\n error = getError(angle);\n\n if (Math.abs(error) <= HEADING_THRESHOLD) {\n steer = 0.0;\n leftSpeed = 0.0;\n rightSpeed = 0.0;\n onTarget = true;\n }\n else {\n steer = getSteer(error, PCoeff);\n rightSpeed = speed * steer;\n leftSpeed = -rightSpeed;\n }\n\n // Send desired speeds to motors.\n robot.leftDrive.setPower(leftSpeed);\n robot.rightDrive.setPower(rightSpeed);\n\n // Display it for the driver.\n telemetry.addData(\"Target\", \"%5.2f\", angle);\n telemetry.addData(\"Err/St\", \"%5.2f/%5.2f\", error, steer);\n telemetry.addData(\"Speed.\", \"%5.2f:%5.2f\", leftSpeed, rightSpeed);\n\n return onTarget;\n }", "public double eval(double x) {\n double temp;\n temp = this.a * Math.tan(this.b * x + this.c) + this.d;\n return temp;\n }", "@Test\n public void test17() throws Throwable {\n IllinoisSolver illinoisSolver0 = new IllinoisSolver();\n Tanh tanh0 = new Tanh();\n AllowedSolution allowedSolution0 = AllowedSolution.LEFT_SIDE;\n double double0 = illinoisSolver0.solve(16, (UnivariateRealFunction) tanh0, (-8.575998569792264E-17), 2.384185791015625E-7, allowedSolution0);\n }", "public double activationDerivative(double z);", "public double getTheta()\n\t{\n\t\treturn Math.toRadians(theta);\n\t}", "public double calculateHeadingRadians(){\r\n if(coordinateHistory.size() > 2){\r\n GPSCoordinate firstPoint = coordinateHistory.get(coordinateHistory.size() - 2);\r\n GPSCoordinate secondPoint = coordinateHistory.get(coordinateHistory.size() - 1);\r\n \r\n if(!firstPoint.compareTo(secondPoint)){\r\n double latA = firstPoint.getLatitude();\r\n double longA = firstPoint.getLongitude();\r\n double latB = secondPoint.getLatitude();\r\n double longB = secondPoint.getLongitude();\r\n\r\n double X = Math.cos(latB) * Math.sin(longB - longA);\r\n double Y = (Math.cos(latA) * Math.sin(latB)) - (Math.sin(latA) * Math.cos(latB) * Math.cos(longB - longA));\r\n\r\n headingRadians = - Math.atan2(X, Y);\r\n return headingRadians;\r\n }else{\r\n return headingRadians;\r\n }\r\n }else{\r\n return headingRadians;\r\n }\r\n }", "public double sProbability(String t_f, String t_e, Integer h){\n\t\tTriple<String, String, Integer> f_e_h = new Triple<String, String, Integer>(t_f,t_e,h);\n\t\tdouble first = (s.containsKey(f_e_h) ? s.get(f_e_h) : 0 );\n\t\tdouble[] tagDist = {0, 0.401, 0.264, 0.004, 0.004, 0.012, 0.205, 0.031, 0.008, 0.003, 0.086, 0.002};\n\t\t\n\t\treturn lambda*first + (1-lambda)*tagDist[h];\n\t\t\t\n\t}", "@Test\n\tvoid tanTestWithNegativeInfinity() throws CustomException {\n\t\tdouble input = Double.NEGATIVE_INFINITY;\n\t\tassertThrows(CustomException.class, () -> {TrigLib.tan(input);}, \"Throws Exception\");\n\t}", "boolean onHeading(double speed, double angle, double PCoeff) {\n double error ;\n double steer ;\n boolean onTarget = false ;\n double leftSpeed;\n double rightSpeed;\n\n // determine turn power based on +/- error\n error = getError(angle);\n\n if (Math.abs(error) <= HEADING_THRESHOLD) {\n steer = 0.0;\n leftSpeed = 0.0;\n rightSpeed = 0.0;\n onTarget = true;\n }\n else {\n steer = getSteer(error, PCoeff);\n rightSpeed = speed * steer;\n leftSpeed = -rightSpeed;\n }\n\n // Send desired speeds to motors.\n leftMotor.setPower(leftSpeed);\n rightMotor.setPower(rightSpeed);\n\n // Display it for the driver.\n telemetry.addData(\"Target\", \"%5.2f\", angle);\n telemetry.addData(\"Err/St\", \"%5.2f/%5.2f\", error, steer);\n telemetry.addData(\"Speed.\", \"%5.2f:%5.2f\", leftSpeed, rightSpeed);\n\n return onTarget;\n }", "public double calcHypo(double x,double y){\n\t\tdouble h = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\n\t\treturn h;\n\t}", "public double compute(double v)\r\n {\n return Math.toDegrees(Float11.atan(v));\r\n }", "private Float sigmoidSmoothing(Float value){\n\t\tvalue = (float) (1/(1+Math.pow(value, -1)));\n\t\treturn value;\n\t}", "@Override\n\tpublic double DienTich() {\n\t\treturn (Math.sqrt(banKinh)*P);\n\t}", "@Override\n\tpublic Simplex2v3d getTangentPlane(float xPos, float zPos) {\n\t\treturn new Simplex2v3d(func.evaluateDerivative(new float[] {xPos, zPos}, 0), func.evaluateDerivative(new float[] {xPos, zPos}, 1), new Vector3f(xPos, getHeight(xPos, zPos), zPos));\n\t}", "private float horisontalTicker() {\n\t\t\t\treturn (ticker_horisontal += 0.8f);\n\t\t\t}", "public static final float sinh(float x) {\n \t\treturn (MoreMath.pow(MoreMath.E, x) - MoreMath.pow(MoreMath.E, -x)) / 2.0f;\n \t}", "private static float easeInOut(float t) {\n return MathHelper.lerp(t, t * t, 2 * t - (t * t));\n }", "public double getHeadingInDegrees(){\r\n double headingRadians = calculateHeadingRadians();\r\n return headingRadians * 180 / Math.PI;\r\n }", "public double calculateTheta (double angleA, double angleB){\n\t\tif(LocalizationLab.fallingEdge == false){\n\t\t\tdeltaTheta = 37 - (0.5)*(angleA+angleB);\n\t\t}\n\t\telse{\n\t\t\tdeltaTheta = 220 - (0.5)*(angleA+angleB);\n\t\t}\n\t\treturn deltaTheta;\n\t}", "private double moyenne(Hashtable<Integer, Double> h){\n\t\tEnumeration<Integer> e = h.keys();\n\t\tdouble res = 0 ;\n\t\t// On somme l'ensemble des distances entre cette tables et les tables occuppées, on divise ensuite.\n\t\twhile(e.hasMoreElements()){ res += h.get(e.nextElement()) ; }\n\t\tres /= h.size() ;\n\t\treturn res ;\n\t}", "private static double angulo(Point2D.Double p2,Point2D.Double p1){\n \t\n return Math.atan2(p2.x - p1.x, p2.y - p1.y);\n }", "public static double sigmoid(double value, double k, double a) {\n return Math.pow(value, a) / (Math.pow(k, a) + Math.pow(value, a));\n }", "@Test\n public void test31() throws Throwable {\n Complex complex0 = new Complex(0.0, 0.0);\n Complex complex1 = complex0.tanh();\n Complex complex2 = complex0.asin();\n Complex complex3 = new Complex(0.0, 0.0);\n Complex complex4 = complex0.cos();\n Complex complex5 = complex4.sqrt1z();\n Complex complex6 = complex0.tan();\n Complex complex7 = complex4.acos();\n Complex complex8 = complex0.tan();\n String string0 = complex4.toString();\n Complex complex9 = complex0.negate();\n Complex complex10 = complex0.exp();\n Complex complex11 = complex4.negate();\n int int0 = complex7.hashCode();\n Complex complex12 = complex11.tanh();\n Complex complex13 = complex10.divide(complex8);\n }", "boolean onHeading(double speed, double angle, double PCoeff) {\n double error ;\n double steer ;\n boolean onTarget = false ;\n double leftSpeed;\n double rightSpeed;\n\n // determine turn power based on +/- error\n error = getError(angle);\n\n if (Math.abs(error) <= HEADING_THRESHOLD) {\n steer = 0.0;\n leftSpeed = 0.0;\n rightSpeed = 0.0;\n onTarget = true;\n }\n else {\n steer = getSteer(error, PCoeff);\n rightSpeed = speed * steer;\n leftSpeed = -rightSpeed;\n }\n\n // Send desired speeds to motors.\n leftmotor.setPower(leftSpeed);\n rightmotor.setPower(rightSpeed);\n\n return onTarget;\n }" ]
[ "0.775054", "0.77315736", "0.7311127", "0.7082893", "0.6543509", "0.6299508", "0.6234793", "0.60910326", "0.6075975", "0.6068501", "0.59987015", "0.5963604", "0.5899724", "0.5780101", "0.57661647", "0.5746933", "0.57301974", "0.5673066", "0.5612761", "0.5597096", "0.5560134", "0.55491734", "0.5533096", "0.5486335", "0.5402446", "0.53763527", "0.53762996", "0.53591585", "0.53318346", "0.520022", "0.51942056", "0.5181011", "0.5122983", "0.50485474", "0.50471276", "0.5030363", "0.50025356", "0.49790972", "0.49510854", "0.49377105", "0.49345136", "0.4929661", "0.4906998", "0.48547715", "0.48501977", "0.48351076", "0.4826374", "0.48191768", "0.48109075", "0.48080078", "0.48072413", "0.47995448", "0.47749415", "0.47701487", "0.4769698", "0.47550792", "0.47353005", "0.47302228", "0.4727527", "0.4721559", "0.47142896", "0.47098768", "0.4707618", "0.4705146", "0.47041735", "0.4700417", "0.46920902", "0.46909046", "0.46872818", "0.4652664", "0.46482125", "0.46339035", "0.46032652", "0.45905337", "0.45842314", "0.4582595", "0.45667386", "0.45592", "0.4556012", "0.4553354", "0.4546214", "0.45433563", "0.45276713", "0.45255497", "0.45233235", "0.45094076", "0.45036754", "0.45032588", "0.44952184", "0.44938228", "0.44918373", "0.4489342", "0.44889143", "0.4483942", "0.44818395", "0.44807038", "0.44795784", "0.44783074", "0.4477627", "0.44746548" ]
0.72734606
3
Read the developer key from the properties file.
public List<YoutubeVideo> searchFromYoutube(String keyword) { Properties properties = new Properties(); try { InputStream in = SearchYoutube.class.getResourceAsStream("/weiwei/google/" + PROPERTIES_FILENAME); properties.load(in); } catch (IOException e) { System.err.println("There was an error reading " + PROPERTIES_FILENAME + ": " + e.getCause() + " : " + e.getMessage()); System.exit(1); } try { // This object is used to make YouTube Data API requests. The last // argument is required, but since we don't need anything // initialized when the HttpRequest is initialized, we override // the interface and provide a no-op function. youtube = new YouTube.Builder(Auth.HTTP_TRANSPORT, Auth.JSON_FACTORY, new HttpRequestInitializer() { public void initialize(HttpRequest request) throws IOException { } }).setApplicationName("youtube-cmdline-search-sample").build(); // Prompt the user to enter a query term. String queryTerm = keyword; // Define the API request for retrieving search results. YouTube.Search.List search = youtube.search().list("id,snippet"); // Set your developer key from the {{ Google Cloud Console }} for // non-authenticated requests. See: // {{ https://cloud.google.com/console }} String apiKey = properties.getProperty("youtube.apikey"); search.setKey(apiKey); search.setQ(queryTerm); // Restrict the search results to only include videos. See: // https://developers.google.com/youtube/v3/docs/search/list#type search.setType("video"); // To increase efficiency, only retrieve the fields that the // application uses. search.setFields("items(id/kind,id/videoId,snippet/title,snippet/description,snippet/thumbnails/default/url)"); search.setMaxResults(NUMBER_OF_VIDEOS_RETURNED); // Call the API and print results. SearchListResponse searchResponse = search.execute(); List<SearchResult> searchResultList = searchResponse.getItems(); if (searchResultList != null) { //prettyPrint(searchResultList.iterator(), queryTerm); List<YoutubeVideo> videoIdList = new ArrayList<>(); for (SearchResult singleVideo : searchResultList) { ResourceId rId = singleVideo.getId(); if (rId.getKind().equals("youtube#video")) { YoutubeVideo video = new YoutubeVideo(); Thumbnail thumbnail = singleVideo.getSnippet().getThumbnails().getDefault(); video.setVideoNum(rId.getVideoId()); video.setVideoTitle(singleVideo.getSnippet().getTitle()); video.setDescription(singleVideo.getSnippet().getDescription()); video.setThumbnail(thumbnail.getUrl()); videoIdList.add(video); } } return videoIdList; } } catch (GoogleJsonResponseException e) { System.err.println("There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); } catch (IOException e) { System.err.println("There was an IO error: " + e.getCause() + " : " + e.getMessage()); } catch (Throwable t) { t.printStackTrace(); } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private String getApiKey() throws IOException {\n Properties prop = new Properties();\n InputStream loader = getClass().getClassLoader().getResourceAsStream(\"config.properties\");\n prop.load(loader);\n\n return prop.getProperty(\"apiKey\");\n }", "public static String extractFromPropertiesFile(String key) throws IOException {\n\t\tFileInputStream fis = new FileInputStream(\"./env.properties\");\n\t\tProperties prop = new Properties();\n\t\tprop.load(fis);\t\n\t\treturn prop.getProperty(key);\n\t}", "public String getExistingData(String key) throws IOException {\n\t\tFileReader fs = new FileReader(\"/Users/rohan.rana/Desktop/Appium_Test/resource/Data.properties\");\n\t\tProperties p = new Properties();\n\t\tp.load(fs);\n\t\treturn p.getProperty(key);\n\t}", "static String getAuth(String key) {\r\n try {\r\n Properties properties = new Properties();\r\n properties.load(new FileInputStream(new File(Run.CREDENTIALS_FILE_NAME)));\r\n\r\n return properties.getProperty(key);\r\n }\r\n catch(IOException e) {\r\n System.out.println(e.getMessage());\r\n }\r\n return null;\r\n }", "public static String getProperty(String key, Context context) throws IOException {\n Properties properties = new Properties();\n AssetManager assetManager = context.getAssets();\n InputStream inputStream = assetManager.open(\"config-private.properties\");\n properties.load(inputStream);\n return properties.getProperty(key);\n }", "public String getConfigProperties(String key) {\n String value = null;\n try {\n FileReader fileReader=new FileReader(System.getProperty(\"user.dir\")+\"/src/main/resources/config.properties\");\n Properties properties=new Properties();\n properties.load(fileReader);\n value= properties.getProperty(key);\n }catch (Exception e){\n e.printStackTrace();\n }\n return value;\n }", "String getEnvironmentProperty(String key);", "public final String readProperty(@NonNull final String key){\n return mProperties.getProperty(key);\n }", "public final String readProperty(final String key){\n return mProperties.getProperty(key);\n }", "public static String getProperty (String key) {\n return SystemProperties.getProperty(key);\n }", "public String getProperty(String key) {\n \t\tSecurityManager sm = System.getSecurityManager();\n \n \t\tif (sm != null) {\n \t\t\tsm.checkPropertyAccess(key);\n \t\t}\n \n \t\treturn (framework.getProperty(key));\n \t}", "public static final String getPropertyString(String key) {\n\t\tProperties props = new Properties();\n\t\tprops = loadProperties(propertyFileAddress);\n\t\treturn props.getProperty(key);\n\t}", "private static String loadToken(File file, String key) throws IOException {\n \t\tProperties properties = loadProperties(file);\n \t\tString token = (String) properties.get(key);\n \t\tif (StringUtils.isEmpty(token))\n \t\t\treturn null;\n \t\treturn token;\n \t}", "public static String getProp(String key) {\n try {\n Process process = Runtime.getRuntime().exec(String.format(\"getprop %s\", key));\n String value = new BufferedReader(new InputStreamReader(process.getInputStream())).readLine();\n process.destroy();\n return value;\n } catch (IOException e) {\n Log.d(\"getProp exception\", e.toString(), e);\n return null;\n }\n }", "public String getAppKey() {\n return appKey;\n }", "static void getProp() throws Exception {\r\n\r\n\t\tFileInputStream fileInputStream = new FileInputStream(\r\n\t\t\t\t\"C:\\\\repos\\\\test\\\\src\\\\main\\\\java\\\\test\\\\config.properties\");\r\n\r\n\t\tProperties properties = new Properties();\r\n\t\tproperties.load(fileInputStream);\r\n\r\n\t\tSystem.out.println(\"By using File Input stream class: \" + properties.getProperty(\"username\"));\r\n\r\n\t}", "public String getUserKey()\r\n {\r\n return getAttribute(\"userkey\");\r\n }", "private static String getProperty(String key)\r\n/* 70: */ throws IOException\r\n/* 71: */ {\r\n/* 72: 71 */ log.finest(\"OSHandler.getProperty\");\r\n/* 73: 72 */ File propsFile = getPropertiesFile();\r\n/* 74: 73 */ FileInputStream fis = new FileInputStream(propsFile);\r\n/* 75: 74 */ Properties props = new Properties();\r\n/* 76: 75 */ props.load(fis);\r\n/* 77: 76 */ String value = props.getProperty(key);\r\n/* 78: 77 */ fis.close();\r\n/* 79: 78 */ log.finest(\"Key=\" + key + \" Value=\" + value);\r\n/* 80: 79 */ return value;\r\n/* 81: */ }", "public static String GetData(String key) throws Exception {\r\n PropertiesConfiguration properties;\r\n if (GetConfigData(\"getDataFromEnvironment\").equals(\"testEnvironment\")) {\r\n properties = new PropertiesConfiguration(\r\n System.getProperty(\"user.dir\") + \"//src//test//resource//dataRepo//testEnvironment.properties\");\r\n } else if (GetConfigData(\"getDataFromEnvironment\").equals(\"sandboxEnvironment\")) {\r\n properties = new PropertiesConfiguration(\r\n System.getProperty(\"user.dir\") + \"//src//test//resource//dataRepo//sandboxEnvironment.properties\");\r\n } else {\r\n throw new Exception(\"mentioned environment is not iplemented to get data\");\r\n }\r\n\r\n return properties.getString(key);\r\n }", "public static String loadProperty(String key) {\n Properties prop = new Properties();\n InputStream is;\n\n try {\n is = new FileInputStream(\"./config.properties\");\n prop.load(is);\n } catch (IOException e) {\n System.out.println(\"Error al cargar el archivo\");\n }\n\n return prop.getProperty(key);\n }", "public static String get(String key) {\n return properties.getProperty(key);\n }", "public static String get(String key){\n\t\tif(sys_cfg == null){\n\t\t\tsys_cfg = new Configuration(\"text.properties\");\n\t\t}\n\t\tString value = sys_cfg.getValue(key);\n\t\treturn value;\n\t}", "void setDevkey(String devkey);", "public static String getProperty( String key )\r\n {\r\n if (System.getProperties().containsKey( key ))\r\n {\r\n return System.getProperty( key );\r\n }\r\n return _resourceBundle.getString( key );\r\n }", "public static String readPropertyFile(String pathofFile, String Key)\r\n\t\t{\r\n\t\t\tString value = \"\";\r\n\t\t\treturn value;\r\n\t\t}", "Object getAuthInfoKey();", "public String getSystemProperties(String key) {\n // Whether EDGE, UMTS, etc...\n return SystemProperties.get(key);\n }", "public String get(String key) {\n return this.properties.getProperty(key);\n }", "@SuppressWarnings(\"IfStatementWithIdenticalBranches\")\n public final String getPropertyFromFile(final String key) {\n final var file = this.getPropertyCatalog();\n String data = \"\";\n File prop = new File(file);\n if (!prop.exists() || prop.length() == 0) {\n data = \"Refuse.Missing property file.\";\n } else {\n try (BufferedReader reader = new BufferedReader(\n new FileReader(file))) {\n String line;\n while ((line = reader.readLine()) != null) {\n if (line.contains(\"=\") && line.contains(key)) {\n if (line.split(\"=\").length >= 2) {\n data = line.split(\"=\")[1];\n break;\n } else {\n data = \"abuse parameter.\";\n break;\n }\n }\n }\n } catch (IOException e) {\n data = \"Refuse.Mistake in-out property file.\";\n }\n }\n return data;\n }", "java.lang.String getPublicEciesKey();", "static void getProps() throws Exception {\r\n\t\tFileReader fileReader = new FileReader(\"C:\\\\repos\\\\test\\\\src\\\\main\\\\java\\\\test\\\\config.properties\");\r\n\t\tProperties properties = new Properties();\r\n\r\n\t\tproperties.load(fileReader);\r\n\r\n\t\tSystem.out.println(\"By using File Reader: \" + properties.getProperty(\"username\"));\r\n\r\n\t}", "public static String getProp(PropertiesAllowedKeys key) {\n\t\ttry {\n\t\t\treturn (String) properties.get(key.toString());\n\t\t} catch (NullPointerException e) {\n\t\t\tSystem.err\n\t\t\t\t\t.println(\"You just found a bug in marabou. Marabou requested a config key from marabou.properties that is non existent.\\n\"\n\t\t\t\t\t\t\t+ \"Please file a bug report and include this messages and what you just did.\");\n\t\t\treturn \"\";\n\t\t}\n\t}", "public static String getPropertyFromFile(String propName)throws ISException{\n InputStream inputStream;\n Properties prop = new Properties();\n try {\n inputStream = new FileInputStream(new File(System.getenv(\"conf.home\")+\"\\\\application.properties\"));\n prop.load(inputStream);\n if(prop==null){\n throw new ISException(\"getProperty: Cannot open property file!\");\n }\n return prop.getProperty(propName);\n } catch(Exception e){\n throw new ISException(\"getProperty: Cannot open property file!\");\n }\n }", "protected abstract String getUseProjectKey();", "public String getMainKey() {\r\n return mainKey;\r\n }", "private static String readPropertiesFile() {\n Properties prop = new Properties();\n\n try (InputStream inputStream = MembershipService.class.getClassLoader().getResourceAsStream(\"config.properties\")) {\n\n if (inputStream != null) {\n prop.load(inputStream);\n } else {\n throw new FileNotFoundException(\"property file 'config.properties' not found in the classpath\");\n }\n } catch (Exception e) {\n return \"\";\n }\n return prop.getProperty(\"introducer\");\n }", "protected String getProperty(String key) {\r\n\t\ttry {\r\n\t\t\tif (null == key || (\"\").equals(key.trim())) {\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t\treturn rb.getString(key);\r\n\t\t} catch (Exception ex) {\r\n\t\t\tLOG.error(\"Can't find key \" + key + \"in resource bundle file\", ex);\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}", "public String get(String key) {\n return this.properties.getProperty(key);\n }", "public static String getProperty(final String key) {\n String str = null;\n if (resourceBundle != null) {\n str = resourceBundle.getString(key);\n LOGGER.debug(\"Value found: \" + str + \" for key: \" + key);\n } else {\n LOGGER.debug(\"Properties file was not loaded correctly!!\");\n }\n return str;\n }", "public String getAPIkey() {\n\t\treturn key1;\r\n\t}", "String getComponentAesKey();", "public static String getProperty(String key) {\n\t\treturn properties.getProperty(key);\n\t}", "protected abstract String getExecutableKey();", "@Nullable\n private synchronized KeyPair readKeyPair() throws GeneralSecurityException, IOException {\n final String methodTag = TAG + \":readKeyPair\";\n\n Logger.v(methodTag, \"Reading Key entry\");\n try {\n final KeyStore keyStore = KeyStore.getInstance(ANDROID_KEY_STORE);\n keyStore.load(null);\n\n final Certificate cert = keyStore.getCertificate(KEY_STORE_CERT_ALIAS);\n final Key privateKey = keyStore.getKey(KEY_STORE_CERT_ALIAS, null);\n\n if (cert == null || privateKey == null) {\n Logger.v(methodTag, \"Key entry doesn't exist.\");\n return null;\n }\n\n return new KeyPair(cert.getPublicKey(), (PrivateKey) privateKey);\n } catch (final RuntimeException e) {\n // There is an issue in android keystore that resets keystore\n // Issue 61989: AndroidKeyStore deleted after changing screen lock type\n // https://code.google.com/p/android/issues/detail?id=61989\n // in this case getEntry throws\n // java.lang.RuntimeException: error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long\n // handle it as regular KeyStoreException\n throw new KeyStoreException(e);\n }\n }", "public void readPrivateKey(String filename) {\n FileHandler fh = new FileHandler();\n Map<String, BigInteger> skMap= fh.getKeyFromFile(filename);\n this.n = skMap.get(\"n\");\n this.d = skMap.get(\"key\");\n }", "public static String getProperty(String key) {\r\n\r\n\t\treturn getProperties(LanguageManagerUtil.getCurrentLanguage()).getString(key);\r\n\t}", "public static String get(String key) throws UnknownID, IOFailure, ArgumentNotValid {\n\t\tArgumentNotValid.checkNotNullOrEmpty(key, \"String key\");\n\t\tString val = System.getProperty(key);\n\t\tif (val != null) {\n\t\t\treturn val;\n\t\t}\n\n\t\t// Key not in System.properties try loaded data instead\n\t\tsynchronized (fileSettingsXmlList) {\n\t\t\tfor (SimpleXml settingsXml : fileSettingsXmlList) {\n\t\t\t\tif (settingsXml.hasKey(key)) {\n\t\t\t\t\treturn settingsXml.getString(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n/*\n\t\t// Key not in file based settings, try classpath settings instead\n\t\tsynchronized (defaultClasspathSettingsXmlList) {\n\t\t\tfor (SimpleXml settingsXml : defaultClasspathSettingsXmlList) {\n\t\t\t\tif (settingsXml.hasKey(key)) {\n\t\t\t\t\treturn settingsXml.getString(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n */\n\t\tthrow new UnknownID(\"No match for key '\" + key + \"' in settings\");\n\t}", "@Override\r\n\tpublic String getProperty(String key) {\r\n\t\t\r\n\t\treturn Settings.getProperty(key);\r\n\t\t\r\n\t}", "java.lang.String getClientKey();", "public byte[] getUserKey() throws IOException\n {\n byte[] u = null;\n COSString user = (COSString)encryptionDictionary.getDictionaryObject( COSName.getPDFName( \"U\" ) );\n if( user != null )\n {\n u = user.getBytes();\n }\n return u;\n }", "String getProperty(String key);", "String getProperty(String key);", "String getProperty(String key);", "private static String getKey(String filename) throws IOException {\n\t\tString strKeyPEM = \"\";\n\t\tBufferedReader br = new BufferedReader(new FileReader(filename));\n\t\tString line;\n\t\twhile ((line = br.readLine()) != null) {\n\t\t\tstrKeyPEM += line;\n\t\t}\n\t\tbr.close();\n\t\treturn strKeyPEM;\n\t}", "public String getProperty(String key) {\n String value = properties.getProperty(key);\n return value;\n }", "public String accessLocationPropFile(){\n\t\tProperties prop = new Properties();\n\t\tString loc=\"\";\n\t\ttry {\n\t\t\t//load a properties file\n\t\t\tprop.load(new FileInputStream(\"C:/Users/SARA/Desktop/OpenMRS/de/DeIdentifiedPatientDataExportModule/api/src/main/resources/config1.properties\"));\n\t\t\tInteger a = getRandomBetween(1, 3);\n\t\t\tloc = prop.getProperty(a.toString());\n\n\t\t} catch (IOException ex) {\n\t\t\tlog.error(\"IOException in accessing Location File\", ex);\n\t\t}\n\t\treturn loc;\n\t}", "private String get(String key)\n {\n return settings.getProperty(key);\n }", "public static String getProperty(String aKey) {\n checkArgument(!isNullOrEmpty(aKey), \"aKey cannot be null or empty\");\n \n loadPropertiesFile();\n String propValue = \"\";\n propValue = props.getProperty(aKey);\n return propValue;\n }", "public String getKeyFilePath();", "@Override\n public PropertySource<?> locate(Environment environment) {\n return new MapPropertySource(\"secretKey\", Collections.<String, Object>singletonMap(\"auth.secret-key\", \"Sup3rS3cr37\"));\n }", "public String getAccessKey() {\n return properties.getProperty(ACCESS_KEY);\n }", "private Properties loadProperties(String propertyFile) {\n\t\toAuthProperties = new Properties();\n\t\ttry {\n\t\t\toAuthProperties.load(App.class.getResourceAsStream(propertyFile));\n\t\t} catch (IOException e) {\n\t\t\tSystem.err.println(\"Unable to read \" + propertyFile\n\t\t\t\t\t+ \" configuration. Make sure you have a properly formatted \" + propertyFile + \" file.\");\n\t\t\treturn null;\n\t\t}\n\t\treturn oAuthProperties;\n\t}", "public static String getProperty(String key) {\n\t\tString val = properties.getProperty(key);\n\t\tif (val == null) {\n\t\t\tAlert.raise(null, \"Unable to find config property named '\" + key + \"' in \"\n\t\t\t\t\t+ Configuration.configFileName);\n\t\t}\n\t\treturn val;\n\t}", "public static String getProperty(String key) {\r\n if (oProperties == null) {\r\n oInstance.loadProperties();\r\n }\r\n return oProperties.getProperty(key);\r\n }", "public String accessKey() {\n return this.accessKey;\n }", "public String getPropertyDecrypted(ApplicationConfigurationPropertyConstant key)\r\n throws EncryptionException {\r\n String value = properties.get(key.getKeyString());\r\n if (StringUtils.isNotEmpty(value)) {\r\n return EncryptionUtils.decrypt(value,\r\n ApplicationProperty.INSTALLATION_UNIQUE_ID.getValue());\r\n }\r\n return value;\r\n }", "public static String getIAMUserKey(){\n \t\t// There are a few places to look for this\n \t\tString key = System.getProperty(\"AWS_SECRET_KEY\");\n \t\tif(key != null) return key;\n \t\tkey = System.getProperty(STACK_IAM_KEY);\n \t\tif (key == null) return null;\n \t\tkey = key.trim();\n \t\tif (\"\".equals(key)) return null;\n \t\treturn key;\n \t}", "public static String getValue(String key) {\r\n\t\tload();\r\n\t\treturn properties.getProperty(key);\r\n\t}", "String get(String key) {\n return settings.get(key);\n }", "private String getDeprecatedSystemPropertyKey(String key) {\n if (key == null) {\n throw new IllegalArgumentException(\"key\");\n }\n return SYSTEM_PROPERTY_ROOT_DEPRECATED + key;\n }", "public String getStringProperty(String key) {\n \n return environment.getProperty(key, String.class);\n }", "public String getSecretKey() {\n return properties.getProperty(SECRET_KEY);\n }", "@Override\n\tpublic String getKey() {\n\t\t LiuLiang_Key = Util.getMaiYuanConfig(\"LiuLiang_Key\");\n\t\treturn LiuLiang_Key;\n\t}", "public static String getProperty(String key) {\r\n\t\treturn prop.getProperty(key);\r\n\t}", "public static String getString(final String key) {\r\n if (PROP == null) {\r\n throw new RuntimeException(\"Config hasn't been initialized yet.\");\r\n }\r\n if (PROP.containsKey(key))\r\n return PROP.getProperty(key);\r\n else\r\n throw new RuntimeException(\"No config key found for [\" + key + \"].\"\r\n + \" from PROP:\" + PROP);\r\n }", "private String getValueFromProperty(String key) {\n\t\treturn properties.getProperty(key);\n\n\t}", "public String getProperty( String key )\n {\n List<Props.Entry> props = this.props.getEntry();\n Props.Entry keyObj = new Props.Entry();\n keyObj.setKey( key );\n\n String value = null;\n int indx = props.indexOf( keyObj );\n if ( indx != -1 )\n {\n Props.Entry entry = props.get( props.indexOf( keyObj ) );\n value = entry.getValue();\n }\n\n return value;\n }", "public static String readValue(String filePath, String key) {\n\t\tProperties props = new Properties();\n\t\tString value = new String();\n\t\ttry {\n\t\t\tInputStream in = new BufferedInputStream(new FileInputStream(\n\t\t\t\t\tfilePath));\n\t\t\tprops.load(in);\n\t\t\tvalue = props.getProperty(key);\n\t\t\tSystem.out.println(key + \":\" + value);\n\t\t\treturn value;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\treturn value;\n\t\t}\n\t}", "public String getPropKey() {\n return propKey;\n }", "private String key() {\n return \"secret\";\n }", "public final File getUserPropertiesFile() {\n\t\treturn userPropertiesFile;\n\t}", "public String getAPIKey()\r\n {\r\n return APIKey;\r\n }", "public String propKey() {\n return propKey;\n }", "java.lang.String getPropertiesOrThrow(\n java.lang.String key);", "private String getRequiredProperty(Properties props, String key) {\r\n\t\tString value = props.getProperty(key);\r\n\t\tif ((value == null) || (value.trim().length() == 0)) {\r\n\t\t\tthrow new IllegalArgumentException(\r\n\t\t\t\t\t\"Property file must provide a value for '\" + key + \"'\");\r\n\t\t}\r\n\t\treturn value;\r\n\t}", "public static String getString(String key) {\n try {\n return ctxPropertiesMap.get(key);\n } catch (MissingResourceException e) {\n return null;\n }\n }", "public String fw_Read_From_Property_file(String PropertyName) throws IOException\n\t{\n\t\tProperties prop = new Properties();\n\t\tInputStream input = null;\n\t\tinput = new FileInputStream(\"config.properties\");\n\t\tprop.load(input);\n\t\treturn prop.getProperty(PropertyName);\n\n\t}", "public String getPropertyKey() {\n\t\treturn propertyKey;\n\t}", "public static String readString(Context context, String key) {\n\t\tSharedPreferences sp = context.getSharedPreferences(Constant.PRE_CSDN_APP, Context.MODE_PRIVATE);\n\t\treturn sp.getString(key, \"\");\n\t}", "private void readSharedPreferences() {\n SharedPreferences sharedPref = getActivity().getSharedPreferences(SETTINGS_FILE_KEY, MODE_PRIVATE);\n currentDeviceAddress = sharedPref.getString(SETTINGS_CURRENT_DEVICE_ADDRESS, \"\");\n currentDeviceName = sharedPref.getString(SETTINGS_CURRENT_DEVICE_NAME, \"\");\n currentFilenamePrefix = sharedPref.getString(SETTINGS_CURRENT_FILENAME_PREFIX, \"\");\n currentSubjectName = sharedPref.getString(SETTINGS_SUBJECT_NAME, \"\");\n currentShoes = sharedPref.getString(SETTINGS_SHOES, \"\");\n currentTerrain = sharedPref.getString(SETTINGS_TERRAIN, \"\");\n }", "private String getProperty(String property) {\n String ret = sdkProperties.getProperty(property);\n if (null == ret) {\n logger.warn(String.format(\"No configuration value found for '%s'\", property));\n }\n return ret;\n }", "public String getProperty(String key) {\n\t\treturn this.properties.getProperty(key);\n\t}", "public String getSecretKey() {\n return getProperty(SECRET_KEY);\n }", "public static String getPropertyValue(String key){\n return properties.getProperty(key);\n }", "public static String GetRunTimeData(String key) throws IOException, ConfigurationException {\r\n\r\n PropertiesConfiguration properties = new PropertiesConfiguration(\r\n System.getProperty(\"user.dir\") + \"//src//test//resource//dataRepo//runTimeDataRepo.properties\");\r\n return properties.getString(key);\r\n\r\n }", "int getProductKey();", "public static String readKey() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tSystem.out.print(\"Enter the key :: \");\n\t\tSystem.out.println();\n\t\tString s = br.readLine();\n\t\treturn s;\n\n\t}", "java.lang.String getPubkey();", "public String getPropertyeee(String key) {\n if (key == null) {\n return null;\n }\n String value = properties.getProperty(key);\n if (value == null) {\n return null;\n }\n return value;\n }", "private String getStringProperty(ParameterList key, boolean isFile) \n throws NumberFormatException, NullPointerException, MissingOptionException{\n try {\n boolean keyPresent = fileParameters.containsKey(key.name);\n String strValue = keyPresent ? fileParameters.getProperty(key.name).replaceAll(\"\\\\s\", \"\") : null;\n if (!keyPresent && key.mandatory) {\n throw new MissingOptionException(\"Input parameter not found: \" + key.name);\n }\n else if(!keyPresent){\n return null;\n }\n if(isFile){\n strValue = strValue.replaceFirst(\"^~\",System.getProperty(\"user.home\"));\n }\n loadedParametersLog.append(key.name).append(\"=\").append(strValue).append(\"\\n\");\n return strValue;\n } catch (NullPointerException e) {\n throw new NullPointerException(e.getMessage() + \"\\nThe parameter file was not initialized.\");\n }\n }", "public static String getKey(){\n\t\treturn key;\n\t}" ]
[ "0.67462003", "0.635409", "0.6341859", "0.6291053", "0.6189665", "0.6153231", "0.6134391", "0.6088675", "0.60510945", "0.6029294", "0.59849495", "0.5934606", "0.58925396", "0.58860046", "0.5855257", "0.5814855", "0.5808532", "0.5782577", "0.57595485", "0.57589525", "0.57120615", "0.56816185", "0.56803554", "0.56765753", "0.5671894", "0.566668", "0.56666726", "0.56666076", "0.56427866", "0.56150275", "0.5605916", "0.5593227", "0.55723476", "0.5568985", "0.555401", "0.5552187", "0.5519152", "0.55164325", "0.5506281", "0.55027556", "0.5489936", "0.5489526", "0.5484919", "0.54838693", "0.54824805", "0.5481657", "0.54796314", "0.5479544", "0.5468423", "0.5463294", "0.5463029", "0.5463029", "0.5463029", "0.54499", "0.54252577", "0.5401529", "0.5399334", "0.53806597", "0.5362765", "0.5361606", "0.5357442", "0.5355784", "0.53385895", "0.53358924", "0.53305405", "0.5322277", "0.53115296", "0.5282195", "0.5276925", "0.5273106", "0.52705634", "0.526194", "0.52596426", "0.52576923", "0.5256749", "0.5252464", "0.5250775", "0.5247805", "0.5247431", "0.52427846", "0.5228136", "0.52262014", "0.5226169", "0.52249026", "0.52206355", "0.5216622", "0.52156466", "0.52110106", "0.5210243", "0.5202553", "0.5177223", "0.51738524", "0.51682", "0.51655245", "0.5164677", "0.5164167", "0.5163694", "0.5152704", "0.51495117", "0.514667", "0.5145223" ]
0.0
-1
/ access modifiers changed from: protected
public void onResume() { List<String> a2; try { super.onResume(); if (Build.VERSION.SDK_INT >= 23 && this.a) { String[] strArr = this.needPermissions; try { if (Build.VERSION.SDK_INT >= 23 && getApplicationInfo().targetSdkVersion >= 23 && (a2 = a(strArr)) != null && a2.size() > 0) { try { getClass().getMethod("requestPermissions", String[].class, Integer.TYPE).invoke(this, (String[]) a2.toArray(new String[a2.size()]), 0); } catch (Throwable th) { } } } catch (Throwable th2) { th2.printStackTrace(); } } } catch (Throwable th3) { th3.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private abstract void privateabstract();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void smell() {\n\t\t\n\t}", "public abstract Object mo26777y();", "protected void h() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "protected abstract Set method_1559();", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo70713b();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "protected Doodler() {\n\t}", "public abstract void mo27386d();", "@Override\n\tprotected void getExras() {\n\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}", "private PropertyAccess() {\n\t\tsuper();\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public abstract void mo56925d();", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo27385c();", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public abstract void mo30696a();", "abstract int pregnancy();", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n public void init() {\n\n }", "@Override\n void init() {\n }", "@Override\n\tpublic void leti() \n\t{\n\t}", "private TMCourse() {\n\t}", "public abstract void mo35054b();", "@Override\n public void init() {\n }", "@Override\n\tpublic void buscar() {\n\t\t\n\t}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public final void mo51373a() {\n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "protected FanisamBato(){\n\t}", "public abstract Object mo1771a();", "public abstract void m15813a();", "public void gored() {\n\t\t\n\t}", "@Override\n public void get() {}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "private Get() {}", "private Get() {}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public abstract void mo27464a();", "public abstract String mo41079d();", "@Override\n\tpublic void classroom() {\n\t\t\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void logic() {\n\n\t}", "public abstract void mo102899a();", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo42329d();", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void method_4270() {}", "public abstract void mo6549b();", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "protected void init() {\n // to override and use this method\n }" ]
[ "0.7375736", "0.7042321", "0.6922649", "0.6909494", "0.68470824", "0.6830288", "0.68062353", "0.6583185", "0.6539446", "0.65011257", "0.64917654", "0.64917654", "0.64733833", "0.6438831", "0.64330196", "0.64330196", "0.64295477", "0.6426414", "0.6420484", "0.64083177", "0.6406691", "0.6402136", "0.6400287", "0.63977665", "0.63784796", "0.6373787", "0.63716805", "0.63680965", "0.6353791", "0.63344383", "0.6327005", "0.6327005", "0.63259363", "0.63079315", "0.6279023", "0.6271251", "0.62518364", "0.62254924", "0.62218183", "0.6213994", "0.6204108", "0.6195944", "0.61826825", "0.617686", "0.6158371", "0.6138765", "0.61224854", "0.6119267", "0.6119013", "0.61006695", "0.60922325", "0.60922325", "0.6086324", "0.6083917", "0.607071", "0.6070383", "0.6067458", "0.60568124", "0.6047576", "0.6047091", "0.60342956", "0.6031699", "0.6026248", "0.6019563", "0.60169774", "0.6014913", "0.6011912", "0.59969044", "0.59951806", "0.5994921", "0.599172", "0.59913194", "0.5985337", "0.59844744", "0.59678656", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.59647757", "0.59647757", "0.59616375", "0.5956373", "0.5952514", "0.59497356", "0.59454703", "0.5941018", "0.5934147", "0.5933801", "0.59318185", "0.5931161", "0.5929297", "0.5926942", "0.5925829", "0.5924853", "0.5923296", "0.5922199", "0.59202504", "0.5918595" ]
0.0
-1
check for valid input
public void writeNumber(int row, int column, int value){ if(!checkInput(row, column, value)) return; //Tile must be instance of Guess if (gameField[row][column] instanceof Guess) { if (gameState == GameState.PAUSED) { if (row == usedRow && column == usedColumn) { ((Guess) gameField[row][column]).setValue(value); gameState = GameState.PLAYING; usedRow = -1; usedColumn = -1; } else { //if game is PAUSED and player tries to change different Tile return; } } else { gameField[row][column].setTileState(TileState.GUESSING); ((Guess) gameField[row][column]).setValue(value); } //add record recordsList.add(new Record(row, column, value, gameField)); //check for if is number already used if(isNumberUsed(row, column, value)){ this.gameState = GameState.PAUSED; return; } if(isSolved()) this.gameState = GameState.SOLVED; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean isValidInput() {\n\t\treturn true;\n\t}", "private boolean isInputValid() {\n return true;\n }", "protected abstract boolean isInputValid();", "protected abstract boolean checkInput();", "private void validateInputParameters(){\n\n }", "protected abstract int isValidInput();", "private void checkUserInput() {\n }", "@Override\n\tpublic boolean checkInput() {\n\t\treturn true;\n\t}", "public boolean checkInput();", "public abstract boolean verifyInput();", "public boolean isInputValid()\n {\n String[] values = getFieldValues();\n if(values[0].length() > 0 || values[1].length() > 0 || values[2].length() > 0)\n return true;\n else\n return false;\n }", "private static boolean isBadInput(String s) {\n\t\tString[] split = s.split(\"\\\\s+\");\n\t\tif (split.length != 3) {\n\t\t\tSystem.err.printf(\"Unknow length: %d\\n\", split.length);\n\t\t\treturn true;\n\t\t}\n\t\ttry {\n\t\t\tInteger.parseInt(split[0]);\n\t\t\tInteger.parseInt(split[2]);\n\t\t} catch (NumberFormatException e) {\n\t\t\tSystem.err.printf(\"Input numbers only.\\n\");\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tif (split[1].length() != 1) {\n\t\t\tSystem.err.printf(\"Operator should be one character.\\n\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean checkForWrongInput(){\n if(this.studentCode.getText().isEmpty())\n return true;\n //Check for length\n if(this.studentCode.getText().length() != 3)\n return true;\n //Check for invalid characters\n for(char c: this.studentCode.getText().toCharArray())\n if(!Character.isDigit(c))\n return true;\n\n return false;\n }", "void checkValid();", "private boolean validateInput() {\n\tboolean valid = false;\n\ttry {\n\t if (paymentText == null | paymentText.getValue() == \"\") {\n\t\tpaymentText.focus();\n\t\tthrow new NullPointerException(\"paymentText fehlt\");\n\t }\n\t if (paymentBetrag == null | paymentBetrag.getValue() == \"\") {\n\t\tpaymentBetrag.focus();\n\t\tthrow new NullPointerException(\"paymentBetrag fehlt\");\n\t }\n\t if (!paymentBetrag.isEmpty()) {\n\t\t@SuppressWarnings(\"unused\")\n\t\tdouble d = Double.parseDouble(paymentBetrag.getValue());\n\t }\n\t // seems that everything was OK\n\t valid = true;\n\t} catch (NullPointerException e) {\n\t System.out.println(\"PaymentWindow - \" + e);\n\t} catch (NumberFormatException e) {\n\t // entered value is no number\n\t paymentBetrag.focus();\n\t}\n\treturn valid;\n }", "private boolean isInValidInput(String input) {\n\n\t\tif (input == null || input.isEmpty())\n\t\t\treturn true;\n\n\t\tint firstPipeIndex = input.indexOf(PARAM_DELIMITER);\n\t\tint secondPipeIndex = input.indexOf(PARAM_DELIMITER, firstPipeIndex + 1);\n\n\t\t/*\n\t\t * if there are no PARAM_DELIMITERs or starts with a PARAM_DELIMITER\n\t\t * (Meaning command is missing) or only single PARAM_DELIMITER input is\n\t\t * not valid\n\t\t */\n\t\tif (firstPipeIndex == -1 || firstPipeIndex == 0 || secondPipeIndex == -1)\n\t\t\treturn true;\n\n\t\t// Means package name is empty\n\t\tif (secondPipeIndex - firstPipeIndex < 2)\n\t\t\treturn true;\n\n\t\treturn false;\n\t}", "private boolean validFormInputs() {\n String email = etEmail.getText().toString();\n String password = etPassword.getText().toString();\n String institutionName = etInstitutionName.getText().toString();\n String addressFirst = etInstitutionAddressFirst.getText().toString();\n String addressSecond = etInstitutionAddressSecond.getText().toString();\n String CIF = etCIF.getText().toString();\n\n String[] allInputs = {email, password, institutionName, addressFirst, addressSecond, CIF};\n for (String currentInput : allInputs) {\n if (currentInput.matches(\"/s+\")) // Regex pt cazul cand stringul e gol sau contine doar spatii\n return false; // formular invalid - toate inputurile trebuie sa fie completate\n }\n String[] stringsAddressFirst = addressFirst.split(\",\");\n String[] stringsAddressSecond = addressSecond.split(\",\");\n if (stringsAddressFirst.length != 4 ||\n stringsAddressSecond.length != 3)\n return false;\n\n //<editor-fold desc=\"Checking if NUMBER and APARTMENT are numbers\">\n try {\n Integer.parseInt(stringsAddressSecond[0]);\n Integer.parseInt(stringsAddressSecond[2]);\n return true; // parsed successfully without throwing any parsing exception from string to int\n }catch (Exception e) {\n Log.v(LOG_TAG, \"Error on converting input to number : \" + e);\n return false; // parsed unsuccessfully - given strings can not be converted to int\n }\n //</editor-fold>\n }", "public boolean checkInput(){\n if(spelerIDField.getText().equals(\"\") || typeField.getText().equals(\"\") || codeField.getText().equals(\"\") || heeftBetaaldField.getText().equals(\"\")){\n return true;\n } else { return false; }\n }", "protected abstract boolean isInputValid(@NotNull ConversationContext context, @NotNull String input);", "private boolean isValidInput() {\n if (null == mUsername || mUsername.length() <= 0) {\n return false;\n } else if (null == mPassword || mPassword.length() <= 0) {\n return false;\n }\n return true;\n }", "@Override\n\tprotected void isValid(String input) throws DataInputException\n\t{\n\t}", "public boolean checkInput(String input){\n\t\t//make sure only input 0-9\n\t\tif(input.length() != 1){\n\t\t\treturn false;\n\t\t}\n\t\tchar c = input.charAt(0);\n\t\tif(!Character.isDigit(c)){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean checkEntryInputs() {\n\t\tboolean isValid = true;\n\t\tif(sampleNumberTF.getText().equals(\"\")) {\n\t\t\tisValid = false;\n\t\t}\n\t\t\n\t\tif(materialDescriptionTF.getText().equals(\"\")) {\n\t\t\tisValid = false;\n\t\t}\n\t\t\n\t\tif(Double.valueOf(bacteroidesConcentrationTF.getText())==null) {\n\t\t\tisValid = false;\n\t\t}\n\t\treturn isValid;\n\t}", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (nameField.getText() == null || nameField.getText().length() == 0) {\r\n errorMessage += \"请输入直播名!\\n\";\r\n }\r\n if (urlField.getText() == null || urlField.getText().length() == 0) {\r\n errorMessage += \"请输入直播流!\\n\";\r\n }\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n Alert alert = new Alert(Alert.AlertType.ERROR);\r\n alert.setTitle(\"输入错误\");\r\n alert.setContentText(errorMessage);\r\n return false;\r\n }\r\n }", "private static boolean validateInput1(String[] input) {\n\t\tif (input.length != 1) {\n\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private static boolean valid_input(String user_input) {\n \n boolean output = false;\n \n if(user_input.length() == 2){\n \n output = (user_input.substring(0,1).matches(\"[0-9]\") && user_input.substring(1,2).matches(\"[a-zA-Z]\"));\n } else if (user_input.length() == 3) {\n \n output = (user_input.substring(0,2).matches(\"[1-2][0-9]\") && user_input.substring(2,3).matches(\"[a-zA-Z]\"));\n \n if(Integer.parseInt(user_input.substring(0,2))>TicTacToe.game.gridSize){\n output = false;\n }\n }\n \n return output;\n }", "private boolean checkInputValidity() {\n // if any of the input field is empty, return false directly\n if (name.getText().equals(\"\") || id.getText().equals(\"\") || fiber.getText().equals(\"\")\n || protein.getText().equals(\"\") || fat.getText().equals(\"\") || calories.getText().equals(\"\")\n || carbohydrate.getText().equals(\"\")) {\n String message = \"Make sure enter the value of all nutrient components, please try again!\";\n // display the warning windows with the assigned warning message\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close();// close the add food stage\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n // if any nutrition info input is not a number value or is negative, return false directly\n try {\n Double fibervalue = null;\n Double proteinvalue = null;\n Double fatvalue = null;\n Double caloriesvalue = null;\n Double carbohydratevalue = null;\n // trim the input to exact numeric value\n fibervalue = Double.valueOf(fiber.getText().trim());\n proteinvalue = Double.valueOf(protein.getText().trim());\n fatvalue = Double.valueOf(fat.getText().trim());\n caloriesvalue = Double.valueOf(calories.getText().trim());\n carbohydratevalue = Double.valueOf(carbohydrate.getText().trim());\n // nutrition input is suppose to be positive numbers\n // if any of the numbers is negative, return false diretcly\n if (fibervalue < 0.0 || proteinvalue < 0.0 || fatvalue < 0.0 || caloriesvalue < 0.0\n || carbohydratevalue < 0.0) {\n String message = \"The input of the nutrient can not be negative, please try again!\";\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close();\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n // if any input of the nutrition info is not a double value, catch the exception and return\n // false\n } catch (Exception e) {\n String message =\n \"At least one nutrition value input is invalid, please type a number in nutrient textbox!\";\n // display the warning windows with the assigned warning message\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close(); // close the addfood stage\n // wait for response from ok button\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n return true;\n }", "private boolean validateInput(EditText titleInput, EditText descriptionInput, EditText priceInput) {\n String title = titleInput.getText().toString();\n String description = descriptionInput.getText().toString();\n int price = (TextUtils.isEmpty(priceInput.getText().toString()))? -1 : Integer.parseInt(priceInput.getText().toString());\n if (TextUtils.isEmpty(title) || TextUtils.isEmpty(description) || price < 0) {\n Toast.makeText(this.getActivity(),\n \"Please, fill in all fields.\",\n Toast.LENGTH_LONG).show();\n return false;\n }\n if (photoURI == null) {\n Toast.makeText(this.getActivity(),\n \"Please, add a picture to this item before submitting it.\",\n Toast.LENGTH_LONG).show();\n return false;\n }\n return true;\n }", "public boolean isInputValid(ConversationContext context, String s)\r\n/* */ {\r\n/* 135 */ return (s.equalsIgnoreCase(\"one\")) || (s.equals(\"1\")) || (s.equalsIgnoreCase(\"two\")) || (s.equals(\"2\")) || (s.equalsIgnoreCase(\"zero\")) || (s.equals(\"0\"));\r\n/* */ }", "private boolean validateInput() {\n boolean isValid = true;\n Alert errMsg = Util.getAlert(Alert.AlertType.ERROR);\n if (connectionsCB.getEditor().getText() == null || !Util.isValidAddress(connectionsCB.getEditor().getText())) {\n errMsg.setContentText(\"Invalid TRex Host Name or IP address\");\n isValid = false;\n } else if (!Util.isValidPort(rpcPort.getText())) {\n errMsg.setContentText(\"Invalid TRex Sync Port Number(\" + rpcPort.getText() + \")\");\n isValid = false;\n } else if (!Util.isValidPort(asyncPort.getText())) {\n errMsg.setContentText(\"Invalid Async Port Number(\" + asyncPort.getText() + \")\");\n isValid = false;\n } else if (Util.isNullOrEmpty(nameTF.getText())) {\n errMsg.setContentText(\"Name should not be empty\");\n isValid = false;\n }\n\n if (!isValid) {\n errMsg.show();\n }\n return isValid;\n }", "private boolean validInput()\n {\n boolean completeForm = true; //all textfields have been filled in\n boolean noExceptions = true; //all textfields (except name) have int\n boolean selectionMade = true; //user has selected a ship type\n\n if (shipNameInput.getText()==\"Ship name\" ||\n xcoordInput.getText()==\"Starting x coordinate\" ||\n ycoordInput.getText()==\"Starting y coordinate\")\n {\n System.out.println(\"ERROR: Please fill in all text fields before \"+\n \"adding your ship.\");\n completeForm = false;\n }\n try\n {\n xcoord = Integer.parseInt(xcoordInput.getText());\n ycoord = Integer.parseInt(ycoordInput.getText());\n }\n catch (NumberFormatException except)\n {\n System.out.println(\"ERROR: Ship coordinates and speed need to be \"+\n \"entered as integers.\");\n noExceptions = false;\n }\n if (directionInput.getResponse() == \"none\")\n {\n System.out.println(\"ERROR: Please choose a direction.\");\n selectionMade = false;\n }\n else\n {\n String d = directionInput.getResponse();\n if (d == \"N\") direction = 0;\n else if (d == \"NE\") direction = Ship.NE;\n else if (d == \"E\") direction = Ship.E;\n else if (d == \"SE\") direction = Ship.SE;\n else if (d == \"S\") direction = Ship.S;\n else if (d == \"SW\") direction = Ship.SW;\n else if (d == \"W\") direction = Ship.W;\n else if (d == \"NW\") direction = Ship.NW;\n }\n shipName = shipNameInput.getText();\n speed = speedSlider.getValue();\n\n return (completeForm && noExceptions && selectionMade);\n }", "private boolean validEditInput() throws SQLException {\n // Checks if any of the fields is empty\n if(teamNameEditField.getText().equals(\"\") || abbrevationEditField.getText().equals(\"\")\n || chooseCityBox.getValue() == null || chooseLeagueBox.getValue() == null\n || chooseLeagueTeamBox.getValue() == null) {\n displayMessage(messagePane,\"Please fill all the fields\",true);\n return false;\n }\n // Checks the abbrevation length\n else if(abbrevationEditField.getText().length() > 3)\n {\n displayMessage(messagePane,\"Abbrevations must be at most 3 characters\",true);\n return false;\n }\n // Checks team name length\n else if (teamNameEditField.getText().length() > 30){\n displayMessage(messagePane,\"Team Names must be smaller than 30 characters\",true);\n return false;\n }\n return true;\n }", "private static boolean valid(String arg) {\n\n /* check if valid option */\n if ( arg.equals(\"-v\") || arg.equals(\"-i\") || arg.equals(\"-p\") || arg.equals(\"-h\") )\n return true;\n\n /* check if valid port */\n try {\n int port = Integer.parseInt(arg);\n if ( ( 0 < port ) && ( port < 65354 ) )\n return true;\n } catch (NumberFormatException ignored) {}\n\n /* check if valid ip address */\n String[] ips = arg.split(\"\\\\.\");\n if ( ips.length != 4 )\n return false;\n try{\n for (int i=0; i<4; i++){\n int ip = Integer.parseInt(ips[i]);\n if ( ( ip < 0) || (255 < ip ) )\n return false;\n }\n } catch (NumberFormatException ignored) {return false;}\n\n return true;\n }", "private boolean isInputValid(){\n\t\tString errorMessage = \"\";\n\t\tif((nameField.getText() == null) || (nameField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid product name!\\n\";\n\t\t}\n\t\tif((amountAvailableField.getText() == null) || (amountAvailableField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid amount available value!\\n\";\n\t\t}\n\t\tif((amountSoldField.getText() == null) || (amountSoldField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid amount sold value!\\n\";\n\t\t}\n\t\tif((priceEachField.getText() == null) || (priceEachField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid price for each!\\n\";\n\t\t}\n\t\tif((priceMakeField.getText() == null) || (priceMakeField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid price to make the product!\\n\";\n\t\t}\n\t\tif(errorMessage.length() == 0){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "private void validateData() {\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (ServiceName.getText() == null || ServiceName.getText().length() == 0) {\n errorMessage += \"No valid name!\\n\";\n }\n if (Serviceemail.getText() == null || Serviceemail.getText().length() == 0) {\n Pattern p = Pattern.compile(\"[_A-Za-z0-9][A-Za-z0-9._]*?@[_A-Za-z0-9]+([.][_A-Za-z]+)+\");\n Matcher m = p.matcher(Serviceemail.getText());\n if (m.find() && m.group().equals(Serviceemail.getText())) {\n errorMessage += \"No valid Mail Forment!\\n\";\n }\n }\n if (servicedescrip.getText() == null || servicedescrip.getText().length() == 0) {\n errorMessage += \"No valid description !\\n\";\n }\n if (f == null && s.getImage() == null) {\n errorMessage += \"No valid photo ( please upload a photo !)\\n\";\n }\n if (Serviceprice.getText() == null || Serviceprice.getText().length() == 0) {\n errorMessage += \"No valid prix !\\n\";\n } else {\n // try to parse the postal code into an int.\n try {\n Float.parseFloat(Serviceprice.getText());\n } catch (NumberFormatException e) {\n errorMessage += \"No valid prix (must be a Float)!\\n\";\n }\n }\n if ( !Weekly.isSelected() && !Daily.isSelected() && !Monthly.isSelected()) {\n errorMessage += \"No valid Etat ( select an item !)\\n\";\n }\n if (Servicesatet.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid etat ( select an item !)\\n\";\n }\n if (ServiceCity.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid City ( select an item !)\\n\";\n }\n if (servicetype.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid Type ( select an item !)\\n\";\n }\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.setTitle(\"Invalid Fields\");\n alert.setHeaderText(\"Please correct invalid fields\");\n alert.setContentText(errorMessage);\n alert.showAndWait();\n return false;\n }\n }", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n// Show the error message.\r\n Dialogs.create()\r\n .title(\"Invalid Fields\")\r\n .masthead(\"Please correct invalid fields\")\r\n .message(errorMessage)\r\n .showError();\r\n return false;\r\n }\r\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (ID.getText() == null || ID.getText().length() == 0) {\n errorMessage += \"No valid id!\\n\";\n System.out.println(\"fl\");\n }\n if (password.getText() == null || password.getText().length() == 0) {\n errorMessage += \"No valid password!\\n\"; \n }\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Dialogs.create()\n .title(\"Invalid Fields\")\n .masthead(\"Please correct invalid fields\")\n .message(errorMessage)\n .showError();\n return false;\n }\n }", "public void checkInput(TextField number) {\r\n\t\ttry {\r\n\t\t\tlong num = Long.parseLong(number.getText());\r\n\t\t\tif (num < 0) \t\t\t\t\t// ako je negativan broj, pretvorit cemo ga u pozitivan\r\n\t\t\t\tnum = Math.abs(num);\r\n\t\t\tif (isValid(num)) \r\n\t\t\t\tscene2();\r\n\t\t}\r\n\t\tcatch (Exception e) {\t\t\t\t// hvatanje greske\r\n\t\t\talert(\"Wrong input, try again!\");\r\n\t\t}\r\n\t}", "private boolean validateInputs() {\n return !proID.getText().isEmpty() || \n !proName.getText().isEmpty() ||\n !proPrice.getText().isEmpty();\n }", "private boolean validateInput(){\n boolean operationOK = true;\n //perform input validation on the double values in the form\n String integrationTime = this.integrationTimeText.getText();\n String integrationFrequency = this.integrationFrequencyText.getText();\n \n if(!integrationTime.equals(\"\")){\n try {\n Double itime = Double.parseDouble(integrationTime);\n integrationTimeText.setBackground(Color.WHITE);\n integrationTimeText.setToolTipText(\"Time in seconds (s)\");\n } catch (NumberFormatException ex) {\n integrationTimeText.setBackground(Color.RED);\n operationOK=false;\n integrationTimeText.setToolTipText(\"This field has to be a valid double (eg. 1.5)\");\n }\n }\n if(!integrationFrequency.equals(\"\")){\n try {\n Double itime = Double.parseDouble(integrationFrequency);\n integrationFrequencyText.setBackground(Color.WHITE);\n integrationFrequencyText.setToolTipText(\"Frequency in Hertz (Hz)\");\n \n } catch (NumberFormatException ex) {\n operationOK=false;\n integrationFrequencyText.setBackground(Color.RED);\n integrationFrequencyText.setToolTipText(\"This field has to be a valid double (eg. 1.5)\");\n }\n }\n if(currentStepOperationsPanel!=null){\n operationOK = this.currentStepOperationsPanel.validateInput();\n \n }\n return operationOK;\n }", "boolean inputValid(String s) {\n\n if (s.length() == 0) {\n return false;\n }\n\n //check whether there are wrong commas\n for (int ii = 1; ii < s.length() - 1; ii++) {\n if (s.charAt(ii) == ',') {\n if(!s.contains(\"log\")) {\n resS = \"There are wrong commas\";\n return false;\n }\n }\n }\n\n //check whether there are multiple points\n if(s.charAt(0)=='.' || s.charAt(s.length()-1)=='.') return false;\n for (int ii = 1; ii < s.length() - 1; ii++) {\n if (s.charAt(ii) == '.') {\n if (!Character.isDigit(s.charAt(ii - 1))) {\n resS=\"These are wrong points.\";\n return false;\n } else if (!Character.isDigit(s.charAt(ii + 1))) {\n resS=\"These are wrong points.\";\n return false;\n } else {\n for (int jj = ii + 2; jj < s.length(); jj++) {\n if (s.charAt(jj) == '.') {\n String ss = s.substring(ii + 2, jj);\n if (!(ss.contains(\"+\") || ss.contains(\"-\") || ss.contains(\"*\") || ss.contains(\"/\") || ss.contains(\"%\")\n || ss.contains(\"^\") || ss.contains(\")\"))) {\n resS=\"These are wrong points.\";\n return false;\n }\n }\n }\n }\n }\n }\n ArrayList<Token> operation = tokenize(s);\n return isNumberOrOpe(operation) && isOpePosRight(operation) && isValidparentheses(operation) && isValidTan(operation) && isLogWrong(operation);\n }", "private boolean validateData() {\r\n TASKAggInfo agg = null;\r\n int index = aggList.getSelectedIndex();\r\n if (index != 0) {\r\n agg = (TASKAggInfo)aggregators.elementAt(aggList.getSelectedIndex()-1);\r\n }\r\n\r\n if (getArgument1() == BAD_ARGUMENT) {\r\n JOptionPane.showMessageDialog(this, \"Argument 1 must be of type: \"+TASKTypes.TypeName[agg.getArgType()], \"Error\", JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n else if (getArgument2() == BAD_ARGUMENT) {\r\n JOptionPane.showMessageDialog(this, \"Argument 2 must be of type: \"+TASKTypes.TypeName[agg.getArgType()], \"Error\", JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n else if (getOperand() == BAD_ARGUMENT) {\r\n JOptionPane.showMessageDialog(this, \"Filter value must be of type integer\", \"Error\", JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n return true;\r\n }", "private boolean isInputValid() {\n\t\tString errorMessage = \"\";\n\t\t\n\t\tif (dateField.getText() == null || dateField.getText().length() == 0) {\n\t\t\terrorMessage += \"Kein gültiges Datum!\\n\";\n\t\t} else {\n\t\t\tif (!DateUtil.validDate(dateField.getText())) {\n\t\t\t\terrorMessage += \"Kein gültiges Datum. Benutze das dd.mm.yyy Format!\\n\";\n\t\t\t}\n\t\t}\n\t\tString categoryFieldSelection = categoryField.getSelectionModel().getSelectedItem();\n\t\tif (categoryFieldSelection.isEmpty() || categoryFieldSelection.length() == 0) {\n\t\t\terrorMessage += \"Keine gültige Kategorie!\\n\";\n\t\t}\n\t\tif (useField.getText() == null || useField.getText().length() == 0) {\n\t\t\terrorMessage += \"Kein gültiger Verwendungszweck!\\n\";\n\t\t}\n\t\tif (amountField.getText() == null || amountField.getText().length() == 0) {\n\t\t\terrorMessage += \"Kein gültiger Betrag!\\n\";\n\t\t} \n\t\t/**else {\n\t\t\t// try to parse the amount into a double\n\t\t\ttry {\n\t\t\t\tDouble.parseDouble(amountField.getText());\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t\terrorMessage += \"Kein zulässiger Betrag! (Nur Dezimalzahlen erlaubt)\\n\";\n\t\t\t}\n\t\t}**/\n\t\tif (distributionKindField.getText() == null || distributionKindField.getText().length() == 0) {\n\t\t\terrorMessage += \"Keine gültige Ausgabeart!\\n\";\n\t\t}\n\n\t\tif (errorMessage.length() == 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\t// Show the error message.\n\t\t\tAlert alert = new Alert(AlertType.ERROR);\n\t\t\talert.initOwner(dialogStage);\n\t\t\talert.setTitle(\"Ungültige Eingaben\");\n\t\t\talert.setHeaderText(\"Bitte korrigieren Sie die Fehler in den Feldern.\");\n\t\t\talert.setContentText(errorMessage);\n\t\t\talert.showAndWait();\n\t\t\treturn false;\n\t\t}\n\t}", "private boolean checkInputFields(){\r\n\t\tString allertMsg = \"Invalid input: \" + System.getProperty(\"line.separator\");\r\n\t\t\r\n\t\t//Check input for MCS text field\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_MCSTf.getText());\r\n\t\t\tif(testValue < 0 || testValue > 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a number between 0 and 1 as a MCS score.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for relevance score weight and coherence score weight text fields\r\n\t\ttry{\r\n\t\t\tFloat relScoreW = Float.parseFloat(m_RelScoreTf.getText());\r\n\t\t\tFloat cohScoreW = Float.parseFloat(m_CohScoreTf.getText());\r\n\t\t\tif(relScoreW < 0 || relScoreW > 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t\tif(cohScoreW < 0 || cohScoreW > 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t\tif((relScoreW + cohScoreW) != 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a number between 0 and 1 as a weight for relevance and coherence score.\" + System.getProperty(\"line.separator\");\r\n\t\t\tallertMsg += \"Sum of the weights for relevance and coherence score must be 1.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for MCS text field\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_KeyTf.getText());\r\n\t\t\tif(testValue < 0)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number as multiplier for keyword concepts.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for category confidence weight\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_CatConfTf.getText());\r\n\t\t\tif(testValue < 0)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number as a weight for the weight of the category confidence of concepts.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for weight of repeated concepts\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_RepeatTf.getText());\r\n\t\t\tif(testValue < 0)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number as a weight for repeated concepts.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for number of output categories\r\n\t\ttry{\r\n\t\t\tInteger testValue = Integer.parseInt(m_MaxCatsTf.getText());\r\n\t\t\tif(testValue < 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number for the maximum number of output categories.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\ttry{\r\n\t\t\tInteger testValue = Integer.parseInt(m_MinCatsTf.getText());\r\n\t\t\tif(testValue < 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number for the minimum number of output categories.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_MinCatScoreTf.getText());\r\n\t\t\tif(testValue < 0.0f || testValue > 1.0f)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number between 0 and 1 as minimum category score.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\tif(allertMsg.length() > 18){\r\n\t\t\tAlert alert = new Alert(AlertType.ERROR);\r\n\t\t\talert.setContentText(allertMsg);\r\n\t\t\talert.showAndWait();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "default Boolean validateInput(String input){\n if (input.contains(\"(\") || input.contains(\")\") || input.contains(\"[\") || input.contains(\"}\") || input.contains(\"{\") || input.contains(\"}\") )\n {\n return true;\n }else{\n return false;\n }\n }", "private boolean validateInput() {\n String username = editUsername.getText().toString().trim();\n String email = editEmail.getText().toString().trim();\n String password = editPassword.getText().toString().trim();\n String repeatPassword = editRepeatPassword.getText().toString().trim();\n if (!password.equals(repeatPassword)) {\n ShowMessageUtil.tosatSlow(\"Enter passwords differ\", EmailRegisterActivity.this);\n return false;\n } else if (username.equals(\"\") || email.equals(\"\") || password.equals(\"\")) {\n ShowMessageUtil.tosatSlow(\"every item can not be empty!\", EmailRegisterActivity.this);\n return false;\n }\n if (username.length()>10){\n ShowMessageUtil.tosatSlow(\"the character length of the username can't be over than 10\", EmailRegisterActivity.this);\n return false;\n }\n return true;\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (commentField.getText() == null || commentField.getText().length() == 0) {\n errorMessage += \"Не введен комментарий!\\n\";\n }\n if (timeField.getText() == null || timeField.getText().length() == 0) {\n errorMessage += \"Не введено время выполнения задачи!\\n\";\n }\n if (errorMessage.length() == 0) {\n return true;\n } if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.INFORMATION);\n alert.setTitle(\"Не введены все данные!\");\n alert.setHeaderText(null);\n alert.setContentText(\"Пожалуйста, введите все данные!\");\n alert.showAndWait();\n return false;\n }\n }", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (idLabel.getText() == null || idLabel.getText().length() == 0) {\r\n errorMessage += \"No valid ID number!\\n\"; \r\n } else {\r\n // try to parse the postal code into an int.\r\n try {\r\n Integer.parseInt(idLabel.getText());\r\n } catch (NumberFormatException e) {\r\n errorMessage += \"No valid ID number (must be an integer)!\\n\"; \r\n }\r\n }\r\n \r\n if (firstNameField.getText() == null || firstNameField.getText().length() == 0) {\r\n errorMessage += \"No valid first name!\\n\"; \r\n }\r\n if (lastNameField.getText() == null || lastNameField.getText().length() == 0) {\r\n errorMessage += \"No valid last name!\\n\"; \r\n }\r\n if (industryField.getText() == null || industryField.getText().length() == 0) {\r\n errorMessage += \"No valid industry!\\n\"; \r\n }\r\n\r\n if (workTypeField.getText() == null || workTypeField.getText().length() == 0) {\r\n errorMessage += \"No valid work type!\\n\"; \r\n }\r\n\r\n if (addressField.getText() == null || addressField.getText().length() == 0) {\r\n errorMessage += \"No valid address!\\n\";\r\n }\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n // Show the error message.\r\n Alert alert = new Alert(AlertType.ERROR);\r\n alert.initOwner(dialogStage);\r\n alert.setTitle(\"Invalid Fields\");\r\n alert.setHeaderText(\"Please correct invalid fields\");\r\n alert.setContentText(errorMessage);\r\n\r\n alert.showAndWait();\r\n\r\n return false;\r\n }\r\n }", "public boolean inputIsValid() {\n return nameIsValid() &&\n descriptionIsValid() &&\n priceIsValid() &&\n streetIsValid() &&\n zipcodeIsValid() &&\n cityIsValid() &&\n imageIsSelected();\n }", "public static boolean isValid(String args[]){\n \n if(args.length < 2){\n System.out.println(\"Not enough arguments detected. Please enter two\"\n + \" integer arguments.\");\n return false;\n }\n \n Scanner scanin = new Scanner(args[0]);\n Scanner scanin2 = new Scanner(args[1]);\n\t \n if(!scanin.hasNextInt() || !scanin2.hasNextInt()){\n System.out.println(\"Invalid argument type detected. Please enter two\"\n + \" integer arguments.\");\n return false;\n }\n\t else\n return true;\n }", "private static String[] checkInput(String input) throws Exception{\n String[] in = input.trim().split(\" \");\n\n if(in.length == 0){\n throw new CommandException(ExceptionEnum.INCORRECT_COMMAND_EXCEPTION);\n }\n\n if(CommandEnum.getCommandEnumFrom(in[0]) == null){\n throw new CommandException(ExceptionEnum.INCORRECT_COMMAND_EXCEPTION);\n }\n\n if(isSpecificCommandENum(in[0],BYE)){\n return in;\n }\n if(isSpecificCommandENum(in[0],TERMINATE)){\n return in;\n }\n\n if(in.length < MIN_PARAM){\n throw new CommandException(ExceptionEnum.LESS_INPUT_EXCEPTION);\n }\n\n if(in.length > MAX_PARAM){\n throw new CommandException(ExceptionEnum.EXTRA_INPUT_EXCEPTION);\n }\n\n //check input value\n for(int i = 1; i < in.length; i++){\n try{\n Integer.parseInt(in[i]);\n }catch(NumberFormatException e){\n throw new CommandException(ExceptionEnum.INVALID_INPUT_EXCEPTION);\n }\n }\n\n return in;\n }", "private boolean isValid(String input){\n return input.length() == 10 && input.matches(\"-?\\\\d+(\\\\.\\\\d+)?\");\n //check its digits\n }", "@Test\r\n public void Test004TakeUserInputValid()\r\n {\r\n gol.input = new Scanner(new ByteArrayInputStream(\"1 1 2 2 2 3 2 4 -1\".getBytes()));\r\n gol.takeUserInput();\r\n assertTrue(gol.grid[1][1] == 1 && gol.grid[2][2] == 1 && gol.grid[2][3] == 1 && gol.grid[2][4] == 1);\r\n }", "public void invalid() {\r\n\t\tSystem.out.println(\"Please enter a valid input\");\r\n\t}", "private boolean validateInputs() {\n question = txtQuestion.getText().trim();\n option1 = txtOption1.getText().trim();\n option2 = txtOption2.getText().trim();\n option3 = txtOption3.getText().trim();\n option4 = txtOption4.getText().trim();\n correctOption = jcCorrectAns.getSelectedItem().toString();\n //System.out.println(correctOption);\n if(question.isEmpty() || option1.isEmpty() || option2.isEmpty() || \n option3.isEmpty() || option4.isEmpty() || correctOption.isEmpty()){\n return false;\n }\n return true;\n }", "private boolean checkUserInputValidity() {\n // Extract Student information from the edit text views\n String studentName = mStudentNameEditText.getText().toString().trim();\n String studentGradeString = mStudentGradeEditText.getText().toString();\n\n // Check for valid student name\n if (TextUtils.isEmpty(studentName)) {\n Toast.makeText(this, R.string.please_enter_valid_name, Toast.LENGTH_SHORT).show();\n mStudentNameEditText.requestFocus();\n return false;\n }\n\n // Check for valid student birthdate\n if (mStudentBirthdate == 0) {\n Toast.makeText(this, R.string.please_enter_valid_birthdate,\n Toast.LENGTH_SHORT).show();\n return false;\n }\n if (DateUtils.isChosenDateAfterToday(mStudentBirthdate)) {\n Toast.makeText(this, R.string.please_enter_valid_birthdate,\n Toast.LENGTH_SHORT).show();\n return false;\n }\n\n // Check for valid student grade\n if (TextUtils.isEmpty(studentGradeString)) {\n Toast.makeText(this, R.string.please_enter_valid_grade, Toast.LENGTH_SHORT).show();\n mStudentGradeEditText.requestFocus();\n return false;\n } else {\n int studentGrade = Integer.parseInt(studentGradeString);\n if (studentGrade <= 0) {\n Toast.makeText(this, R.string.please_enter_valid_grade, Toast.LENGTH_SHORT).show();\n mStudentGradeEditText.requestFocus();\n return false;\n }\n }\n\n return true;\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (gemNameField.getText() == null || gemNameField.getText().length() == 0) {\n errorMessage += \"No valid gem name!\\n\";\n }\n if (gemValueField.getText() == null || gemValueField.getText().length() == 0) {\n errorMessage += \"No valid gem value!\\n\";\n } else {\n // try to parse the gem value into an int.\n try {\n Integer.parseInt(gemValueField.getText());\n } catch (NumberFormatException e) {\n errorMessage += \"No valid gem value (must be an integer)!\\n\";\n }\n }\n if (gemDescripField.getText() == null || gemDescripField.getText().length() == 0) {\n errorMessage += \"No valid gem description!\\n\";\n }\n\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.initOwner(dialogStage);\n alert.setTitle(\"Invalid Fields\");\n alert.setHeaderText(\"Please correct invalid fields\");\n alert.setContentText(errorMessage);\n\n alert.showAndWait();\n\n return false;\n }\n }", "public boolean checkInput(String str)\n {\n try\n {\n Integer.parseInt(str);\n } \n catch(NumberFormatException ex)\n {\n return false;\n } \n return true;\n }", "private static boolean validateInput2(String[] input) {\n\t\tif (input.length != 2) {\n\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private void checkInput(String input)throws Exception{\n\n if (input.getBytes(\"UTF-8\").length > 255){\n throw new IOException(\"Message too long\");\n\n }\n try {\n if (Integer.parseInt(input) < 0 || Integer.parseInt(input) > 65535) {\n throw new IOException(\"Port not valid\");\n }\n }catch (NumberFormatException e){\n //nothing should happen\n }\n }", "private boolean validInput() throws SQLException {\n if (userNameField.getText().length() == 0) {\n displayMessage(messagePane, \"Name cannot be empty\", true);\n return false;\n }\n else if (userNameField.getText().length() == 1) {\n displayMessage(messagePane, \"Name cannot be empty\", true);\n return false;\n }\n else if (!isAllLetters(userNameField.getText())) {\n displayMessage(messagePane, \"Names must be all letters\", true);\n return false;\n }\n else if (!(userNameField.getText().contains(\" \")) || userNameField.getText().charAt(0) == ' ') {\n displayMessage(messagePane, \"Name must consist of two words\", true);\n return false;\n }\n else if (!(emailField.getText().contains(\"@\"))) {\n displayMessage(messagePane, \"Invalid email\", true);\n return false;\n }\n else if (DatabaseManager.isEmailTaken(user.getDatabaseConnection(), emailField.getText()) && !(emailField.getText().equals(user.getUser().getEmail()))){\n displayMessage(messagePane, \"Email is used before\", true);\n return false;\n }\n else {\n displayMessage(messagePane,\"Changes are saved\", false);\n return true;\n }\n }", "private boolean validateInput(){\n boolean result = false;\n\n if(!us.setUsername(userField.getText())){\n errorLabel.setText(\"Nombre de usuario invalido\");\n } else if(!us.setPassword(passField.getText())){ //Valido 1 por uno los campos que ingreso el usuario\n errorLabel.setText(\"Contraseña invalida\");\n } else if(!us.setName(nameField.getText())){\n errorLabel.setText(\"Nombre Invalido\");\n } else if(!us.setSurname(surnameField.getText())){\n errorLabel.setText(\"Apellido Invalido\");\n } else if(!us.setDni(dniField.getText())){\n errorLabel.setText(\"Dni invalido\");\n } else if(!ageField.getText().matches(\"\\\\d{2}\")){\n errorLabel.setText(\"Edad invalida\");\n }\n else{\n us.setAge(Integer.parseInt(ageField.getText()));\n result = true;\n }\n return result;\n }", "private boolean isValidInput(String input) \r\n {\r\n\t \r\n return input!=null&&input.length()<=10;\r\n \r\n }", "private void inputValidation(String[] args) {\r\n\t\t// Must have two argument inputs - grammar and sample input\r\n\t\tif (args.length != 2) {\r\n\t\t\tSystem.out.println(\"Invalid parameters. Try:\\njava Main <path/to/grammar> <path/to/input>\");\r\n\t\t\tSystem.exit(-1);\r\n\t\t}\r\n\t}", "private boolean validateInputs() {\n if (Constants.NULL.equals(review)) {\n reviewET.setError(\"Must type a review!\");\n reviewET.requestFocus();\n return false;\n }\n if (Constants.NULL.equals(heading)) {\n headingET.setError(\"Heading cannot be empty\");\n headingET.requestFocus();\n return false;\n }\n return true;\n }", "private void validateData(String input) {\n String[] inputStringArray = input.split(\" \");\n\n for (String s : inputStringArray) {\n try {\n Integer.parseInt(s);\n } catch (NumberFormatException e) {\n throw new NumberFormatException(\n \"Looks like your input - \" + s + \", is not a number. Try again\");\n }\n }\n }", "public boolean validateInput(double input){\n\t\tif(input >= -1 && input <= 1)\n\t\t return true;\n\t\treturn false;\t\n\t}", "private boolean isValid(char input) {\n if (this.isLetter(input) || this.isDigit(input) || this.isOperator(input)\n || this.isIgnored(input)) {\n return true;\n } else return false;\n }", "public abstract boolean isValidValue(String input);", "public void validateInput(Information information) {\n information.validateFirstName();\n information.validateLastName();\n information.validateZipcode();\n information.validateEmployeeID();\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 checkValidity() {\n String sep = DECIMAL_FORMAT.getDecimalFormatSymbols().getDecimalSeparator() + \"\";\n String name = nameField.getText().trim();\n String priceText = valueField.getText().trim();\n if (name.equals(\"\") || priceText.equals(\"\")) {\n Utils.showWarningMessage(getRootPane(), \"The fields can not be empty!\");\n return false;\n }\n String price = priceText.replace(sep, \"\");\n if (!price.matches(\"^[0-9]+$\")) {\n Utils.showWarningMessage(getRootPane(), \"Please enter a valid price!\");\n return false;\n }\n int priceInt = Integer.parseInt(price);\n if (priceInt == 0) {\n Utils.showWarningMessage(getRootPane(), \"The price can not be 0.\");\n return false;\n }\n return true;\n }", "public void validateInput(String fName, String lName, String zipCode, String employID){\n boolean firstname = firstNameTwoCharactersLong(fName);\n //boolean firstFilled = firstNameFilled\n boolean firstFilled = firstNameFilled(fName);\n //boolean lastname = lastNameTwoCharactersLong\n boolean lastname = lastNameTwoCharactersLong(lName);\n //boolean lastFilled = lastNameFilled\n boolean lastFilled = lastNameFilled(lName);\n //boolean the rest\n boolean employeeID = employeeIDValid(employID);\n boolean zCode = zipCodeValid(zipCode);\n\n //if all of them are valid=true then error prints \"there are no errors found\n if (firstname && firstFilled && lastname && lastFilled && employeeID && zCode){\n errorMessage = \"There were no errors found\";\n }\n //Display error message\n System.out.println(errorMessage);\n\n }", "private boolean validateInputInfo(){\n\n //Get user input\n String firstName = newContactFirstName.getText().toString();\n String lastName = newContactLastName.getText().toString();\n String email = newContactEmailAddress.getText().toString();\n String phone = newContactPhoneNumber.getText().toString();\n\n //Check to make sure no boxes were left empty\n if(firstName.isEmpty() || lastName.isEmpty() || email.isEmpty() || phone.isEmpty()){\n Toast.makeText(this, \"You must fill all fields before continuing!\", Toast.LENGTH_LONG).show();\n return false;\n }\n //Check to see if phone number is valid\n else if(!(phone.length() >= 10)){\n Toast.makeText(this, \"Make sure to input a valid 10 digit phone number!\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n return true;\n }", "protected void check() throws IOException, ServletException {\n if(value.length()==0)\n error(\"please specify at least one component\");\n else {\n \t\t//TODO add more checks\n \t\tok();\n }\n }", "boolean checkValidity();", "private void validate() {\n\t\t// just in case;\n\t\tfor (int i=0;i<NR_OF_FIELDS; i++) {\n\t\t\tvalid[i] = \"0\";\n\t\t}\n\t\t//\n\t\t// Validate name and surname:\n\t\t//\n\t\tif ( ! this.isUpperAlpha(nume)) {\n\t\t\tfields[0] = \"1\";\n\t\t}\n\t\t\n\t\tif ( ! this.isUpperAlphaWithSpace(nume)) {\n\t\t\tfields[1] = \"1\";\n\t\t}\n\t\t//\n\t\t// validate seria\n\t\t//\n\t\tvalid[2] = \"1\";\t\t\t\t\t\t\t// presupun ca seria este invalida, si incerc sa o validez\n\t\tfor (int i=0; i<seriiBuletin.length; i++) {\n\t\t\tif (seriiBuletin[i].equals(seria)) {\n\t\t\t\tvalid[2] = \"0\";\n\t\t\t}\n\t\t}\n\t\t//\n\t\t// validate numarul\n\t\t//\n\t\ttry {\n\t\t\tvalid[3] = \"1\";\n\t\t\tint nr = Integer.valueOf(numarul);\n\t\t\tif ( nr >= 100000 && nr <= 999999 ) {\n\t\t\t\tvalid[3] = \"0\";\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tLog.d(TAG, \"Error validating seria.\");\n\t\t}\n\n\t\t//\n\t\t// validate sex\n\t\t//\n\t\tif ( ! (sex == 'M' || sex == 'F')) {\n\t\t\tvalid[6] = \"1\";\n\t\t}\n\t\t//\n\t\t// Validate valabilitate\n\t\t//\n\t\tif ( ! isNumber(this.valabilitate)) {\n\t\t\tvalid[7] = \"1\";\n\t\t}\n\t\t//\n\t\t// validate CNP\n\t\t//\n\t\tif ( ! (isNumber(CNP) && isValidCNP(CNP))) {\n\t\t\tvalid[8] = \"1\";\n\t\t}\n\t\t\n\t}", "public static boolean checkInput(String saInput) {\r\n\t\treturn checkGenericPattern(saInput) && checkGenericPattern(unalter(saInput));\r\n\t}", "private static String validateInputStr() {\n String str = \"\";\n Scanner genericString = new Scanner(System.in);\n if (!genericString.hasNextInt()) {\n str = genericString.nextLine();\n return str;\n }\n else {\n validateInputStr();\n }\n return str;\n }", "private void verifyInput(){\n String firstName = mFirstNameField.getText().toString();\n String lastName = mLastNameField.getText().toString();\n\n mNameFieldsFilled = !TextUtils.isEmpty(firstName) && !TextUtils.isEmpty(lastName);\n\n }", "public boolean validate(String input)//true if valid\n\t{\n\t\t//loop through string verifying for numbers\n\t\tfor(int i = 0;i<input.length(); i++)\n\t\t{\n\t\t\tchar c = input.charAt(i);\n\t\t\tif(!Character.isDigit(c))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\t\n\t\t}\n\t\treturn true;\n\t}", "boolean isInputValid(){\n\t\tString ac = edAccount.getText().toString();\n\t\tString pwd = edPassword.getText().toString();\n\t\tboolean isAccEmpty = StringUtil.isNullOrEmpty(ac);\n\t\tboolean isPwdEmpty = StringUtil.isNullOrEmpty(pwd);\n\t\tif(isAccEmpty){\n\t\t\tedAccount.requestFocus();\n\t\t}else if(isPwdEmpty){\n\t\t\tedPassword.requestFocus();\n\t\t}\n\t\treturn !( isAccEmpty|| isPwdEmpty);\n\t}", "public boolean validateForm() {\r\n\t\tint validNum;\r\n\t\tdouble validDouble;\r\n\t\tString lengthVal = lengthInput.getText();\r\n\t\tString widthVal = widthInput.getText();\r\n\t\tString minDurationVal = minDurationInput.getText();\r\n\t\tString maxDurationVal = maxDurationInput.getText();\r\n\t\tString evPercentVal = evPercentInput.getText();\r\n\t\tString disabilityPercentVal = disabilityPercentInput.getText();\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.1 - Ensure all inputs are numbers\r\n\t\t */\r\n\t\t\r\n\t\t// Try to parse length as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(lengthVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Length must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(widthVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Width must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(minDurationVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Min Duration must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(maxDurationVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Max Duration must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidDouble = Double.parseDouble(evPercentVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"EV % must be a number\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidDouble = Double.parseDouble(disabilityPercentVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Disability % must be a number\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.2 - Ensure all needed inputs are non-zero\r\n\t\t */\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(lengthVal);\r\n\t\tif (validNum <= 0) {\r\n\t\t\tsetErrorMessage(\"Length must be greater than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(widthVal);\r\n\t\tif (validNum <= 0) {\r\n\t\t\tsetErrorMessage(\"Width must be greater than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(minDurationVal);\r\n\t\tif (validNum < 10) {\r\n\t\t\tsetErrorMessage(\"Min Duration must be at least 10\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(maxDurationVal);\r\n\t\tif (validNum < 10) {\r\n\t\t\tsetErrorMessage(\"Max Duration must be at least 10\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidDouble = Double.parseDouble(evPercentVal);\r\n\t\tif (validDouble < 0) {\r\n\t\t\tsetErrorMessage(\"EV % can't be less than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidDouble = Double.parseDouble(disabilityPercentVal);\r\n\t\tif (validDouble < 0) {\r\n\t\t\tsetErrorMessage(\"Disability % can't be less than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.3 - Ensure Max Duration can't be smaller than Min Duration\r\n\t\t */\r\n\t\t\r\n\t\tif (Integer.parseInt(minDurationVal) > Integer.parseInt(maxDurationVal)) {\r\n\t\t\tsetErrorMessage(\"Max Duration can't be less than Min Duration\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.4 - Ensure values aren't too large for the system to handle\r\n\t\t */\r\n\t\t\r\n\t\tif (Integer.parseInt(lengthVal) > 15) {\r\n\t\t\tsetErrorMessage(\"Carpark length can't be greater than 15 spaces\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (Integer.parseInt(widthVal) > 25) {\r\n\t\t\tsetErrorMessage(\"Carpark width can't be greater than 25 spaces\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif (Integer.parseInt(minDurationVal) > 150) {\r\n\t\t\tsetErrorMessage(\"Min Duration can't be greater than 150\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Integer.parseInt(maxDurationVal) > 300) {\r\n\t\t\tsetErrorMessage(\"Max Duration can't be greater than 300\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Double.parseDouble(evPercentVal) > 100) {\r\n\t\t\tsetErrorMessage(\"EV % can't be greater than 100\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Double.parseDouble(disabilityPercentVal) > 100) {\r\n\t\t\tsetErrorMessage(\"Disability % can't be greater than 100\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Integer.parseInt(minDurationVal) > 150) {\r\n\t\t\tsetErrorMessage(\"Min Duration can't be greater than 150\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\treturn true;\r\n\t}", "private void validarCampos() {\n }", "void validate();", "void validate();", "@Override\n\tprotected void checkNumberOfInputs(int length) {\n\n\t}", "public static boolean isSecondArgumentValid(String input) {\n\t\tif (CommonUtils.isNotNullOrEmpty(input) && CommonUtils.isNumeric(input))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "public static boolean checkForValidInput(String input) {\n try {\n int inputValue = Integer.parseInt(input);\n return inputValue >= 0 && inputValue <= 8;\n } catch (NumberFormatException e) {\n return false;\n }\n }", "private boolean validCreateInput() throws SQLException {\n // Checks if any of the fields is empty\n if(teamNameCreateField.getText().equals(\"\") || abbrevationCreateField.getText().equals(\"\")\n || chooseCityBoxCreate.getValue() == null || chooseLeagueBoxCreate.getValue() == null\n || chooseAgeGroupCreate.getValue() == null || chooseLeagueTeamBoxCreate.getValue() == null){\n displayMessage(messagePane,\"Please fill all the fields\",true);\n return false;\n }\n // Checks the abbrevation length\n else if(abbrevationCreateField.getText().length() > 3)\n {\n displayMessage(messagePane,\"Abbrevations must be at most 3 characters\",true);\n return false;\n }\n // Checks team name length\n else if (teamNameCreateField.getText().length() > 30){\n displayMessage(messagePane,\"Team Names must be smaller than 30 characters\",true);\n return false;\n }\n return true;\n }", "private boolean isInputValid() {\n\t\tString errorMessage = \"\";\n\t\t\n\t\tif(userNameField.getText() == null || userNameField.getText().length() == 0) {\n\t\t\terrorMessage += \"Üres a felhasználó név mező!\\n\";\n\t\t}\n\t\tif(passwordField.getText() == null || passwordField.getText().length() == 0) {\n\t\t\terrorMessage += \"Üres a jelszó mező!\";\n\t\t}\n\t\t\n\t\tif(errorMessage.length() == 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\t// show the error message\n\t\t\tAlert alert = new Alert(AlertType.ERROR);\n\t\t\talert.initOwner(dialogStage);\n\t\t\talert.setTitle(\"Érvénytelen mezők\");\n\t\t\talert.setHeaderText(\"Kérlek töltsd ki az összes mezőt!\");\n\t\t\talert.setContentText(errorMessage);\n\t\t\t\n\t\t\talert.showAndWait();\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\t}", "public boolean Validate_Input(String attack_coord){\r\n\t\tattack_coord=attack_coord.trim(); //deletes any unecessary whitespace\r\n\t\tif(attack_coord.length()>3) { //format incorrect\r\n\t\t\tdisplay.scroll(\"Input string too long to be proper coordinate\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(attack_coord.length()<=1){\r\n\t\t\tdisplay.scroll(\"Input string too short to be proper coordinate\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// Convert the string inputs into integers\r\n\t\tString x_as_string = attack_coord.substring(1);\r\n\t\tycoor = letterToIndex(attack_coord.charAt(0));\r\n\t\t\r\n\t\t\r\n\t\ttry{\r\n\t\t\txcoor=Integer.parseInt(x_as_string);\r\n\t\t\txcoor--; //to match the xcoor with the array position\r\n\t\t} catch (NumberFormatException nfe) {\r\n\t display.scroll(\"Incorrect Format. Enter with letter and then number i.e. B3\");\r\n\t display.printScreen();\r\n\t return false;\r\n\t\t}\r\n\r\n\t\t\r\n\t\t\r\n\r\n\t\tif(!hisBoard.in_Grid(xcoor, ycoor)){\r\n\t\t\tdisplay.scroll(\"The Coordinate input is not within (A-J) or (1-10)\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(hisBoard.already_attacked(xcoor,ycoor)){\r\n\t\t\tdisplay.scroll(\"Coordinate has already been attacked\");\r\n\t\t\tdisplay.printScreen();\t\t\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "protected void validateInput()\r\n\t{\r\n\t\tString errorMessage = null;\r\n\t\tif ( validator != null ) {\r\n\t\t\terrorMessage = validator.isValid(text.getText());\r\n\t\t}\r\n\t\t// Bug 16256: important not to treat \"\" (blank error) the same as null\r\n\t\t// (no error)\r\n\t\tsetErrorMessage(errorMessage);\r\n\t}", "private boolean checkForInvalidInput(){\n String email = emailTextView.getText().toString();\n String password = passwordTextView.getText().toString();\n String name = usernameTextView.getText().toString();\n\n\n if(email.isEmpty() || password.isEmpty() || name.isEmpty()){\n Toast.makeText(getApplicationContext(),\"Please fill in all fields\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n\n if(!email.contains(\"@\")){\n Toast.makeText(getApplicationContext(),\"Please enter a valid email\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n if(!isStudent && !isTeacher){\n Toast.makeText(getApplicationContext(),\"Please select Student or Teacher\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n\n\n\n\n // add more checks?\n\n return true;\n\n }", "private boolean validateInput(){\n Window owner=root.getScene().getWindow();\n inputFileds.addAll(txtfn,txtln,txtsurname,txtDOB,txtResidence,txtMobile,txtID,username);\n for (TextField textField : inputFileds) {\n if(textField.getText().isEmpty()){\n //set css stroke\n Dialog.showMessageDialog(owner,\"Missing Details\",\"Invalid Input\",DialogIcon.WARNING);\n textField.requestFocus();\n return false;\n }\n }\n inputFileds.removeAll(txtDOB,txtMobile,username);\n for (TextField textField : inputFileds) {\n if(textField.getText().length()>30){\n //set css stroke\n Dialog.showMessageDialog(owner,\"Sorry the text you entered can not be greater that 30 characters\",\"Text too Long\",DialogIcon.WARNING);\n textField.requestFocus();\n return false;\n }\n }\n if(username.getText().length()>20 || username.getText().length()<4){\n Dialog.showMessageDialog(owner, \"Sorry your Username has to be More than 3 Characters and can not Exceed 20 Charchaters\", \"Invalid input\",DialogIcon.WARNING);\n username.requestFocus();\n return false;\n }\n if(pass.getText().isEmpty()){\n Dialog.showMessageDialog(owner,\"Missing Details\",\"Invalid Input\",DialogIcon.WARNING);\n pass.requestFocus();\n return false;\n }\n if(pass.getText().length()>20 || pass.getText().length()<4){\n Dialog.showMessageDialog(owner, \"Sorry your Password has to be More than 3 Characters and can not Exceed 20 Charchaters\", \"Invalid Input\",DialogIcon.WARNING);\n pass.requestFocus();\n return false;\n }\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd/MM/yyyy\");\n SimpleDateFormat yearFormat = new SimpleDateFormat(\"yyyy\");\n try {\n date = dateFormat.parse(txtDOB.getText());\n Calendar cal=Calendar.getInstance();\n int year=Integer.parseInt(yearFormat.format(date));\n if (year <= 1900 || year>cal.get(Calendar.YEAR)) {\n Dialog.showMessageDialog(owner,\"Invalid Date of Birth\", \"Invalid Input\",DialogIcon.WARNING);\n txtDOB.requestFocus();\n return false;\n }\n String initialEntry=txtDOB.getText();\n String parsedValue=dateFormat.format(date);\n if(!initialEntry.equals(parsedValue)){\n Dialog.showMessageDialog(owner, \"Note your Date of Birth has been corrected\", \"Date Corrected\",DialogIcon.INFORMATION);\n }\n txtDOB.setText(dateFormat.format(date));\n } catch (ParseException ex) {\n Dialog.showMessageDialog(owner,\"Invalid Date of Birth\", \"Invalid Input\",DialogIcon.WARNING);\n txtDOB.requestFocus();\n return false;\n }\n try {\n int mobile=Integer.parseInt(txtMobile.getText());\n } catch (NumberFormatException e) {\n Dialog.showMessageDialog(owner, \"Invalid Mobile Number\", \"Invalid data\",DialogIcon.WARNING);\n txtMobile.requestFocus();\n return false;\n }\n if(txtMobile.getText().length() != 10){\n Dialog.showMessageDialog(owner, \"Sorry your Mobile Number is invalid\", \"Invalid input\",DialogIcon.WARNING);\n txtMobile.requestFocus();\n return false;\n }\n String sql=\"select Username,Password from users where Username=?\";\n try(PreparedStatement prstmt=con.prepareStatement(sql)) {\n prstmt.setString(1, username.getText());\n ResultSet rs=prstmt.executeQuery();\n if(rs.next()){\n Dialog.showMessageDialog(owner, \"Sorry Username already exists\\n Please change to different Username\", \"Username Exists\",DialogIcon.WARNING);\n username.requestFocus();\n return false;\n }\n rs.close();\n } catch (SQLException e) {\n System.err.println(e);\n }\n return true;\n }", "private boolean validateInput() {\n String departmentInput = mDepartmentField.getText().toString();\n String emailInput = mEmailField.getText().toString();\n String passwordInput = mPasswordField.getText().toString();\n\n if (departmentInput.isEmpty()) {\n mDepartmentField.setError(\"Please enter your department number\");\n mDepartmentField.requestFocus();\n return false;\n } else {\n mPasswordField.setError(null);\n }\n\n\n if (emailInput.isEmpty() || !Patterns.EMAIL_ADDRESS.matcher(emailInput).matches()) {\n mEmailField.setError(\"Please enter a valid email address\");\n mEmailField.requestFocus();\n return false;\n } else {\n mEmailField.setError(null);\n }\n\n if (passwordInput.isEmpty()) {\n mPasswordField.setError(\"Please enter your password\");\n mPasswordField.requestFocus();\n return false;\n } else {\n mPasswordField.setError(null);\n }\n\n return true;\n }", "private boolean validateUserInputs() {\n ArrayList<String> errors = new ArrayList();\n \n if (this.view.getContent().equals(\"\")) {\n errors.add(\"\\t - Enter a comment\");\n }\n \n if (errors.size() > 0) {\n String errorMsg = \"Unable to save new Asset.\\nDetails:\";\n for (String error : errors) {\n errorMsg += \"\\n\" + error;\n }\n JOptionPane.showMessageDialog(this.view, errorMsg, \"Unable to Save\", JOptionPane.INFORMATION_MESSAGE);\n return false;\n }\n return true;\n }", "public boolean validateInput(String title) {\n \t\n \tboolean valid = true;\n \tString error = \"\";\n \t\n \tif(title.equals(\"\")) {\n \t\terror += \"Invalid title\";\n \t\tvalid = false;\n \t}else if(currentTaskItems.size() == 0) {\n \t\terror += \"Please attach an item to your task\";\n \t\tvalid = false;\n \t}else if(!propertiesGrabbed) {\n \t\terror += \"Please enter the tasks properties\";\n \t\tvalid = false;\n \t}\n \t\n \t//if valid return else toast\n \tif(valid){\n \t\treturn true;\n \t}else{\n\n \t\tContext context = getApplicationContext();\n \t\tToast toast = Toast.makeText(context, error, Toast.LENGTH_SHORT);\n \t\ttoast.show();\n \t\treturn false;\n \t}\n }", "private boolean isUserInputValid(String[] packetData)\n\t{\n\t\tif(packetData.length < 3 ) return false;\n\t\tString address = packetData[0];\n\t\tint port = Integer.parseInt(packetData[1]);\n\n\t\tint addressPeriodsCount = address.length() - address.replace(\".\", \"\").length();\n\n\t\tif (packetData.length < 3)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\telse if(address.equals(\"localhost\") && (port > 0 || port <= 65535))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn (addressPeriodsCount == 3 ||addressPeriodsCount == 2 ) && (port > 0 || port <= 65535);\n\t\t}\n\t}", "public static boolean validateMenuOption(String input) {\r\n boolean valid = false;\r\n try {\r\n if (Integer.parseInt(input) < 1 || Integer.parseInt(input) > 5){\r\n System.out.println(\"**Error: Menu option not found.\\n\"\r\n +\" Please type a single digit [1-5] for menu option.\");\r\n } \r\n else {\r\n valid = true;\r\n }\r\n }\r\n catch (NumberFormatException nfe) {\r\n System.out.println(\"**Error: Only a single number can be input.\\n\"\r\n +\" Please type a single digit [1-5] for menu option.\");\r\n }\r\n return valid;\r\n }" ]
[ "0.84283096", "0.8279811", "0.8173578", "0.7814372", "0.78072685", "0.76525486", "0.7641181", "0.75494045", "0.7533217", "0.7248567", "0.7233538", "0.7094465", "0.70860356", "0.70676017", "0.7062181", "0.7041608", "0.70374566", "0.7036175", "0.7028434", "0.69914263", "0.69434917", "0.6930006", "0.6887363", "0.688484", "0.6877617", "0.687156", "0.6825481", "0.6819745", "0.6803094", "0.6801715", "0.67922795", "0.67867124", "0.67826796", "0.67799556", "0.6777724", "0.6774258", "0.676157", "0.6757966", "0.6755803", "0.67533857", "0.67531115", "0.67469007", "0.67343104", "0.6732378", "0.6727642", "0.671763", "0.6717164", "0.67105114", "0.6710452", "0.6708039", "0.6706999", "0.6705111", "0.67004204", "0.6696957", "0.66925114", "0.668555", "0.667766", "0.66706353", "0.666929", "0.6669114", "0.6669087", "0.6640919", "0.6632329", "0.65950215", "0.6592842", "0.65917605", "0.6571654", "0.6567888", "0.6563689", "0.65624845", "0.65476036", "0.65424246", "0.6534722", "0.6519466", "0.6513298", "0.6511367", "0.6508082", "0.6507898", "0.65053225", "0.65023094", "0.64992523", "0.6496722", "0.64958155", "0.64947975", "0.6493414", "0.64824337", "0.64824337", "0.6474706", "0.64696604", "0.64632416", "0.64622724", "0.6448644", "0.6448056", "0.6442508", "0.6437141", "0.64247316", "0.6423981", "0.640355", "0.6401683", "0.64006954", "0.6396333" ]
0.0
-1
check for valid input
public void writeHelpingGuess(int row, int column, int help){ if(!checkInput(row, column, help)) return; if(gameField[row][column] instanceof Guess){ gameField[row][column].setTileState(TileState.HELPING); ((Guess) gameField[row][column]).setHelp(help == 0 ? 0 : help - 1, help); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean isValidInput() {\n\t\treturn true;\n\t}", "private boolean isInputValid() {\n return true;\n }", "protected abstract boolean isInputValid();", "protected abstract boolean checkInput();", "private void validateInputParameters(){\n\n }", "protected abstract int isValidInput();", "private void checkUserInput() {\n }", "@Override\n\tpublic boolean checkInput() {\n\t\treturn true;\n\t}", "public boolean checkInput();", "public abstract boolean verifyInput();", "public boolean isInputValid()\n {\n String[] values = getFieldValues();\n if(values[0].length() > 0 || values[1].length() > 0 || values[2].length() > 0)\n return true;\n else\n return false;\n }", "private static boolean isBadInput(String s) {\n\t\tString[] split = s.split(\"\\\\s+\");\n\t\tif (split.length != 3) {\n\t\t\tSystem.err.printf(\"Unknow length: %d\\n\", split.length);\n\t\t\treturn true;\n\t\t}\n\t\ttry {\n\t\t\tInteger.parseInt(split[0]);\n\t\t\tInteger.parseInt(split[2]);\n\t\t} catch (NumberFormatException e) {\n\t\t\tSystem.err.printf(\"Input numbers only.\\n\");\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tif (split[1].length() != 1) {\n\t\t\tSystem.err.printf(\"Operator should be one character.\\n\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean checkForWrongInput(){\n if(this.studentCode.getText().isEmpty())\n return true;\n //Check for length\n if(this.studentCode.getText().length() != 3)\n return true;\n //Check for invalid characters\n for(char c: this.studentCode.getText().toCharArray())\n if(!Character.isDigit(c))\n return true;\n\n return false;\n }", "void checkValid();", "private boolean validateInput() {\n\tboolean valid = false;\n\ttry {\n\t if (paymentText == null | paymentText.getValue() == \"\") {\n\t\tpaymentText.focus();\n\t\tthrow new NullPointerException(\"paymentText fehlt\");\n\t }\n\t if (paymentBetrag == null | paymentBetrag.getValue() == \"\") {\n\t\tpaymentBetrag.focus();\n\t\tthrow new NullPointerException(\"paymentBetrag fehlt\");\n\t }\n\t if (!paymentBetrag.isEmpty()) {\n\t\t@SuppressWarnings(\"unused\")\n\t\tdouble d = Double.parseDouble(paymentBetrag.getValue());\n\t }\n\t // seems that everything was OK\n\t valid = true;\n\t} catch (NullPointerException e) {\n\t System.out.println(\"PaymentWindow - \" + e);\n\t} catch (NumberFormatException e) {\n\t // entered value is no number\n\t paymentBetrag.focus();\n\t}\n\treturn valid;\n }", "private boolean isInValidInput(String input) {\n\n\t\tif (input == null || input.isEmpty())\n\t\t\treturn true;\n\n\t\tint firstPipeIndex = input.indexOf(PARAM_DELIMITER);\n\t\tint secondPipeIndex = input.indexOf(PARAM_DELIMITER, firstPipeIndex + 1);\n\n\t\t/*\n\t\t * if there are no PARAM_DELIMITERs or starts with a PARAM_DELIMITER\n\t\t * (Meaning command is missing) or only single PARAM_DELIMITER input is\n\t\t * not valid\n\t\t */\n\t\tif (firstPipeIndex == -1 || firstPipeIndex == 0 || secondPipeIndex == -1)\n\t\t\treturn true;\n\n\t\t// Means package name is empty\n\t\tif (secondPipeIndex - firstPipeIndex < 2)\n\t\t\treturn true;\n\n\t\treturn false;\n\t}", "private boolean validFormInputs() {\n String email = etEmail.getText().toString();\n String password = etPassword.getText().toString();\n String institutionName = etInstitutionName.getText().toString();\n String addressFirst = etInstitutionAddressFirst.getText().toString();\n String addressSecond = etInstitutionAddressSecond.getText().toString();\n String CIF = etCIF.getText().toString();\n\n String[] allInputs = {email, password, institutionName, addressFirst, addressSecond, CIF};\n for (String currentInput : allInputs) {\n if (currentInput.matches(\"/s+\")) // Regex pt cazul cand stringul e gol sau contine doar spatii\n return false; // formular invalid - toate inputurile trebuie sa fie completate\n }\n String[] stringsAddressFirst = addressFirst.split(\",\");\n String[] stringsAddressSecond = addressSecond.split(\",\");\n if (stringsAddressFirst.length != 4 ||\n stringsAddressSecond.length != 3)\n return false;\n\n //<editor-fold desc=\"Checking if NUMBER and APARTMENT are numbers\">\n try {\n Integer.parseInt(stringsAddressSecond[0]);\n Integer.parseInt(stringsAddressSecond[2]);\n return true; // parsed successfully without throwing any parsing exception from string to int\n }catch (Exception e) {\n Log.v(LOG_TAG, \"Error on converting input to number : \" + e);\n return false; // parsed unsuccessfully - given strings can not be converted to int\n }\n //</editor-fold>\n }", "public boolean checkInput(){\n if(spelerIDField.getText().equals(\"\") || typeField.getText().equals(\"\") || codeField.getText().equals(\"\") || heeftBetaaldField.getText().equals(\"\")){\n return true;\n } else { return false; }\n }", "protected abstract boolean isInputValid(@NotNull ConversationContext context, @NotNull String input);", "private boolean isValidInput() {\n if (null == mUsername || mUsername.length() <= 0) {\n return false;\n } else if (null == mPassword || mPassword.length() <= 0) {\n return false;\n }\n return true;\n }", "@Override\n\tprotected void isValid(String input) throws DataInputException\n\t{\n\t}", "public boolean checkInput(String input){\n\t\t//make sure only input 0-9\n\t\tif(input.length() != 1){\n\t\t\treturn false;\n\t\t}\n\t\tchar c = input.charAt(0);\n\t\tif(!Character.isDigit(c)){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean checkEntryInputs() {\n\t\tboolean isValid = true;\n\t\tif(sampleNumberTF.getText().equals(\"\")) {\n\t\t\tisValid = false;\n\t\t}\n\t\t\n\t\tif(materialDescriptionTF.getText().equals(\"\")) {\n\t\t\tisValid = false;\n\t\t}\n\t\t\n\t\tif(Double.valueOf(bacteroidesConcentrationTF.getText())==null) {\n\t\t\tisValid = false;\n\t\t}\n\t\treturn isValid;\n\t}", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (nameField.getText() == null || nameField.getText().length() == 0) {\r\n errorMessage += \"请输入直播名!\\n\";\r\n }\r\n if (urlField.getText() == null || urlField.getText().length() == 0) {\r\n errorMessage += \"请输入直播流!\\n\";\r\n }\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n Alert alert = new Alert(Alert.AlertType.ERROR);\r\n alert.setTitle(\"输入错误\");\r\n alert.setContentText(errorMessage);\r\n return false;\r\n }\r\n }", "private static boolean validateInput1(String[] input) {\n\t\tif (input.length != 1) {\n\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private static boolean valid_input(String user_input) {\n \n boolean output = false;\n \n if(user_input.length() == 2){\n \n output = (user_input.substring(0,1).matches(\"[0-9]\") && user_input.substring(1,2).matches(\"[a-zA-Z]\"));\n } else if (user_input.length() == 3) {\n \n output = (user_input.substring(0,2).matches(\"[1-2][0-9]\") && user_input.substring(2,3).matches(\"[a-zA-Z]\"));\n \n if(Integer.parseInt(user_input.substring(0,2))>TicTacToe.game.gridSize){\n output = false;\n }\n }\n \n return output;\n }", "private boolean checkInputValidity() {\n // if any of the input field is empty, return false directly\n if (name.getText().equals(\"\") || id.getText().equals(\"\") || fiber.getText().equals(\"\")\n || protein.getText().equals(\"\") || fat.getText().equals(\"\") || calories.getText().equals(\"\")\n || carbohydrate.getText().equals(\"\")) {\n String message = \"Make sure enter the value of all nutrient components, please try again!\";\n // display the warning windows with the assigned warning message\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close();// close the add food stage\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n // if any nutrition info input is not a number value or is negative, return false directly\n try {\n Double fibervalue = null;\n Double proteinvalue = null;\n Double fatvalue = null;\n Double caloriesvalue = null;\n Double carbohydratevalue = null;\n // trim the input to exact numeric value\n fibervalue = Double.valueOf(fiber.getText().trim());\n proteinvalue = Double.valueOf(protein.getText().trim());\n fatvalue = Double.valueOf(fat.getText().trim());\n caloriesvalue = Double.valueOf(calories.getText().trim());\n carbohydratevalue = Double.valueOf(carbohydrate.getText().trim());\n // nutrition input is suppose to be positive numbers\n // if any of the numbers is negative, return false diretcly\n if (fibervalue < 0.0 || proteinvalue < 0.0 || fatvalue < 0.0 || caloriesvalue < 0.0\n || carbohydratevalue < 0.0) {\n String message = \"The input of the nutrient can not be negative, please try again!\";\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close();\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n // if any input of the nutrition info is not a double value, catch the exception and return\n // false\n } catch (Exception e) {\n String message =\n \"At least one nutrition value input is invalid, please type a number in nutrient textbox!\";\n // display the warning windows with the assigned warning message\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close(); // close the addfood stage\n // wait for response from ok button\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n return true;\n }", "private boolean validateInput(EditText titleInput, EditText descriptionInput, EditText priceInput) {\n String title = titleInput.getText().toString();\n String description = descriptionInput.getText().toString();\n int price = (TextUtils.isEmpty(priceInput.getText().toString()))? -1 : Integer.parseInt(priceInput.getText().toString());\n if (TextUtils.isEmpty(title) || TextUtils.isEmpty(description) || price < 0) {\n Toast.makeText(this.getActivity(),\n \"Please, fill in all fields.\",\n Toast.LENGTH_LONG).show();\n return false;\n }\n if (photoURI == null) {\n Toast.makeText(this.getActivity(),\n \"Please, add a picture to this item before submitting it.\",\n Toast.LENGTH_LONG).show();\n return false;\n }\n return true;\n }", "public boolean isInputValid(ConversationContext context, String s)\r\n/* */ {\r\n/* 135 */ return (s.equalsIgnoreCase(\"one\")) || (s.equals(\"1\")) || (s.equalsIgnoreCase(\"two\")) || (s.equals(\"2\")) || (s.equalsIgnoreCase(\"zero\")) || (s.equals(\"0\"));\r\n/* */ }", "private boolean validateInput() {\n boolean isValid = true;\n Alert errMsg = Util.getAlert(Alert.AlertType.ERROR);\n if (connectionsCB.getEditor().getText() == null || !Util.isValidAddress(connectionsCB.getEditor().getText())) {\n errMsg.setContentText(\"Invalid TRex Host Name or IP address\");\n isValid = false;\n } else if (!Util.isValidPort(rpcPort.getText())) {\n errMsg.setContentText(\"Invalid TRex Sync Port Number(\" + rpcPort.getText() + \")\");\n isValid = false;\n } else if (!Util.isValidPort(asyncPort.getText())) {\n errMsg.setContentText(\"Invalid Async Port Number(\" + asyncPort.getText() + \")\");\n isValid = false;\n } else if (Util.isNullOrEmpty(nameTF.getText())) {\n errMsg.setContentText(\"Name should not be empty\");\n isValid = false;\n }\n\n if (!isValid) {\n errMsg.show();\n }\n return isValid;\n }", "private boolean validInput()\n {\n boolean completeForm = true; //all textfields have been filled in\n boolean noExceptions = true; //all textfields (except name) have int\n boolean selectionMade = true; //user has selected a ship type\n\n if (shipNameInput.getText()==\"Ship name\" ||\n xcoordInput.getText()==\"Starting x coordinate\" ||\n ycoordInput.getText()==\"Starting y coordinate\")\n {\n System.out.println(\"ERROR: Please fill in all text fields before \"+\n \"adding your ship.\");\n completeForm = false;\n }\n try\n {\n xcoord = Integer.parseInt(xcoordInput.getText());\n ycoord = Integer.parseInt(ycoordInput.getText());\n }\n catch (NumberFormatException except)\n {\n System.out.println(\"ERROR: Ship coordinates and speed need to be \"+\n \"entered as integers.\");\n noExceptions = false;\n }\n if (directionInput.getResponse() == \"none\")\n {\n System.out.println(\"ERROR: Please choose a direction.\");\n selectionMade = false;\n }\n else\n {\n String d = directionInput.getResponse();\n if (d == \"N\") direction = 0;\n else if (d == \"NE\") direction = Ship.NE;\n else if (d == \"E\") direction = Ship.E;\n else if (d == \"SE\") direction = Ship.SE;\n else if (d == \"S\") direction = Ship.S;\n else if (d == \"SW\") direction = Ship.SW;\n else if (d == \"W\") direction = Ship.W;\n else if (d == \"NW\") direction = Ship.NW;\n }\n shipName = shipNameInput.getText();\n speed = speedSlider.getValue();\n\n return (completeForm && noExceptions && selectionMade);\n }", "private boolean validEditInput() throws SQLException {\n // Checks if any of the fields is empty\n if(teamNameEditField.getText().equals(\"\") || abbrevationEditField.getText().equals(\"\")\n || chooseCityBox.getValue() == null || chooseLeagueBox.getValue() == null\n || chooseLeagueTeamBox.getValue() == null) {\n displayMessage(messagePane,\"Please fill all the fields\",true);\n return false;\n }\n // Checks the abbrevation length\n else if(abbrevationEditField.getText().length() > 3)\n {\n displayMessage(messagePane,\"Abbrevations must be at most 3 characters\",true);\n return false;\n }\n // Checks team name length\n else if (teamNameEditField.getText().length() > 30){\n displayMessage(messagePane,\"Team Names must be smaller than 30 characters\",true);\n return false;\n }\n return true;\n }", "private static boolean valid(String arg) {\n\n /* check if valid option */\n if ( arg.equals(\"-v\") || arg.equals(\"-i\") || arg.equals(\"-p\") || arg.equals(\"-h\") )\n return true;\n\n /* check if valid port */\n try {\n int port = Integer.parseInt(arg);\n if ( ( 0 < port ) && ( port < 65354 ) )\n return true;\n } catch (NumberFormatException ignored) {}\n\n /* check if valid ip address */\n String[] ips = arg.split(\"\\\\.\");\n if ( ips.length != 4 )\n return false;\n try{\n for (int i=0; i<4; i++){\n int ip = Integer.parseInt(ips[i]);\n if ( ( ip < 0) || (255 < ip ) )\n return false;\n }\n } catch (NumberFormatException ignored) {return false;}\n\n return true;\n }", "private boolean isInputValid(){\n\t\tString errorMessage = \"\";\n\t\tif((nameField.getText() == null) || (nameField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid product name!\\n\";\n\t\t}\n\t\tif((amountAvailableField.getText() == null) || (amountAvailableField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid amount available value!\\n\";\n\t\t}\n\t\tif((amountSoldField.getText() == null) || (amountSoldField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid amount sold value!\\n\";\n\t\t}\n\t\tif((priceEachField.getText() == null) || (priceEachField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid price for each!\\n\";\n\t\t}\n\t\tif((priceMakeField.getText() == null) || (priceMakeField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid price to make the product!\\n\";\n\t\t}\n\t\tif(errorMessage.length() == 0){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "private void validateData() {\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (ServiceName.getText() == null || ServiceName.getText().length() == 0) {\n errorMessage += \"No valid name!\\n\";\n }\n if (Serviceemail.getText() == null || Serviceemail.getText().length() == 0) {\n Pattern p = Pattern.compile(\"[_A-Za-z0-9][A-Za-z0-9._]*?@[_A-Za-z0-9]+([.][_A-Za-z]+)+\");\n Matcher m = p.matcher(Serviceemail.getText());\n if (m.find() && m.group().equals(Serviceemail.getText())) {\n errorMessage += \"No valid Mail Forment!\\n\";\n }\n }\n if (servicedescrip.getText() == null || servicedescrip.getText().length() == 0) {\n errorMessage += \"No valid description !\\n\";\n }\n if (f == null && s.getImage() == null) {\n errorMessage += \"No valid photo ( please upload a photo !)\\n\";\n }\n if (Serviceprice.getText() == null || Serviceprice.getText().length() == 0) {\n errorMessage += \"No valid prix !\\n\";\n } else {\n // try to parse the postal code into an int.\n try {\n Float.parseFloat(Serviceprice.getText());\n } catch (NumberFormatException e) {\n errorMessage += \"No valid prix (must be a Float)!\\n\";\n }\n }\n if ( !Weekly.isSelected() && !Daily.isSelected() && !Monthly.isSelected()) {\n errorMessage += \"No valid Etat ( select an item !)\\n\";\n }\n if (Servicesatet.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid etat ( select an item !)\\n\";\n }\n if (ServiceCity.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid City ( select an item !)\\n\";\n }\n if (servicetype.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid Type ( select an item !)\\n\";\n }\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.setTitle(\"Invalid Fields\");\n alert.setHeaderText(\"Please correct invalid fields\");\n alert.setContentText(errorMessage);\n alert.showAndWait();\n return false;\n }\n }", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n// Show the error message.\r\n Dialogs.create()\r\n .title(\"Invalid Fields\")\r\n .masthead(\"Please correct invalid fields\")\r\n .message(errorMessage)\r\n .showError();\r\n return false;\r\n }\r\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (ID.getText() == null || ID.getText().length() == 0) {\n errorMessage += \"No valid id!\\n\";\n System.out.println(\"fl\");\n }\n if (password.getText() == null || password.getText().length() == 0) {\n errorMessage += \"No valid password!\\n\"; \n }\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Dialogs.create()\n .title(\"Invalid Fields\")\n .masthead(\"Please correct invalid fields\")\n .message(errorMessage)\n .showError();\n return false;\n }\n }", "public void checkInput(TextField number) {\r\n\t\ttry {\r\n\t\t\tlong num = Long.parseLong(number.getText());\r\n\t\t\tif (num < 0) \t\t\t\t\t// ako je negativan broj, pretvorit cemo ga u pozitivan\r\n\t\t\t\tnum = Math.abs(num);\r\n\t\t\tif (isValid(num)) \r\n\t\t\t\tscene2();\r\n\t\t}\r\n\t\tcatch (Exception e) {\t\t\t\t// hvatanje greske\r\n\t\t\talert(\"Wrong input, try again!\");\r\n\t\t}\r\n\t}", "private boolean validateInputs() {\n return !proID.getText().isEmpty() || \n !proName.getText().isEmpty() ||\n !proPrice.getText().isEmpty();\n }", "private boolean validateInput(){\n boolean operationOK = true;\n //perform input validation on the double values in the form\n String integrationTime = this.integrationTimeText.getText();\n String integrationFrequency = this.integrationFrequencyText.getText();\n \n if(!integrationTime.equals(\"\")){\n try {\n Double itime = Double.parseDouble(integrationTime);\n integrationTimeText.setBackground(Color.WHITE);\n integrationTimeText.setToolTipText(\"Time in seconds (s)\");\n } catch (NumberFormatException ex) {\n integrationTimeText.setBackground(Color.RED);\n operationOK=false;\n integrationTimeText.setToolTipText(\"This field has to be a valid double (eg. 1.5)\");\n }\n }\n if(!integrationFrequency.equals(\"\")){\n try {\n Double itime = Double.parseDouble(integrationFrequency);\n integrationFrequencyText.setBackground(Color.WHITE);\n integrationFrequencyText.setToolTipText(\"Frequency in Hertz (Hz)\");\n \n } catch (NumberFormatException ex) {\n operationOK=false;\n integrationFrequencyText.setBackground(Color.RED);\n integrationFrequencyText.setToolTipText(\"This field has to be a valid double (eg. 1.5)\");\n }\n }\n if(currentStepOperationsPanel!=null){\n operationOK = this.currentStepOperationsPanel.validateInput();\n \n }\n return operationOK;\n }", "boolean inputValid(String s) {\n\n if (s.length() == 0) {\n return false;\n }\n\n //check whether there are wrong commas\n for (int ii = 1; ii < s.length() - 1; ii++) {\n if (s.charAt(ii) == ',') {\n if(!s.contains(\"log\")) {\n resS = \"There are wrong commas\";\n return false;\n }\n }\n }\n\n //check whether there are multiple points\n if(s.charAt(0)=='.' || s.charAt(s.length()-1)=='.') return false;\n for (int ii = 1; ii < s.length() - 1; ii++) {\n if (s.charAt(ii) == '.') {\n if (!Character.isDigit(s.charAt(ii - 1))) {\n resS=\"These are wrong points.\";\n return false;\n } else if (!Character.isDigit(s.charAt(ii + 1))) {\n resS=\"These are wrong points.\";\n return false;\n } else {\n for (int jj = ii + 2; jj < s.length(); jj++) {\n if (s.charAt(jj) == '.') {\n String ss = s.substring(ii + 2, jj);\n if (!(ss.contains(\"+\") || ss.contains(\"-\") || ss.contains(\"*\") || ss.contains(\"/\") || ss.contains(\"%\")\n || ss.contains(\"^\") || ss.contains(\")\"))) {\n resS=\"These are wrong points.\";\n return false;\n }\n }\n }\n }\n }\n }\n ArrayList<Token> operation = tokenize(s);\n return isNumberOrOpe(operation) && isOpePosRight(operation) && isValidparentheses(operation) && isValidTan(operation) && isLogWrong(operation);\n }", "private boolean validateData() {\r\n TASKAggInfo agg = null;\r\n int index = aggList.getSelectedIndex();\r\n if (index != 0) {\r\n agg = (TASKAggInfo)aggregators.elementAt(aggList.getSelectedIndex()-1);\r\n }\r\n\r\n if (getArgument1() == BAD_ARGUMENT) {\r\n JOptionPane.showMessageDialog(this, \"Argument 1 must be of type: \"+TASKTypes.TypeName[agg.getArgType()], \"Error\", JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n else if (getArgument2() == BAD_ARGUMENT) {\r\n JOptionPane.showMessageDialog(this, \"Argument 2 must be of type: \"+TASKTypes.TypeName[agg.getArgType()], \"Error\", JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n else if (getOperand() == BAD_ARGUMENT) {\r\n JOptionPane.showMessageDialog(this, \"Filter value must be of type integer\", \"Error\", JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n return true;\r\n }", "private boolean isInputValid() {\n\t\tString errorMessage = \"\";\n\t\t\n\t\tif (dateField.getText() == null || dateField.getText().length() == 0) {\n\t\t\terrorMessage += \"Kein gültiges Datum!\\n\";\n\t\t} else {\n\t\t\tif (!DateUtil.validDate(dateField.getText())) {\n\t\t\t\terrorMessage += \"Kein gültiges Datum. Benutze das dd.mm.yyy Format!\\n\";\n\t\t\t}\n\t\t}\n\t\tString categoryFieldSelection = categoryField.getSelectionModel().getSelectedItem();\n\t\tif (categoryFieldSelection.isEmpty() || categoryFieldSelection.length() == 0) {\n\t\t\terrorMessage += \"Keine gültige Kategorie!\\n\";\n\t\t}\n\t\tif (useField.getText() == null || useField.getText().length() == 0) {\n\t\t\terrorMessage += \"Kein gültiger Verwendungszweck!\\n\";\n\t\t}\n\t\tif (amountField.getText() == null || amountField.getText().length() == 0) {\n\t\t\terrorMessage += \"Kein gültiger Betrag!\\n\";\n\t\t} \n\t\t/**else {\n\t\t\t// try to parse the amount into a double\n\t\t\ttry {\n\t\t\t\tDouble.parseDouble(amountField.getText());\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t\terrorMessage += \"Kein zulässiger Betrag! (Nur Dezimalzahlen erlaubt)\\n\";\n\t\t\t}\n\t\t}**/\n\t\tif (distributionKindField.getText() == null || distributionKindField.getText().length() == 0) {\n\t\t\terrorMessage += \"Keine gültige Ausgabeart!\\n\";\n\t\t}\n\n\t\tif (errorMessage.length() == 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\t// Show the error message.\n\t\t\tAlert alert = new Alert(AlertType.ERROR);\n\t\t\talert.initOwner(dialogStage);\n\t\t\talert.setTitle(\"Ungültige Eingaben\");\n\t\t\talert.setHeaderText(\"Bitte korrigieren Sie die Fehler in den Feldern.\");\n\t\t\talert.setContentText(errorMessage);\n\t\t\talert.showAndWait();\n\t\t\treturn false;\n\t\t}\n\t}", "private boolean checkInputFields(){\r\n\t\tString allertMsg = \"Invalid input: \" + System.getProperty(\"line.separator\");\r\n\t\t\r\n\t\t//Check input for MCS text field\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_MCSTf.getText());\r\n\t\t\tif(testValue < 0 || testValue > 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a number between 0 and 1 as a MCS score.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for relevance score weight and coherence score weight text fields\r\n\t\ttry{\r\n\t\t\tFloat relScoreW = Float.parseFloat(m_RelScoreTf.getText());\r\n\t\t\tFloat cohScoreW = Float.parseFloat(m_CohScoreTf.getText());\r\n\t\t\tif(relScoreW < 0 || relScoreW > 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t\tif(cohScoreW < 0 || cohScoreW > 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t\tif((relScoreW + cohScoreW) != 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a number between 0 and 1 as a weight for relevance and coherence score.\" + System.getProperty(\"line.separator\");\r\n\t\t\tallertMsg += \"Sum of the weights for relevance and coherence score must be 1.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for MCS text field\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_KeyTf.getText());\r\n\t\t\tif(testValue < 0)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number as multiplier for keyword concepts.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for category confidence weight\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_CatConfTf.getText());\r\n\t\t\tif(testValue < 0)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number as a weight for the weight of the category confidence of concepts.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for weight of repeated concepts\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_RepeatTf.getText());\r\n\t\t\tif(testValue < 0)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number as a weight for repeated concepts.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for number of output categories\r\n\t\ttry{\r\n\t\t\tInteger testValue = Integer.parseInt(m_MaxCatsTf.getText());\r\n\t\t\tif(testValue < 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number for the maximum number of output categories.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\ttry{\r\n\t\t\tInteger testValue = Integer.parseInt(m_MinCatsTf.getText());\r\n\t\t\tif(testValue < 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number for the minimum number of output categories.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_MinCatScoreTf.getText());\r\n\t\t\tif(testValue < 0.0f || testValue > 1.0f)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number between 0 and 1 as minimum category score.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\tif(allertMsg.length() > 18){\r\n\t\t\tAlert alert = new Alert(AlertType.ERROR);\r\n\t\t\talert.setContentText(allertMsg);\r\n\t\t\talert.showAndWait();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "default Boolean validateInput(String input){\n if (input.contains(\"(\") || input.contains(\")\") || input.contains(\"[\") || input.contains(\"}\") || input.contains(\"{\") || input.contains(\"}\") )\n {\n return true;\n }else{\n return false;\n }\n }", "private boolean validateInput() {\n String username = editUsername.getText().toString().trim();\n String email = editEmail.getText().toString().trim();\n String password = editPassword.getText().toString().trim();\n String repeatPassword = editRepeatPassword.getText().toString().trim();\n if (!password.equals(repeatPassword)) {\n ShowMessageUtil.tosatSlow(\"Enter passwords differ\", EmailRegisterActivity.this);\n return false;\n } else if (username.equals(\"\") || email.equals(\"\") || password.equals(\"\")) {\n ShowMessageUtil.tosatSlow(\"every item can not be empty!\", EmailRegisterActivity.this);\n return false;\n }\n if (username.length()>10){\n ShowMessageUtil.tosatSlow(\"the character length of the username can't be over than 10\", EmailRegisterActivity.this);\n return false;\n }\n return true;\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (commentField.getText() == null || commentField.getText().length() == 0) {\n errorMessage += \"Не введен комментарий!\\n\";\n }\n if (timeField.getText() == null || timeField.getText().length() == 0) {\n errorMessage += \"Не введено время выполнения задачи!\\n\";\n }\n if (errorMessage.length() == 0) {\n return true;\n } if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.INFORMATION);\n alert.setTitle(\"Не введены все данные!\");\n alert.setHeaderText(null);\n alert.setContentText(\"Пожалуйста, введите все данные!\");\n alert.showAndWait();\n return false;\n }\n }", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (idLabel.getText() == null || idLabel.getText().length() == 0) {\r\n errorMessage += \"No valid ID number!\\n\"; \r\n } else {\r\n // try to parse the postal code into an int.\r\n try {\r\n Integer.parseInt(idLabel.getText());\r\n } catch (NumberFormatException e) {\r\n errorMessage += \"No valid ID number (must be an integer)!\\n\"; \r\n }\r\n }\r\n \r\n if (firstNameField.getText() == null || firstNameField.getText().length() == 0) {\r\n errorMessage += \"No valid first name!\\n\"; \r\n }\r\n if (lastNameField.getText() == null || lastNameField.getText().length() == 0) {\r\n errorMessage += \"No valid last name!\\n\"; \r\n }\r\n if (industryField.getText() == null || industryField.getText().length() == 0) {\r\n errorMessage += \"No valid industry!\\n\"; \r\n }\r\n\r\n if (workTypeField.getText() == null || workTypeField.getText().length() == 0) {\r\n errorMessage += \"No valid work type!\\n\"; \r\n }\r\n\r\n if (addressField.getText() == null || addressField.getText().length() == 0) {\r\n errorMessage += \"No valid address!\\n\";\r\n }\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n // Show the error message.\r\n Alert alert = new Alert(AlertType.ERROR);\r\n alert.initOwner(dialogStage);\r\n alert.setTitle(\"Invalid Fields\");\r\n alert.setHeaderText(\"Please correct invalid fields\");\r\n alert.setContentText(errorMessage);\r\n\r\n alert.showAndWait();\r\n\r\n return false;\r\n }\r\n }", "public boolean inputIsValid() {\n return nameIsValid() &&\n descriptionIsValid() &&\n priceIsValid() &&\n streetIsValid() &&\n zipcodeIsValid() &&\n cityIsValid() &&\n imageIsSelected();\n }", "public static boolean isValid(String args[]){\n \n if(args.length < 2){\n System.out.println(\"Not enough arguments detected. Please enter two\"\n + \" integer arguments.\");\n return false;\n }\n \n Scanner scanin = new Scanner(args[0]);\n Scanner scanin2 = new Scanner(args[1]);\n\t \n if(!scanin.hasNextInt() || !scanin2.hasNextInt()){\n System.out.println(\"Invalid argument type detected. Please enter two\"\n + \" integer arguments.\");\n return false;\n }\n\t else\n return true;\n }", "private static String[] checkInput(String input) throws Exception{\n String[] in = input.trim().split(\" \");\n\n if(in.length == 0){\n throw new CommandException(ExceptionEnum.INCORRECT_COMMAND_EXCEPTION);\n }\n\n if(CommandEnum.getCommandEnumFrom(in[0]) == null){\n throw new CommandException(ExceptionEnum.INCORRECT_COMMAND_EXCEPTION);\n }\n\n if(isSpecificCommandENum(in[0],BYE)){\n return in;\n }\n if(isSpecificCommandENum(in[0],TERMINATE)){\n return in;\n }\n\n if(in.length < MIN_PARAM){\n throw new CommandException(ExceptionEnum.LESS_INPUT_EXCEPTION);\n }\n\n if(in.length > MAX_PARAM){\n throw new CommandException(ExceptionEnum.EXTRA_INPUT_EXCEPTION);\n }\n\n //check input value\n for(int i = 1; i < in.length; i++){\n try{\n Integer.parseInt(in[i]);\n }catch(NumberFormatException e){\n throw new CommandException(ExceptionEnum.INVALID_INPUT_EXCEPTION);\n }\n }\n\n return in;\n }", "private boolean isValid(String input){\n return input.length() == 10 && input.matches(\"-?\\\\d+(\\\\.\\\\d+)?\");\n //check its digits\n }", "@Test\r\n public void Test004TakeUserInputValid()\r\n {\r\n gol.input = new Scanner(new ByteArrayInputStream(\"1 1 2 2 2 3 2 4 -1\".getBytes()));\r\n gol.takeUserInput();\r\n assertTrue(gol.grid[1][1] == 1 && gol.grid[2][2] == 1 && gol.grid[2][3] == 1 && gol.grid[2][4] == 1);\r\n }", "public void invalid() {\r\n\t\tSystem.out.println(\"Please enter a valid input\");\r\n\t}", "private boolean validateInputs() {\n question = txtQuestion.getText().trim();\n option1 = txtOption1.getText().trim();\n option2 = txtOption2.getText().trim();\n option3 = txtOption3.getText().trim();\n option4 = txtOption4.getText().trim();\n correctOption = jcCorrectAns.getSelectedItem().toString();\n //System.out.println(correctOption);\n if(question.isEmpty() || option1.isEmpty() || option2.isEmpty() || \n option3.isEmpty() || option4.isEmpty() || correctOption.isEmpty()){\n return false;\n }\n return true;\n }", "private boolean checkUserInputValidity() {\n // Extract Student information from the edit text views\n String studentName = mStudentNameEditText.getText().toString().trim();\n String studentGradeString = mStudentGradeEditText.getText().toString();\n\n // Check for valid student name\n if (TextUtils.isEmpty(studentName)) {\n Toast.makeText(this, R.string.please_enter_valid_name, Toast.LENGTH_SHORT).show();\n mStudentNameEditText.requestFocus();\n return false;\n }\n\n // Check for valid student birthdate\n if (mStudentBirthdate == 0) {\n Toast.makeText(this, R.string.please_enter_valid_birthdate,\n Toast.LENGTH_SHORT).show();\n return false;\n }\n if (DateUtils.isChosenDateAfterToday(mStudentBirthdate)) {\n Toast.makeText(this, R.string.please_enter_valid_birthdate,\n Toast.LENGTH_SHORT).show();\n return false;\n }\n\n // Check for valid student grade\n if (TextUtils.isEmpty(studentGradeString)) {\n Toast.makeText(this, R.string.please_enter_valid_grade, Toast.LENGTH_SHORT).show();\n mStudentGradeEditText.requestFocus();\n return false;\n } else {\n int studentGrade = Integer.parseInt(studentGradeString);\n if (studentGrade <= 0) {\n Toast.makeText(this, R.string.please_enter_valid_grade, Toast.LENGTH_SHORT).show();\n mStudentGradeEditText.requestFocus();\n return false;\n }\n }\n\n return true;\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (gemNameField.getText() == null || gemNameField.getText().length() == 0) {\n errorMessage += \"No valid gem name!\\n\";\n }\n if (gemValueField.getText() == null || gemValueField.getText().length() == 0) {\n errorMessage += \"No valid gem value!\\n\";\n } else {\n // try to parse the gem value into an int.\n try {\n Integer.parseInt(gemValueField.getText());\n } catch (NumberFormatException e) {\n errorMessage += \"No valid gem value (must be an integer)!\\n\";\n }\n }\n if (gemDescripField.getText() == null || gemDescripField.getText().length() == 0) {\n errorMessage += \"No valid gem description!\\n\";\n }\n\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.initOwner(dialogStage);\n alert.setTitle(\"Invalid Fields\");\n alert.setHeaderText(\"Please correct invalid fields\");\n alert.setContentText(errorMessage);\n\n alert.showAndWait();\n\n return false;\n }\n }", "public boolean checkInput(String str)\n {\n try\n {\n Integer.parseInt(str);\n } \n catch(NumberFormatException ex)\n {\n return false;\n } \n return true;\n }", "private static boolean validateInput2(String[] input) {\n\t\tif (input.length != 2) {\n\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private void checkInput(String input)throws Exception{\n\n if (input.getBytes(\"UTF-8\").length > 255){\n throw new IOException(\"Message too long\");\n\n }\n try {\n if (Integer.parseInt(input) < 0 || Integer.parseInt(input) > 65535) {\n throw new IOException(\"Port not valid\");\n }\n }catch (NumberFormatException e){\n //nothing should happen\n }\n }", "private boolean validInput() throws SQLException {\n if (userNameField.getText().length() == 0) {\n displayMessage(messagePane, \"Name cannot be empty\", true);\n return false;\n }\n else if (userNameField.getText().length() == 1) {\n displayMessage(messagePane, \"Name cannot be empty\", true);\n return false;\n }\n else if (!isAllLetters(userNameField.getText())) {\n displayMessage(messagePane, \"Names must be all letters\", true);\n return false;\n }\n else if (!(userNameField.getText().contains(\" \")) || userNameField.getText().charAt(0) == ' ') {\n displayMessage(messagePane, \"Name must consist of two words\", true);\n return false;\n }\n else if (!(emailField.getText().contains(\"@\"))) {\n displayMessage(messagePane, \"Invalid email\", true);\n return false;\n }\n else if (DatabaseManager.isEmailTaken(user.getDatabaseConnection(), emailField.getText()) && !(emailField.getText().equals(user.getUser().getEmail()))){\n displayMessage(messagePane, \"Email is used before\", true);\n return false;\n }\n else {\n displayMessage(messagePane,\"Changes are saved\", false);\n return true;\n }\n }", "private boolean validateInput(){\n boolean result = false;\n\n if(!us.setUsername(userField.getText())){\n errorLabel.setText(\"Nombre de usuario invalido\");\n } else if(!us.setPassword(passField.getText())){ //Valido 1 por uno los campos que ingreso el usuario\n errorLabel.setText(\"Contraseña invalida\");\n } else if(!us.setName(nameField.getText())){\n errorLabel.setText(\"Nombre Invalido\");\n } else if(!us.setSurname(surnameField.getText())){\n errorLabel.setText(\"Apellido Invalido\");\n } else if(!us.setDni(dniField.getText())){\n errorLabel.setText(\"Dni invalido\");\n } else if(!ageField.getText().matches(\"\\\\d{2}\")){\n errorLabel.setText(\"Edad invalida\");\n }\n else{\n us.setAge(Integer.parseInt(ageField.getText()));\n result = true;\n }\n return result;\n }", "private boolean isValidInput(String input) \r\n {\r\n\t \r\n return input!=null&&input.length()<=10;\r\n \r\n }", "private void inputValidation(String[] args) {\r\n\t\t// Must have two argument inputs - grammar and sample input\r\n\t\tif (args.length != 2) {\r\n\t\t\tSystem.out.println(\"Invalid parameters. Try:\\njava Main <path/to/grammar> <path/to/input>\");\r\n\t\t\tSystem.exit(-1);\r\n\t\t}\r\n\t}", "private boolean validateInputs() {\n if (Constants.NULL.equals(review)) {\n reviewET.setError(\"Must type a review!\");\n reviewET.requestFocus();\n return false;\n }\n if (Constants.NULL.equals(heading)) {\n headingET.setError(\"Heading cannot be empty\");\n headingET.requestFocus();\n return false;\n }\n return true;\n }", "private void validateData(String input) {\n String[] inputStringArray = input.split(\" \");\n\n for (String s : inputStringArray) {\n try {\n Integer.parseInt(s);\n } catch (NumberFormatException e) {\n throw new NumberFormatException(\n \"Looks like your input - \" + s + \", is not a number. Try again\");\n }\n }\n }", "public boolean validateInput(double input){\n\t\tif(input >= -1 && input <= 1)\n\t\t return true;\n\t\treturn false;\t\n\t}", "private boolean isValid(char input) {\n if (this.isLetter(input) || this.isDigit(input) || this.isOperator(input)\n || this.isIgnored(input)) {\n return true;\n } else return false;\n }", "public abstract boolean isValidValue(String input);", "public void validateInput(Information information) {\n information.validateFirstName();\n information.validateLastName();\n information.validateZipcode();\n information.validateEmployeeID();\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 checkValidity() {\n String sep = DECIMAL_FORMAT.getDecimalFormatSymbols().getDecimalSeparator() + \"\";\n String name = nameField.getText().trim();\n String priceText = valueField.getText().trim();\n if (name.equals(\"\") || priceText.equals(\"\")) {\n Utils.showWarningMessage(getRootPane(), \"The fields can not be empty!\");\n return false;\n }\n String price = priceText.replace(sep, \"\");\n if (!price.matches(\"^[0-9]+$\")) {\n Utils.showWarningMessage(getRootPane(), \"Please enter a valid price!\");\n return false;\n }\n int priceInt = Integer.parseInt(price);\n if (priceInt == 0) {\n Utils.showWarningMessage(getRootPane(), \"The price can not be 0.\");\n return false;\n }\n return true;\n }", "public void validateInput(String fName, String lName, String zipCode, String employID){\n boolean firstname = firstNameTwoCharactersLong(fName);\n //boolean firstFilled = firstNameFilled\n boolean firstFilled = firstNameFilled(fName);\n //boolean lastname = lastNameTwoCharactersLong\n boolean lastname = lastNameTwoCharactersLong(lName);\n //boolean lastFilled = lastNameFilled\n boolean lastFilled = lastNameFilled(lName);\n //boolean the rest\n boolean employeeID = employeeIDValid(employID);\n boolean zCode = zipCodeValid(zipCode);\n\n //if all of them are valid=true then error prints \"there are no errors found\n if (firstname && firstFilled && lastname && lastFilled && employeeID && zCode){\n errorMessage = \"There were no errors found\";\n }\n //Display error message\n System.out.println(errorMessage);\n\n }", "private boolean validateInputInfo(){\n\n //Get user input\n String firstName = newContactFirstName.getText().toString();\n String lastName = newContactLastName.getText().toString();\n String email = newContactEmailAddress.getText().toString();\n String phone = newContactPhoneNumber.getText().toString();\n\n //Check to make sure no boxes were left empty\n if(firstName.isEmpty() || lastName.isEmpty() || email.isEmpty() || phone.isEmpty()){\n Toast.makeText(this, \"You must fill all fields before continuing!\", Toast.LENGTH_LONG).show();\n return false;\n }\n //Check to see if phone number is valid\n else if(!(phone.length() >= 10)){\n Toast.makeText(this, \"Make sure to input a valid 10 digit phone number!\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n return true;\n }", "protected void check() throws IOException, ServletException {\n if(value.length()==0)\n error(\"please specify at least one component\");\n else {\n \t\t//TODO add more checks\n \t\tok();\n }\n }", "boolean checkValidity();", "private void validate() {\n\t\t// just in case;\n\t\tfor (int i=0;i<NR_OF_FIELDS; i++) {\n\t\t\tvalid[i] = \"0\";\n\t\t}\n\t\t//\n\t\t// Validate name and surname:\n\t\t//\n\t\tif ( ! this.isUpperAlpha(nume)) {\n\t\t\tfields[0] = \"1\";\n\t\t}\n\t\t\n\t\tif ( ! this.isUpperAlphaWithSpace(nume)) {\n\t\t\tfields[1] = \"1\";\n\t\t}\n\t\t//\n\t\t// validate seria\n\t\t//\n\t\tvalid[2] = \"1\";\t\t\t\t\t\t\t// presupun ca seria este invalida, si incerc sa o validez\n\t\tfor (int i=0; i<seriiBuletin.length; i++) {\n\t\t\tif (seriiBuletin[i].equals(seria)) {\n\t\t\t\tvalid[2] = \"0\";\n\t\t\t}\n\t\t}\n\t\t//\n\t\t// validate numarul\n\t\t//\n\t\ttry {\n\t\t\tvalid[3] = \"1\";\n\t\t\tint nr = Integer.valueOf(numarul);\n\t\t\tif ( nr >= 100000 && nr <= 999999 ) {\n\t\t\t\tvalid[3] = \"0\";\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tLog.d(TAG, \"Error validating seria.\");\n\t\t}\n\n\t\t//\n\t\t// validate sex\n\t\t//\n\t\tif ( ! (sex == 'M' || sex == 'F')) {\n\t\t\tvalid[6] = \"1\";\n\t\t}\n\t\t//\n\t\t// Validate valabilitate\n\t\t//\n\t\tif ( ! isNumber(this.valabilitate)) {\n\t\t\tvalid[7] = \"1\";\n\t\t}\n\t\t//\n\t\t// validate CNP\n\t\t//\n\t\tif ( ! (isNumber(CNP) && isValidCNP(CNP))) {\n\t\t\tvalid[8] = \"1\";\n\t\t}\n\t\t\n\t}", "public static boolean checkInput(String saInput) {\r\n\t\treturn checkGenericPattern(saInput) && checkGenericPattern(unalter(saInput));\r\n\t}", "private static String validateInputStr() {\n String str = \"\";\n Scanner genericString = new Scanner(System.in);\n if (!genericString.hasNextInt()) {\n str = genericString.nextLine();\n return str;\n }\n else {\n validateInputStr();\n }\n return str;\n }", "private void verifyInput(){\n String firstName = mFirstNameField.getText().toString();\n String lastName = mLastNameField.getText().toString();\n\n mNameFieldsFilled = !TextUtils.isEmpty(firstName) && !TextUtils.isEmpty(lastName);\n\n }", "public boolean validate(String input)//true if valid\n\t{\n\t\t//loop through string verifying for numbers\n\t\tfor(int i = 0;i<input.length(); i++)\n\t\t{\n\t\t\tchar c = input.charAt(i);\n\t\t\tif(!Character.isDigit(c))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\t\n\t\t}\n\t\treturn true;\n\t}", "boolean isInputValid(){\n\t\tString ac = edAccount.getText().toString();\n\t\tString pwd = edPassword.getText().toString();\n\t\tboolean isAccEmpty = StringUtil.isNullOrEmpty(ac);\n\t\tboolean isPwdEmpty = StringUtil.isNullOrEmpty(pwd);\n\t\tif(isAccEmpty){\n\t\t\tedAccount.requestFocus();\n\t\t}else if(isPwdEmpty){\n\t\t\tedPassword.requestFocus();\n\t\t}\n\t\treturn !( isAccEmpty|| isPwdEmpty);\n\t}", "public boolean validateForm() {\r\n\t\tint validNum;\r\n\t\tdouble validDouble;\r\n\t\tString lengthVal = lengthInput.getText();\r\n\t\tString widthVal = widthInput.getText();\r\n\t\tString minDurationVal = minDurationInput.getText();\r\n\t\tString maxDurationVal = maxDurationInput.getText();\r\n\t\tString evPercentVal = evPercentInput.getText();\r\n\t\tString disabilityPercentVal = disabilityPercentInput.getText();\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.1 - Ensure all inputs are numbers\r\n\t\t */\r\n\t\t\r\n\t\t// Try to parse length as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(lengthVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Length must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(widthVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Width must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(minDurationVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Min Duration must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(maxDurationVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Max Duration must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidDouble = Double.parseDouble(evPercentVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"EV % must be a number\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidDouble = Double.parseDouble(disabilityPercentVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Disability % must be a number\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.2 - Ensure all needed inputs are non-zero\r\n\t\t */\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(lengthVal);\r\n\t\tif (validNum <= 0) {\r\n\t\t\tsetErrorMessage(\"Length must be greater than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(widthVal);\r\n\t\tif (validNum <= 0) {\r\n\t\t\tsetErrorMessage(\"Width must be greater than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(minDurationVal);\r\n\t\tif (validNum < 10) {\r\n\t\t\tsetErrorMessage(\"Min Duration must be at least 10\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(maxDurationVal);\r\n\t\tif (validNum < 10) {\r\n\t\t\tsetErrorMessage(\"Max Duration must be at least 10\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidDouble = Double.parseDouble(evPercentVal);\r\n\t\tif (validDouble < 0) {\r\n\t\t\tsetErrorMessage(\"EV % can't be less than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidDouble = Double.parseDouble(disabilityPercentVal);\r\n\t\tif (validDouble < 0) {\r\n\t\t\tsetErrorMessage(\"Disability % can't be less than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.3 - Ensure Max Duration can't be smaller than Min Duration\r\n\t\t */\r\n\t\t\r\n\t\tif (Integer.parseInt(minDurationVal) > Integer.parseInt(maxDurationVal)) {\r\n\t\t\tsetErrorMessage(\"Max Duration can't be less than Min Duration\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.4 - Ensure values aren't too large for the system to handle\r\n\t\t */\r\n\t\t\r\n\t\tif (Integer.parseInt(lengthVal) > 15) {\r\n\t\t\tsetErrorMessage(\"Carpark length can't be greater than 15 spaces\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (Integer.parseInt(widthVal) > 25) {\r\n\t\t\tsetErrorMessage(\"Carpark width can't be greater than 25 spaces\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif (Integer.parseInt(minDurationVal) > 150) {\r\n\t\t\tsetErrorMessage(\"Min Duration can't be greater than 150\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Integer.parseInt(maxDurationVal) > 300) {\r\n\t\t\tsetErrorMessage(\"Max Duration can't be greater than 300\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Double.parseDouble(evPercentVal) > 100) {\r\n\t\t\tsetErrorMessage(\"EV % can't be greater than 100\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Double.parseDouble(disabilityPercentVal) > 100) {\r\n\t\t\tsetErrorMessage(\"Disability % can't be greater than 100\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Integer.parseInt(minDurationVal) > 150) {\r\n\t\t\tsetErrorMessage(\"Min Duration can't be greater than 150\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\treturn true;\r\n\t}", "private void validarCampos() {\n }", "void validate();", "void validate();", "@Override\n\tprotected void checkNumberOfInputs(int length) {\n\n\t}", "public static boolean isSecondArgumentValid(String input) {\n\t\tif (CommonUtils.isNotNullOrEmpty(input) && CommonUtils.isNumeric(input))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "public static boolean checkForValidInput(String input) {\n try {\n int inputValue = Integer.parseInt(input);\n return inputValue >= 0 && inputValue <= 8;\n } catch (NumberFormatException e) {\n return false;\n }\n }", "private boolean validCreateInput() throws SQLException {\n // Checks if any of the fields is empty\n if(teamNameCreateField.getText().equals(\"\") || abbrevationCreateField.getText().equals(\"\")\n || chooseCityBoxCreate.getValue() == null || chooseLeagueBoxCreate.getValue() == null\n || chooseAgeGroupCreate.getValue() == null || chooseLeagueTeamBoxCreate.getValue() == null){\n displayMessage(messagePane,\"Please fill all the fields\",true);\n return false;\n }\n // Checks the abbrevation length\n else if(abbrevationCreateField.getText().length() > 3)\n {\n displayMessage(messagePane,\"Abbrevations must be at most 3 characters\",true);\n return false;\n }\n // Checks team name length\n else if (teamNameCreateField.getText().length() > 30){\n displayMessage(messagePane,\"Team Names must be smaller than 30 characters\",true);\n return false;\n }\n return true;\n }", "private boolean isInputValid() {\n\t\tString errorMessage = \"\";\n\t\t\n\t\tif(userNameField.getText() == null || userNameField.getText().length() == 0) {\n\t\t\terrorMessage += \"Üres a felhasználó név mező!\\n\";\n\t\t}\n\t\tif(passwordField.getText() == null || passwordField.getText().length() == 0) {\n\t\t\terrorMessage += \"Üres a jelszó mező!\";\n\t\t}\n\t\t\n\t\tif(errorMessage.length() == 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\t// show the error message\n\t\t\tAlert alert = new Alert(AlertType.ERROR);\n\t\t\talert.initOwner(dialogStage);\n\t\t\talert.setTitle(\"Érvénytelen mezők\");\n\t\t\talert.setHeaderText(\"Kérlek töltsd ki az összes mezőt!\");\n\t\t\talert.setContentText(errorMessage);\n\t\t\t\n\t\t\talert.showAndWait();\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\t}", "public boolean Validate_Input(String attack_coord){\r\n\t\tattack_coord=attack_coord.trim(); //deletes any unecessary whitespace\r\n\t\tif(attack_coord.length()>3) { //format incorrect\r\n\t\t\tdisplay.scroll(\"Input string too long to be proper coordinate\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(attack_coord.length()<=1){\r\n\t\t\tdisplay.scroll(\"Input string too short to be proper coordinate\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// Convert the string inputs into integers\r\n\t\tString x_as_string = attack_coord.substring(1);\r\n\t\tycoor = letterToIndex(attack_coord.charAt(0));\r\n\t\t\r\n\t\t\r\n\t\ttry{\r\n\t\t\txcoor=Integer.parseInt(x_as_string);\r\n\t\t\txcoor--; //to match the xcoor with the array position\r\n\t\t} catch (NumberFormatException nfe) {\r\n\t display.scroll(\"Incorrect Format. Enter with letter and then number i.e. B3\");\r\n\t display.printScreen();\r\n\t return false;\r\n\t\t}\r\n\r\n\t\t\r\n\t\t\r\n\r\n\t\tif(!hisBoard.in_Grid(xcoor, ycoor)){\r\n\t\t\tdisplay.scroll(\"The Coordinate input is not within (A-J) or (1-10)\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(hisBoard.already_attacked(xcoor,ycoor)){\r\n\t\t\tdisplay.scroll(\"Coordinate has already been attacked\");\r\n\t\t\tdisplay.printScreen();\t\t\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "protected void validateInput()\r\n\t{\r\n\t\tString errorMessage = null;\r\n\t\tif ( validator != null ) {\r\n\t\t\terrorMessage = validator.isValid(text.getText());\r\n\t\t}\r\n\t\t// Bug 16256: important not to treat \"\" (blank error) the same as null\r\n\t\t// (no error)\r\n\t\tsetErrorMessage(errorMessage);\r\n\t}", "private boolean checkForInvalidInput(){\n String email = emailTextView.getText().toString();\n String password = passwordTextView.getText().toString();\n String name = usernameTextView.getText().toString();\n\n\n if(email.isEmpty() || password.isEmpty() || name.isEmpty()){\n Toast.makeText(getApplicationContext(),\"Please fill in all fields\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n\n if(!email.contains(\"@\")){\n Toast.makeText(getApplicationContext(),\"Please enter a valid email\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n if(!isStudent && !isTeacher){\n Toast.makeText(getApplicationContext(),\"Please select Student or Teacher\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n\n\n\n\n // add more checks?\n\n return true;\n\n }", "private boolean validateInput(){\n Window owner=root.getScene().getWindow();\n inputFileds.addAll(txtfn,txtln,txtsurname,txtDOB,txtResidence,txtMobile,txtID,username);\n for (TextField textField : inputFileds) {\n if(textField.getText().isEmpty()){\n //set css stroke\n Dialog.showMessageDialog(owner,\"Missing Details\",\"Invalid Input\",DialogIcon.WARNING);\n textField.requestFocus();\n return false;\n }\n }\n inputFileds.removeAll(txtDOB,txtMobile,username);\n for (TextField textField : inputFileds) {\n if(textField.getText().length()>30){\n //set css stroke\n Dialog.showMessageDialog(owner,\"Sorry the text you entered can not be greater that 30 characters\",\"Text too Long\",DialogIcon.WARNING);\n textField.requestFocus();\n return false;\n }\n }\n if(username.getText().length()>20 || username.getText().length()<4){\n Dialog.showMessageDialog(owner, \"Sorry your Username has to be More than 3 Characters and can not Exceed 20 Charchaters\", \"Invalid input\",DialogIcon.WARNING);\n username.requestFocus();\n return false;\n }\n if(pass.getText().isEmpty()){\n Dialog.showMessageDialog(owner,\"Missing Details\",\"Invalid Input\",DialogIcon.WARNING);\n pass.requestFocus();\n return false;\n }\n if(pass.getText().length()>20 || pass.getText().length()<4){\n Dialog.showMessageDialog(owner, \"Sorry your Password has to be More than 3 Characters and can not Exceed 20 Charchaters\", \"Invalid Input\",DialogIcon.WARNING);\n pass.requestFocus();\n return false;\n }\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd/MM/yyyy\");\n SimpleDateFormat yearFormat = new SimpleDateFormat(\"yyyy\");\n try {\n date = dateFormat.parse(txtDOB.getText());\n Calendar cal=Calendar.getInstance();\n int year=Integer.parseInt(yearFormat.format(date));\n if (year <= 1900 || year>cal.get(Calendar.YEAR)) {\n Dialog.showMessageDialog(owner,\"Invalid Date of Birth\", \"Invalid Input\",DialogIcon.WARNING);\n txtDOB.requestFocus();\n return false;\n }\n String initialEntry=txtDOB.getText();\n String parsedValue=dateFormat.format(date);\n if(!initialEntry.equals(parsedValue)){\n Dialog.showMessageDialog(owner, \"Note your Date of Birth has been corrected\", \"Date Corrected\",DialogIcon.INFORMATION);\n }\n txtDOB.setText(dateFormat.format(date));\n } catch (ParseException ex) {\n Dialog.showMessageDialog(owner,\"Invalid Date of Birth\", \"Invalid Input\",DialogIcon.WARNING);\n txtDOB.requestFocus();\n return false;\n }\n try {\n int mobile=Integer.parseInt(txtMobile.getText());\n } catch (NumberFormatException e) {\n Dialog.showMessageDialog(owner, \"Invalid Mobile Number\", \"Invalid data\",DialogIcon.WARNING);\n txtMobile.requestFocus();\n return false;\n }\n if(txtMobile.getText().length() != 10){\n Dialog.showMessageDialog(owner, \"Sorry your Mobile Number is invalid\", \"Invalid input\",DialogIcon.WARNING);\n txtMobile.requestFocus();\n return false;\n }\n String sql=\"select Username,Password from users where Username=?\";\n try(PreparedStatement prstmt=con.prepareStatement(sql)) {\n prstmt.setString(1, username.getText());\n ResultSet rs=prstmt.executeQuery();\n if(rs.next()){\n Dialog.showMessageDialog(owner, \"Sorry Username already exists\\n Please change to different Username\", \"Username Exists\",DialogIcon.WARNING);\n username.requestFocus();\n return false;\n }\n rs.close();\n } catch (SQLException e) {\n System.err.println(e);\n }\n return true;\n }", "private boolean validateInput() {\n String departmentInput = mDepartmentField.getText().toString();\n String emailInput = mEmailField.getText().toString();\n String passwordInput = mPasswordField.getText().toString();\n\n if (departmentInput.isEmpty()) {\n mDepartmentField.setError(\"Please enter your department number\");\n mDepartmentField.requestFocus();\n return false;\n } else {\n mPasswordField.setError(null);\n }\n\n\n if (emailInput.isEmpty() || !Patterns.EMAIL_ADDRESS.matcher(emailInput).matches()) {\n mEmailField.setError(\"Please enter a valid email address\");\n mEmailField.requestFocus();\n return false;\n } else {\n mEmailField.setError(null);\n }\n\n if (passwordInput.isEmpty()) {\n mPasswordField.setError(\"Please enter your password\");\n mPasswordField.requestFocus();\n return false;\n } else {\n mPasswordField.setError(null);\n }\n\n return true;\n }", "private boolean validateUserInputs() {\n ArrayList<String> errors = new ArrayList();\n \n if (this.view.getContent().equals(\"\")) {\n errors.add(\"\\t - Enter a comment\");\n }\n \n if (errors.size() > 0) {\n String errorMsg = \"Unable to save new Asset.\\nDetails:\";\n for (String error : errors) {\n errorMsg += \"\\n\" + error;\n }\n JOptionPane.showMessageDialog(this.view, errorMsg, \"Unable to Save\", JOptionPane.INFORMATION_MESSAGE);\n return false;\n }\n return true;\n }", "public boolean validateInput(String title) {\n \t\n \tboolean valid = true;\n \tString error = \"\";\n \t\n \tif(title.equals(\"\")) {\n \t\terror += \"Invalid title\";\n \t\tvalid = false;\n \t}else if(currentTaskItems.size() == 0) {\n \t\terror += \"Please attach an item to your task\";\n \t\tvalid = false;\n \t}else if(!propertiesGrabbed) {\n \t\terror += \"Please enter the tasks properties\";\n \t\tvalid = false;\n \t}\n \t\n \t//if valid return else toast\n \tif(valid){\n \t\treturn true;\n \t}else{\n\n \t\tContext context = getApplicationContext();\n \t\tToast toast = Toast.makeText(context, error, Toast.LENGTH_SHORT);\n \t\ttoast.show();\n \t\treturn false;\n \t}\n }", "private boolean isUserInputValid(String[] packetData)\n\t{\n\t\tif(packetData.length < 3 ) return false;\n\t\tString address = packetData[0];\n\t\tint port = Integer.parseInt(packetData[1]);\n\n\t\tint addressPeriodsCount = address.length() - address.replace(\".\", \"\").length();\n\n\t\tif (packetData.length < 3)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\telse if(address.equals(\"localhost\") && (port > 0 || port <= 65535))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn (addressPeriodsCount == 3 ||addressPeriodsCount == 2 ) && (port > 0 || port <= 65535);\n\t\t}\n\t}", "public static boolean validateMenuOption(String input) {\r\n boolean valid = false;\r\n try {\r\n if (Integer.parseInt(input) < 1 || Integer.parseInt(input) > 5){\r\n System.out.println(\"**Error: Menu option not found.\\n\"\r\n +\" Please type a single digit [1-5] for menu option.\");\r\n } \r\n else {\r\n valid = true;\r\n }\r\n }\r\n catch (NumberFormatException nfe) {\r\n System.out.println(\"**Error: Only a single number can be input.\\n\"\r\n +\" Please type a single digit [1-5] for menu option.\");\r\n }\r\n return valid;\r\n }" ]
[ "0.84283096", "0.8279811", "0.8173578", "0.7814372", "0.78072685", "0.76525486", "0.7641181", "0.75494045", "0.7533217", "0.7248567", "0.7233538", "0.7094465", "0.70860356", "0.70676017", "0.7062181", "0.7041608", "0.70374566", "0.7036175", "0.7028434", "0.69914263", "0.69434917", "0.6930006", "0.6887363", "0.688484", "0.6877617", "0.687156", "0.6825481", "0.6819745", "0.6803094", "0.6801715", "0.67922795", "0.67867124", "0.67826796", "0.67799556", "0.6777724", "0.6774258", "0.676157", "0.6757966", "0.6755803", "0.67533857", "0.67531115", "0.67469007", "0.67343104", "0.6732378", "0.6727642", "0.671763", "0.6717164", "0.67105114", "0.6710452", "0.6708039", "0.6706999", "0.6705111", "0.67004204", "0.6696957", "0.66925114", "0.668555", "0.667766", "0.66706353", "0.666929", "0.6669114", "0.6669087", "0.6640919", "0.6632329", "0.65950215", "0.6592842", "0.65917605", "0.6571654", "0.6567888", "0.6563689", "0.65624845", "0.65476036", "0.65424246", "0.6534722", "0.6519466", "0.6513298", "0.6511367", "0.6508082", "0.6507898", "0.65053225", "0.65023094", "0.64992523", "0.6496722", "0.64958155", "0.64947975", "0.6493414", "0.64824337", "0.64824337", "0.6474706", "0.64696604", "0.64632416", "0.64622724", "0.6448644", "0.6448056", "0.6442508", "0.6437141", "0.64247316", "0.6423981", "0.640355", "0.6401683", "0.64006954", "0.6396333" ]
0.0
-1
check for valid input
private void setTileInField(int row, int column, int value, char section){ if(!checkInput(row, column, value)) return; if(value > 0){ gameField[row][column] = new Assignment(value, Section.getSection(section)); } else { gameField[row][column] = new Guess(Section.getSection(section)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean isValidInput() {\n\t\treturn true;\n\t}", "private boolean isInputValid() {\n return true;\n }", "protected abstract boolean isInputValid();", "protected abstract boolean checkInput();", "private void validateInputParameters(){\n\n }", "protected abstract int isValidInput();", "private void checkUserInput() {\n }", "@Override\n\tpublic boolean checkInput() {\n\t\treturn true;\n\t}", "public boolean checkInput();", "public abstract boolean verifyInput();", "public boolean isInputValid()\n {\n String[] values = getFieldValues();\n if(values[0].length() > 0 || values[1].length() > 0 || values[2].length() > 0)\n return true;\n else\n return false;\n }", "private static boolean isBadInput(String s) {\n\t\tString[] split = s.split(\"\\\\s+\");\n\t\tif (split.length != 3) {\n\t\t\tSystem.err.printf(\"Unknow length: %d\\n\", split.length);\n\t\t\treturn true;\n\t\t}\n\t\ttry {\n\t\t\tInteger.parseInt(split[0]);\n\t\t\tInteger.parseInt(split[2]);\n\t\t} catch (NumberFormatException e) {\n\t\t\tSystem.err.printf(\"Input numbers only.\\n\");\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tif (split[1].length() != 1) {\n\t\t\tSystem.err.printf(\"Operator should be one character.\\n\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean checkForWrongInput(){\n if(this.studentCode.getText().isEmpty())\n return true;\n //Check for length\n if(this.studentCode.getText().length() != 3)\n return true;\n //Check for invalid characters\n for(char c: this.studentCode.getText().toCharArray())\n if(!Character.isDigit(c))\n return true;\n\n return false;\n }", "void checkValid();", "private boolean validateInput() {\n\tboolean valid = false;\n\ttry {\n\t if (paymentText == null | paymentText.getValue() == \"\") {\n\t\tpaymentText.focus();\n\t\tthrow new NullPointerException(\"paymentText fehlt\");\n\t }\n\t if (paymentBetrag == null | paymentBetrag.getValue() == \"\") {\n\t\tpaymentBetrag.focus();\n\t\tthrow new NullPointerException(\"paymentBetrag fehlt\");\n\t }\n\t if (!paymentBetrag.isEmpty()) {\n\t\t@SuppressWarnings(\"unused\")\n\t\tdouble d = Double.parseDouble(paymentBetrag.getValue());\n\t }\n\t // seems that everything was OK\n\t valid = true;\n\t} catch (NullPointerException e) {\n\t System.out.println(\"PaymentWindow - \" + e);\n\t} catch (NumberFormatException e) {\n\t // entered value is no number\n\t paymentBetrag.focus();\n\t}\n\treturn valid;\n }", "private boolean isInValidInput(String input) {\n\n\t\tif (input == null || input.isEmpty())\n\t\t\treturn true;\n\n\t\tint firstPipeIndex = input.indexOf(PARAM_DELIMITER);\n\t\tint secondPipeIndex = input.indexOf(PARAM_DELIMITER, firstPipeIndex + 1);\n\n\t\t/*\n\t\t * if there are no PARAM_DELIMITERs or starts with a PARAM_DELIMITER\n\t\t * (Meaning command is missing) or only single PARAM_DELIMITER input is\n\t\t * not valid\n\t\t */\n\t\tif (firstPipeIndex == -1 || firstPipeIndex == 0 || secondPipeIndex == -1)\n\t\t\treturn true;\n\n\t\t// Means package name is empty\n\t\tif (secondPipeIndex - firstPipeIndex < 2)\n\t\t\treturn true;\n\n\t\treturn false;\n\t}", "private boolean validFormInputs() {\n String email = etEmail.getText().toString();\n String password = etPassword.getText().toString();\n String institutionName = etInstitutionName.getText().toString();\n String addressFirst = etInstitutionAddressFirst.getText().toString();\n String addressSecond = etInstitutionAddressSecond.getText().toString();\n String CIF = etCIF.getText().toString();\n\n String[] allInputs = {email, password, institutionName, addressFirst, addressSecond, CIF};\n for (String currentInput : allInputs) {\n if (currentInput.matches(\"/s+\")) // Regex pt cazul cand stringul e gol sau contine doar spatii\n return false; // formular invalid - toate inputurile trebuie sa fie completate\n }\n String[] stringsAddressFirst = addressFirst.split(\",\");\n String[] stringsAddressSecond = addressSecond.split(\",\");\n if (stringsAddressFirst.length != 4 ||\n stringsAddressSecond.length != 3)\n return false;\n\n //<editor-fold desc=\"Checking if NUMBER and APARTMENT are numbers\">\n try {\n Integer.parseInt(stringsAddressSecond[0]);\n Integer.parseInt(stringsAddressSecond[2]);\n return true; // parsed successfully without throwing any parsing exception from string to int\n }catch (Exception e) {\n Log.v(LOG_TAG, \"Error on converting input to number : \" + e);\n return false; // parsed unsuccessfully - given strings can not be converted to int\n }\n //</editor-fold>\n }", "public boolean checkInput(){\n if(spelerIDField.getText().equals(\"\") || typeField.getText().equals(\"\") || codeField.getText().equals(\"\") || heeftBetaaldField.getText().equals(\"\")){\n return true;\n } else { return false; }\n }", "protected abstract boolean isInputValid(@NotNull ConversationContext context, @NotNull String input);", "private boolean isValidInput() {\n if (null == mUsername || mUsername.length() <= 0) {\n return false;\n } else if (null == mPassword || mPassword.length() <= 0) {\n return false;\n }\n return true;\n }", "@Override\n\tprotected void isValid(String input) throws DataInputException\n\t{\n\t}", "public boolean checkInput(String input){\n\t\t//make sure only input 0-9\n\t\tif(input.length() != 1){\n\t\t\treturn false;\n\t\t}\n\t\tchar c = input.charAt(0);\n\t\tif(!Character.isDigit(c)){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean checkEntryInputs() {\n\t\tboolean isValid = true;\n\t\tif(sampleNumberTF.getText().equals(\"\")) {\n\t\t\tisValid = false;\n\t\t}\n\t\t\n\t\tif(materialDescriptionTF.getText().equals(\"\")) {\n\t\t\tisValid = false;\n\t\t}\n\t\t\n\t\tif(Double.valueOf(bacteroidesConcentrationTF.getText())==null) {\n\t\t\tisValid = false;\n\t\t}\n\t\treturn isValid;\n\t}", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (nameField.getText() == null || nameField.getText().length() == 0) {\r\n errorMessage += \"请输入直播名!\\n\";\r\n }\r\n if (urlField.getText() == null || urlField.getText().length() == 0) {\r\n errorMessage += \"请输入直播流!\\n\";\r\n }\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n Alert alert = new Alert(Alert.AlertType.ERROR);\r\n alert.setTitle(\"输入错误\");\r\n alert.setContentText(errorMessage);\r\n return false;\r\n }\r\n }", "private static boolean validateInput1(String[] input) {\n\t\tif (input.length != 1) {\n\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private static boolean valid_input(String user_input) {\n \n boolean output = false;\n \n if(user_input.length() == 2){\n \n output = (user_input.substring(0,1).matches(\"[0-9]\") && user_input.substring(1,2).matches(\"[a-zA-Z]\"));\n } else if (user_input.length() == 3) {\n \n output = (user_input.substring(0,2).matches(\"[1-2][0-9]\") && user_input.substring(2,3).matches(\"[a-zA-Z]\"));\n \n if(Integer.parseInt(user_input.substring(0,2))>TicTacToe.game.gridSize){\n output = false;\n }\n }\n \n return output;\n }", "private boolean checkInputValidity() {\n // if any of the input field is empty, return false directly\n if (name.getText().equals(\"\") || id.getText().equals(\"\") || fiber.getText().equals(\"\")\n || protein.getText().equals(\"\") || fat.getText().equals(\"\") || calories.getText().equals(\"\")\n || carbohydrate.getText().equals(\"\")) {\n String message = \"Make sure enter the value of all nutrient components, please try again!\";\n // display the warning windows with the assigned warning message\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close();// close the add food stage\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n // if any nutrition info input is not a number value or is negative, return false directly\n try {\n Double fibervalue = null;\n Double proteinvalue = null;\n Double fatvalue = null;\n Double caloriesvalue = null;\n Double carbohydratevalue = null;\n // trim the input to exact numeric value\n fibervalue = Double.valueOf(fiber.getText().trim());\n proteinvalue = Double.valueOf(protein.getText().trim());\n fatvalue = Double.valueOf(fat.getText().trim());\n caloriesvalue = Double.valueOf(calories.getText().trim());\n carbohydratevalue = Double.valueOf(carbohydrate.getText().trim());\n // nutrition input is suppose to be positive numbers\n // if any of the numbers is negative, return false diretcly\n if (fibervalue < 0.0 || proteinvalue < 0.0 || fatvalue < 0.0 || caloriesvalue < 0.0\n || carbohydratevalue < 0.0) {\n String message = \"The input of the nutrient can not be negative, please try again!\";\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close();\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n // if any input of the nutrition info is not a double value, catch the exception and return\n // false\n } catch (Exception e) {\n String message =\n \"At least one nutrition value input is invalid, please type a number in nutrient textbox!\";\n // display the warning windows with the assigned warning message\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close(); // close the addfood stage\n // wait for response from ok button\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n return true;\n }", "private boolean validateInput(EditText titleInput, EditText descriptionInput, EditText priceInput) {\n String title = titleInput.getText().toString();\n String description = descriptionInput.getText().toString();\n int price = (TextUtils.isEmpty(priceInput.getText().toString()))? -1 : Integer.parseInt(priceInput.getText().toString());\n if (TextUtils.isEmpty(title) || TextUtils.isEmpty(description) || price < 0) {\n Toast.makeText(this.getActivity(),\n \"Please, fill in all fields.\",\n Toast.LENGTH_LONG).show();\n return false;\n }\n if (photoURI == null) {\n Toast.makeText(this.getActivity(),\n \"Please, add a picture to this item before submitting it.\",\n Toast.LENGTH_LONG).show();\n return false;\n }\n return true;\n }", "public boolean isInputValid(ConversationContext context, String s)\r\n/* */ {\r\n/* 135 */ return (s.equalsIgnoreCase(\"one\")) || (s.equals(\"1\")) || (s.equalsIgnoreCase(\"two\")) || (s.equals(\"2\")) || (s.equalsIgnoreCase(\"zero\")) || (s.equals(\"0\"));\r\n/* */ }", "private boolean validateInput() {\n boolean isValid = true;\n Alert errMsg = Util.getAlert(Alert.AlertType.ERROR);\n if (connectionsCB.getEditor().getText() == null || !Util.isValidAddress(connectionsCB.getEditor().getText())) {\n errMsg.setContentText(\"Invalid TRex Host Name or IP address\");\n isValid = false;\n } else if (!Util.isValidPort(rpcPort.getText())) {\n errMsg.setContentText(\"Invalid TRex Sync Port Number(\" + rpcPort.getText() + \")\");\n isValid = false;\n } else if (!Util.isValidPort(asyncPort.getText())) {\n errMsg.setContentText(\"Invalid Async Port Number(\" + asyncPort.getText() + \")\");\n isValid = false;\n } else if (Util.isNullOrEmpty(nameTF.getText())) {\n errMsg.setContentText(\"Name should not be empty\");\n isValid = false;\n }\n\n if (!isValid) {\n errMsg.show();\n }\n return isValid;\n }", "private boolean validInput()\n {\n boolean completeForm = true; //all textfields have been filled in\n boolean noExceptions = true; //all textfields (except name) have int\n boolean selectionMade = true; //user has selected a ship type\n\n if (shipNameInput.getText()==\"Ship name\" ||\n xcoordInput.getText()==\"Starting x coordinate\" ||\n ycoordInput.getText()==\"Starting y coordinate\")\n {\n System.out.println(\"ERROR: Please fill in all text fields before \"+\n \"adding your ship.\");\n completeForm = false;\n }\n try\n {\n xcoord = Integer.parseInt(xcoordInput.getText());\n ycoord = Integer.parseInt(ycoordInput.getText());\n }\n catch (NumberFormatException except)\n {\n System.out.println(\"ERROR: Ship coordinates and speed need to be \"+\n \"entered as integers.\");\n noExceptions = false;\n }\n if (directionInput.getResponse() == \"none\")\n {\n System.out.println(\"ERROR: Please choose a direction.\");\n selectionMade = false;\n }\n else\n {\n String d = directionInput.getResponse();\n if (d == \"N\") direction = 0;\n else if (d == \"NE\") direction = Ship.NE;\n else if (d == \"E\") direction = Ship.E;\n else if (d == \"SE\") direction = Ship.SE;\n else if (d == \"S\") direction = Ship.S;\n else if (d == \"SW\") direction = Ship.SW;\n else if (d == \"W\") direction = Ship.W;\n else if (d == \"NW\") direction = Ship.NW;\n }\n shipName = shipNameInput.getText();\n speed = speedSlider.getValue();\n\n return (completeForm && noExceptions && selectionMade);\n }", "private boolean validEditInput() throws SQLException {\n // Checks if any of the fields is empty\n if(teamNameEditField.getText().equals(\"\") || abbrevationEditField.getText().equals(\"\")\n || chooseCityBox.getValue() == null || chooseLeagueBox.getValue() == null\n || chooseLeagueTeamBox.getValue() == null) {\n displayMessage(messagePane,\"Please fill all the fields\",true);\n return false;\n }\n // Checks the abbrevation length\n else if(abbrevationEditField.getText().length() > 3)\n {\n displayMessage(messagePane,\"Abbrevations must be at most 3 characters\",true);\n return false;\n }\n // Checks team name length\n else if (teamNameEditField.getText().length() > 30){\n displayMessage(messagePane,\"Team Names must be smaller than 30 characters\",true);\n return false;\n }\n return true;\n }", "private static boolean valid(String arg) {\n\n /* check if valid option */\n if ( arg.equals(\"-v\") || arg.equals(\"-i\") || arg.equals(\"-p\") || arg.equals(\"-h\") )\n return true;\n\n /* check if valid port */\n try {\n int port = Integer.parseInt(arg);\n if ( ( 0 < port ) && ( port < 65354 ) )\n return true;\n } catch (NumberFormatException ignored) {}\n\n /* check if valid ip address */\n String[] ips = arg.split(\"\\\\.\");\n if ( ips.length != 4 )\n return false;\n try{\n for (int i=0; i<4; i++){\n int ip = Integer.parseInt(ips[i]);\n if ( ( ip < 0) || (255 < ip ) )\n return false;\n }\n } catch (NumberFormatException ignored) {return false;}\n\n return true;\n }", "private boolean isInputValid(){\n\t\tString errorMessage = \"\";\n\t\tif((nameField.getText() == null) || (nameField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid product name!\\n\";\n\t\t}\n\t\tif((amountAvailableField.getText() == null) || (amountAvailableField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid amount available value!\\n\";\n\t\t}\n\t\tif((amountSoldField.getText() == null) || (amountSoldField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid amount sold value!\\n\";\n\t\t}\n\t\tif((priceEachField.getText() == null) || (priceEachField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid price for each!\\n\";\n\t\t}\n\t\tif((priceMakeField.getText() == null) || (priceMakeField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid price to make the product!\\n\";\n\t\t}\n\t\tif(errorMessage.length() == 0){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "private void validateData() {\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (ServiceName.getText() == null || ServiceName.getText().length() == 0) {\n errorMessage += \"No valid name!\\n\";\n }\n if (Serviceemail.getText() == null || Serviceemail.getText().length() == 0) {\n Pattern p = Pattern.compile(\"[_A-Za-z0-9][A-Za-z0-9._]*?@[_A-Za-z0-9]+([.][_A-Za-z]+)+\");\n Matcher m = p.matcher(Serviceemail.getText());\n if (m.find() && m.group().equals(Serviceemail.getText())) {\n errorMessage += \"No valid Mail Forment!\\n\";\n }\n }\n if (servicedescrip.getText() == null || servicedescrip.getText().length() == 0) {\n errorMessage += \"No valid description !\\n\";\n }\n if (f == null && s.getImage() == null) {\n errorMessage += \"No valid photo ( please upload a photo !)\\n\";\n }\n if (Serviceprice.getText() == null || Serviceprice.getText().length() == 0) {\n errorMessage += \"No valid prix !\\n\";\n } else {\n // try to parse the postal code into an int.\n try {\n Float.parseFloat(Serviceprice.getText());\n } catch (NumberFormatException e) {\n errorMessage += \"No valid prix (must be a Float)!\\n\";\n }\n }\n if ( !Weekly.isSelected() && !Daily.isSelected() && !Monthly.isSelected()) {\n errorMessage += \"No valid Etat ( select an item !)\\n\";\n }\n if (Servicesatet.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid etat ( select an item !)\\n\";\n }\n if (ServiceCity.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid City ( select an item !)\\n\";\n }\n if (servicetype.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid Type ( select an item !)\\n\";\n }\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.setTitle(\"Invalid Fields\");\n alert.setHeaderText(\"Please correct invalid fields\");\n alert.setContentText(errorMessage);\n alert.showAndWait();\n return false;\n }\n }", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n// Show the error message.\r\n Dialogs.create()\r\n .title(\"Invalid Fields\")\r\n .masthead(\"Please correct invalid fields\")\r\n .message(errorMessage)\r\n .showError();\r\n return false;\r\n }\r\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (ID.getText() == null || ID.getText().length() == 0) {\n errorMessage += \"No valid id!\\n\";\n System.out.println(\"fl\");\n }\n if (password.getText() == null || password.getText().length() == 0) {\n errorMessage += \"No valid password!\\n\"; \n }\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Dialogs.create()\n .title(\"Invalid Fields\")\n .masthead(\"Please correct invalid fields\")\n .message(errorMessage)\n .showError();\n return false;\n }\n }", "public void checkInput(TextField number) {\r\n\t\ttry {\r\n\t\t\tlong num = Long.parseLong(number.getText());\r\n\t\t\tif (num < 0) \t\t\t\t\t// ako je negativan broj, pretvorit cemo ga u pozitivan\r\n\t\t\t\tnum = Math.abs(num);\r\n\t\t\tif (isValid(num)) \r\n\t\t\t\tscene2();\r\n\t\t}\r\n\t\tcatch (Exception e) {\t\t\t\t// hvatanje greske\r\n\t\t\talert(\"Wrong input, try again!\");\r\n\t\t}\r\n\t}", "private boolean validateInputs() {\n return !proID.getText().isEmpty() || \n !proName.getText().isEmpty() ||\n !proPrice.getText().isEmpty();\n }", "private boolean validateInput(){\n boolean operationOK = true;\n //perform input validation on the double values in the form\n String integrationTime = this.integrationTimeText.getText();\n String integrationFrequency = this.integrationFrequencyText.getText();\n \n if(!integrationTime.equals(\"\")){\n try {\n Double itime = Double.parseDouble(integrationTime);\n integrationTimeText.setBackground(Color.WHITE);\n integrationTimeText.setToolTipText(\"Time in seconds (s)\");\n } catch (NumberFormatException ex) {\n integrationTimeText.setBackground(Color.RED);\n operationOK=false;\n integrationTimeText.setToolTipText(\"This field has to be a valid double (eg. 1.5)\");\n }\n }\n if(!integrationFrequency.equals(\"\")){\n try {\n Double itime = Double.parseDouble(integrationFrequency);\n integrationFrequencyText.setBackground(Color.WHITE);\n integrationFrequencyText.setToolTipText(\"Frequency in Hertz (Hz)\");\n \n } catch (NumberFormatException ex) {\n operationOK=false;\n integrationFrequencyText.setBackground(Color.RED);\n integrationFrequencyText.setToolTipText(\"This field has to be a valid double (eg. 1.5)\");\n }\n }\n if(currentStepOperationsPanel!=null){\n operationOK = this.currentStepOperationsPanel.validateInput();\n \n }\n return operationOK;\n }", "boolean inputValid(String s) {\n\n if (s.length() == 0) {\n return false;\n }\n\n //check whether there are wrong commas\n for (int ii = 1; ii < s.length() - 1; ii++) {\n if (s.charAt(ii) == ',') {\n if(!s.contains(\"log\")) {\n resS = \"There are wrong commas\";\n return false;\n }\n }\n }\n\n //check whether there are multiple points\n if(s.charAt(0)=='.' || s.charAt(s.length()-1)=='.') return false;\n for (int ii = 1; ii < s.length() - 1; ii++) {\n if (s.charAt(ii) == '.') {\n if (!Character.isDigit(s.charAt(ii - 1))) {\n resS=\"These are wrong points.\";\n return false;\n } else if (!Character.isDigit(s.charAt(ii + 1))) {\n resS=\"These are wrong points.\";\n return false;\n } else {\n for (int jj = ii + 2; jj < s.length(); jj++) {\n if (s.charAt(jj) == '.') {\n String ss = s.substring(ii + 2, jj);\n if (!(ss.contains(\"+\") || ss.contains(\"-\") || ss.contains(\"*\") || ss.contains(\"/\") || ss.contains(\"%\")\n || ss.contains(\"^\") || ss.contains(\")\"))) {\n resS=\"These are wrong points.\";\n return false;\n }\n }\n }\n }\n }\n }\n ArrayList<Token> operation = tokenize(s);\n return isNumberOrOpe(operation) && isOpePosRight(operation) && isValidparentheses(operation) && isValidTan(operation) && isLogWrong(operation);\n }", "private boolean validateData() {\r\n TASKAggInfo agg = null;\r\n int index = aggList.getSelectedIndex();\r\n if (index != 0) {\r\n agg = (TASKAggInfo)aggregators.elementAt(aggList.getSelectedIndex()-1);\r\n }\r\n\r\n if (getArgument1() == BAD_ARGUMENT) {\r\n JOptionPane.showMessageDialog(this, \"Argument 1 must be of type: \"+TASKTypes.TypeName[agg.getArgType()], \"Error\", JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n else if (getArgument2() == BAD_ARGUMENT) {\r\n JOptionPane.showMessageDialog(this, \"Argument 2 must be of type: \"+TASKTypes.TypeName[agg.getArgType()], \"Error\", JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n else if (getOperand() == BAD_ARGUMENT) {\r\n JOptionPane.showMessageDialog(this, \"Filter value must be of type integer\", \"Error\", JOptionPane.ERROR_MESSAGE);\r\n return false;\r\n }\r\n return true;\r\n }", "private boolean isInputValid() {\n\t\tString errorMessage = \"\";\n\t\t\n\t\tif (dateField.getText() == null || dateField.getText().length() == 0) {\n\t\t\terrorMessage += \"Kein gültiges Datum!\\n\";\n\t\t} else {\n\t\t\tif (!DateUtil.validDate(dateField.getText())) {\n\t\t\t\terrorMessage += \"Kein gültiges Datum. Benutze das dd.mm.yyy Format!\\n\";\n\t\t\t}\n\t\t}\n\t\tString categoryFieldSelection = categoryField.getSelectionModel().getSelectedItem();\n\t\tif (categoryFieldSelection.isEmpty() || categoryFieldSelection.length() == 0) {\n\t\t\terrorMessage += \"Keine gültige Kategorie!\\n\";\n\t\t}\n\t\tif (useField.getText() == null || useField.getText().length() == 0) {\n\t\t\terrorMessage += \"Kein gültiger Verwendungszweck!\\n\";\n\t\t}\n\t\tif (amountField.getText() == null || amountField.getText().length() == 0) {\n\t\t\terrorMessage += \"Kein gültiger Betrag!\\n\";\n\t\t} \n\t\t/**else {\n\t\t\t// try to parse the amount into a double\n\t\t\ttry {\n\t\t\t\tDouble.parseDouble(amountField.getText());\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t\terrorMessage += \"Kein zulässiger Betrag! (Nur Dezimalzahlen erlaubt)\\n\";\n\t\t\t}\n\t\t}**/\n\t\tif (distributionKindField.getText() == null || distributionKindField.getText().length() == 0) {\n\t\t\terrorMessage += \"Keine gültige Ausgabeart!\\n\";\n\t\t}\n\n\t\tif (errorMessage.length() == 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\t// Show the error message.\n\t\t\tAlert alert = new Alert(AlertType.ERROR);\n\t\t\talert.initOwner(dialogStage);\n\t\t\talert.setTitle(\"Ungültige Eingaben\");\n\t\t\talert.setHeaderText(\"Bitte korrigieren Sie die Fehler in den Feldern.\");\n\t\t\talert.setContentText(errorMessage);\n\t\t\talert.showAndWait();\n\t\t\treturn false;\n\t\t}\n\t}", "private boolean checkInputFields(){\r\n\t\tString allertMsg = \"Invalid input: \" + System.getProperty(\"line.separator\");\r\n\t\t\r\n\t\t//Check input for MCS text field\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_MCSTf.getText());\r\n\t\t\tif(testValue < 0 || testValue > 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a number between 0 and 1 as a MCS score.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for relevance score weight and coherence score weight text fields\r\n\t\ttry{\r\n\t\t\tFloat relScoreW = Float.parseFloat(m_RelScoreTf.getText());\r\n\t\t\tFloat cohScoreW = Float.parseFloat(m_CohScoreTf.getText());\r\n\t\t\tif(relScoreW < 0 || relScoreW > 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t\tif(cohScoreW < 0 || cohScoreW > 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t\tif((relScoreW + cohScoreW) != 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a number between 0 and 1 as a weight for relevance and coherence score.\" + System.getProperty(\"line.separator\");\r\n\t\t\tallertMsg += \"Sum of the weights for relevance and coherence score must be 1.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for MCS text field\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_KeyTf.getText());\r\n\t\t\tif(testValue < 0)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number as multiplier for keyword concepts.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for category confidence weight\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_CatConfTf.getText());\r\n\t\t\tif(testValue < 0)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number as a weight for the weight of the category confidence of concepts.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for weight of repeated concepts\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_RepeatTf.getText());\r\n\t\t\tif(testValue < 0)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number as a weight for repeated concepts.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\t//Check input for number of output categories\r\n\t\ttry{\r\n\t\t\tInteger testValue = Integer.parseInt(m_MaxCatsTf.getText());\r\n\t\t\tif(testValue < 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number for the maximum number of output categories.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\ttry{\r\n\t\t\tInteger testValue = Integer.parseInt(m_MinCatsTf.getText());\r\n\t\t\tif(testValue < 1)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number for the minimum number of output categories.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\ttry{\r\n\t\t\tFloat testValue = Float.parseFloat(m_MinCatScoreTf.getText());\r\n\t\t\tif(testValue < 0.0f || testValue > 1.0f)\r\n\t\t\t\tthrow new NumberFormatException();\r\n\t\t}catch (NumberFormatException e){\r\n\t\t\tallertMsg += \"Please enter a positive number between 0 and 1 as minimum category score.\" + System.getProperty(\"line.separator\");\r\n\t\t}\r\n\t\tif(allertMsg.length() > 18){\r\n\t\t\tAlert alert = new Alert(AlertType.ERROR);\r\n\t\t\talert.setContentText(allertMsg);\r\n\t\t\talert.showAndWait();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "default Boolean validateInput(String input){\n if (input.contains(\"(\") || input.contains(\")\") || input.contains(\"[\") || input.contains(\"}\") || input.contains(\"{\") || input.contains(\"}\") )\n {\n return true;\n }else{\n return false;\n }\n }", "private boolean validateInput() {\n String username = editUsername.getText().toString().trim();\n String email = editEmail.getText().toString().trim();\n String password = editPassword.getText().toString().trim();\n String repeatPassword = editRepeatPassword.getText().toString().trim();\n if (!password.equals(repeatPassword)) {\n ShowMessageUtil.tosatSlow(\"Enter passwords differ\", EmailRegisterActivity.this);\n return false;\n } else if (username.equals(\"\") || email.equals(\"\") || password.equals(\"\")) {\n ShowMessageUtil.tosatSlow(\"every item can not be empty!\", EmailRegisterActivity.this);\n return false;\n }\n if (username.length()>10){\n ShowMessageUtil.tosatSlow(\"the character length of the username can't be over than 10\", EmailRegisterActivity.this);\n return false;\n }\n return true;\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (commentField.getText() == null || commentField.getText().length() == 0) {\n errorMessage += \"Не введен комментарий!\\n\";\n }\n if (timeField.getText() == null || timeField.getText().length() == 0) {\n errorMessage += \"Не введено время выполнения задачи!\\n\";\n }\n if (errorMessage.length() == 0) {\n return true;\n } if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.INFORMATION);\n alert.setTitle(\"Не введены все данные!\");\n alert.setHeaderText(null);\n alert.setContentText(\"Пожалуйста, введите все данные!\");\n alert.showAndWait();\n return false;\n }\n }", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (idLabel.getText() == null || idLabel.getText().length() == 0) {\r\n errorMessage += \"No valid ID number!\\n\"; \r\n } else {\r\n // try to parse the postal code into an int.\r\n try {\r\n Integer.parseInt(idLabel.getText());\r\n } catch (NumberFormatException e) {\r\n errorMessage += \"No valid ID number (must be an integer)!\\n\"; \r\n }\r\n }\r\n \r\n if (firstNameField.getText() == null || firstNameField.getText().length() == 0) {\r\n errorMessage += \"No valid first name!\\n\"; \r\n }\r\n if (lastNameField.getText() == null || lastNameField.getText().length() == 0) {\r\n errorMessage += \"No valid last name!\\n\"; \r\n }\r\n if (industryField.getText() == null || industryField.getText().length() == 0) {\r\n errorMessage += \"No valid industry!\\n\"; \r\n }\r\n\r\n if (workTypeField.getText() == null || workTypeField.getText().length() == 0) {\r\n errorMessage += \"No valid work type!\\n\"; \r\n }\r\n\r\n if (addressField.getText() == null || addressField.getText().length() == 0) {\r\n errorMessage += \"No valid address!\\n\";\r\n }\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n // Show the error message.\r\n Alert alert = new Alert(AlertType.ERROR);\r\n alert.initOwner(dialogStage);\r\n alert.setTitle(\"Invalid Fields\");\r\n alert.setHeaderText(\"Please correct invalid fields\");\r\n alert.setContentText(errorMessage);\r\n\r\n alert.showAndWait();\r\n\r\n return false;\r\n }\r\n }", "public boolean inputIsValid() {\n return nameIsValid() &&\n descriptionIsValid() &&\n priceIsValid() &&\n streetIsValid() &&\n zipcodeIsValid() &&\n cityIsValid() &&\n imageIsSelected();\n }", "public static boolean isValid(String args[]){\n \n if(args.length < 2){\n System.out.println(\"Not enough arguments detected. Please enter two\"\n + \" integer arguments.\");\n return false;\n }\n \n Scanner scanin = new Scanner(args[0]);\n Scanner scanin2 = new Scanner(args[1]);\n\t \n if(!scanin.hasNextInt() || !scanin2.hasNextInt()){\n System.out.println(\"Invalid argument type detected. Please enter two\"\n + \" integer arguments.\");\n return false;\n }\n\t else\n return true;\n }", "private static String[] checkInput(String input) throws Exception{\n String[] in = input.trim().split(\" \");\n\n if(in.length == 0){\n throw new CommandException(ExceptionEnum.INCORRECT_COMMAND_EXCEPTION);\n }\n\n if(CommandEnum.getCommandEnumFrom(in[0]) == null){\n throw new CommandException(ExceptionEnum.INCORRECT_COMMAND_EXCEPTION);\n }\n\n if(isSpecificCommandENum(in[0],BYE)){\n return in;\n }\n if(isSpecificCommandENum(in[0],TERMINATE)){\n return in;\n }\n\n if(in.length < MIN_PARAM){\n throw new CommandException(ExceptionEnum.LESS_INPUT_EXCEPTION);\n }\n\n if(in.length > MAX_PARAM){\n throw new CommandException(ExceptionEnum.EXTRA_INPUT_EXCEPTION);\n }\n\n //check input value\n for(int i = 1; i < in.length; i++){\n try{\n Integer.parseInt(in[i]);\n }catch(NumberFormatException e){\n throw new CommandException(ExceptionEnum.INVALID_INPUT_EXCEPTION);\n }\n }\n\n return in;\n }", "private boolean isValid(String input){\n return input.length() == 10 && input.matches(\"-?\\\\d+(\\\\.\\\\d+)?\");\n //check its digits\n }", "@Test\r\n public void Test004TakeUserInputValid()\r\n {\r\n gol.input = new Scanner(new ByteArrayInputStream(\"1 1 2 2 2 3 2 4 -1\".getBytes()));\r\n gol.takeUserInput();\r\n assertTrue(gol.grid[1][1] == 1 && gol.grid[2][2] == 1 && gol.grid[2][3] == 1 && gol.grid[2][4] == 1);\r\n }", "public void invalid() {\r\n\t\tSystem.out.println(\"Please enter a valid input\");\r\n\t}", "private boolean validateInputs() {\n question = txtQuestion.getText().trim();\n option1 = txtOption1.getText().trim();\n option2 = txtOption2.getText().trim();\n option3 = txtOption3.getText().trim();\n option4 = txtOption4.getText().trim();\n correctOption = jcCorrectAns.getSelectedItem().toString();\n //System.out.println(correctOption);\n if(question.isEmpty() || option1.isEmpty() || option2.isEmpty() || \n option3.isEmpty() || option4.isEmpty() || correctOption.isEmpty()){\n return false;\n }\n return true;\n }", "private boolean checkUserInputValidity() {\n // Extract Student information from the edit text views\n String studentName = mStudentNameEditText.getText().toString().trim();\n String studentGradeString = mStudentGradeEditText.getText().toString();\n\n // Check for valid student name\n if (TextUtils.isEmpty(studentName)) {\n Toast.makeText(this, R.string.please_enter_valid_name, Toast.LENGTH_SHORT).show();\n mStudentNameEditText.requestFocus();\n return false;\n }\n\n // Check for valid student birthdate\n if (mStudentBirthdate == 0) {\n Toast.makeText(this, R.string.please_enter_valid_birthdate,\n Toast.LENGTH_SHORT).show();\n return false;\n }\n if (DateUtils.isChosenDateAfterToday(mStudentBirthdate)) {\n Toast.makeText(this, R.string.please_enter_valid_birthdate,\n Toast.LENGTH_SHORT).show();\n return false;\n }\n\n // Check for valid student grade\n if (TextUtils.isEmpty(studentGradeString)) {\n Toast.makeText(this, R.string.please_enter_valid_grade, Toast.LENGTH_SHORT).show();\n mStudentGradeEditText.requestFocus();\n return false;\n } else {\n int studentGrade = Integer.parseInt(studentGradeString);\n if (studentGrade <= 0) {\n Toast.makeText(this, R.string.please_enter_valid_grade, Toast.LENGTH_SHORT).show();\n mStudentGradeEditText.requestFocus();\n return false;\n }\n }\n\n return true;\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (gemNameField.getText() == null || gemNameField.getText().length() == 0) {\n errorMessage += \"No valid gem name!\\n\";\n }\n if (gemValueField.getText() == null || gemValueField.getText().length() == 0) {\n errorMessage += \"No valid gem value!\\n\";\n } else {\n // try to parse the gem value into an int.\n try {\n Integer.parseInt(gemValueField.getText());\n } catch (NumberFormatException e) {\n errorMessage += \"No valid gem value (must be an integer)!\\n\";\n }\n }\n if (gemDescripField.getText() == null || gemDescripField.getText().length() == 0) {\n errorMessage += \"No valid gem description!\\n\";\n }\n\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.initOwner(dialogStage);\n alert.setTitle(\"Invalid Fields\");\n alert.setHeaderText(\"Please correct invalid fields\");\n alert.setContentText(errorMessage);\n\n alert.showAndWait();\n\n return false;\n }\n }", "public boolean checkInput(String str)\n {\n try\n {\n Integer.parseInt(str);\n } \n catch(NumberFormatException ex)\n {\n return false;\n } \n return true;\n }", "private static boolean validateInput2(String[] input) {\n\t\tif (input.length != 2) {\n\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private void checkInput(String input)throws Exception{\n\n if (input.getBytes(\"UTF-8\").length > 255){\n throw new IOException(\"Message too long\");\n\n }\n try {\n if (Integer.parseInt(input) < 0 || Integer.parseInt(input) > 65535) {\n throw new IOException(\"Port not valid\");\n }\n }catch (NumberFormatException e){\n //nothing should happen\n }\n }", "private boolean validInput() throws SQLException {\n if (userNameField.getText().length() == 0) {\n displayMessage(messagePane, \"Name cannot be empty\", true);\n return false;\n }\n else if (userNameField.getText().length() == 1) {\n displayMessage(messagePane, \"Name cannot be empty\", true);\n return false;\n }\n else if (!isAllLetters(userNameField.getText())) {\n displayMessage(messagePane, \"Names must be all letters\", true);\n return false;\n }\n else if (!(userNameField.getText().contains(\" \")) || userNameField.getText().charAt(0) == ' ') {\n displayMessage(messagePane, \"Name must consist of two words\", true);\n return false;\n }\n else if (!(emailField.getText().contains(\"@\"))) {\n displayMessage(messagePane, \"Invalid email\", true);\n return false;\n }\n else if (DatabaseManager.isEmailTaken(user.getDatabaseConnection(), emailField.getText()) && !(emailField.getText().equals(user.getUser().getEmail()))){\n displayMessage(messagePane, \"Email is used before\", true);\n return false;\n }\n else {\n displayMessage(messagePane,\"Changes are saved\", false);\n return true;\n }\n }", "private boolean validateInput(){\n boolean result = false;\n\n if(!us.setUsername(userField.getText())){\n errorLabel.setText(\"Nombre de usuario invalido\");\n } else if(!us.setPassword(passField.getText())){ //Valido 1 por uno los campos que ingreso el usuario\n errorLabel.setText(\"Contraseña invalida\");\n } else if(!us.setName(nameField.getText())){\n errorLabel.setText(\"Nombre Invalido\");\n } else if(!us.setSurname(surnameField.getText())){\n errorLabel.setText(\"Apellido Invalido\");\n } else if(!us.setDni(dniField.getText())){\n errorLabel.setText(\"Dni invalido\");\n } else if(!ageField.getText().matches(\"\\\\d{2}\")){\n errorLabel.setText(\"Edad invalida\");\n }\n else{\n us.setAge(Integer.parseInt(ageField.getText()));\n result = true;\n }\n return result;\n }", "private boolean isValidInput(String input) \r\n {\r\n\t \r\n return input!=null&&input.length()<=10;\r\n \r\n }", "private void inputValidation(String[] args) {\r\n\t\t// Must have two argument inputs - grammar and sample input\r\n\t\tif (args.length != 2) {\r\n\t\t\tSystem.out.println(\"Invalid parameters. Try:\\njava Main <path/to/grammar> <path/to/input>\");\r\n\t\t\tSystem.exit(-1);\r\n\t\t}\r\n\t}", "private boolean validateInputs() {\n if (Constants.NULL.equals(review)) {\n reviewET.setError(\"Must type a review!\");\n reviewET.requestFocus();\n return false;\n }\n if (Constants.NULL.equals(heading)) {\n headingET.setError(\"Heading cannot be empty\");\n headingET.requestFocus();\n return false;\n }\n return true;\n }", "private void validateData(String input) {\n String[] inputStringArray = input.split(\" \");\n\n for (String s : inputStringArray) {\n try {\n Integer.parseInt(s);\n } catch (NumberFormatException e) {\n throw new NumberFormatException(\n \"Looks like your input - \" + s + \", is not a number. Try again\");\n }\n }\n }", "public boolean validateInput(double input){\n\t\tif(input >= -1 && input <= 1)\n\t\t return true;\n\t\treturn false;\t\n\t}", "private boolean isValid(char input) {\n if (this.isLetter(input) || this.isDigit(input) || this.isOperator(input)\n || this.isIgnored(input)) {\n return true;\n } else return false;\n }", "public abstract boolean isValidValue(String input);", "public void validateInput(Information information) {\n information.validateFirstName();\n information.validateLastName();\n information.validateZipcode();\n information.validateEmployeeID();\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 checkValidity() {\n String sep = DECIMAL_FORMAT.getDecimalFormatSymbols().getDecimalSeparator() + \"\";\n String name = nameField.getText().trim();\n String priceText = valueField.getText().trim();\n if (name.equals(\"\") || priceText.equals(\"\")) {\n Utils.showWarningMessage(getRootPane(), \"The fields can not be empty!\");\n return false;\n }\n String price = priceText.replace(sep, \"\");\n if (!price.matches(\"^[0-9]+$\")) {\n Utils.showWarningMessage(getRootPane(), \"Please enter a valid price!\");\n return false;\n }\n int priceInt = Integer.parseInt(price);\n if (priceInt == 0) {\n Utils.showWarningMessage(getRootPane(), \"The price can not be 0.\");\n return false;\n }\n return true;\n }", "public void validateInput(String fName, String lName, String zipCode, String employID){\n boolean firstname = firstNameTwoCharactersLong(fName);\n //boolean firstFilled = firstNameFilled\n boolean firstFilled = firstNameFilled(fName);\n //boolean lastname = lastNameTwoCharactersLong\n boolean lastname = lastNameTwoCharactersLong(lName);\n //boolean lastFilled = lastNameFilled\n boolean lastFilled = lastNameFilled(lName);\n //boolean the rest\n boolean employeeID = employeeIDValid(employID);\n boolean zCode = zipCodeValid(zipCode);\n\n //if all of them are valid=true then error prints \"there are no errors found\n if (firstname && firstFilled && lastname && lastFilled && employeeID && zCode){\n errorMessage = \"There were no errors found\";\n }\n //Display error message\n System.out.println(errorMessage);\n\n }", "private boolean validateInputInfo(){\n\n //Get user input\n String firstName = newContactFirstName.getText().toString();\n String lastName = newContactLastName.getText().toString();\n String email = newContactEmailAddress.getText().toString();\n String phone = newContactPhoneNumber.getText().toString();\n\n //Check to make sure no boxes were left empty\n if(firstName.isEmpty() || lastName.isEmpty() || email.isEmpty() || phone.isEmpty()){\n Toast.makeText(this, \"You must fill all fields before continuing!\", Toast.LENGTH_LONG).show();\n return false;\n }\n //Check to see if phone number is valid\n else if(!(phone.length() >= 10)){\n Toast.makeText(this, \"Make sure to input a valid 10 digit phone number!\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n return true;\n }", "protected void check() throws IOException, ServletException {\n if(value.length()==0)\n error(\"please specify at least one component\");\n else {\n \t\t//TODO add more checks\n \t\tok();\n }\n }", "boolean checkValidity();", "private void validate() {\n\t\t// just in case;\n\t\tfor (int i=0;i<NR_OF_FIELDS; i++) {\n\t\t\tvalid[i] = \"0\";\n\t\t}\n\t\t//\n\t\t// Validate name and surname:\n\t\t//\n\t\tif ( ! this.isUpperAlpha(nume)) {\n\t\t\tfields[0] = \"1\";\n\t\t}\n\t\t\n\t\tif ( ! this.isUpperAlphaWithSpace(nume)) {\n\t\t\tfields[1] = \"1\";\n\t\t}\n\t\t//\n\t\t// validate seria\n\t\t//\n\t\tvalid[2] = \"1\";\t\t\t\t\t\t\t// presupun ca seria este invalida, si incerc sa o validez\n\t\tfor (int i=0; i<seriiBuletin.length; i++) {\n\t\t\tif (seriiBuletin[i].equals(seria)) {\n\t\t\t\tvalid[2] = \"0\";\n\t\t\t}\n\t\t}\n\t\t//\n\t\t// validate numarul\n\t\t//\n\t\ttry {\n\t\t\tvalid[3] = \"1\";\n\t\t\tint nr = Integer.valueOf(numarul);\n\t\t\tif ( nr >= 100000 && nr <= 999999 ) {\n\t\t\t\tvalid[3] = \"0\";\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tLog.d(TAG, \"Error validating seria.\");\n\t\t}\n\n\t\t//\n\t\t// validate sex\n\t\t//\n\t\tif ( ! (sex == 'M' || sex == 'F')) {\n\t\t\tvalid[6] = \"1\";\n\t\t}\n\t\t//\n\t\t// Validate valabilitate\n\t\t//\n\t\tif ( ! isNumber(this.valabilitate)) {\n\t\t\tvalid[7] = \"1\";\n\t\t}\n\t\t//\n\t\t// validate CNP\n\t\t//\n\t\tif ( ! (isNumber(CNP) && isValidCNP(CNP))) {\n\t\t\tvalid[8] = \"1\";\n\t\t}\n\t\t\n\t}", "public static boolean checkInput(String saInput) {\r\n\t\treturn checkGenericPattern(saInput) && checkGenericPattern(unalter(saInput));\r\n\t}", "private static String validateInputStr() {\n String str = \"\";\n Scanner genericString = new Scanner(System.in);\n if (!genericString.hasNextInt()) {\n str = genericString.nextLine();\n return str;\n }\n else {\n validateInputStr();\n }\n return str;\n }", "private void verifyInput(){\n String firstName = mFirstNameField.getText().toString();\n String lastName = mLastNameField.getText().toString();\n\n mNameFieldsFilled = !TextUtils.isEmpty(firstName) && !TextUtils.isEmpty(lastName);\n\n }", "public boolean validate(String input)//true if valid\n\t{\n\t\t//loop through string verifying for numbers\n\t\tfor(int i = 0;i<input.length(); i++)\n\t\t{\n\t\t\tchar c = input.charAt(i);\n\t\t\tif(!Character.isDigit(c))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\t\n\t\t}\n\t\treturn true;\n\t}", "boolean isInputValid(){\n\t\tString ac = edAccount.getText().toString();\n\t\tString pwd = edPassword.getText().toString();\n\t\tboolean isAccEmpty = StringUtil.isNullOrEmpty(ac);\n\t\tboolean isPwdEmpty = StringUtil.isNullOrEmpty(pwd);\n\t\tif(isAccEmpty){\n\t\t\tedAccount.requestFocus();\n\t\t}else if(isPwdEmpty){\n\t\t\tedPassword.requestFocus();\n\t\t}\n\t\treturn !( isAccEmpty|| isPwdEmpty);\n\t}", "public boolean validateForm() {\r\n\t\tint validNum;\r\n\t\tdouble validDouble;\r\n\t\tString lengthVal = lengthInput.getText();\r\n\t\tString widthVal = widthInput.getText();\r\n\t\tString minDurationVal = minDurationInput.getText();\r\n\t\tString maxDurationVal = maxDurationInput.getText();\r\n\t\tString evPercentVal = evPercentInput.getText();\r\n\t\tString disabilityPercentVal = disabilityPercentInput.getText();\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.1 - Ensure all inputs are numbers\r\n\t\t */\r\n\t\t\r\n\t\t// Try to parse length as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(lengthVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Length must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(widthVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Width must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(minDurationVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Min Duration must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidNum = Integer.parseInt(maxDurationVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Max Duration must be an integer\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidDouble = Double.parseDouble(evPercentVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"EV % must be a number\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t// Try to parse width as int\r\n\t\ttry {\r\n\t\t\tvalidDouble = Double.parseDouble(disabilityPercentVal);\r\n\t } catch (NumberFormatException e) {\r\n\t \tsetErrorMessage(\"Disability % must be a number\");\r\n\t return false;\r\n\t }\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.2 - Ensure all needed inputs are non-zero\r\n\t\t */\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(lengthVal);\r\n\t\tif (validNum <= 0) {\r\n\t\t\tsetErrorMessage(\"Length must be greater than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(widthVal);\r\n\t\tif (validNum <= 0) {\r\n\t\t\tsetErrorMessage(\"Width must be greater than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(minDurationVal);\r\n\t\tif (validNum < 10) {\r\n\t\t\tsetErrorMessage(\"Min Duration must be at least 10\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidNum = Integer.parseInt(maxDurationVal);\r\n\t\tif (validNum < 10) {\r\n\t\t\tsetErrorMessage(\"Max Duration must be at least 10\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidDouble = Double.parseDouble(evPercentVal);\r\n\t\tif (validDouble < 0) {\r\n\t\t\tsetErrorMessage(\"EV % can't be less than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvalidDouble = Double.parseDouble(disabilityPercentVal);\r\n\t\tif (validDouble < 0) {\r\n\t\t\tsetErrorMessage(\"Disability % can't be less than 0\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.3 - Ensure Max Duration can't be smaller than Min Duration\r\n\t\t */\r\n\t\t\r\n\t\tif (Integer.parseInt(minDurationVal) > Integer.parseInt(maxDurationVal)) {\r\n\t\t\tsetErrorMessage(\"Max Duration can't be less than Min Duration\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t/**\r\n\t\t * Step.4 - Ensure values aren't too large for the system to handle\r\n\t\t */\r\n\t\t\r\n\t\tif (Integer.parseInt(lengthVal) > 15) {\r\n\t\t\tsetErrorMessage(\"Carpark length can't be greater than 15 spaces\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (Integer.parseInt(widthVal) > 25) {\r\n\t\t\tsetErrorMessage(\"Carpark width can't be greater than 25 spaces\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif (Integer.parseInt(minDurationVal) > 150) {\r\n\t\t\tsetErrorMessage(\"Min Duration can't be greater than 150\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Integer.parseInt(maxDurationVal) > 300) {\r\n\t\t\tsetErrorMessage(\"Max Duration can't be greater than 300\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Double.parseDouble(evPercentVal) > 100) {\r\n\t\t\tsetErrorMessage(\"EV % can't be greater than 100\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Double.parseDouble(disabilityPercentVal) > 100) {\r\n\t\t\tsetErrorMessage(\"Disability % can't be greater than 100\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif (Integer.parseInt(minDurationVal) > 150) {\r\n\t\t\tsetErrorMessage(\"Min Duration can't be greater than 150\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\treturn true;\r\n\t}", "private void validarCampos() {\n }", "void validate();", "void validate();", "@Override\n\tprotected void checkNumberOfInputs(int length) {\n\n\t}", "public static boolean isSecondArgumentValid(String input) {\n\t\tif (CommonUtils.isNotNullOrEmpty(input) && CommonUtils.isNumeric(input))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "public static boolean checkForValidInput(String input) {\n try {\n int inputValue = Integer.parseInt(input);\n return inputValue >= 0 && inputValue <= 8;\n } catch (NumberFormatException e) {\n return false;\n }\n }", "private boolean validCreateInput() throws SQLException {\n // Checks if any of the fields is empty\n if(teamNameCreateField.getText().equals(\"\") || abbrevationCreateField.getText().equals(\"\")\n || chooseCityBoxCreate.getValue() == null || chooseLeagueBoxCreate.getValue() == null\n || chooseAgeGroupCreate.getValue() == null || chooseLeagueTeamBoxCreate.getValue() == null){\n displayMessage(messagePane,\"Please fill all the fields\",true);\n return false;\n }\n // Checks the abbrevation length\n else if(abbrevationCreateField.getText().length() > 3)\n {\n displayMessage(messagePane,\"Abbrevations must be at most 3 characters\",true);\n return false;\n }\n // Checks team name length\n else if (teamNameCreateField.getText().length() > 30){\n displayMessage(messagePane,\"Team Names must be smaller than 30 characters\",true);\n return false;\n }\n return true;\n }", "private boolean isInputValid() {\n\t\tString errorMessage = \"\";\n\t\t\n\t\tif(userNameField.getText() == null || userNameField.getText().length() == 0) {\n\t\t\terrorMessage += \"Üres a felhasználó név mező!\\n\";\n\t\t}\n\t\tif(passwordField.getText() == null || passwordField.getText().length() == 0) {\n\t\t\terrorMessage += \"Üres a jelszó mező!\";\n\t\t}\n\t\t\n\t\tif(errorMessage.length() == 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\t// show the error message\n\t\t\tAlert alert = new Alert(AlertType.ERROR);\n\t\t\talert.initOwner(dialogStage);\n\t\t\talert.setTitle(\"Érvénytelen mezők\");\n\t\t\talert.setHeaderText(\"Kérlek töltsd ki az összes mezőt!\");\n\t\t\talert.setContentText(errorMessage);\n\t\t\t\n\t\t\talert.showAndWait();\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\t}", "public boolean Validate_Input(String attack_coord){\r\n\t\tattack_coord=attack_coord.trim(); //deletes any unecessary whitespace\r\n\t\tif(attack_coord.length()>3) { //format incorrect\r\n\t\t\tdisplay.scroll(\"Input string too long to be proper coordinate\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(attack_coord.length()<=1){\r\n\t\t\tdisplay.scroll(\"Input string too short to be proper coordinate\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// Convert the string inputs into integers\r\n\t\tString x_as_string = attack_coord.substring(1);\r\n\t\tycoor = letterToIndex(attack_coord.charAt(0));\r\n\t\t\r\n\t\t\r\n\t\ttry{\r\n\t\t\txcoor=Integer.parseInt(x_as_string);\r\n\t\t\txcoor--; //to match the xcoor with the array position\r\n\t\t} catch (NumberFormatException nfe) {\r\n\t display.scroll(\"Incorrect Format. Enter with letter and then number i.e. B3\");\r\n\t display.printScreen();\r\n\t return false;\r\n\t\t}\r\n\r\n\t\t\r\n\t\t\r\n\r\n\t\tif(!hisBoard.in_Grid(xcoor, ycoor)){\r\n\t\t\tdisplay.scroll(\"The Coordinate input is not within (A-J) or (1-10)\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(hisBoard.already_attacked(xcoor,ycoor)){\r\n\t\t\tdisplay.scroll(\"Coordinate has already been attacked\");\r\n\t\t\tdisplay.printScreen();\t\t\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "protected void validateInput()\r\n\t{\r\n\t\tString errorMessage = null;\r\n\t\tif ( validator != null ) {\r\n\t\t\terrorMessage = validator.isValid(text.getText());\r\n\t\t}\r\n\t\t// Bug 16256: important not to treat \"\" (blank error) the same as null\r\n\t\t// (no error)\r\n\t\tsetErrorMessage(errorMessage);\r\n\t}", "private boolean checkForInvalidInput(){\n String email = emailTextView.getText().toString();\n String password = passwordTextView.getText().toString();\n String name = usernameTextView.getText().toString();\n\n\n if(email.isEmpty() || password.isEmpty() || name.isEmpty()){\n Toast.makeText(getApplicationContext(),\"Please fill in all fields\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n\n if(!email.contains(\"@\")){\n Toast.makeText(getApplicationContext(),\"Please enter a valid email\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n if(!isStudent && !isTeacher){\n Toast.makeText(getApplicationContext(),\"Please select Student or Teacher\", Toast.LENGTH_LONG).show();\n return false;\n }\n\n\n\n\n\n // add more checks?\n\n return true;\n\n }", "private boolean validateInput(){\n Window owner=root.getScene().getWindow();\n inputFileds.addAll(txtfn,txtln,txtsurname,txtDOB,txtResidence,txtMobile,txtID,username);\n for (TextField textField : inputFileds) {\n if(textField.getText().isEmpty()){\n //set css stroke\n Dialog.showMessageDialog(owner,\"Missing Details\",\"Invalid Input\",DialogIcon.WARNING);\n textField.requestFocus();\n return false;\n }\n }\n inputFileds.removeAll(txtDOB,txtMobile,username);\n for (TextField textField : inputFileds) {\n if(textField.getText().length()>30){\n //set css stroke\n Dialog.showMessageDialog(owner,\"Sorry the text you entered can not be greater that 30 characters\",\"Text too Long\",DialogIcon.WARNING);\n textField.requestFocus();\n return false;\n }\n }\n if(username.getText().length()>20 || username.getText().length()<4){\n Dialog.showMessageDialog(owner, \"Sorry your Username has to be More than 3 Characters and can not Exceed 20 Charchaters\", \"Invalid input\",DialogIcon.WARNING);\n username.requestFocus();\n return false;\n }\n if(pass.getText().isEmpty()){\n Dialog.showMessageDialog(owner,\"Missing Details\",\"Invalid Input\",DialogIcon.WARNING);\n pass.requestFocus();\n return false;\n }\n if(pass.getText().length()>20 || pass.getText().length()<4){\n Dialog.showMessageDialog(owner, \"Sorry your Password has to be More than 3 Characters and can not Exceed 20 Charchaters\", \"Invalid Input\",DialogIcon.WARNING);\n pass.requestFocus();\n return false;\n }\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd/MM/yyyy\");\n SimpleDateFormat yearFormat = new SimpleDateFormat(\"yyyy\");\n try {\n date = dateFormat.parse(txtDOB.getText());\n Calendar cal=Calendar.getInstance();\n int year=Integer.parseInt(yearFormat.format(date));\n if (year <= 1900 || year>cal.get(Calendar.YEAR)) {\n Dialog.showMessageDialog(owner,\"Invalid Date of Birth\", \"Invalid Input\",DialogIcon.WARNING);\n txtDOB.requestFocus();\n return false;\n }\n String initialEntry=txtDOB.getText();\n String parsedValue=dateFormat.format(date);\n if(!initialEntry.equals(parsedValue)){\n Dialog.showMessageDialog(owner, \"Note your Date of Birth has been corrected\", \"Date Corrected\",DialogIcon.INFORMATION);\n }\n txtDOB.setText(dateFormat.format(date));\n } catch (ParseException ex) {\n Dialog.showMessageDialog(owner,\"Invalid Date of Birth\", \"Invalid Input\",DialogIcon.WARNING);\n txtDOB.requestFocus();\n return false;\n }\n try {\n int mobile=Integer.parseInt(txtMobile.getText());\n } catch (NumberFormatException e) {\n Dialog.showMessageDialog(owner, \"Invalid Mobile Number\", \"Invalid data\",DialogIcon.WARNING);\n txtMobile.requestFocus();\n return false;\n }\n if(txtMobile.getText().length() != 10){\n Dialog.showMessageDialog(owner, \"Sorry your Mobile Number is invalid\", \"Invalid input\",DialogIcon.WARNING);\n txtMobile.requestFocus();\n return false;\n }\n String sql=\"select Username,Password from users where Username=?\";\n try(PreparedStatement prstmt=con.prepareStatement(sql)) {\n prstmt.setString(1, username.getText());\n ResultSet rs=prstmt.executeQuery();\n if(rs.next()){\n Dialog.showMessageDialog(owner, \"Sorry Username already exists\\n Please change to different Username\", \"Username Exists\",DialogIcon.WARNING);\n username.requestFocus();\n return false;\n }\n rs.close();\n } catch (SQLException e) {\n System.err.println(e);\n }\n return true;\n }", "private boolean validateInput() {\n String departmentInput = mDepartmentField.getText().toString();\n String emailInput = mEmailField.getText().toString();\n String passwordInput = mPasswordField.getText().toString();\n\n if (departmentInput.isEmpty()) {\n mDepartmentField.setError(\"Please enter your department number\");\n mDepartmentField.requestFocus();\n return false;\n } else {\n mPasswordField.setError(null);\n }\n\n\n if (emailInput.isEmpty() || !Patterns.EMAIL_ADDRESS.matcher(emailInput).matches()) {\n mEmailField.setError(\"Please enter a valid email address\");\n mEmailField.requestFocus();\n return false;\n } else {\n mEmailField.setError(null);\n }\n\n if (passwordInput.isEmpty()) {\n mPasswordField.setError(\"Please enter your password\");\n mPasswordField.requestFocus();\n return false;\n } else {\n mPasswordField.setError(null);\n }\n\n return true;\n }", "private boolean validateUserInputs() {\n ArrayList<String> errors = new ArrayList();\n \n if (this.view.getContent().equals(\"\")) {\n errors.add(\"\\t - Enter a comment\");\n }\n \n if (errors.size() > 0) {\n String errorMsg = \"Unable to save new Asset.\\nDetails:\";\n for (String error : errors) {\n errorMsg += \"\\n\" + error;\n }\n JOptionPane.showMessageDialog(this.view, errorMsg, \"Unable to Save\", JOptionPane.INFORMATION_MESSAGE);\n return false;\n }\n return true;\n }", "public boolean validateInput(String title) {\n \t\n \tboolean valid = true;\n \tString error = \"\";\n \t\n \tif(title.equals(\"\")) {\n \t\terror += \"Invalid title\";\n \t\tvalid = false;\n \t}else if(currentTaskItems.size() == 0) {\n \t\terror += \"Please attach an item to your task\";\n \t\tvalid = false;\n \t}else if(!propertiesGrabbed) {\n \t\terror += \"Please enter the tasks properties\";\n \t\tvalid = false;\n \t}\n \t\n \t//if valid return else toast\n \tif(valid){\n \t\treturn true;\n \t}else{\n\n \t\tContext context = getApplicationContext();\n \t\tToast toast = Toast.makeText(context, error, Toast.LENGTH_SHORT);\n \t\ttoast.show();\n \t\treturn false;\n \t}\n }", "private boolean isUserInputValid(String[] packetData)\n\t{\n\t\tif(packetData.length < 3 ) return false;\n\t\tString address = packetData[0];\n\t\tint port = Integer.parseInt(packetData[1]);\n\n\t\tint addressPeriodsCount = address.length() - address.replace(\".\", \"\").length();\n\n\t\tif (packetData.length < 3)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\telse if(address.equals(\"localhost\") && (port > 0 || port <= 65535))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn (addressPeriodsCount == 3 ||addressPeriodsCount == 2 ) && (port > 0 || port <= 65535);\n\t\t}\n\t}", "public static boolean validateMenuOption(String input) {\r\n boolean valid = false;\r\n try {\r\n if (Integer.parseInt(input) < 1 || Integer.parseInt(input) > 5){\r\n System.out.println(\"**Error: Menu option not found.\\n\"\r\n +\" Please type a single digit [1-5] for menu option.\");\r\n } \r\n else {\r\n valid = true;\r\n }\r\n }\r\n catch (NumberFormatException nfe) {\r\n System.out.println(\"**Error: Only a single number can be input.\\n\"\r\n +\" Please type a single digit [1-5] for menu option.\");\r\n }\r\n return valid;\r\n }" ]
[ "0.84283096", "0.8279811", "0.8173578", "0.7814372", "0.78072685", "0.76525486", "0.7641181", "0.75494045", "0.7533217", "0.7248567", "0.7233538", "0.7094465", "0.70860356", "0.70676017", "0.7062181", "0.7041608", "0.70374566", "0.7036175", "0.7028434", "0.69914263", "0.69434917", "0.6930006", "0.6887363", "0.688484", "0.6877617", "0.687156", "0.6825481", "0.6819745", "0.6803094", "0.6801715", "0.67922795", "0.67867124", "0.67826796", "0.67799556", "0.6777724", "0.6774258", "0.676157", "0.6757966", "0.6755803", "0.67533857", "0.67531115", "0.67469007", "0.67343104", "0.6732378", "0.6727642", "0.671763", "0.6717164", "0.67105114", "0.6710452", "0.6708039", "0.6706999", "0.6705111", "0.67004204", "0.6696957", "0.66925114", "0.668555", "0.667766", "0.66706353", "0.666929", "0.6669114", "0.6669087", "0.6640919", "0.6632329", "0.65950215", "0.6592842", "0.65917605", "0.6571654", "0.6567888", "0.6563689", "0.65624845", "0.65476036", "0.65424246", "0.6534722", "0.6519466", "0.6513298", "0.6511367", "0.6508082", "0.6507898", "0.65053225", "0.65023094", "0.64992523", "0.6496722", "0.64958155", "0.64947975", "0.6493414", "0.64824337", "0.64824337", "0.6474706", "0.64696604", "0.64632416", "0.64622724", "0.6448644", "0.6448056", "0.6442508", "0.6437141", "0.64247316", "0.6423981", "0.640355", "0.6401683", "0.64006954", "0.6396333" ]
0.0
-1
Create an empty groceries list of Grocery and display it.
public static void main(String[] args) { List<Grocery> groceries = new ArrayList<>(); String message = "Groceries: "; displayList(message, groceries); // Create three different Grocery objects. Grocery object1 = new Grocery("bananas"); Grocery object2 = new Grocery("orange"); Grocery object3 = new Grocery("tomato"); // Add them to the groceries list and display it. To display the Grocery class create the toString method. groceries.add(object1); groceries.add(object2); groceries.add(object3); displayList(message, groceries); // Create a new Grocery with the same name as a previous one and Grocery newGrocery = new Grocery("orange"); // use it to remove the original one from the list. // To remove a Grocery automatically you need to create the equals method in the Grocery class. // Specify that two Grocery are the same if their name is the same. // ??????????????????????????????????? groceries.remove(newGrocery); displayList(message, groceries); // Add one of the existing groceries twice and display the list. groceries.add(object3); groceries.add(object3); displayList(message, groceries); // Remove the third element of the list by providing its position and display it. groceries.remove(3); displayList(message, groceries); // Display its size. message = "Groceries size: "; System.out.println(message + groceries.size()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public List<String> getGroceries()\n {\n List<String> groceryList=new ArrayList<String>();\n\n String selectQuery = \"SELECT * FROM \" + TABLE_GROCERIES;\n\n SQLiteDatabase db = this.getWritableDatabase();\n Cursor cursor = db.rawQuery(selectQuery, null);\n\n // looping through all rows and adding to list\n if (cursor.moveToFirst()) {\n do {\n groceryList.add(cursor.getString(0));\n } while (cursor.moveToNext());\n }\n\n return groceryList;\n }", "public void addGroceries(List<String> groceryList)\n {\n for(int i=0;i<groceryList.size();i++)\n {\n addGrocery(groceryList.get(i));\n }\n }", "public GroceryStore () {\n aisles = 20;\n freezers = 5;\n inventoryFull = 8;\n fresh = 9;\n liveAnimals = false;\n bakery = true;\n bestSeller = \"Milk\";\n numberOfProducts = 10000;\n }", "public DeckGao()\r\n {\r\n cards = new ArrayList<CardGao>();\r\n top = NUMCARDS - 1;\r\n\r\n for(String suit : SUITS)\r\n {\r\n for(int i = 1; i<14; i++)\r\n {\r\n cards.add(new CardGao(suit, i));\r\n }\r\n }\r\n }", "public void fillGarage() {\n\t\n\t\tfor (int i = 0; i < 10; i++) { // 10 cars\n\t\t\taddVehicle(new Car(\"Silver\", \"Audi\", \"petrol\", 250, 4, 40000));\n\t\t}\n\t\tfor (int i = 0; i < 20; i++) { // 20 motorcycles\n\t\t\taddVehicle(new Motorcycle(\"Red\", \"Suzuki\", \"petrol\", 300, 2, 80000));\n\t\t}\n\t\tfor (int i = 0; i < 3; i++) { // 3 buses \n\t\t\taddVehicle(new Bus(\"White\", \"Volvo\", \"diesel\", 140, 4, 100000));\n\t\t}\n\t\t\n\t}", "@Override\r\n\tpublic List<Groupe> getGroupes() {\n\t\treturn dao.getGroupes();\r\n\t}", "public ArrayList<Grocery> buildCurrentList(ArrayList<Grocery> allGroc) {\n\n currentGroc = new ArrayList<Grocery>();\n\n for (int i = 0; i < allGroc.size(); i++) {\n Grocery grocery = allGroc.get(i);\n if (!currentGroc.contains(grocery) && !grocery.isPurchased()) {\n currentGroc.add(grocery);\n }\n }\n return currentGroc;\n }", "public void initialiseGodList() {\n PlayerCreator playerCreator = new PlayerCreator();\n for (int i = 0; i < playerCreator.getArrayGods().size(); i++)\n godListNames.add(playerCreator.getArrayGods().get(i).getGodName());\n }", "public ArrayList<Fish> generateGuppies() {\n ArrayList<Fish> generatedFish = new ArrayList<Fish>();\n\n final double femaleProbability = 0.5;\n\n Random generator = new Random();\n\n int ageInWeeks;\n double healthCoefficient;\n double femaleRoll;\n for (int i = 1; i <= numberOfGuppies; i++) {\n ageInWeeks = generator.nextInt(maxAge - minAge) + minAge;\n healthCoefficient = generator.nextDouble()\n * (maxHealthCoefficient - minHealthCoefficient)\n + minHealthCoefficient;\n femaleRoll = generator.nextDouble();\n\n generatedFish.add(new Guppy(\"Poecilia\", \"reticulata\",\n ageInWeeks, femaleRoll < femaleProbability, 0,\n healthCoefficient));\n }\n\n return generatedFish;\n }", "public void buscarGrado() {\n \tGrado grado = new Grado();\n \tgrado.setDescripcionSeccion(\"Primaria\");\n \tgrado.setNumGrado(4);\n \tgrado.setDescripcionUltimoGrado(\"NO\");\n \tString respuesta = negocio.buscarGrado(\"\", grado);\n \tSystem.out.println(respuesta);\n }", "private void createClinicList(){\n\n ArrayList<Clinic> clinics = LogIn.clinicDAO.getAllClinics();\n for(Clinic cn : clinics){\n double avgRating = LogIn.rateDAO.getAvgRating(cn.getClinicID());\n clinicList.add(new ClinicItem(cn.getClinicName(), drawable.clinic_logo, \"Singapore\", Double.toString(avgRating)));\n }\n }", "public String getListaGrupos () {\n String nomesGruposList = \"\";\n if(this.conversas != null && this.conversas.size() > 0){\n for(int i = 0; i < this.conversas.size(); i++){\n //nomesGruposList += conversas.get(i).nomeGrupo + \" \";\n }\n }\n return nomesGruposList;\n }", "public void addGroceryItem(String item){\n groceryList.add(item);\n }", "public ResponseEntity<List<GrupoDS>> buscarGrupos() {\n \tList<GrupoDS> lista = new ArrayList<>();\n \tfor (GrupoModel model : grupoRepository.findAll()) {\n \t\tlista.add(new GrupoDS(model));\n \t}\n return new ResponseEntity<List<GrupoDS>>(lista, HttpStatus.OK);\n }", "@Test\r\n public void testIsEmpty() {\r\n Grocery entry1 = new Grocery(\"Mayo\", \"Dressing / Mayo\", 1, 2.99f, 1);\r\n\r\n // Test empty\r\n assertTrue(instance.isEmpty());\r\n\r\n instance.add(entry1);\r\n\r\n // Test not empty\r\n assertFalse(instance.isEmpty());\r\n }", "public void criaGrupo() {\n\t\tThread threadMain = Thread.currentThread(); // determina grupo raiz\n\t\tThreadGroup grupoRaiz = threadMain.getThreadGroup().getParent();\n\t\tThreadGroup newGroup = new ThreadGroup(grupoRaiz, \"Extra-\"\n\t\t\t\t+ gruposCriados++);\n\t\tnewGroup.setDaemon(true); // ajusta auto-remocao do grupo\n\t\tint quant = (int) (Math.random() * 10);\n\t\tfor (int i = 0; i < quant; i++) { // adiciona EmptyThreads ao grupo\n\t\t\tnew EmptyThread(newGroup, \"EmptyThread-\" + i).start();\n\t\t}\n\t\tbRefresh.doClick();\n\t}", "public CatalogoJogos() {\r\n\t\tthis.listaDeJogosComprados = new ArrayList<Jogo>();\r\n\t}", "private void fillcbGrupo() {\n\t\tcbGrupoContable.setNullSelectionAllowed(false);\n\t\tcbGrupoContable.setInputPrompt(\"Seleccione Grupo Contable\");\n\t\tfor (GruposContablesModel grupo : grupoimpl.getalls()) {\n\t\t\tcbGrupoContable.addItem(grupo.getGRC_Grupo_Contable());\n\t\t\tcbGrupoContable.setItemCaption(grupo.getGRC_Grupo_Contable(), grupo.getGRC_Nombre_Grupo_Contable());\n\t\t}\n\t}", "@Override\n\tpublic List<ContactGroup> listGroupe() {\n\t\ttry {\n\t\t\tSystem.out.println(\n\t\t\t\t\t\"************************* je suis dans Liste des groupes *********************************\");\n\n\t\t\tsession = HibernateUtil.getSessionFactory().openSession();\n\t\t\ttx = session.beginTransaction();\n\n\t\t\tQuery query = session.createQuery(\"from ContactGroup\");\n\n\t\t\tSystem.out.println(\"\\n\");\n\t\t\tSystem.out.println(\"******************list de groupes:\" + String.valueOf(query.list()));\n\n\t\t\tList<ContactGroup> lg = (List<ContactGroup>) query.list();\n\t\t\ttx.commit();\n\t\t\tsession.close();\n\n\t\t\treturn lg;\n\n\t\t} catch (HibernateException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}", "public void addGrocery(String title)\n {\n SQLiteDatabase db = this.getWritableDatabase();\n System.out.println(\"\\n\\nAdding to grocery list \"+title);\n ContentValues values = new ContentValues();\n values.put(KEY_TITLE,title);\n db.insert(TABLE_GROCERIES,null,values);\n db.close();\n }", "@Override\n public void onDataChange(@NonNull DataSnapshot snapshot) {\n for (DataSnapshot dataSnapshot: snapshot.getChildren()) {\n GroceryList p = dataSnapshot.getValue(GroceryList.class);\n list.add(p);\n }\n\n groceryListAdapter = new GroceryListAdapter(CreateList.this, list);\n groceryList.setAdapter(groceryListAdapter);\n groceryListAdapter.notifyDataSetChanged();\n }", "@Override\r\n\tpublic List<Crew> getAllCrew() {\r\n\t\tList<Crew> crew = new ArrayList<>();\r\n\t\tcrew.addAll(pilots);\r\n\t\tcrew.addAll(cabinCrew);\r\n\t\treturn crew;\r\n\t}", "public void clearAggroList()\n\t{\n\t\tgetAggroList().clear();\n\t}", "public static List<Groupe> getAll() {\n\n // Creation de l'entity manager\n EntityManager em = GestionFactory.factory.createEntityManager();\n\n // Recherche\n @SuppressWarnings(\"unchecked\")\n List<Groupe> list = em.createQuery(\"SELECT e FROM Groupe e\").getResultList();\n\n return list;\n }", "public static void genocide() {\n //Assigns fitness levels\n evaluateFitnesses();\n\n //Sorts by fitness\n sortByFitlvl();\n\n //Simple genocide, kills off all until population size.\n for (int i = Population.size() - 1; i >= populationSize; i--) {\n Population.remove(i);\n }\n\n /*\n //Different kind of Genocide, selects organisms based on gaussian distribution\n\n while(Population.size() > populationSize){\n int randomOrganism = (int)(Population.size() - (Population.size()*Utilities.sharpGauss(2)));\n Population.remove(randomOrganism);\n }\n */\n }", "public void fillInventory(TheGroceryStore g);", "public void llenarComboGrado() {\t\n\t\tString respuesta = negocio.llenarComboGrado(\"\");\n\t\tSystem.out.println(respuesta);\t\n\t}", "public void creatList()\n\t{\n\t\tbowlers.add(new Bowler(\"A\",44));\n\t\tbowlers.add(new Bowler(\"B\",25));\n\t\tbowlers.add(new Bowler(\"C\",2));\n\t\tbowlers.add(new Bowler(\"D\",10));\n\t\tbowlers.add(new Bowler(\"E\",6));\n\t}", "private void loadGroceryCursor(ArrayList<String> items) {\n groceryCursor = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items);\n groceryList.setAdapter(groceryCursor);\n }", "public List<Grupo> obtenerTodosLosGrupos() {\n return this.grupoFacade.findAll();\n }", "public void makeEmpty() {\n // remove Squares until empty\n while (!exploreList.isEmpty()) {\n exploreList.getNext();\n }\n }", "@RequestMapping(value=\"/list\", method=RequestMethod.GET)\r\n\tpublic HashMap<String, Object> getAll(){\r\n\t\t\r\n\t\tHashMap<String, Object> h = new HashMap<String, Object>();\r\n\t\tList<JuridictionGroupe> jGroupes = jGRep.findAll();\r\n\t\th.put(\"message\", \"success\");\r\n\t\th.put(\"list_juridiction_groupe\", jGroupes);\r\n\t\th.put(\"status\", 0);\r\n\t\treturn h;\r\n\t}", "public ArrayList<Guppy> spawn() {\n if (!this.isFemale) { return null; }\n if (this.ageInWeeks < MINIMUM_SPAWNING_AGE) { return null; }\n if (Double.compare(this.randomNumberGenerator.nextDouble(), SPAWN_CHANCE) > 0) { return null; }\n\n ArrayList<Guppy> babyGuppies = new ArrayList<>();\n int babiesAmount = this.randomNumberGenerator.nextInt(MAX_BABIES_SPAWN_AMOUNT + 1);\n for (int i = 0; i < babiesAmount; i++) {\n babyGuppies.add(new Guppy(this.genus,\n this.species,\n 0,\n this.randomNumberGenerator.nextBoolean(),\n this.generationNumber + 1,\n (this.healthCoefficient + 1) / 2));\n }\n return babyGuppies;\n }", "@Override\r\n\tpublic AbstractBagGift createBagGift() {\n\t\treturn new MerchantCollection();\r\n\t}", "public Golfer() \n {\n name = \"__\";\n homeCourse = \"__\";\n idNum = 9999;\n this.name = name;\n this.homeCourse = homeCourse;\n this.idNum = idNum;\n final int LENGTH = 20;\n Score[] values = new Score[LENGTH];\n values = this.scores;\n }", "public BuildingList() {\n Building temp = new Building(1);\n temp.createSubAreas(6);\n temp.setSystemPass(\"0000\");\n URL url = this.getClass().getClassLoader()\n .getResource(\"singleHouse.jpg\");\n temp.setImage(url);\n\n buildings.add(temp);\n temp = new Building(2);\n url = this.getClass().getClassLoader()\n .getResource(\"commercial.jpg\");\n temp.setImage(url);\n buildings.add(temp);\n }", "public GcGroupLevelExample() {\n oredCriteria = new ArrayList<Criteria>();\n }", "public static Rosters empty()\n\t{\n\t\tList<Player> pList = new ArrayList<Player>();\n\t\treturn new Rosters(pList);\n\t}", "List<Map<String, Object>> listGrades()throws BusinessException;", "public void makeEmpty() {\n for (int i = 0; i < buckets.length; i++) {\n buckets[i] = new SList();\n }\n size = 0;\n }", "public GermchitExample() {\n oredCriteria = new ArrayList<Criteria>();\n }", "public mycoffee() throws ParseException {\n initComponents();\n \n SimpleDateFormat df = new SimpleDateFormat(\"dd-MM-yyyy\", Locale.ENGLISH);\n coffeeshop[] a = new coffeeshop[]{new coffeeshop(\"Kha Coffee\", \"2 Nguyen Trai\"),\n new coffeeshop(\"White Coffee\", \"42 Nguyen Hue\"),\n new coffeeshop(\"red Coffee\", \"92 Nguyen Trai\")};\n managers = new manager[]{\n new manager(a, 100, \"Nguyen Van A\", 0, df.parse(\"12-12-1999\")),\n new manager( new coffeeshop[]{\n new coffeeshop(\"Hoang Hac\", \"35 Nguyen Hue\")\n },\n 2000,\"Nguyen Van B\", 1, df.parse(\"12-12-1999\"))\n };\n for(int i = 0; i < managers.length; i++) {\n cbQL.addItem(managers[i].getHoten());\n }\n \n DefaultTableModel model = (DefaultTableModel)tblCoffeeshop.getModel();\n model.setRowCount(0);\n coffeeshop[] shops = managers[0].getShops();\n for(int i = 0; i < shops.length; i++) {\n model.insertRow(model.getRowCount(),\n new Object[]{model.getRowCount() + 1,\n shops[i].getName(),\n shops[i].getAddress()});\n }\n }", "public void emptyStoutGlass(){\n System.out.println( \"Emptying \" + name);\n }", "public void emptyList() {\n coursesTaken = new ArrayList<CourseTaken>();\r\n }", "private void refreshList()\n {\n String line;\n int temp;\n Classes.getItems().clear();\n for (int i = 0; i < SchModMan.getClasses().length; i++)\n {\n line = \"\";\n line += SchModMan.getClasses()[i].getName();\n temp = line.length();\n for (int j = 0; j < 22 - temp; j++)\n line += \" \";\n line += SchModMan.getClasses()[i].getNumberOfStudents();\n temp = line.length();\n for (int j = 0; j < 36 - temp; j++)\n line += \" \";\n line += SchModMan.getClasses()[i].getNumberOfGroups();\n Classes.getItems().add(line);\n }\n }", "private Object saveGivens() {\n List<String> out = new ArrayList<>();\n for(UUID id : givenEmpty) {\n out.add(id.toString());\n }\n return out;\n }", "public void getAllGroups() { \t\n \tCursor groupsCursor = groupDbHelper.getAllGroupEntries();\n \tList<String> groupNames = new ArrayList<String>();\n \tgroupNames.add(\"Create a Group\");\n \t\n \t// If query returns group, display them in Groups Tab\n \t// Might want to add ordering query so that most recent\n \t// spots display first...\n \tif (groupsCursor.getCount() > 0) {\n \t\tgroupsCursor.moveToFirst();\n \t\twhile (!groupsCursor.isAfterLast()) {\n \t\t\tgroupNames.add(groupsCursor.getString(1));\n \t\t\tgroupsCursor.moveToLast();\n \t\t}\n \t\t\n \t}\n \t\n \t// Close cursor\n \tgroupsCursor.close();\n \t\n \t// Temporary - Ad`d Sample Groups to List\n \t//for (String groupname : groupSamples) {\n \t\t//groupNames.add(groupname);\n \t//}\n \t\n \tgroupsview.setAdapter(new ArrayAdapter<String>(this, \n \t\t\t\tandroid.R.layout.simple_list_item_1, groupNames));\n }", "public displayGurps() {\n initComponents();\n }", "public NavigableSet<Groupe> getGroupes();", "public static void display(){\n \n //create an array : Remember positions\n //wheat= 0\n //Land = 1 \n //Population = 2\n \n String[] items = {\"Wheat\", \"Land\", \"Population\"};\n \n \n // call the crops object \n Crops theCrops = Game.getCrop();\n \n //get wheat\n int wheat = theCrops.getWheatInStore();\n \n //get land (acres)\n int acres = theCrops.getAcres();\n \n //get population \n \n int population = theCrops.getPopulation();\n \n //print results \n \n System.out.println(\"\\nInventory List:\");\n //wheat \n System.out.println(\"Wheat in Store:\" + wheat + \" bushels of \" + items[0]);\n //acres\n System.out.println(\"Acres of Land owned:\" + acres + \" acres of \" + items[1]);\n \n //population\n System.out.println(\"Current population:\" + population + \" people in the \" + items[2]);\n \n \n \n }", "@Override\n\tpublic List<Grupo> obtenerGrupos() {\n\t\tSystem.out.println(\"Grupo Service\");\n\t\ttry {\n\t\t\t \n\t\t\t\tList<Grupo> tmp=this.grupoDao.obtenerGrupos();\n\t\t\t\tSystem.out.println(\"Lista de Grupos\"+tmp.size());\n\t\t\t\t\treturn tmp;\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}", "public void buildDisplay() {\n ColorMap map = new ColorMap();\n\n for (int i = 1; i <= maxGrassPerCell; i++) {\n map.mapColor(i, new Color(0, Math.max(256 - i * 12, 50), 0));\n }\n map.mapColor(0, Color.white);\n\n Value2DDisplay displayMoney =\n new Value2DDisplay(space.getCurrentGrassSpace(), map);\n\n Object2DDisplay displayRabbits = new Object2DDisplay(space.getCurrentRabbitSpace());\n displayRabbits.setObjectList(rabbitList);\n\n displaySurf.addDisplayableProbeable(displayMoney, \"Grass\");\n displaySurf.addDisplayableProbeable(displayRabbits, \"Rabbits\");\n\n populationPlot.addSequence(\"Number of Rabbits\", new rabbitCount(), Color.BLUE);\n populationPlot.addSequence(\"Number of Grass\", new grassCount(), new Color(0, 150, 0));\n }", "public OccList()\n {\n int capacity = 8;\n data = new Occ[capacity];\n // initialize data with empty occ\n for (int i=0; i<capacity; i++) data[i] = new Occ(); \n }", "private void idGrupos() {\n\t\tmyHorizontalListView.setOnItemClickListener(new OnItemClickListener() {\n\n\t\t\tpublic void onItemClick(AdapterView<?> parent, View view,\n\t\t\t\t\tint position, long id) {\n\t\t\t\tURL_BOOKS = \"http://tutoriapps.herokuapp.com/api/v1/groups/\"\n\t\t\t\t\t\t+ gid[position].toString() + \"/books.json?auth_token=\";\n\t\t\t\tposicionId = gid[position].toString();\n\t\t\t\tvalorUltimo = 0;\n\t\t\t\tnuevo = 0;\n\t\t\t\taa.clear();\n\t\t\t\tgetData();\n\t\t\t}\n\t\t});\n\t}", "private void buildShipsList() {\r\n ObservableList<ShipBar> lstShips = FXCollections.observableArrayList();\r\n Map<String, ShipType> ships = Data.SHIPS.get();\r\n for (String s : planet.getShips()) {\r\n ShipType ship = ships.get(s);\r\n ShipBar u = new ShipBar();\r\n u.setKey(s);\r\n u.setText(ship.getName());\r\n u.setPrice(ship.getPrice() - currentShip.getNetWorth());\r\n u.setToggleGroup(shipGroup);\r\n lstShips.add(u);\r\n }\r\n buyShips.setItems(lstShips);\r\n }", "private void buildBoats() {\n\t\tboats.add(new Boat(\"red\"));\n\t\tboats.add(new Boat(\"pink\"));\n\t\tboats.add(new Boat(\"blue\"));\n\t\tboats.add(new Boat(\"yellow\"));\n\t\tboats.add(new Boat(\"orange\"));\n\t\tboats.add(new Boat(\"green\"));\n\t\tboats.add(new Boat(\"purple\"));\n\t}", "private void display() {\n\t\tif (bag.getSize() == 0) {\n\t\t\tSystem.out.println(\"The bag is empty!\");\n\t\t} else {\n\t\t\tSystem.out.println(\"**You have \" + bag.getSize() + \" items in the bag.\");\n\t\t\tbag.print();\n\t\t\tSystem.out.println(\"**End of list\");\n\t\t}\n\t}", "public List<BeanGrupo> getGrupos() {\n\t\treturn grupos;\n\t}", "public static void main(String[] args) {\n\t\tGiftList list = new GiftList();\r\n\r\n\t\tSystem.out.println(\"Creating 3 gifts.....\");\r\n\t\tfor(int i=1;i<4;i++) {\r\n\t\t\tGiftBasket basket= new GiftBasket(i+5,\"Large\",i*5);\r\n\t\t\t//list.addGiftBasketToEnd(basket);\r\n\t\t}\r\n\t\tlist.showAllGiftBaskets();\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn \"Garage [id=\" + id + \", name=\" + name + \"]\";\n\t}", "@GetMapping(\"/new\")\n public ResultEntity<List<ItemDTO>> getAllNewLots()\n {\n\n return itemService.getItemsBySubCategory(ConstantUtil.TYPE_SALE_RENT,\"Other\");\n }", "public static void carlist() {\n Cars xx = new Cars();\n System.out.println(\"You have \" + String.valueOf(listcars.size())+ \" cars\");\n System.out.println(\"List of all your cars \");\n for (int i = 0; i < listcars.size();i++) {\n xx = listcars.get(i);\n System.out.println(xx.getBrand()+ \" \"+ xx.getModel()+ \" \"+ xx.getReference()+ \" \"+ xx.getYear()+ \" \");\n }\n }", "@Override\n\tpublic String toString() {\n\t\tStringBuilder resultBuilder = new StringBuilder(\"\");\n\n\t\tfor (GradedItem item : gradedItems) {\n\t\t\tresultBuilder.append(item.toString());\n\t\t\tresultBuilder.append(\"\\n\");\n\t\t}\n\n\t\treturn resultBuilder.toString();\n\t}", "private JPanel getPAbmGrupos() {\r\n if (pAbmGrupos == null) {\r\n lInfo = new JLabel();\r\n lInfo.setBounds(new Rectangle(0, 240, 370, 30));\r\n lInfo.setHorizontalAlignment(SwingConstants.CENTER);\r\n lInfo.setHorizontalTextPosition(SwingConstants.CENTER);\r\n \r\n lInfo.setText(\"\");\r\n lId = new JLabel();\r\n lId.setBounds(new Rectangle(10, 20, 90, 20));\r\n lId.setText(\"Id Grupo\");\r\n lNombre = new JLabel();\r\n lNombre.setBounds(new Rectangle(10, 45, 90, 20));\r\n lNombre.setText(\"Nombre\");\r\n pAbmGrupos = new JPanel();\r\n pAbmGrupos.setLayout(null);\r\n pAbmGrupos.add(lNombre);\r\n pAbmGrupos.add(getTNombre());\r\n pAbmGrupos.add(getBGuardar());\r\n pAbmGrupos.add(getBCancelar());\r\n pAbmGrupos.add(getBEliminar());\r\n pAbmGrupos.add(getPGrupos());\r\n pAbmGrupos.add(getTBuscar());\r\n pAbmGrupos.add(getBBuscar());\r\n pAbmGrupos.add(getBNuevo(), null);\r\n pAbmGrupos.add(lId, null);\r\n pAbmGrupos.add(getTId(), null);\r\n pAbmGrupos.add(lInfo, null);\r\n \r\n }\r\n return pAbmGrupos;\r\n }", "public void clear() {\r\n GiftList.clear();\r\n names = new LinkedList<>();\r\n totalGifts = 0;\r\n totalCost = 0;\r\n }", "public ArrayList<Stock> addDefaultStocks() {\n Stock amzn = new Stock(\"Amazon\", \"AMZN\", new Dollar(2474.00), 100); \n Stock fb = new Stock(\"Facebook\", \"FB\", new Dollar(204.71), 100); \n Stock msft = new Stock(\"Microsoft\", \"MSFT\", new Dollar(174.57), 100); \n Stock googl = new Stock(\"Alphabet\", \"GOOGL\", new Dollar(1317.32), 100); \n Stock baba = new Stock(\"Alibaba\", \"BABA\", new Dollar(194.48), 100); \n Stock fis = new Stock(\"Fidelity\", \"FIS\", new Dollar(26.01), 100); \n Stock crm = new Stock(\"Salesforce\", \"CRM\", new Dollar(156.37), 100); \n Stock ma = new Stock(\"Mastercard\", \"MA\", new Dollar(268.74), 100); \n Stock v = new Stock(\"Visa\", \"V\", new Dollar(175.57), 100); \n Stock nflx = new Stock(\"Netflix\", \"NFLX\", new Dollar(415.27), 100); \n\n stocks.add(amzn); \n stocks.add(fb); \n stocks.add(msft); \n stocks.add(googl); \n stocks.add(baba); \n stocks.add(fis);\n stocks.add(crm); \n stocks.add(ma); \n stocks.add(v); \n stocks.add(nflx); \n\n return stocks; \n }", "public void printAllGroups() throws IllegalCourseTypeException {\n if (courseType == CourseType.LEC) {\n throw new IllegalCourseTypeException(\n \"Oops, it appears that \" + courseName + \" doesn't have any groups.\"\n );\n }\n\n System.out.println();\n System.out.println(\"+-----------------------------------------------+\");\n System.out.println(\"| Groups in \" + courseName + \" |\");\n System.out.println(\"+----------------+-------------+----------------+\");\n System.out.println(\"| Group Name | Vacancy | Total Size |\");\n System.out.println(\"+----------------+-------------+----------------+\");\n \n for (Map.Entry<String, Integer[]> entry : tutLabGroups.entrySet()) {\n if (entry.getKey().equals(\"_LEC\")) {\n continue;\n }\n System.out.print(\"| \" + entry.getKey() + \" | \");\n System.out.printf(\"%2s\", entry.getValue()[0]);\n System.out.print(\" | \");\n System.out.printf(\"%2s\", entry.getValue()[1]);\n System.out.println(\" |\");\n }\n\n System.out.println(\"+----------------+-------------+----------------+\");\n System.out.println();\n }", "public static void emptyWishlist() {\n click(WISHLIST_UPPER_MENU);\n click(REMOVE_FROM_WISHLIST_BUTTON);\n }", "public void createDecks(){\r\n\t\tfor (int j = 10; j < 20; j++){\r\n\t\t\taddCard(new Card(cardNames[j]));\r\n\t\t}\r\n\t}", "public ArrayList<Casella> getGrup()\n\t{\n\t\treturn grup;\n\t}", "public void collection() {\n\t\tif(showCollection) {\n\t\t\tclear_console();\n\t\t\tfor(int i = 1;i<crystalQuantity.length;i++) {\n\t\t\t\tif(crystalQuantity[i]>0) {\n\t\t\t\t\tSystem.out.println(\"T\" + i + \": \" + crystalQuantity[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public FoodGroup() {\n\t\tmeal = new ArrayList<String>();\n\t\tfoodDetail = new HashMap<String,Food>();\n\t\tfoodPortion = new HashMap<String,Double>();\n\t}", "private List<Card> createDeck(){\n List<Card> newDeck= new ArrayList<Card>();\n for (int i =0;i<CardSet.ALL_CARDS.size(); ++i ) {\n newDeck.add(CardSet.ALL_CARDS.get(i));\n }\n return newDeck;\n }", "void addGroceryItem(String item) {\n\n\t}", "public List<Gallery> getGallery() {\n List<Gallery> galleries = new ArrayList<>();\n galleries.add(new Gallery(\"islands\", \"Holiday 2017\", \"Islands\", 130, 4, \"City break\", \"13/04/2018\", \"15/04/2018\"));\n galleries.add(new Gallery(\"rome\", \"Fall 2017\",\"Rome\", 250, 5,\"City break\", \"13/04/2018\", \"15/04/2018\"));\n galleries.add(new Gallery(\"london\",\"Summer 2017\",\"London\",300,3,\"City break\", \"13/04/2018\", \"15/04/2018\"));\n galleries.add(new Gallery(\"paris\",\"Winter 2017\",\"Paris\",100,2,\"City break\", \"13/04/2018\", \"15/04/2018\"));\n galleries.add(new Gallery(\"san_francisco\",\"Spring 2018\",\" San Francisco\",250.5,4,\"City break\", \"13/04/2018\", \"15/04/2018\"));\n galleries.add(new Gallery(\"greece\",\"Summer 2018\",\"Greece\",234,3,\"City break\", \"13/04/2018\", \"15/04/2018\"));\n return galleries;\n }", "public static void emptyCart() {\n click(SHOPPING_CART_UPPER_MENU);\n click(REMOVE_FROM_CART_BUTTON);\n Browser.driver.navigate().refresh();\n }", "public static Group newDeck() {\n\t\tGroup g = new Group();\n\t\tfor (Suit s : Suit.values()) {\n\t\t\tfor (Rank r : Rank.values()) {\n\t\t\t\tCard c = new Card(r,s);\n\t\t\t\tg.add(c);\n\t\t\t}\n\t\t}\n\t\treturn g;\n\t}", "private void fillFruitList()\n\t{\n\t\tfruitList.add(\"apple\");\n\t\tfruitList.add(\"kiwi\");\n\t\tfruitList.add(\"coconut\");\n\t\tfruitList.add(\"orange\");\n\t\tfruitList.add(\"pineapple\");\n\t\tfruitList.add(\"pear\");\n\t\tfruitList.add(\"banana\");\n\t\tfruitList.add(\"papaya\");\n\t\tfruitList.add(\"blueberry\");\n\t}", "@Test\n public void getClients_initiallyReturnsEmptyList_ArrayList() {\n Stylist.clear();\n Stylist testStylist = new Stylist(\"Xena\");\n assertEquals(0, testStylist.getStylist().size());\n }", "public void listarCarros() {\n System.err.println(\"Carros: \\n\");\n if (carrosCadastrados.isEmpty()) {\n System.err.println(\"Nao existem carros cadastrados\");\n } else {\n System.err.println(Arrays.toString(carrosCadastrados.toArray()));\n }\n }", "public void empty() {\n int StartSize = stockList.size();\r\n // While array is not empty.\r\n while (stockList.size() > 0) {\r\n // For every item in the \"stockList\" array.\r\n for (int i = 0; i < StartSize; i++) {\r\n // Remove the beanBag object at the current position in the \"stockList\".\r\n stockList.remove(i);\r\n // Set the global int \"nextReservationNumber\" to 0.\r\n nextReservationNum = 0;\r\n }\r\n }\r\n }", "public PopulationGrowth() {\n initComponents();\n }", "private JComboBox getComboBoxGosti() {\r\n\t\tif (comboBoxGosti == null) {\r\n\t\t\tcomboBoxGosti = new JComboBox<Tim>();\r\n\t\t\tGUIKontroler.popuniComboBox(comboBoxGosti);\r\n\t\t\tcomboBoxGosti.setPreferredSize(new Dimension(130, 20));\r\n\t\t}\r\n\t\treturn comboBoxGosti;\r\n\t}", "void populate() {\n daftarNotifikasi.add(new DaftarNotifikasi(\"Ludfi Ika P\", \"Hari ini mau gathering dimana?\", 2, R.drawable.profil_2));\n daftarNotifikasi.add(new DaftarNotifikasi(\"Erinda\", \"Ada pagelaran di kota\", 6, R.drawable.profil_3));\n daftarNotifikasi.add(new DaftarNotifikasi(\"Aleq\", \"Saya punya solusi untuk itu\", 10, R.drawable.profil_1));\n }", "public void refreshList() {\n PartDAO partDAO = new PartDAO();\n for (Part p : partDAO.getAll()) {\n if (p.getStockLevel() > 0) {\n Label partLabel = new Label(\"ID: \" + p.getPartID() + \" / Name: \" + p.getName() + \" / Stock: \" + p.getStockLevel());\n partHashMap.put(partLabel.getText(), p);\n partList.getItems().add(partLabel);\n }\n }\n Customer customer = new Customer();\n CustomerDAO customerDAO = new CustomerDAO();\n for(Customer c: customerDAO.getAll()) {\n if(jobReference.getJob().getCustomerID() == Integer.parseInt(c.getCustomerID())) {\n customer.setFirstName(c.getFirstName());\n customer.setLastName(c.getLastName());\n break;\n }\n }\n if(jobReference.getJob().getRegistrationID() == null) {\n jobDetailsLbl.setText(\"Date: \" + jobReference.getJob().getDateBookedIn() + \" / Name: \" + customer.getFirstName() + \" \" + customer.getLastName() + \" / Part-only job\");\n }\n else {\n jobDetailsLbl.setText(\"Date: \" + jobReference.getJob().getDateBookedIn() + \" / Name: \" + customer.getFirstName() + \" \" + customer.getLastName() + \" / Car ID: \" + jobReference.getJob().getRegistrationID());\n }\n stockUsedField.setText(\"1\");\n }", "public List<Gadget> getGadgetList() {\n List<Gadget> gadgets = new ArrayList<>();\n orders.entrySet().stream().forEach((s) -> s.getValue().forEach((s1) -> gadgets.add(s1)));\n return gadgets;\n }", "public static void allDrugList() {\r\n\t\ttry {\r\n\t\t\tPreparedStatement ps = St_MaryConnection.getConnection()\r\n\t\t\t\t\t.prepareStatement(\"Select Distinct drugNameOrder\" + \" From\" + \" counterdrugordertable\");\r\n\t\t\tResultSet rs = ps.executeQuery();\r\n\t\t\twhile (rs.next()) {\r\n\t\t\t\tString drugDescription = rs.getString(\"drugNameOrder\");\r\n\t\t\t\t// drugModel.removeAllElements();\r\n\t\t\t\tdrugModel.addElement(drugDescription);\r\n\t\t\t}\r\n\r\n\t\t} catch (SQLException ex) {\r\n\t\t\tSystem.out.println(\"Error in getting all drug list and set on drug box\\n\" + ex);\r\n\t\t}\r\n\t}", "public void createList(View v){\n //Checking the user has added ingredients\n if(!ingredientModelList.isEmpty()){\n //Retrieving the current date and formatting it\n Calendar calendar = Calendar.getInstance();\n DateFormat dateFormat = new SimpleDateFormat(\"dd/MM/yyyy\");\n String date = dateFormat.format(calendar.getTime());\n\n //Retrieving the grocery list title from the user input and the ArrayList<String> of Ingredients\n String title = groceryListTitleEt.getText().toString();\n ArrayList<String> ingredientList = arrayListFromIngredient(ingredientModelList);\n\n //Creating the grocery list model\n GroceryListModel groceryListModel = new GroceryListModel(date, ingredientList);\n\n //Checking if user has added a title\n if(title!=null){\n groceryListModel.setTitle(title);\n }\n\n // Using a single value event listener to read from the FirebaseDatabase\n databaseReference.child(uId).addListenerForSingleValueEvent(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot dataSnapshot) {\n //Creating a current user that is the value of the user retrieved\n User currentUser = dataSnapshot.getValue(User.class);\n //Checking if user retrieved is null\n if(currentUser!=null){\n //Checking if the user has created any groceryLists yet\n if(currentUser.groceryListModels == null){\n //If the user hasn't, it creates a new list adding the grocerListModel just created\n List<GroceryListModel> groceryListModels = new ArrayList<>();\n groceryListModels.add(groceryListModel);\n //Uses databaseReference to set the groceryListModels list to the newly created list\n databaseReference.child(uId).child(\"groceryListModels\").setValue(groceryListModels);\n\n Log.d(\"Debug log\", \"Created new groceryListModels\");\n }else{\n //Retrieves the user's groceryListModels, adds the new groceryListModel\n List<GroceryListModel> userGroceryListModels = currentUser.groceryListModels;\n userGroceryListModels.add(groceryListModel);\n //Uses databaseReference to set the groceryListModels to the new one\n databaseReference.child(uId).child(\"groceryListModels\").setValue(userGroceryListModels);\n\n Log.d(\"Debug log\", \"Added to existing groceryListModels\");\n }\n }\n finish();\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError databaseError) {\n //Used to determine whether the request was successful\n Log.d(\"Error log\", \"Couldn't read from database\");\n }\n });\n\n\n }else{\n //Prompts the user to add ingredients if they haven't done so\n Toast.makeText(this, \"You need to add ingredients to your list!\", Toast.LENGTH_LONG).show();\n }\n\n }", "@GET\n public List<JsonGenre> getAll() {\n \tList<Genre> genres = genreDao.getGenres();\n \tLOGGER.info(\"find \"+genres.size()+\" genres in the database\");\n \tArrayList<JsonGenre> ls = new ArrayList<JsonGenre>();\n \tfor (Genre s:genres) {\n \t\tls.add(new JsonGenre(s.getId(), s.getName()));\n \t}\n \treturn ls;\n }", "public grille_chiffre(){\n\tgc=new Object[5][5];\n\tlst_8=new ArrayList<Object>();\n}", "public String getGruposToString(){\n\t\tif(null == grupos){\n\t\t\treturn \"\";\n\t\t}else{\n\t\t\tStringBuilder grupos = new StringBuilder();\n\t\t\tfor (int i = 0; i < this.grupos.size(); i++) {\n\t\t\t\tif(i == (this.grupos.size()-1)){\n\t\t\t\t\tgrupos.append(this.grupos.get(i).getNombreGrupo());\n\t\t\t\t}else{\n\t\t\t\t\tgrupos.append(this.grupos.get(i).getNombreGrupo()).append(\", \");\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn grupos.toString();\n\t\t}\n\t}", "private void createFoodTrees(){\r\n while(!foodArray.isEmpty()){\r\n Food element= foodArray.dequeue();\r\n priceTree.add(element);\r\n stockTree.add(element);\r\n }\r\n }", "public Garage() {\n\t\tid = generateId();\n\t}", "private void fillGenderList() {\n GenderList = new ArrayList<>();\n GenderList.add(\"Male\");\n GenderList.add(\"Female\");\n }", "@Override\n\tpublic List<Genre> displayAllGenres() throws MovieException {\n\t\treturn obj.displayAllGenres();\n\t}", "public static List<Company> createCompanies() {\r\n\t\tList<Company> companies = new ArrayList<Company>();\r\n\t\tcompanies.add(createCompany(1, \"Pepcus\", \"IT\", \"PEP\", new Date(), \"IT comp at Indore\", \"This is search help1\"));\r\n\t\tcompanies.add(createCompany(2, \"Google\", \"IT\", \"PEP\", new Date(), \"IT comp at Indore\", \"This is search help2\"));\r\n\t\tcompanies.add(createCompany(3, \"Facebook\", \"IT\", \"PEP\", new Date(), \"IT comp at Indore\", \"This is search help3\"));\r\n\t\tcompanies.add(createCompany(4, \"Suzuki\", \"IT\", \"PEP\", new Date(), \"IT comp at Indore\", \"This is search help4\"));\r\n\t\tcompanies.add(createCompany(5, \"General Motors\", \"IT\", \"PEP\", new Date(), \"IT comp at Indore\", \"This is search help5\"));\r\n\t\tcompanies.add(createCompany(6, \"L & T\", \"IT\", \"PEP\", new Date(), \"IT comp at Indore\", \"This is search help6\"));\r\n\t\tcompanies.add(createCompany(7, \"General Electric\", \"IT\", \"PEP\", new Date(), \"IT comp at Indore\", \"This is search help7\"));\r\n\t\tcompanies.add(createCompany(8, \"Oracle\", \"IT\", \"PEP\", new Date(), \"IT comp at Indore\", \"This is search help8\"));\r\n\t\tcompanies.add(createCompany(9, \"Microsoft\", \"IT\", \"PEP\", new Date(), \"IT comp at Indore\", \"This is search help9\"));\r\n\t\tcompanies.add(createCompany(10, \"Thinkhr\", \"IT\", \"PEP\", new Date(), \"IT comp at Indore\", \"This is search help10\"));\r\n\t\treturn companies;\r\n\r\n\t}", "public void printGodList(List<God> gods){\n int counter = 1;\n for(God god : gods){\n System.out.println(counter+\") \"+god.toString());\n counter++;\n }\n }", "public List<Gasto> findAll(){\n\t\treturn (List<Gasto>) gastoModel.findAll();\n\t}", "Groepen maakGroepsindeling(Groepen aanwezigheidsGroepen);", "@Override\r\n\tpublic List<CabinCrew> getAllCabinCrew() {\r\n\t\tList<CabinCrew> cloned = new ArrayList<>(cabinCrew);\r\n\t\treturn cloned;\r\n\t}" ]
[ "0.6509279", "0.6272645", "0.58826584", "0.58146167", "0.56952953", "0.5651561", "0.56416875", "0.56088084", "0.5574338", "0.55662674", "0.5553649", "0.5527695", "0.5518467", "0.5493655", "0.5478653", "0.545088", "0.537712", "0.53474855", "0.53243804", "0.53080845", "0.5258759", "0.5247193", "0.52316946", "0.52211434", "0.5192443", "0.5189496", "0.518467", "0.5179727", "0.51675606", "0.51624584", "0.5153231", "0.51501715", "0.51489925", "0.5138954", "0.5128737", "0.5123684", "0.51191497", "0.5109887", "0.5096625", "0.5092334", "0.5079886", "0.50615335", "0.5059268", "0.50549495", "0.50450915", "0.50440633", "0.50395745", "0.5034325", "0.5032833", "0.50321436", "0.5024088", "0.50211114", "0.50189024", "0.50161576", "0.5013522", "0.50114334", "0.50067776", "0.4996782", "0.49961725", "0.49910355", "0.49803934", "0.49744362", "0.4973349", "0.49725023", "0.49702817", "0.49581096", "0.49390987", "0.49376917", "0.49346632", "0.49292618", "0.49276987", "0.49235597", "0.49178672", "0.49123445", "0.49084458", "0.49018607", "0.49001515", "0.48948765", "0.48900637", "0.48896772", "0.48894686", "0.48868614", "0.48825753", "0.48805946", "0.48804235", "0.48798454", "0.4870081", "0.4866309", "0.48582804", "0.4857833", "0.48563454", "0.4849901", "0.4848979", "0.48475325", "0.4847435", "0.48451492", "0.48448077", "0.4835881", "0.4834139", "0.48323625" ]
0.69168603
0
View headerView = this.mViewHolder.navigationView.getHeaderView(0);
private void updateHeader() { this.mViewHolder.imageView = findViewById(R.id.image_header); this.mViewHolder.textHeader = findViewById(R.id.text_nav_header); this.mViewHolder.textHeader.setText(_NAME); Glide.with(this).load(user.getPhotoUrl()).into(this.mViewHolder.imageView); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testGetView_Header() {\n mView = mAdapter.getView(0, null, null);\n }", "private HeaderViewClickListener manageHeaderClick() {\n return new HeaderViewClickListener() {\n @Override\n public void onClickOfHeaderLeftView() {\n AppUtils.showLog(TAG, \"onClickOfHeaderLeftView\");\n mActivity.onBackPressed();\n }\n\n @Override\n public void onClickOfHeaderRightView() {\n Toast.makeText(mActivity, \"Coming Soon\", Toast.LENGTH_SHORT).show();\n }\n };\n }", "public interface IHeaderView {\n\n\n View getLeftView();\n\n View getRightView();\n\n}", "private void loadNavHeader() {\n // name, website\n txtName.setText(\"Ashish Jain\");\n txtWebsite.setText(\"[email protected]\");\n\n navigationView.getMenu().getItem(3).setActionView(R.layout.menu_dot);\n }", "private static void setUpNavigationHeader() {\n View navigationHeader = navigationView.getHeaderView(0);\n TextView userName = navigationHeader.findViewById(R.id.lblUserName);\n TextView userEmail = navigationHeader.findViewById(R.id.lblUserEmail);\n CircularImageView circularImageView = navigationHeader.findViewById(R.id.imgUser);\n\n userName.setText(user.getUsername());\n userEmail.setText(user.getEmail());\n\n if (user.getUserProfileImage() == null) {\n circularImageView.setDrawable(resources.getDrawable(R.drawable.user_icon_sample));\n } else {\n Drawable imgUser = new BitmapDrawable(resources, user.getUserProfileImage());\n circularImageView.setDrawable(imgUser);\n }\n }", "public void initComponetNavHeader() {\n\n navigationView.setNavigationItemSelectedListener(this);\n View headerView = navigationView.getHeaderView(0);\n imageViewProfil = headerView.findViewById(R.id.imageViewProfil);\n tvName = headerView.findViewById(R.id.tvName);\n tvEmail = headerView.findViewById(R.id.tvEmail);\n\n tvName.setText(name);\n tvEmail.setText(email);\n\n imageViewProfil.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n startActivity(new Intent(SettingActivity.this, ProfilActivity.class).\n addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));\n }\n });\n\n }", "@Override\n\tpublic View getHeaderView(int position, View convertView) {\n\t\tHeaderViewHolder holder;\n\n\t\tif (convertView == null) {\n\t\t\tholder = new HeaderViewHolder();\n\t\t\tconvertView = LinearLayout.inflate(context, R.layout.header, null);\n\t\t\tholder.text = (TextView) convertView.findViewById(R.id.text);\n\t\t\tconvertView.setTag(holder);\n\t\t} else {\n\t\t\tholder = (HeaderViewHolder) convertView.getTag();\n\t\t}\n\n\t\t// set header text as first char in name\n\t\tholder.text.setText(mModelRssItems.get(position).getPubdate());\n\n\t\treturn convertView;\n\t}", "private void manageHeaderView() {\n PickupBoyDashboard.getInstance().manageHeaderVisibitlity(false);\n HeaderViewManager.getInstance().InitializeHeaderView(null, view, manageHeaderClick());\n HeaderViewManager.getInstance().setHeading(true, mActivity.getResources().getString(R.string.bokings));\n HeaderViewManager.getInstance().setLeftSideHeaderView(true, R.drawable.left_arrow);\n HeaderViewManager.getInstance().setRightSideHeaderView(false, R.drawable.left_arrow);\n HeaderViewManager.getInstance().setLogoView(false);\n HeaderViewManager.getInstance().setProgressLoader(false, false);\n\n }", "public LinearLayout getHeaderLayout() {\n return mHeaderLayout;\n }", "public int addHeaderView(View header) {\n return addHeaderView(header, -1);\n }", "private void loadNavHeader() {\n // name, website\n txtName.setText(StoreData.LoadString(Constants.NAME,\"Anonymous\",getApplicationContext()));\n txtWebsite.setText(StoreData.LoadString(Constants.EMAIL,\"anonymous\",getApplicationContext()));\n urlProfileImg = StoreData.LoadString(Constants.IMGURL,\"\",getApplicationContext());\n // loading header background image\n Glide.with(this).load(urlNavHeaderBg)\n .crossFade()\n .diskCacheStrategy(DiskCacheStrategy.ALL)\n .into(imgNavHeaderBg);\n\n // Loading profile image\n Glide.with(this).load(urlProfileImg)\n .crossFade()\n .placeholder(R.drawable.anonymous_profile_pic)\n .error(R.drawable.anonymous_profile_pic)\n .thumbnail(0.5f)\n .bitmapTransform(new CircleTransform(this))\n .diskCacheStrategy(DiskCacheStrategy.ALL)\n .into(imgProfile);\n\n // showing dot next to notifications label\n navigationView.getMenu().getItem(3).setActionView(R.layout.menu_dot);\n }", "PageHeader getPageHeader();", "PageHeader getPageHeader();", "TextView getSubTitleView();", "public WebElement headerDiv() {\r\n return driver.findElement(By.id(\"header\"));\r\n }", "private int getHeaderViewPosition() {\n if (getEmptyViewCount() == 1) {\n if (mHeadAndEmptyEnable) {\n return 0;\n }\n } else {\n return 0;\n }\n return -1;\n }", "public interface HanIHeaderViewPagerFragment extends HanIViewPagerFragment {\n int getHeaderLayout();\n\n ViewGroup createTabView();\n}", "private void init() {\n headerViewLeftView = findViewById(R.id.headerViewLeftView);\n ivHeaderViewLeft = findViewById(R.id.ivHeaderViewLeft);\n tvHeaderViewLeft = findViewById(R.id.tvHeaderViewLeft);\n\n headerViewRightView = findViewById(R.id.headerViewRightView);\n ivHeaderViewRight = findViewById(R.id.ivHeaderViewRight);\n tvHeaderViewRight = findViewById(R.id.tvHeaderViewRight);\n\n tvHeaderViewTitle = findViewById(R.id.tvHeaderViewTitle);\n headerViewLineAtBottom = findViewById(R.id.headerViewLineAtBottom);\n\n headerViewLeftView.setOnClickListener(new OnClickListener() {\n @Override\n public void onClick(View v) {\n MKeyboardUtil.hideKeyboard(v);\n HActivity.finishActivity(getContext());\n }\n });\n// addView(headerView);\n }", "@Override\n public void addHeaderView(View v) {\n if (mHeaderFooterHelper == null)\n mHeaderFooterHelper = new HeaderFooterHelper();\n int headerSize = getHeaderSize();\n mHeaderFooterHelper.addHeaderView(v);\n notifyItemInserted(headerSize);\n }", "private ULCContainer getHeaderPane() {\n if (headerPane == null) {\n headerPane = RichDialogPanelFactory.create(TabHeaderBarPanel.class);\n headerPane.setName(\"headerPane\");\n }\n return headerPane;\n }", "TextView getTitleView();", "private HorizontalLayout getHeader() {\n HorizontalLayout header = new HorizontalLayout();\n header.setWidth(\"100%\");\n header.setHeight(\"100px\");\n // TODO move this into a separate HeaderView class\n header.addComponent(new Label(\"Patient Management System Team Green\"));\n return header;\n }", "private void navigationViewHandler(NavigationView navigationView) {\n View headerView = navigationView.getHeaderView(0);\n if (headerView != null) {\n circleImgViewProfilePic = (CircleImageView) headerView.findViewById(R.id.circleImgViewProfilePic);\n circleImgViewCamera = (CircleImageView) headerView.findViewById(R.id.circleImgViewCamera);\n TextView txtUserFullName = (TextView) headerView.findViewById(R.id.txtUserFullName);\n setProfilePic(circleImgViewProfilePic, null);\n\n circleImgViewCamera.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n profilePicImageChooser();\n }\n });\n\n txtUserFullName.setText(userProfile.getFirstName() + \" \" + userProfile.getLastName());\n }\n }", "void onHeaderClicked(RowHeaderPresenter.ViewHolder viewHolder, Row row);", "View getHeader(int groupIndex, View convertView, ViewGroup parent);", "HeadViewHolder(View itemView) {\n super(itemView);\n viewPager = itemView.findViewById(R.id.viewPager);\n// rbContinuous = itemView.findViewById(R.id.rb_continuous);\n// rbDaily = itemView.findViewById(R.id.rb_daily);\n// layoutStyle = itemView.findViewById(R.id.layout_style);\n// tvAdd = itemView.findViewById(R.id.tv_add);\n }", "public void setHeaderView(LinearLayout headerView) {\r\n\t\tthis.headerView = headerView;\r\n\t}", "public interface OnHeaderRefreshListener\n\t{\n\n\t\tpublic void onHeaderRefresh(PullToRefreshView view);\n\t}", "void onHeaderSelected(RowHeaderPresenter.ViewHolder viewHolder, Row row);", "public HomeViewHolder(@NonNull View itemView) {\n super(itemView);\n //itemView.findViewById(R.id.fl_rvitem_homeview1);\n // itemView.findViewById(R.id.fl_rvitem_homeview2);\n }", "@Override\n\tpublic void onNaviViewLoaded() {\n\t\t\n\t}", "public String getHeader() {\n\t\tString item_text = getQuantityString(getCount());\n\t\tString header = getActivity().getString(R.string.browse_items_text, item_text, getCount());\n\t\treturn header;\n\t}", "public void onDrawerOpened(View drawerView) {\n super.onDrawerOpened(drawerView);\n // Do whatever you want here\n String name = null;\n if (((Application) getApplication()).getAuthUser() != null\n && (name = ((Application) getApplication()).getAuthUser().getName()) != null) {\n// textViewHeader = (TextView) binding.navigationView.getHeaderView(0).findViewById(R.id.welcome_textview);\n// textViewHeader = (TextView) binding.welcomeTextview;\n if (name.contains(\" \")) {\n name = name.substring(0, name.indexOf(\" \"));\n }\n binding.welcomeTextview.setText(getString(R.string.welcome_user, name));\n }\n\n\n }", "public void removeHeaderView(View header) {\n if (getHeaderLayoutCount() == 0) return;\n\n mHeaderLayout.removeView(header);\n if (mHeaderLayout.getChildCount() == 0) {\n int position = getHeaderViewPosition();\n if (position != -1) {\n notifyItemRemoved(position);\n }\n }\n }", "private void initDrawerView() {\n toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);\n drawer.addDrawerListener(toggle);\n toggle.setHomeAsUpIndicator(R.drawable.ic_menu_drawer);\n toggle.syncState();\n\n navigationView = findViewById(R.id.nav_view);\n navigationView.setNavigationItemSelectedListener(this);\n navigationView.inflateHeaderView(R.layout.nav_header_main_loged);\n navigationView.inflateHeaderView(R.layout.nav_header_main);\n txt_user_email = navigationView.getHeaderView(0).findViewById(R.id.txt_user_email);\n txt_user_name = navigationView.getHeaderView(0).findViewById(R.id.txt_user_name);\n btn_sign_up = navigationView.getHeaderView(1).findViewById(R.id.btn_sign_up);\n btn_log_in = navigationView.getHeaderView(1).findViewById(R.id.btn_log_in);\n drawViewSideMenu();\n }", "@VisibleForTesting\n public View.OnClickListener getHeaderIconListener() {\n return new View.OnClickListener() {\n /* class com.android.settings.panel.$$Lambda$PanelFragment$N3DMhbGuDEaImQpPovL7Ug2k3kc */\n\n public final void onClick(View view) {\n PanelFragment.this.lambda$getHeaderIconListener$6$PanelFragment(view);\n }\n };\n }", "private void drawHeader(Canvas c, View child, View headerView) {\n trace();\n c.save();\n if (sticky) {\n log(\"draw sticky header\");\n c.translate(0, Math.max(0, child.getTop() - headerView.getHeight()));\n } else {\n log(\"draw no sticky header\");\n c.translate(0, child.getTop() - headerView.getHeight());\n }\n headerView.draw(c);\n c.restore();\n }", "public std_msgs.msg.dds.Header getHeader()\n {\n return header_;\n }", "@Override\n protected void bindSectionHeader(View view, int position, boolean displaySectionHeader) {\n if (displaySectionHeader) {\n view.findViewById(R.id.section_header).setVisibility(View.VISIBLE);\n TextView lSectionTitle = (TextView) view.findViewById(R.id.section_header);\n lSectionTitle.setText(\"\" + getSections()[getSectionForPosition(position)]);\n } else {\n view.findViewById(R.id.section_header).setVisibility(View.GONE);\n }\n }", "public Object getHeader() {\n return header;\n }", "@Override\n public int getItemCount() {\n return mNavTitles.length+1; // the number of items in the list will be +1 the titles including the header view.\n }", "public void onHeaderRefresing();", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n // Inflate the layout for this fragment\n ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_header, null);\n\n // Getting text view\n headerTextView = root.findViewById(R.id.headerTextView);\n headerTextView.append(headerText);\n return root;\n }", "public /* synthetic */ void lambda$getHeaderIconListener$6$PanelFragment(View view) {\n getActivity().startActivity(this.mPanel.getHeaderIconIntent());\n }", "private void loadNavHeader() {\n SharedPreferences prefs = getSharedPreferences(LOG_IN_PREFS_NAME, MODE_PRIVATE);\n userName = prefs.getString(\"userName\", \"No token generated\");\n userEmail = prefs.getString(\"email\", \"No token generated\");\n userAvatarName = prefs.getInt(\"userAvatar\", 0);\n\n // name, email, profileImage\n navHeaderUserName.setText(userName);\n navHeaderUserEmail.setText(userEmail);\n imgNavHeaderProfile.setImageResource(ProfileImageAssets.getProfileImages().get(userAvatarName));\n\n }", "public void setHeader() {\n tvHeader.setText(getResources().getString(R.string.text_skill));\n tvDots.setVisibility(View.INVISIBLE);\n }", "private void setUpNavigationView() {\n navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {\n\n // This method will trigger on item Click of navigation menu\n @Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n\n //Check to see which item was being clicked and perform appropriate action\n switch (menuItem.getItemId()) {\n\n case R.id.nav_home:\n navItemIndex = 0;\n CURRENT_TAG = TAG_HOME;\n break;\n case R.id.nav_movies:\n navItemIndex = 1;\n CURRENT_TAG = GIVE_ASSIGNMENT;\n break;\n case R.id.nav_result:\n navItemIndex = 2;\n CURRENT_TAG = TAG_RESUlT;\n break;\n case R.id.nav_chat:\n navItemIndex = 3;\n CURRENT_TAG = CHAT;\n break;\n case R.id.nav_notifications:\n navItemIndex = 4;\n CURRENT_TAG = Profile;\n break;\n\n default:\n navItemIndex = 0;\n }\n\n //Checking if the item is in checked state or not, if not make it in checked state\n if (menuItem.isChecked()) {\n menuItem.setChecked(false);\n } else {\n menuItem.setChecked(true);\n }\n menuItem.setChecked(true);\n\n loadHomeFragment();\n\n return true;\n }\n });\n\n\n ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.openDrawer, R.string.closeDrawer) {\n\n @Override\n public void onDrawerClosed(View drawerView) {\n // Code here will be triggered once the drawer closes as we dont want anything to happen so we leave this blank\n super.onDrawerClosed(drawerView);\n }\n\n @Override\n public void onDrawerOpened(View drawerView) {\n // Code here will be triggered once the drawer open as we dont want anything to happen so we leave this blank\n super.onDrawerOpened(drawerView);\n }\n };\n\n //Setting the actionbarToggle to drawer layout\n drawer.setDrawerListener(actionBarDrawerToggle);\n\n //calling sync state is necessary or else your hamburger icon wont show up\n actionBarDrawerToggle.syncState();\n }", "private void buildHeader(Layout parent) {\n\n }", "@Override\n protected void convertHead(BaseViewHolder helper, MySectionEntity item) {\n helper.setText(R.id.tv_headTitle, item.header);\n }", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.side_drawer, menu);\r\n //navigationView.getHeaderView(0).findViewById(R.id.nav_scores);\r\n\r\n return true;\r\n }", "com.didiyun.base.v1.Header getHeader();", "public void configurePinnedHeader(View header, int position, int alpha) {\n\t\t PinnedHeaderCache cache = (PinnedHeaderCache) header.getTag();\n\t\n\t\t if (cache == null) {\n\t\t cache = new PinnedHeaderCache();\n\t\t cache.titleView = (TextView) header.findViewById(R.id.header_text);\n\t\t cache.textColor = cache.titleView.getTextColors();\n\t\t cache.background = header.getBackground();\n\t\t header.setTag(cache);\n\t\t }\n\t\t\n\t\t int section = getSectionForPosition(position);\n\t\t \n\t\t if (section != -1) {\n\t\t\t String title = (String) mIndexer.getSections()[section];\n\t\t\t cache.titleView.setText(title);\n\t\t\t\n\t\t\t if (alpha == 255) {\n\t\t\t // Opaque: use the default background, and the original text color\n\t\t\t header.setBackgroundDrawable(cache.background);\n\t\t\t cache.titleView.setTextColor(cache.textColor);\n\t\t\t } else {\n\t\t\t // Faded: use a solid color approximation of the background, and\n\t\t\t // a translucent text color\n\t\t\t \tfinal int diffAlpha = 255 - alpha;\n\t\t\t \tfinal int red = Color.red(mPinnedHeaderBackgroundColor);\n\t\t\t \tfinal int diffRed = 255 - red;\n\t\t\t \tfinal int green = Color.green(mPinnedHeaderBackgroundColor);\n\t\t\t \tfinal int diffGreen = 255 - green;\n\t\t\t \tfinal int blue = Color.blue(mPinnedHeaderBackgroundColor);\n\t\t\t \tfinal int diffBlue = 255 - blue;\n\t\t\t header.setBackgroundColor(Color.rgb(\n\t\t\t \t\tred + (diffRed * diffAlpha / 255),\n\t\t\t \t\tgreen + (diffGreen * diffAlpha / 255),\n\t\t\t \t\tblue + (diffBlue * diffAlpha / 255)));\n\t\t\t\n\t\t\t int textColor = cache.textColor.getDefaultColor();\n\t\t\t cache.titleView.setTextColor(Color.argb(alpha,\n\t\t\t Color.red(textColor), Color.green(textColor), Color.blue(textColor)));\n\t\t\t }\n\t\t }\n\t\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_navigation, container, false);\n mTabLayout = view.findViewById(R.id.navigation_tab_layout);\n mRecyclerView = view.findViewById(R.id.navigation_RecyclerView);\n tvTitlecontent=view.findViewById(R.id.tv_titlecontent);\n tvTitlecontent.setText(\"导航\");\n return view;\n }", "public NavigationController getNavigationController();", "@Override\n public AbstractViewHolder onCreateColumnHeaderViewHolder(ViewGroup parent, int viewType) {\n View layout = mInflater.inflate(R.layout.table_view_column_header_layout, parent, false);\n\n // Create a ColumnHeader ViewHolder\n return new ColumnHeaderViewHolder(layout, getTableView()); }", "private void setBottomSheetHeader(View child) {\n if (child instanceof BottomSheetBehaviorView) {\n View view = child.findViewWithTag(BottomSheetHeaderView.TAG);\n if (view != null && view instanceof BottomSheetHeaderView) {\n BottomSheetBehaviorView b = (BottomSheetBehaviorView) child;\n RNBottomSheetBehavior behavior = b.behavior;\n headerView = (BottomSheetHeaderView) view;\n headerView.registerFields();\n headerView.toggle(behavior.getState() == RNBottomSheetBehavior.STATE_COLLAPSED);\n behavior.setHeader(headerView);\n }\n }\n }", "public int getTitleViewId() {\n return R.id.tv_title;\n }", "public String getbyHeader(){\n String byHed=driver.findElement(byHeader).getText();\n return byHed;\n }", "@Override\n public void onBindViewHolder(MyAdapter.ViewHolder holder, final int position) {\n if(holder.Holderid ==1) { // as the list view is going to be called after the header view so we decrement the\n // position by 1 and pass it to the holder while setting the text and image\n holder.textView.setText(mNavTitles[position - 1]); // Setting the Text with the array of our Titles\n holder.imageView.setImageResource(mIcons[position -1]);// Settimg the image with array of our icons\n }\n else{\n\n holder.profile11.setImageBitmap(bitmap1); // Similarly we set the resources for header view\n holder.Name.setText(name);\n holder.email.setText(email);\n\n }\n\n }", "private void initView(){\n backBtn = (Button)findViewById(R.id.header_bar_btn_back);\n titleTv = (TextView)findViewById(R.id.header_bar_tv_title);\n confirmBtn = (Button)findViewById(R.id.header_bar_btn_add);\n }", "public HeaderFragment() {}", "private void validatedHeader() {\n\t\tif(loginView != null){\n\t\t\tLabel greeting = new Label(T.get(\"LABEL_TOP_BAR_GREETING\") + T.get(\"LABEL_GUEST_USER\"));\n\t\t\tLanguageSelector languageSelector = new LanguageSelector(loginView);\n\t\t\tThemeSelector themeSelector = new ThemeSelector();\n\t\t\tbuildHeader(greeting ,null, languageSelector, themeSelector);\n\t\t}\n\t\telse if(registerView != null){\n\t\t\tLabel greeting = new Label(T.get(\"LABEL_TOP_BAR_GREETING\") + T.get(\"LABEL_GUEST_USER\"));\n\t\t\tLanguageSelector languageSelector = new LanguageSelector(registerView);\n\t\t\tThemeSelector themeSelector = new ThemeSelector();\n\t\t\tbuildHeader(greeting ,null, languageSelector, themeSelector);\n\t\t}\n\t\telse if(mainView != null){\n\t\t\tString username = UI.getCurrent().getSession().getAttribute(T.system(\"SESSION_NAME\")).toString();\n\t\t\tLabel greeting = new Label(T.get(\"LABEL_TOP_BAR_GREETING\") + username);\n\t\t\tLanguageSelector languageSelector = new LanguageSelector(mainView);\n\t\t\tThemeSelector themeSelector = new ThemeSelector();\n\t\t\tLogoutButton logout = new LogoutButton();\n\t\t\tbuildHeader(greeting ,logout, languageSelector, themeSelector);\n\t\t}\n\t\tsetStyleName(T.system(\"STYLE_VIEW_TOP_BAR\"));\n\t}", "public View initTopView() {\n return null;\n }", "@Override\n\tpublic int getViewType() {\n\t\treturn RowType.HEADER_ITEM.ordinal();\n\t}", "@Override\n public void onDrawerOpened(View drawerView) {\n }", "String getHeader(String headerName);", "@Override\n public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {\n if (holder instanceof LoadingViewHolder) {\n LoadingViewHolder loadingViewHolder = (LoadingViewHolder) holder;\n if ( loadingViewHolder.loading_progressbar !=null) {\n loadingViewHolder.loading_progressbar.setIndeterminate(true);\n }\n }else if (holder instanceof HeaderViewHolder){\n onCreateHeaderView(holder,position);\n }else {\n if (addedHeader()){\n onCreateMainView(holder,position -1);\n }else {\n onCreateMainView(holder, position);\n }\n }\n\n\n }", "@Override\n public final void onBindViewHolder(AbsViewHolder viewHolder, int position) {\n int hCount = getHeaderCount();\n if (position < hCount) {\n onBindHeaderView(position, viewHolder.itemView);\n } else if (position >= hCount && position < hCount + getCount()) {\n int pos = position - hCount;\n viewHolder.setItemPosition(position - hCount);\n onBindItemViewHolder(viewHolder, getItem(pos), pos, position);\n }\n }", "public interface BaseHeaderOperator {\n View addLeftHeader(ViewGroup llLeftHeader);\n View addRightHeader(ViewGroup llRightHeader);\n void setDefaultLeftHeader();\n}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View layout = inflater.inflate(R.layout.fragment_navigation_drawer, container, false);\n recyclerView = (RecyclerView) layout.findViewById(R.id.recycler_view);\n adaptor = new NavigationRecyclerAdapter(getActivity(), getData());\n recyclerView.setAdapter(adaptor);\n recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));\n\n LinearLayout homeContainer = (LinearLayout) layout.findViewById(R.id.home_container_nav_drawer);\n homeContainer.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n if (getActivity().getClass() != HomeActivity.class) {\n Intent intent = new Intent(getActivity(), HomeActivity.class);\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n startActivity(intent);\n }\n }\n });\n\n LinearLayout contactContainer = (LinearLayout) layout.findViewById(R.id.contact_us_container_nav_drawer);\n contactContainer.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n startActivity(new Intent(getActivity(), ContactUsActivity.class));\n }\n });\n\n return layout;\n }", "public interface TitleBarView {\n\n public Activity getOutActivity();\n\n public void initBackBtnWithBackgroundImage(int res);\n\n public void initTitleText(String titleText);\n\n public void initTitleBarWithBackgroundImage(int resImg);\n\n public void initTitleBarWithBackgroundColor(int resColor);\n\n public void initRightText(String rightText);\n\n public void initRightImage(int resImg);\n\n}", "public Class<?> header() {\n return header;\n }", "protected abstract @LayoutRes\n int setNavigationDrawerContainer();", "public interface HeaderData extends StickyMainData {\n @LayoutRes\n int getHeaderLayout();\n\n int getHeaderType();\n}", "public String getHeader() {\n\t\tif (null != this.header) {\n\t\t\treturn this.header;\n\t\t}\n\t\tValueExpression _ve = getValueExpression(\"header\");\n\t\tif (_ve != null) {\n\t\t\treturn (String) _ve.getValue(getFacesContext().getELContext());\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}", "@Override\n public boolean onTouch(View v, MotionEvent event) {\n if(event.getY() < header.getHeight()\n && listen != null)\n {\n listen.onHeaderClicked( HeaderListView.this );\n return true;\n }\n\n // handle touch normally\n else\n return onTouchEvent(event);\n }", "private org.gwtbootstrap3.client.ui.NavbarHeader get_f_NavbarHeader5() {\n return build_f_NavbarHeader5();\n }", "public String getHeader()\r\n\t{\r\n\t\treturn header;\r\n\t}", "@Override\n public RaftNode getHeader() {\n return allNodes.getHeader();\n }", "public void removeAllHeaderView() {\n if (getHeaderLayoutCount() == 0) return;\n\n mHeaderLayout.removeAllViews();\n int position = getHeaderViewPosition();\n if (position != -1) {\n notifyItemRemoved(position);\n }\n }", "@Override\n\tprotected void onRefresh(View pullHeaderView) {\n\t\t\n\t}", "public Header getHeader() {\n\t\treturn this.header;\n\t}", "@Override\n\tprotected String getHeaderTitle() {\n\t\treturn \"\";\n\t}", "public Header getRequestHeader(String headerName) {\n if (headerName == null) {\n return null;\n } else {\n return getRequestHeaderGroup().getCondensedHeader(headerName);\n }\n }", "@Override\n public void onDrawerOpened(View drawerView) {\n }", "public HeaderViewHolder(MyAdapter myAdapter) {\n super(myAdapter, R.layout.head_delivered_orders);\n ButterKnife.bind(this, itemView);\n pbProcessing.setVisibility(View.GONE);\n }", "@Override\n public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n\n if (viewType == TYPE_ITEM) {\n View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_row,parent,false); //Inflating the layout\n\n ViewHolder vhItem = new ViewHolder(v,viewType); //Creating ViewHolder and passing the object of type view\n\n return vhItem; // Returning the created object\n\n //inflate your layout and pass it to view holder\n\n } else if (viewType == TYPE_HEADER) {\n\n View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.header,parent,false); //Inflating the layout\n\n ViewHolder vhHeader = new ViewHolder(v,viewType); //Creating ViewHolder and passing the object of type view\n\n return vhHeader; //returning the object created\n\n\n }\n return null;\n\n }", "int getItemViewLayoutId();", "public String getHeader() {\n\t\treturn _header;\n\t}", "private void setupDrawerContent() {\n previousMenuItem = navigationView.getMenu().findItem(R.id.nav_category);\n previousMenuItem.setChecked(true);\n previousMenuItem.setCheckable(true);\n\n navigationView.setNavigationItemSelectedListener(\n new NavigationView.OnNavigationItemSelectedListener() {\n @Override\n public boolean onNavigationItemSelected(MenuItem menuItem) {\n\n drawerLayout.closeDrawer(Gravity.LEFT);\n\n if (previousMenuItem.getItemId() == menuItem.getItemId())\n return true;\n\n menuItem.setCheckable(true);\n menuItem.setChecked(true);\n previousMenuItem.setChecked(false);\n previousMenuItem = menuItem;\n\n switch (menuItem.getItemId()) {\n case R.id.nav_category:\n displayView(CATEGORIES_FRAG, null);\n break;\n case R.id.nav_favorites:\n displayView(FAVORITE_FRAG, null);\n break;\n case R.id.nav_reminder:\n displayView(REMINDER_FRAG, null);\n break;\n case R.id.nav_about:\n displayView(ABOUT_FRAG, null);\n break;\n case R.id.nav_feedback:\n IntentHelper.sendEmail(BaseDrawerActivity.this);\n break;\n case R.id.nav_rate_us:\n IntentHelper.voteForAppInBazaar(BaseDrawerActivity.this);\n break;\n case R.id.nav_settings:\n displayView(SETTINGS_FRAG, null);\n break;\n\n }\n\n\n return true;\n }\n }\n\n );\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_detail_list_news, container, false);\n imgDetail = view.findViewById(R.id.imgNews);\n txtTitle = view.findViewById(R.id.txtTitleNews);\n txtDesc = view.findViewById(R.id.txtDesc);\n navController = Navigation.findNavController(getActivity(), R.id.my_nav_host_fragment);\n return view;\n }", "public VCFHeader getHeader();", "private void Inicializar(){\n fragment=null;\n drawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout);\n navigationView=(NavigationView)findViewById(R.id.navview);\n hView = navigationView.getHeaderView(0);\n txtCorreoHeader=(TextView) hView.findViewById(R.id.txtCorreoHeader);\n ImgPerfilMenu=(ImageView)hView.findViewById(R.id.ImgPerfilMenu);\n }", "@Override\n public ElementHeader getElementHeader()\n {\n return elementHeader;\n }", "protected void onCreateDrawer() {\n toolbar = (Toolbar) findViewById(R.id.tool_bar);\n setSupportActionBar(toolbar);\n\n //Initializing NavigationView\n navigationView = (NavigationView) findViewById(R.id.navigation_view);\n\n navigationView.setNavigationItemSelectedListener(new NavigationViewItemListener());\n\n // Initializing Drawer Layout and ActionBarToggle\n drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);\n actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open_drawer, R.string.close_drawer){\n\n @Override\n public void onDrawerClosed(View drawerView) {\n // Code here will be triggered once the drawer closes as we don't want anything to happen so we leave this blank\n super.onDrawerClosed(drawerView);\n }\n\n @Override\n public void onDrawerOpened(View drawerView) {\n // Code here will be triggered once the drawer open as we don't want anything to happen so we leave this blank\n super.onDrawerOpened(drawerView);\n }\n };\n\n //Setting the actionbarToggle to drawer layout\n drawerLayout.addDrawerListener(actionBarDrawerToggle);\n\n //calling sync state is necessary or else your hamburger icon wont show up\n actionBarDrawerToggle.syncState();\n\n UpdateHeader(this, navigationView);\n\n if (YummySession.selectedItemPosition != -1) {\n navigationView.getMenu().getItem(YummySession.selectedItemPosition).setChecked(true);\n }\n\n }", "@Override\n\tpublic void onBannerCollapsed(MoPubView arg0) {\n\t\t\n\t}", "private void premium_ui_BriefingHeader(RecyclerView.ViewHolder viewHolder, ArticleBean bean) {\n BriefingHeaderViewHolder holder = (BriefingHeaderViewHolder) viewHolder;\n holder.userName_Txt.setText(bean.getTitle());\n if (mFrom.equalsIgnoreCase(NetConstants.API_Mystories)) {\n holder.yourEditionFor_Txt.setText(bean.getSectionName());\n holder.yourEditionFor_Txt.setVisibility(View.VISIBLE);\n holder.editionBtn_Txt.setVisibility(View.GONE);\n } else if (mFrom.equalsIgnoreCase(NetConstants.BREIFING_ALL) || mFrom.equalsIgnoreCase(NetConstants.BREIFING_MORNING)\n || mFrom.equalsIgnoreCase(NetConstants.BREIFING_NOON) || mFrom.equalsIgnoreCase(NetConstants.BREIFING_EVENING)) {\n holder.editionBtn_Txt.setText(bean.getSectionName());\n holder.editionBtn_Txt.setVisibility(View.VISIBLE);\n holder.yourEditionFor_Txt.setVisibility(View.VISIBLE);\n holder.yourEditionFor_Txt.setText(\"Today's Briefing\");\n } else if (mFrom.equalsIgnoreCase(NetConstants.API_suggested)) {\n holder.yourEditionFor_Txt.setText(bean.getSectionName());\n holder.yourEditionFor_Txt.setVisibility(View.VISIBLE);\n holder.editionBtn_Txt.setVisibility(View.GONE);\n }\n\n boolean isDayTheme = DefaultPref.getInstance(holder.editionBtn_Txt.getContext()).isUserThemeDay();\n if (isDayTheme) {\n holder.editionBtn_Txt.setCompoundDrawablesWithIntrinsicBounds(null, null,\n ResUtil.getBackgroundDrawable(holder.editionBtn_Txt.getContext().getResources(), R.drawable.ic_edition_dropdown), null);\n } else {\n holder.editionBtn_Txt.setCompoundDrawablesWithIntrinsicBounds(null, null,\n ResUtil.getBackgroundDrawable(holder.editionBtn_Txt.getContext().getResources(), R.drawable.ic_edition_dropdown_white), null);\n }\n\n holder.editionBtn_Txt.setOnClickListener(v -> {\n if (mOnEditionBtnClickListener != null) {\n mOnEditionBtnClickListener.OnEditionBtnClickListener();\n }\n });\n\n }", "public String getHeader() {\n return header;\n }", "public String getHeader() {\n return header;\n }", "public View getTopView() {\n\t\tint topViewIndex = getChildCount() - 1;\n\t\treturn getChildAt(topViewIndex);\n\t}" ]
[ "0.6666111", "0.65741724", "0.6506904", "0.64844435", "0.6462594", "0.6310649", "0.6220674", "0.6178627", "0.6170522", "0.6027194", "0.6005131", "0.5950561", "0.5950561", "0.5892331", "0.58745706", "0.5866149", "0.5861545", "0.5853903", "0.58501893", "0.5849567", "0.5846949", "0.583204", "0.57679987", "0.5732292", "0.57148093", "0.57043225", "0.56807363", "0.56652206", "0.56647784", "0.56628656", "0.5605693", "0.559716", "0.5583542", "0.5580299", "0.55712986", "0.54881346", "0.5478875", "0.5463544", "0.54598784", "0.5458865", "0.54574466", "0.5450808", "0.54327", "0.5430429", "0.54225165", "0.5416853", "0.5380773", "0.53758156", "0.5372319", "0.5372301", "0.53614897", "0.5359762", "0.5349033", "0.5348099", "0.53435475", "0.53324914", "0.5317931", "0.5315466", "0.53146666", "0.5312953", "0.53085184", "0.53085047", "0.5284151", "0.5282641", "0.5275946", "0.5259934", "0.52549994", "0.5252058", "0.52408206", "0.5239562", "0.5223512", "0.521762", "0.52083415", "0.5198398", "0.5193889", "0.51927674", "0.51925755", "0.5191613", "0.51836115", "0.5180106", "0.51777947", "0.51755893", "0.51674604", "0.5164668", "0.5161046", "0.5158977", "0.5144197", "0.5141808", "0.5137323", "0.5135823", "0.5118299", "0.51179385", "0.51081955", "0.51023066", "0.5102142", "0.51010704", "0.5096378", "0.5094847", "0.5094847", "0.50930727" ]
0.58878374
14
Add a pixel to the component
public void accumulate(IntValuePixel p) { size++; for (final ComponentFeature f : features) { f.addSample(p); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void addPixel(int x, int y, byte colour) {\n pixelBuffer[x][y] = colour;\n dirtyPixels.add(new byte[]{((byte) x), ((byte) y)});\n }", "public abstract void putPixelRgb(int x, int y, RGBPixel p);", "public abstract void addComponent(DrawingComponent component);", "public void addPixel(int index, TokenizedPixel pixel) {\n\t\tthis.pixelList.add(index, pixel);\n\t}", "public void addPixel(Pixel pix) throws DuplicatedKeyException {\n\t\tbst.put(bst.getRoot(), pix);\n\t}", "public void drawPixel(int x, int y, int color);", "public void addpixeltoPanel() {\n for (int i = 0; i < 100; i++) {\r\n arrangex();\r\n arrangey();\r\n pixellist.get(i).setBounds(x, y, 10, 10); //Sets Random X and Random Y coordinates\r\n\r\n }\r\n for (int i = 0; i < 100; i++) {\r\n this.add(pixellist.get(i)); //Adds pixel objects to panel\r\n this.pixellist.get(i).setVisible(true);\r\n }\r\n }", "public void addPixel(Pixel pix) throws DuplicatedKeyException {\n\t\t// Try to add the pixel\n\t\ttry {\n\t\t\tbst.put(bst.getRoot(), pix);\n\t\t} catch (Exception e) {\n\t\t\t// Throw an exception\n\t\t\tthrow new DuplicatedKeyException();\n\t\t}\n\t}", "public void updatePixel(int[] location, double[] parameters);", "public void setPixelX(int x) {\n // from AddEventHandler - leave empty\n }", "public void addImage(Image img, int x, int y) {\n\n\t}", "@Override\n public void setPixelRGB(int x, int y, int value) {\n debugView.setPixel(x, y, value);\n repaint();\n }", "void handlePixelStart(int x, int y, int color);", "private static void addBlockToPixa(Pixa pixa, int x, int y, int width, int height, int depth) {\n final Pix pix = new Pix(width, height, depth);\n final Box box = new Box(x, y, width, height);\n\n pixa.add(pix, box, Constants.L_COPY);\n\n pix.recycle();\n box.recycle();\n }", "public void addpixeltoList() {\n for (int i = 0; i < 100; i++) {\r\n pixellist.add(new humanpixel());\r\n }\r\n }", "@Override\n public void addRGB(float R, float G, float B) {\n\n }", "public void drawPixel(int x,int y, int rgbColor)\n {\n image.setRGB(x,y,rgbColor);\n }", "public void setPixel(int x, int y, Pixel p) {\n\t\tsource.setPixel(x + xOffset, y + yOffset, p);\n\t}", "public PixelSet(Pixel pixel) {\n\t\tthis.pixelSet = new LinkedHashSet<Pixel>();\n\t\tpixelSet.add(pixel);\n\t}", "@Override\n public void drawPixelMap(ImageData pixelMap, double x, double y) {\n graphicsEnvironmentImpl.putPixelMap(canvas, pixelMap, x, y);\n }", "private static void addShaped()\n {}", "private void paintPointInColor(int x, int y) {\n\t\traster.setDataElements(x, y, model.getDataElements(c.getRGB(), null));\t\t\n\t}", "public void add(Image img, Point higher, Point lower, int size) {\n int column = jumpCursor();\n set(img, cl, column, higher, lower, size);\n }", "public synchronized void addComponent(DrawableVector draw) {\n instructions.add(draw);\n }", "public void setPixel(int x, int y, Color color)\n\t{\n\t\tsetPixel(x, y, color, 1);\n\t}", "public void addIcon(Direction dir, Color clr){\r\n\t\t \r\n\t\t Graphics2D g = bufferedImage.createGraphics();\r\n\t\t BufferedImage imgPiece;\r\n\t\t File fileImg = new File(\"src/main/java/data/smallfollower_0.png\");\r\n\t \t try {\r\n\t\t\timgPiece = ImageIO.read(fileImg);\r\n\r\n\t\t\t Graphics2D g1 = imgPiece.createGraphics();\t\r\n\t\t\t for (int x = 0; x < imgPiece.getWidth(); x++) {\r\n\t\t\t\t for (int y = 0; y < imgPiece.getHeight(); y++) {\r\n\t\t\t\t\t int color = imgPiece.getRGB(x,y);\r\n\t\t\t\t\t if(color == -65281){\r\n\t\t\t\t\t\t g1.setColor(clr);\r\n\t\t\t\t\t\t g1.fillRect(x,y,1,1);\r\n\t\t\t\t\t }\r\n\t\t\t\t }\r\n\t\t\t }\r\n\t\t g.drawImage(imgPiece, getX(dir), getY(dir), 20, 20, null);\r\n\t\t }\r\n\t\t catch (IOException e) {\r\n\t\t }\r\n\t\t \r\n\t\t \r\n\t }", "public void setRaw(int x, int y, int color){\n pixels.putInt((x + y * width) * 4, color);\n }", "private void paintPoint(int x, int y, Color c) {\n\t\traster.setDataElements(x, y, model.getDataElements(c.getRGB(), null));\t\t\n\t}", "public static void putGraphicsPixel(int[] inputPixels, int inputWidth, int pixelRowStart, int pixelRowEnd,\n int pixelColStart, int pixelColEnd, int[] outputPixels) {\n int i = 0;\n for (int y = pixelRowStart; y < pixelRowEnd; y++) {\n for (int x = pixelColStart; x < pixelColEnd; x++) {\n int val = getXYCoord(inputPixels, x, y, inputWidth);\n if (val != -1) {\n outputPixels[i] = val;\n }\n i++;\n }\n }\n }", "void addTextureCoordinate(Vector t);", "private void paintPoint(int x, int y) {\n\t\traster.setDataElements(x, y, model.getDataElements(Color.BLACK.getRGB(), null));\t\t\n\t}", "public void setPixelY(int y) {\n // from AddEventHandler - leave empty\n }", "public void setPixels(int[] pix) {\n\t\t\tMemoryImageSource source = new MemoryImageSource(_width, _height, pix, 0, _width);\n\t\t\t_image = createImage(source);\n\t\t}", "public void addLayer(JComponent component, int layer, int xOrigin, int yOrigin){\n\t\tInteger depth = new Integer(layer);\n\t\tif(depth.compareTo(BG_DEPTH) <= 0)\n\t\t\tdepth = new Integer(BG_DEPTH + 1);\n\t\tcomponent.setBounds(xOrigin, yOrigin, component.getPreferredSize().width, component.getPreferredSize().height);\n\t\tcontentPane.add(component, depth);\n\t\tcomponent.setOpaque(false);\n\t\tcomponent.setVisible(true);\n\t\tcontentPane.revalidate();\n\t\tcontentPane.repaint();\n\t}", "void addComponent(Component component);", "public static void TurnOnPixel(Color c, int idPixel, String idLumio){\n IMqttClient publisher = Connections.connectPublisher();\n JSONObject json = new JSONObject();\n json.put(\"command\", \"set_pixel\");\n json.put(\"led\", idPixel);\n json.put(\"rgb\",c.getRGB());\n MqttMessage message = new MqttMessage();\n message.setPayload(json.toString().getBytes());\n try {\n publisher.publish(\"laumio/\"+idLumio+\"/json\",message);\n } catch (MqttException e) {\n e.printStackTrace();\n }\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\n\tpublic Picture paint(int x, int y, Pixel p) {\n\t\tif (p == this.value) {\n\t\t\t// no change\n\t\t\treturn this;\n\t\t}else {\n\t\t\t// if changed, it is not more a monochrome picture, so create a new object\n\t\t\tMutablePixelArrayPicture NewPicture = new MutablePixelArrayPicture(this.width, this.height, this.value);\t\n\t\t\t// paint on the new picture\n\t\t\tNewPicture.paint(x, y, p);\n\t\t\treturn NewPicture;\n\t\t}\n\t}", "@Override\r\n public void setPixel(int size, int x, int y, Color c) {\r\n int color = c.getRGB();\r\n\r\n for (int i = 0; i < size; i++) {\r\n for (int j = 0; j < size; j++) {\r\n canvas.setRGB(x + i, y + j, color);\r\n }\r\n }\r\n\r\n repaint();\r\n }", "@Override\n\tpublic void insertParam(int... params) {\n\t\tthis.x = params[0];\n\t\tthis.y = params[1];\n\t\tthis.l1 = params[2];\n\t\tthis.l2 = params[3];\n\t\tthis.color = new Color(params[4],params[5],params[6]);\n\t}", "public int addPicture(byte[] arg0, int arg1) {\n\t\treturn 0;\n\t}", "public void drawImage(float x, float y, float width, float height);", "public void render() { image.drawFromTopLeft(getX(), getY()); }", "public Pixel() {\r\n\t\t}", "public abstract void render(PixelImage canvas);", "public void addFilledComponent(JComponent component, int row, int col) {\n addComponent(component, row, col, C_WIDTH, C_HEIGHT, C_WEST, C_HORZ);\n }", "public void addElement(int x, int y, BoxContainer element){\n\t\t\tArrayList<Integer> coordinates = new ArrayList<Integer>();\n\t\t\tcoordinates.add(x);\n\t\t\tcoordinates.add(y);\n\t\t\tmap.put(coordinates, element);\n\t\t}", "private void addComponent(Component component, // the Component to add\n int row, // add Component at cell row 0..?\n int column, // add Component at cell column 0..?\n int width, // let the Component span this many cells wide\n int height) { // let the Component span this many cells high\n constraints.gridx = column; // store the four parameters in the constraints\n constraints.gridy = row;\n constraints.gridwidth = width;\n constraints.gridheight = height;\n layout.setConstraints(component, constraints); // set the constraints on the layout manager\n add(component); // before add the actual component to the Applet\n }", "void handlePixelEnd(int x, int y, int color);", "public void addComponent(Component c);", "public static void putGraphicsTile(int[] inputPixels, int tileRowStart, int tileCol, int[] outputPixels) {\n int j = 0;\n for (int row = 0; row < 8; row++) {\n for (int col = 0; col < 8; col++) {\n int pixelIndex = (tileRowStart * 8 * 512) + (row * 512) + (tileCol * 8) + col;\n outputPixels[pixelIndex] = inputPixels[j];\n j++;\n }\n }\n }", "public void add(Color rhs) {\n\t\tthis.r += rhs.r;\n\t\tthis.g += rhs.g;\n\t\tthis.b += rhs.b;\n\t}", "void setBlue(int x, int y, int value);", "private void addGraphicObject(GraphicObject g_obj, int x, int y) {\n\t\tg_obj.setFillColor(this.currentFillColor);\n g_obj.setStroke(this.currentStrokeColor, this.currentStrokeSize.getValue());\n\n\t\tthis.canvas.add(g_obj, x, y);\n\t}", "public void render () {\n image (img, xC, yC, xLength * getPixelSize(), yLength * getPixelSize());\n }", "@Override\r\n public void paintComponent(Graphics2D g) {\r\n g.drawImage(img, x, y, null);\r\n }", "public void addPoint(int x, int y) {\n\t\tshape.addPoint(x, y);\n\t}", "public Pixel(int red, int green, int blue)\r\n {\r\n this.red = Fixed(red);\r\n this.green = Fixed(green);\r\n this.blue = Fixed(blue);\r\n }", "public void setPixel(int var1, int var2, int var3) {\n if(var1 >= this.field_745 && var2 >= this.field_743 && var1 < this.field_746 && var2 < this.field_744) {\n this.pixels[var1 + var2 * this.field_723] = var3;\n }\n }", "@Override\n\tpublic Picture paint(int ax, int ay, int bx, int by, Pixel p) {\n\t\tif (p == this.value) {\n\t\t\t// no change\n\t\t\treturn this;\n\t\t}else {\n\t\t\t// if changed, it is not more a monochrome picture, so create a new object\n\t\t\tMutablePixelArrayPicture NewPicture = new MutablePixelArrayPicture(this.width, this.height, this.value);\n\t\t\tNewPicture.paint(ax, ay, bx, by, p);\n\t\t\treturn NewPicture;\n\t\t}\n\t}", "boolean canSetPixel();", "public void set(Image img, int line, int column, Point higher, Point lower, int size) {\n if (hasComponent(line, column)) {\n DisplayComponent dc = components[line][column];\n if (dc instanceof SpriteComponent) {\n SpriteComponent spritec = (SpriteComponent) components[line][column];\n spritec.set(img);\n } else {\n components[line][column] = new SpriteComponent(img, higher, lower, size);\n }\n } else {\n components[line][column] = new SpriteComponent(img, higher, lower, size);\n }\n\n repaint(column * fontSize, line * fontSize, size, size);\n }", "public void addNotify()\n {\n super.addNotify();\n\t\n ib = createImage(width,height);\n ig = ib.getGraphics(); \n }", "protected void registerTile(int x, int y) {}", "public Point2D addPoint(double x, double y);", "public void addPng(ImageView png){\n vertexImages.add(png);\n }", "@Action\n public void addPoint() { \n Point2D pt = randomPoint();\n PrimitiveGraphic bp = JGraphics.point(pt, RandomStyles.point());\n bp.setDefaultTooltip(\"<html><b>Point</b>: <i> \" + pt + \"</i>\");\n bp.setDragEnabled(true);\n root1.addGraphic(bp);\n }", "void setRed(int x, int y, int value);", "void setGreen(int x, int y, int value);", "public void place() {\n\t\tprocessing.image(Image, x, y);\n\t}", "@Override\n\t\tprotected void paintComponent(Graphics g) {\n\t\t\tint width = getWidth();\n\t\t\tint height = getHeight();\n\t\t\tint x = (width - icon.getIconWidth()) / 2;\n\t\t\tint y = icon.getIconHeight() / 2;\n\t\t\tg.setColor(Color.darkGray);\n\t\t\tg.fillRect(0, 0, width, height);\n\t\t\ticon.paintIcon(this, g, x, y);\n\t\t}", "void drawStuff () {drawStuff (img.getGraphics ());}", "@Override\n protected void putImageBuffer(BufferedImage input) \n {\n // Load data in. \n for (int y = 0; y < height; y++) \n {\n for (int x = 0; x < width; x++) \n {\n\t\tdouble h = getHeight(input, x, y);\n\t\tdouble du = 0;\n\t\tdouble dv = 0;\n\t\t\n\t\tif(x > 0)\n\t\t{\t\n\t\t du += h - getHeight(input, x-1, y);\n\t\t}\n\t\tif(x < width - 1)\n\t\t{\n\t\t du += getHeight(input, x+1, y) - h;\n\t\t}\n\t\tif(y > 0)\n\t\t{\n\t\t dv += h - getHeight(input, x , y-1);\n\t\t}\n\t\tif(y < height - 1)\n\t\t{\n\t\t dv += getHeight(input, x, y+1) - h;\n\t\t}\n\t\t\n\t\tdouble u = -du;\n\t\tdouble v = -dv;\n\t\tdouble w = 0.25;\n \n\t\tdouble n = Math.sqrt(u*u + v*v + w*w);\n\n byte a = (byte)(h * 255.0);\n byte r = (byte)((u / n + 1.0) / 2.0 * 255.0);\n byte g = (byte)((v / n + 1.0) / 2.0 * 255.0);\n byte b = (byte)((w / n + 1.0) / 2.0 * 255.0);\n \n int index = (x + y * allocatedWidth) * 4;\n pixelData.put(index++, r);\n pixelData.put(index++, g);\n pixelData.put(index++, b);\n pixelData.put(index , a);\n }\n }\n }", "public void setPixelLocation(Pixel pixelLocation) {\n\t\tthis._PixelLocation = pixelLocation;\n\t}", "@Override\n public Component addPin(Component component)\n {\n component.addFeature(new AddPinButtonFeature(this, component));\n return component;\n }", "private void fuzPixel(int rPix, int cPix, ImageArray iCopy){\n \n /*int rgb= currentIm.getPixel(rPix,cPix);\n double red= DM.getRed(rgb);\n double blue= DM.getBlue(rgb);\n double green= DM.getGreen(rgb);\n int alpha= DM.getAlpha(rgb);*/\n \n int rgb = 0;\n double red = 0.0;\n double blue = 0.0;\n double green = 0.0;\n int alpha = 0;\n \n for(int rr = rPix-1; rr < rPix+2; rr++){\n \n for(int cc = cPix-1; cc <cPix+2; cc++){\n rgb = currentIm.getPixel(rr,cc);\n red = red + DM.getRed(rgb);\n blue = blue + DM.getBlue(rgb);\n green = green + DM.getGreen(rgb);\n alpha= alpha + DM.getAlpha(rgb);\n \n }\n \n }\n \n red = red/9;\n blue = blue/9;\n green = green/9;\n \n iCopy.setPixel(rPix, cPix,\n (alpha << 24) | ((int)red << 16) | ((int)green << 8) | \n (int)blue);\n }", "public void add(Coord c){\r\n\t\tcoords.add(c);\r\n\t}", "public void infectfirstpixel() {\r\n randompixel = r.nextInt(100);\r\n pixellist.get(randompixel).setBackground(Color.red);\r\n count++;\r\n storage.add(randompixel);\r\n\r\n }", "public void addPoint() {\n points += 1;\n }", "public void\r UpdatePixmap(CType display_context, ILPix_t pixmap,\r int x_offset, int y_offset, int width, int height);", "public void setPixel(int x, int y, int iArray[], DataBuffer data) {\n if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) {\n throw new ArrayIndexOutOfBoundsException(\"Coordinate out of bounds!\");\n }\n int pixelOffset = y * scanlineStride + x * pixelStride;\n for (int i = 0; i < numBands; i++) {\n data.setElem(bankIndices[i], pixelOffset + bandOffsets[i], iArray[i]);\n }\n }", "public Pixel(int x, int y) {\n super(x, y);\n }", "public void blitPixel(int x, int y, int color)\n {\n if (x < 0 || x > width - 1 || y < 0 || y >= height - 1)\n return;\n if (((color >> 24) & 0xFF) == 255)\n {\n data[y * width + x] = color;\n } else if (((color >> 24) & 0xFF) > 0)\n {\n data[y * width + x] = Color.tint(data[y * width + x], color);\n }\n }", "public void addObstacle(Coord obstacleCoord);", "public void set(int x, int y, int color){\n if(in(x, y)){\n pixels.putInt((x + y * width) * 4, color);\n }\n }", "public void draw(){\n StdDraw.picture(this.xCoordinate,this.yCoordinate,this.img);\n }", "public void add(Picture picture, int row, int column) \n {\n // Increase the size of the arrays to make room for the new picture\n // First create a new array with one more space\n Picture[] newPictures = new Picture[numPics + 1];\n int[][] newOffsets = new int[numPics + 1][2];\n \n // Read the array of pictures and offsets into the new arrays\n for (int i = 0 ; i < numPics; i++)\n {\n newPictures[i] = pictures[i];\n newOffsets[i] = offsets[i];\n }\n \n // Set the arrays to their respective new arrays, and add the new picture\n pictures = newPictures;\n offsets = newOffsets;\n pictures[numPics] = picture;\n offsets[numPics][0] = row;\n offsets[numPics][1] = column;\n \n // Calculate the new height and width of the collage if it changes\n height = Math.max(height,pictures[numPics].getHeight() + offsets[numPics][0]);\n width = Math.max(width,pictures[numPics].getWidth() + offsets[numPics][1]);\n \n // Update the number of pictures variable\n numPics++;\n\n }", "@Test\n\tpublic void testNewPaintPixelTest() {\n\t\tPixel[][] greenParray = new Pixel[5][5];\n\t\tfor (int x = 0; x < 5; x++) {\n\t\t\tfor (int y = 0; y < 5; y++) {\n\t\t\t\tgreenParray[x][y] = green;\n\t\t\t}\n\t\t}\n\t\t\n\t\tPixel[][] blueParray = new Pixel[5][5];\n\t\tfor (int x = 0; x < 5; x++) {\n\t\t\tfor (int y = 0; y < 5; y++) {\n\t\t\t\tblueParray[x][y] = blue;\n\t\t\t}\n\t\t}\n\t}", "public void drawPixmap(Pixmap pixmap, int x, int y);", "@Override\n\tpublic void paintComponent(Graphics g) {\n\t\tsuper.paintComponent(g);\n\t\tg.drawImage(image, 310, 40, 200, 150, this);\n\t}", "@Test\n public void testSetPixelColor() {\n System.out.println(\"setPixelColor\");\n int numLEDs = 150;\n Color color = new Color(63, 123, 255);\n DotStar instance = new MockDotStar(numLEDs);\n for (int i = 0; i < numLEDs; i++) {\n instance.setPixelColor(i, color);\n }\n\n for (int i = 0; i < numLEDs; i++) {\n assertEquals((byte) 0xFF, instance.data[4 * i]);\n assertEquals((byte) color.getBlue(), instance.data[(4 * i) + 1]);\n assertEquals((byte) color.getGreen(), instance.data[(4 * i) + 2]);\n assertEquals((byte) color.getRed(), instance.data[(4 * i) + 3]);\n }\n }", "public void updateImage(ColorImage newImage) {\n currentImage.push(newImage);\n }", "public void add(Component c){}", "public void drawImage(ImageResource imageResource, float destinationX, float destinationY);", "public void add(double amount) {\n x += amount;\n y += amount;\n }", "@Override\npublic void add(VirtualComponent comp, int pos) {\n\t\n}", "private static void setG8(BufferedImage image, int x, int y, int value) {\n assert (value >= 0 && value <= 255);\n image.setRGB(x, y, value | (value << 8) | (value << 16));\n }", "private void dragPaint() {\n\n\t\t//buffer die image ooit\n\t\tinvalidate();\n\t\trepaint();\n\t}", "private void addComponent(Container container,Component c,int x,int y,int width,int height)\n {\n c.setBounds(x,y,width,height);\n container.add(c);\n }", "public void paintComponent(Graphics page) {\r\n super.paintComponent(page);\r\n IMAGE.paintIcon(this, page, x, y);\r\n }" ]
[ "0.7104337", "0.66623574", "0.6579832", "0.65506786", "0.6437673", "0.64146787", "0.6366153", "0.63267213", "0.62669444", "0.62529916", "0.6226408", "0.620924", "0.6101003", "0.6003771", "0.5997552", "0.59691703", "0.5934172", "0.5931421", "0.58418405", "0.57889533", "0.5760365", "0.57558286", "0.5751078", "0.5733928", "0.5698517", "0.56879956", "0.567675", "0.5642184", "0.56351167", "0.563324", "0.5632487", "0.5629135", "0.56002784", "0.55940974", "0.55764145", "0.5558992", "0.554263", "0.5541042", "0.55352026", "0.5531662", "0.5512859", "0.54868627", "0.54807854", "0.5476338", "0.5472542", "0.5472227", "0.54690206", "0.5466453", "0.54644185", "0.5458259", "0.54306364", "0.5418467", "0.54073817", "0.54007316", "0.539697", "0.5394233", "0.5392083", "0.5388221", "0.53725946", "0.53725064", "0.5369765", "0.53658015", "0.53639495", "0.53573275", "0.5343541", "0.53312767", "0.53295875", "0.53259", "0.53238297", "0.53231484", "0.53222036", "0.53060544", "0.530127", "0.52966684", "0.52876776", "0.5279183", "0.5276114", "0.52687126", "0.526575", "0.52636397", "0.5262501", "0.52575505", "0.52485067", "0.5241123", "0.5239604", "0.5239473", "0.52354944", "0.5215767", "0.52100515", "0.5209018", "0.52085763", "0.5205213", "0.5194032", "0.5190414", "0.51891416", "0.518797", "0.51820326", "0.518184", "0.5179198", "0.5177091" ]
0.5439801
50
Merge another component with this one
public void merge(Component p) { size += p.size(); for (int i = 0; i < features.length; i++) { features[i].merge(p.features[i]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public abstract void merge(Mergeable merge);", "public Item merge(Item other);", "@Override\n\tprotected void merge(Object in1, Object in2, Object out) {\n\t\t\n\t}", "public ComponentCommon(ComponentCommon other) {\n __isset_bitfield = other.__isset_bitfield;\n if (other.is_set_inputs()) {\n Map<GlobalStreamId,Grouping> __this__inputs = new HashMap<GlobalStreamId,Grouping>(other.inputs.size());\n for (Map.Entry<GlobalStreamId, Grouping> other_element : other.inputs.entrySet()) {\n\n GlobalStreamId other_element_key = other_element.getKey();\n Grouping other_element_value = other_element.getValue();\n\n GlobalStreamId __this__inputs_copy_key = new GlobalStreamId(other_element_key);\n\n Grouping __this__inputs_copy_value = new Grouping(other_element_value);\n\n __this__inputs.put(__this__inputs_copy_key, __this__inputs_copy_value);\n }\n this.inputs = __this__inputs;\n }\n if (other.is_set_streams()) {\n Map<String,StreamInfo> __this__streams = new HashMap<String,StreamInfo>(other.streams.size());\n for (Map.Entry<String, StreamInfo> other_element : other.streams.entrySet()) {\n\n String other_element_key = other_element.getKey();\n StreamInfo other_element_value = other_element.getValue();\n\n String __this__streams_copy_key = other_element_key;\n\n StreamInfo __this__streams_copy_value = new StreamInfo(other_element_value);\n\n __this__streams.put(__this__streams_copy_key, __this__streams_copy_value);\n }\n this.streams = __this__streams;\n }\n this.parallelism_hint = other.parallelism_hint;\n if (other.is_set_json_conf()) {\n this.json_conf = other.json_conf;\n }\n }", "void merge();", "private void addComponentToMainLayout(){\n\n // RelativeLayout params were very useful here\n // the addRule method is the key to arrange the components properly\n RelativeLayout.LayoutParams componentB_Params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);\n componentB_Params.addRule(RelativeLayout.RIGHT_OF, this.tableA.getId());\n\n RelativeLayout.LayoutParams componentC_Params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);\n componentC_Params.addRule(RelativeLayout.BELOW, this.tableA.getId());\n\n RelativeLayout.LayoutParams componentD_Params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);\n componentD_Params.addRule(RelativeLayout.RIGHT_OF, this.scrollViewC.getId());\n componentD_Params.addRule(RelativeLayout.BELOW, this.horizontalScrollViewB.getId());\n\n // 'this' is a relative layout,\n // we extend this table layout as relative layout as seen during the creation of this class\n this.addView(this.tableA);\n this.addView(this.horizontalScrollViewB, componentB_Params);\n this.addView(this.scrollViewC, componentC_Params);\n this.addView(this.scrollViewD, componentD_Params);\n\n }", "public void replaceComponent(Component oldComponent, Component newComponent);", "public merits() {\n initComponents();\n }", "public Component load(){\n\t\treturn this;\n\t}", "public Object merge(Object obj) throws HibException;", "public GridCollector merge(GridCollector other) {\n\t\t// cell-wise merge\n\t\tIntStream.range(0, cells.size())\n\t\t .forEach(i -> cells.get(i).addAll(other.cells.get(i)));\n\t\treturn this;\n\t}", "void merge(T other);", "public void addComponent(Component c);", "@Override\n public Image merge(Image a, Image b) {\n if (a.getCached() == null) {\n drawImage(a, 0, 0);\n }\n if (b.getCached() == null) {\n drawImage(b, 0, 0);\n }\n Object nativeImage = graphicsEnvironmentImpl.mergeImages(canvas, a, b, a.getCached(), b.getCached());\n Image merged = Image.create(getImageSource(nativeImage));\n merged.cache(nativeImage);\n return merged;\n }", "Component deepClone();", "protected abstract Component addContent();", "public Exec mergeWith(Exec toMerge) throws MojoExecutionException {\n super.mergeWith(toMerge);\n if(toMerge.getCommands() != null)\n setCommands(toMerge.getCommands());\n if(toMerge.getCommandSeparator() != null)\n setCommandSeparator(toMerge.getCommandSeparator());\n return this;\n }", "@Override\n\tpublic boolean mergeWith(BUEdge other) {\n\t\t// TODO Auto-generated method stub\n\t\treturn false;\n\t}", "public void replaceChildComponent(Widget oldComponent, Widget newComponent) {\n if (oldComponent != layout) {\n return;\n }\n \n setWidget(newComponent);\n layout = (Paintable) newComponent;\n }", "public void merge(TaskViewModel source) {\n setName(source.getName());\n setEstimate(source.getEstimate());\n setDescription(source.getDescription());\n }", "@Override\n\tpublic void merge(MutableAggregationBuffer buffer1, Row buffer2) {\n\t\tif (buffer1.getString(0) == null) {\n\t\t\tbuffer1.update(0, buffer2.getString(0));\n\t\t} else\n\t\t\tbuffer1.update(0, buffer1.getString(0) + \",\" + buffer2.getString(0));\n\n\t\tbuffer1.update(1, buffer1.getLong(1) + buffer2.getLong(1));\n\t\tbuffer1.update(2, buffer1.getLong(2) + buffer2.getLong(2));\n\n\t}", "@Override\n\tpublic Component getComponent() {\n\t\treturn this;\n\t}", "void addComponent(Component component);", "Merge() {\n //Unused Constructor.\n }", "public void add(Component c){}", "@Override\npublic void add(VirtualContainer parent, VirtualComponent comp, int pos) {\n\t\n}", "Component duplicateComponentFound(Component component, String name, String type, String description, String technology);", "@Override\n\tpublic Component clone() {\n\t\treturn null;\n\t}", "public T merge ( T object );", "@Override\r\n\tpublic void append(Layer other)\r\n\t{\n\r\n\t}", "public void merge(ToDoItem anotherItem) {\n this.setDescription(anotherItem.getDescription());\n this.setDone(anotherItem.isDone()); \n }", "public void merge(T entity) {\n\t\t\n\t}", "public void addComponent(String name, Component newComp);", "public CountMin merge(final CountMin other) {\n if (this.rows != other.rows || this.columns != other.columns) {\n throw new IllegalArgumentException(\n \"Trying to merge two CountMin data structures of different sizes.\");\n }\n for (int i = 0; i < rows * columns; i++) {\n this.counts[i] += other.counts[i];\n }\n this.update_sum += other.update_sum;\n return this;\n }", "public void merge(UnitObject<T> unit) {\r\n // placeholder\r\n }", "@Override\npublic void add(VirtualComponent comp, int pos) {\n\t\n}", "void mergePiece(Piece piece);", "public abstract void merge (org.apache.spark.sql.expressions.MutableAggregationBuffer buffer1, org.apache.spark.sql.Row buffer2) ;", "@Override\n public T update(T element) {\n return manager.merge(element);\n }", "public void merge( Resource r )\n\t{\n\t\tr.transter(this, r.amount);\n\t\tr.recycle();\n\t}", "public void merge(BoundsUserSpace b) {\n add(b);\n }", "public interface DuplicateComponentStrategy {\n\n /**\n * Called when a duplicate component is found.\n *\n * @param component the existing Component object\n * @param name the new component name\n * @param type the new component type\n * @param description the new description\n * @param technology the new technology\n *\n * @return a Component instance, or null if a new component should not be created\n */\n Component duplicateComponentFound(Component component, String name, String type, String description, String technology);\n\n}", "void addComponents();", "@Override\n public void ancestorAdded(AncestorEvent event) {\n updateComponents();\n }", "private void merge(DefaultSingleGraphDataUnit source) throws LpException {\n try {\n execute((connection) -> {\n final Update update = connection.prepareUpdate(\n QueryLanguage.SPARQL, QUERY_COPY);\n final SimpleDataset dataset = new SimpleDataset();\n dataset.addDefaultGraph(source.getReadGraph());\n dataset.setDefaultInsertGraph(graph);\n update.setDataset(dataset);\n update.execute();\n });\n } catch (LpException ex) {\n throw new LpException(\"Can't merge with: {}\",\n source.getIri(), ex);\n }\n }", "public void merge(MediaEntity other) {\n merge(other, false);\n }", "public String merge (Context context) throws Exception;", "public Component prepare(){\n\t\treturn this;\n\t}", "@Override\n\tpublic Instance mergeInstance(final Instance inst) {\n\t\treturn null;\n\t}", "@Override\n public JComponent getComponent () {\n return this;\n }", "protected void setComponent(Component newComponent) {\n\tcomponent = newComponent;\n}", "public abstract void injectComponent();", "@Override\npublic void linkUIComponentToMe(VirtualComponent c) {\n\t\n}", "public void replaceComponent(Component comp) {\n\t\tif (this.cachedOnes == null || comp == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.cls.isInstance(comp)) {\n\t\t\tthis.cachedOnes.put(comp.getQualifiedName(), comp);\n\t\t} else if (this == ComponentType.SERVICE\n\t\t\t\t&& comp instanceof ServiceInterface) {\n\t\t\t/*\n\t\t\t * that was bit clumsy, but the actual occurrence is rare, hence we\n\t\t\t * live with that\n\t\t\t */\n\t\t\tthis.cachedOnes.put(comp.getQualifiedName(), comp);\n\t\t} else {\n\t\t\tthrow new ApplicationError(\"An object of type \"\n\t\t\t\t\t+ comp.getClass().getName()\n\t\t\t\t\t+ \" is being passed as component \" + this);\n\t\t}\n\t}", "@Override\n\tpublic boolean combine(EHICommand anotherCommand) {\n\t\treturn false;\n\t}", "@Override\r\n\tpublic void apply(Component component) {\n\t\t\r\n\t}", "@Override\n protected void applyChangesTo(Component component) {\n component.revalidate();\n component.repaint();\n }", "@Override\n public Object writeReplace() {\n return new ResolvableHelper(preferredComponentId);\n }", "public Computation merge(ComputationTemplate template, ComputationTask task);", "public void moveComponentsFrom(ComponentContainer source);", "public ComponentMover(Component destinationComponent, Component... components)\n\t{\n\t\tthis.destinationComponent = destinationComponent;\n\t\tregisterComponent( components );\n\t}", "public void updateComponents() {\n\t\tremoveAllComponents();\n\t\tvalidatedHeader();\n\t}", "private void addComponents(Container content){\r\n\r\n content.add(getRentPane());\r\n content.add(getSellPane());\r\n\r\n }", "protected CompositeInstanceContext mergeSelectedContext(CompositeInstanceContext newContext) {\n\t\tif (mergedContext == null) {\n//System.err.println(\"mergeSelectedContext(): creating new context\");\n\t\t\tmergedContext = newContext;\n\t\t}\n\t\telse {\n\t\t\tAttributeList mergedList = mergedContext.getAttributeList();\n\t\t\tIterator<Attribute> newListIterator = newContext.getAttributeList().values().iterator();\n\t\t\twhile (newListIterator.hasNext()) {\n\t\t\t\tAttribute a = newListIterator.next();\n\t\t\t\tAttributeTag tag = a.getTag();\n\t\t\t\tString mergedValue = Attribute.getSingleStringValueOrEmptyString(mergedList,tag);\n\t\t\t\tString newValue = a.getSingleStringValueOrEmptyString();\n\t\t\t\tif (!newValue.equals(mergedValue)) {\n\t\t\t\t\tString describeTag = tag + \" \" + mergedList.getDictionary().getFullNameFromTag(tag);\nslf4jlogger.info(\"mergeSelectedContext(): for \"+describeTag+\" values differ between existing merged value <\"+mergedValue+\"> and new value <\"+newValue+\">\");\n\t\t\t\t\tif (newValue.length() > 0 && (mergedValue.length() == 0 || isNonZeroLengthDummyValue(mergedValue))) {\nslf4jlogger.info(\"mergeSelectedContext(): for \"+describeTag+\" replacing absent/empty/dummy existing merged value with new value <\"+newValue+\">\");\n\t\t\t\t\t\tmergedList.put(a);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn mergedContext;\n\t}", "@Override\n\tpublic ElementView getComponent() {\n\t\treturn jc;\n\t}", "@Override\r\n\tpublic void updatePackage(PackageJour pj) {\n\t\tem.merge(pj);\r\n\t}", "public Cart merge(Cart other) {\n other.getItems().forEach(item -> add(new Item(item)));\n return this;\n }", "public JComponent addAux2(Color color)\n {\n Category category = new Category(this, \"Aux 2 FX\", color);\n \n JComponent comp;\n String[] params;\n final HBox hbox = new HBox();\n\n final HBox chorus = new HBox();\n \n comp = new LabelledDial(\"High\", this, \"aux2highdamp\", color, 0, 127);\n ((LabelledDial)comp).addAdditionalLabel(\"Damp\");\n chorus.add(comp);\n \n comp = new LabelledDial(\"Time\", this, \"aux2time\", color, 0, 127);\n chorus.add(comp);\n \n VBox vbox = new VBox();\n params = AUX_FX_2_TYPES;\n comp = new Chooser(\"Type\", this, \"aux2type\", params)\n {\n public void update(String key, Model model)\n {\n super.update(key, model);\n hbox.removeLast();\n if (model.get(\"aux2type\", 0) != 2) // anything but phaser\n {\n hbox.addLast(chorus);\n }\n hbox.revalidate();\n hbox.repaint();\n }\n }; \n vbox.add(comp);\n\n comp = new CheckBox(\"Enable\", this, \"aux2mode\");\n vbox.add(comp);\n\n hbox.add(vbox);\n hbox.addLast(chorus);\n \n comp = new LabelledDial(\"Send\", this, \"aux2toaux1\", color, 0, 127);\n ((LabelledDial)comp).addAdditionalLabel(\"To Aux 1\");\n hbox.add(comp);\n \n comp = new LabelledDial(\"Depth\", this, \"aux2depth\", color, 0, 127);\n hbox.add(comp);\n \n comp = new LabelledDial(\"Pre LP\", this, \"aux2prelp\", color, 0, 127);\n hbox.add(comp);\n \n comp = new LabelledDial(\"Pre HP\", this, \"aux2prehp\", color, 0, 127);\n hbox.add(comp);\n \n comp = new LabelledDial(\"Feedback\", this, \"aux2feedback\", color, 0, 127);\n hbox.add(comp);\n\n // The manual says this goes to 123. An Vyzex has no MIDI clock sync for this.\n // But quite a number of preset patches go clear to 127. Discussion with Jan Bote\n // makes it more likely that this LFO is just like the others -- it goes 0-110\n // for basic rates, then 110-127 for MIDI synced rates. So that's what I'm doing.\n comp = new LabelledDial(\"LFO\", this, \"aux2lforate\", color, 0, 127)\n {\n public String map(int value)\n {\n if (value < 111) return \"\" + value;\n else return TEMPO_SYNCS[value - 111];\n }\n };\n ((LabelledDial)comp).addAdditionalLabel(\"Rate\");\n hbox.add(comp);\n model.setMetricMax(\"aux2lforate\", 110);\n\n comp = new LabelledDial(\"LFO\", this, \"aux2lfodepth\", color, 0, 127);\n ((LabelledDial)comp).addAdditionalLabel(\"Depth\");\n hbox.add(comp);\n \n category.add(hbox, BorderLayout.CENTER);\n return category;\n }", "public void merge(BundleClassLoadersContext other) {\n\n extensionDirs = ImmutableList.copyOf(Stream.concat(extensionDirs.stream(),\n other.extensionDirs.stream().filter((x) -> !extensionDirs.contains(x)))\n .collect(Collectors.toList()));\n bundles = ImmutableMap.copyOf(\n Stream.of(bundles, other.bundles).map(Map::entrySet).flatMap(Collection::stream)\n .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (s, a) -> s)));\n }", "public void merge(WModelObject otherObject)\n\t{\n\t\tWCollection collection = null;\n\n\t\t// Check to see if the argument is a WCollection object\n\t\ttry\n\t\t{\n\t\t\tcollection = (WCollection)otherObject;\n\t\t}\n\t\tcatch (ClassCastException exc)\n\t\t{\n\t\t\tcom.ing.connector.Registrar.logError(getClass().getName() + \": Collection objects can only be merged with other Collection objects\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Check to see if the two objects are of the same class\n\t\tClass thisClass = getClass();\n\t\tClass objClass = otherObject.getClass();\n\n\t\tif (thisClass.getName().compareTo(objClass.getName()) != 0)\n\t\t{\n\t\t\tcom.ing.connector.Registrar.logError(thisClass.getName() + \": Cannot compare two different collection objects\");\n\t\t\treturn;\n\t\t}\n\n\t\tWCollection primCollection = new WCollection(thisClass.getName());\t//JFG6.0\n\n\t\tint iObjectCount = this.size();\t\t\t\t\t\t\t//JFG6.0\n\t\tcom.ing.connector.Registrar.logDebugMessage(\"prim object size = \" + iObjectCount);\n\t\tfor (int iCount = 0; iCount < iObjectCount; ++iCount)\t\t\t\t//JFG6.0\n\t\t{\n\t\t\tprimCollection.addElement(this.elementAt(iCount));\t\t\t//JFG6.0\n\t\t\t//com.ing.connector.Registrar.logDebugMessage(\"Entering inside()\");\n\t\t}\n\n primCollection.sort(\"ClassKey\",true);\t\t\t\t\t\t//JFG6.0\n collection.sort(\"ClassKey\",true);\t\t\t\t\t\t\t//JFG6.0\n\n\t\tint iSecObjectCount = collection.size();\n int iStart = 0;\t\t\t\t\t\t\t\t\t\t//JFG6.0\n com.ing.connector.Registrar.logDebugMessage(\"Sec object size = \" + iSecObjectCount);\n\t\tfor (int iSecCount = 0; iSecCount < iSecObjectCount; ++iSecCount)\n\t\t{\n\t\t WModelObject secObject = null;\n\t\t WModelObject primObject = null;\n\n\t\t secObject = collection.elementAt(iSecCount);\n\t\t boolean keyFound = false;\n\n\t\t int iPrimObjectCount = primCollection.size();\n\t\t for (int iPrimCount = iStart; iPrimCount < iPrimObjectCount; ++iPrimCount)\n\t\t {\n\t\t primObject = primCollection.elementAt(iPrimCount);\n\n int iCompare = primObject.compareTo(secObject, \"ClassKey\");\n //com.ing.connector.Registrar.logDebugMessage(\"primObject.compareTo iCompare = \" + iCompare);\n \n\t\t if (iCompare == 0)\n\t\t {\n\t\t\tkeyFound = true;\n\t\t\tcom.ing.connector.Registrar.logDebugMessage(\"prim object and sec object are equal class \" + primObject.getClass().getName());\n\t\t\tprimObject.merge(secObject);\t//LPMO264\n iStart = iPrimCount + 1;\t\t\t\t\t\t\t//JFG6.0\n \n\t\t\tbreak;\n\t\t }\n else\t\t\t\t\t\t\t\t\t\t\t//JFG6.0\n {\n\t\t if (iCompare > 0)\t\t\t\t\t\t\t\t\t//JFG6.0\n\t\t {\n\t\t\t keyFound = false;\t\t\t\t\t\t\t\t//JFG6.0\n iStart = iPrimCount;\t\t\t\t\t\t\t\t//JFG6.0\n \n\t\t break;\t\t\t\t\t\t\t\t\t\t//JFG6.0\n\n }\n }\n\t\t }\n\t\t \n\t\t //com.ing.connector.Registrar.logDebugMessage(\"is keyFound \" + keyFound);\n\t\t if (!keyFound)\n\t\t {\n\t\t addElement(secObject);\n\t\t }\n\t\t}\n\n\t\tprimCollection = null;\t\t\t\t\t\t\t\t\t//JFG6.0\n\n//\t\tint iObjectCount = collection.size();\n//\t\tfor (int iCount = 0; iCount < iObjectCount; ++iCount)\n//\t\t{\n//\t\t\taddElement(collection.elementAt(iCount));\n//\t\t}\n\t}", "public Gui2() {\r\n\t\tbuildMainLayout();\r\n\t\tsetCompositionRoot(mainLayout);\r\n\t}", "public void addComponentToCoolBar(Component component) {\n\t\t_coolBar.addComponent(component);\n\t}", "public void merge(PackageDetail packageDetail) {\n boolean isStable = packageDetail.isStable();\n if (!this.mIsStable || !isStable) {\n boolean z = false;\n this.mIsStable = false;\n if (this.mHasUsed && packageDetail.mHasUsed) {\n this.mUsedTrafficB += packageDetail.mUsedTrafficB;\n } else if (this.mHasUsed || packageDetail.mHasUsed) {\n this.mUsedTrafficB = this.mHasUsed ? this.mUsedTrafficB : packageDetail.mUsedTrafficB;\n this.mHasUsed = true;\n }\n if (this.mHasRemain && packageDetail.mHasRemain) {\n this.mRemainTrafficB += packageDetail.mRemainTrafficB;\n } else if (this.mHasRemain || packageDetail.mHasRemain) {\n this.mRemainTrafficB = this.mHasRemain ? this.mRemainTrafficB : packageDetail.mRemainTrafficB;\n this.mHasRemain = true;\n }\n if (this.mHasUsed && this.mHasRemain) {\n z = true;\n }\n this.mIsStable = z;\n if (this.mIsStable) {\n this.mTotalTrafficB = this.mRemainTrafficB + this.mUsedTrafficB;\n return;\n }\n return;\n }\n this.mTotalTrafficB += packageDetail.mTotalTrafficB;\n this.mUsedTrafficB += packageDetail.mUsedTrafficB;\n this.mRemainTrafficB += packageDetail.mRemainTrafficB;\n }", "private void configureMerge(EObject original) {\n DSEMergeConfigurator configurator = configuratorMapping.get(original.eClass().getEPackage().getNsURI());\n if (configurator != null) {\n configureMerge(configurator);\n } else {\n logger.error(\"Missing required configuration for \" + original.eClass().getEPackage().getNsURI()); \n }\n }", "public void mergePlugin(NewPortalConfigListener other) {\n // if other didn't actually set anything for the default portal name\n // then we should continue to use the current value. This way if an extension\n // doesn't set it, it wont override the parent's set value.\n if (other.defaultPortalSpecified) {\n this.defaultPortal = other.defaultPortal;\n }\n \n if (other.defaultPortalTemplate != null && other.defaultPortalTemplate.length() > 0) {\n this.defaultPortalTemplate = other.defaultPortalTemplate;\n }\n \n if (configs == null) {\n this.configs = other.configs;\n } else if (other.configs != null && !other.configs.isEmpty()) {\n List<NewPortalConfig> result = new ArrayList<NewPortalConfig>(configs);\n result.addAll(other.configs);\n this.configs = Collections.unmodifiableList(result);\n }\n \n if (templateConfigs == null) {\n this.templateConfigs = other.templateConfigs;\n } else if (other.templateConfigs != null && !other.templateConfigs.isEmpty()) {\n List<SiteConfigTemplates> result = new ArrayList<SiteConfigTemplates>(templateConfigs);\n result.addAll(other.templateConfigs);\n this.templateConfigs = Collections.unmodifiableList(result);\n }\n }", "public void addComponent(Component c) {\n for (Component C : components) {\n if (c.getClass().equals(C.getClass())) {\n return;\n }\n }\n components.add(c);\n c.setObject(this);\n }", "public X updateUI() {\n component.updateUI();\n return (X) this;\n }", "public void update(IComponent c);", "public void forceMerge(MediaEntity other) {\n merge(other, true);\n }", "@Override\n\tpublic Component getComponent() {\n\t\treturn p;\n\t}", "public combinacion() {\n initComponents();\n eventos();\n }", "public abstract void add(KitComponent component);", "@Override\r\n\tpublic void merge(List<EObject> sources, List<EObject> targets) {\n\t\tcontext = targets.get(0).eResource().getResourceSet();\r\n\r\n\t\tsuper.merge(sources, targets);\r\n\t}", "public interface Combine<T> {\n\n public T combineWith(T other);\n\n public void mergeFrom(T other);\n\n}", "void reset(Component paramComponent1, Component paramComponent2, int paramInt1, int paramInt2) {\n/* 152 */ if (getComponent() == null) {\n/* 153 */ this.component = createComponent(paramComponent1);\n/* */ }\n/* */ \n/* 156 */ Component component = getComponent();\n/* */ \n/* 158 */ if (component instanceof JWindow) {\n/* 159 */ JWindow jWindow = (JWindow)getComponent();\n/* */ \n/* 161 */ jWindow.setLocation(paramInt1, paramInt2);\n/* 162 */ jWindow.getContentPane().add(paramComponent2, \"Center\");\n/* 163 */ jWindow.invalidate();\n/* 164 */ jWindow.validate();\n/* 165 */ if (jWindow.isVisible())\n/* */ {\n/* */ \n/* 168 */ pack();\n/* */ }\n/* */ } \n/* */ }", "public ResourceSpec merge(final ResourceSpec other) {\n\t\tcheckNotNull(other, \"Cannot merge with null resources\");\n\n\t\tif (this.equals(UNKNOWN) || other.equals(UNKNOWN)) {\n\t\t\treturn UNKNOWN;\n\t\t}\n\n\t\tResourceSpec target = new ResourceSpec(\n\t\t\tthis.cpuCores.merge(other.cpuCores),\n\t\t\tthis.taskHeapMemory.add(other.taskHeapMemory),\n\t\t\tthis.taskOffHeapMemory.add(other.taskOffHeapMemory),\n\t\t\tthis.managedMemory.add(other.managedMemory));\n\t\ttarget.extendedResources.putAll(extendedResources);\n\t\tfor (Resource resource : other.extendedResources.values()) {\n\t\t\ttarget.extendedResources.merge(resource.getName(), resource, (v1, v2) -> v1.merge(v2));\n\t\t}\n\t\treturn target;\n\t}", "private void onComponentUpdate(InheritedComponentInstanceSelDTO dto) {\n\t\tInheritedComponentInstanceSelModelData oldModel = store.findModel(ModuleInstanceSelModelData.PROPERTY_ID, dto\n\t\t\t.getComponent().getId());\n\t\tInheritedComponentInstanceSelModelData newModel = new InheritedComponentInstanceSelModelData(dto);\n\t\tstore.remove(oldModel);\n\t\tstore.add(newModel);\n\t}", "protected void merge(FlowGraph graph){\r\n for(FlowGraphNode node : this.from){\r\n node.addTo(graph.start);\r\n node.to.remove(this);\r\n }\r\n for(FlowGraphNode node : this.to){\r\n graph.end.addTo(node);\r\n node.from.remove(this);\r\n }\r\n }", "public X add(Component component) {\n this.component.add(component);\n return (X) this;\n }", "public void merge() {\n\t\tfor(int i = 1;i<crystalQuantity.length;i++) {\n\t\t\tif (crystalQuantity[i] >= 2) { \n\t\t\t\tcrystalQuantity[i] -= 2; // remove two of the current tier\n\t\t\t\tcrystalQuantity[i+1] += 1; // add one of the new tier\n\t\t\t}\n\t\t}\n\t\tfor(int i = 1;i<dustQuantity.length;i++) {\n\t\t\tif (dustQuantity[i] >= 2) { \n\t\t\t\tdustQuantity[i] -= 2; // remove two of the current tier\n\t\t\t\tcrystalQuantity[i+1] += 1; // add one of the new tier\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tif(!automerge) {\n\t\t\tcollection();\n\t\t}\n\t\t\n\t}", "public FlowGraph merge(FlowGraph graph){\r\n start.merge(graph.start);\r\n end.merge(graph.end);\r\n return this;\r\n }", "public void component(AndroidInjector<App> newComponent) {\n newComponent.inject(this);\n }", "public void wrap(Cargo other) {\n if (other == this) {\n throw new IllegalStateException(\"Autowrap at\" + this);\n }\n if (wrapped == null) wrapped = new ArrayList<>();\n wrapped.add(other);\n }", "public FlowGraph serial_merge(FlowGraph graph){\r\n end.merge(graph.start);\r\n end = graph.end;\r\n return this;\r\n }", "public void merge(Tuple tup) {\n\t\t\n\t}", "public Component addComponent(Component component) {\n return popup.add(component);\n }", "public Builder mergeX(godot.wire.Wire.Vector2 value) {\n if (xBuilder_ == null) {\n if (x_ != null) {\n x_ =\n godot.wire.Wire.Vector2.newBuilder(x_).mergeFrom(value).buildPartial();\n } else {\n x_ = value;\n }\n onChanged();\n } else {\n xBuilder_.mergeFrom(value);\n }\n\n return this;\n }", "public void mergeRebindsFromCollapsed(Permutation other) {\n assert other.orderedPropertyOracles.size() == other.orderedRebindAnswers.size();\n orderedPropertyOracles = Lists.addAll(orderedPropertyOracles,\n other.orderedPropertyOracles);\n orderedRebindAnswers = Lists.addAll(orderedRebindAnswers,\n other.orderedRebindAnswers);\n other.destroy();\n }", "@Override\n protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) {\n\n UltraSearchBackendEntry current = (UltraSearchBackendEntry) e1;\n UltraSearchBackendEntry next = (UltraSearchBackendEntry) e2;\n\n E.checkState(current == null || current.type().isVertex(),\n \"The current entry must be null or VERTEX\");\n E.checkState(next != null && next.type().isEdge(),\n \"The next entry must be EDGE\");\n\n if (current != null) {\n Id nextVertexId = IdGenerator.of(\n next.<String>column(HugeKeys.OWNER_VERTEX));\n if (current.id().equals(nextVertexId)) {\n current.subRow(next.row());\n return current;\n }\n }\n\n return this.wrapByVertex(next);\n }", "private void addComponentRight() {\n\t\tright = new JPanel();\n\t\tleft = new JPanel();\n\n\t\ttry{\n\t\t\tPreferences prefs;\n\t\t\tprefs = new getPrefsSingletan().getPrefs();\n\t\t\tleft.setBackground(Color.decode(prefs.get(Keys.PREFS_COLOR_CENTER, \"#ffffff\")));\n\t\t\tright.setBackground(Color.decode(prefs.get(Keys.PREFS_COLOR_CENTER, \"#ffffff\")));\n\t\t}catch(Exception e){\n\t\t\tleft.setBackground(Color.decode(\"#ffffff\"));\n\t\t\tright.setBackground(Color.decode(\"#ffffff\"));\n\t\t\tJOptionPane.showMessageDialog(null, new JLabel(\"Wrong color code\"));\n\t\t}\n\t\tright.setPreferredSize(new Dimension(500, 800));\n\t\tadd(right, BorderLayout.CENTER);\n\t\tGridBagConstraints constraints = new GridBagConstraints();\n\t\tconstraints.insets = new Insets(0, 0, 0, 0);\n\t\tconstraints.weightx = 1;\n\t\tconstraints.weighty = 1;\n\t\tconstraints.weighty = 1;\n\t\tconstraints.ipadx = 210;\n\t\tconstraints.fill = GridBagConstraints.VERTICAL;\n\t\tconstraints.gridx = 0;\n\t\tconstraints.gridy = 2;\n\t\t\n\t\tBillList = new JList(Bills);\n\t\tJScrollPane ListScrollPane = new JScrollPane(BillList);\n\t\tListScrollPane.setBackground(new Color(40, 150, 100));\n\t\tListScrollPane.setPreferredSize(new Dimension(500,600));\n\t\tright.add(ListScrollPane, constraints);\n\t}" ]
[ "0.5973303", "0.56798565", "0.5658621", "0.55408126", "0.5480708", "0.5464994", "0.54370457", "0.5412792", "0.536161", "0.53580004", "0.5304477", "0.5304013", "0.52830476", "0.5263504", "0.52630293", "0.52565706", "0.52264804", "0.5197369", "0.5187647", "0.5175881", "0.51669157", "0.51592636", "0.5157469", "0.51457554", "0.51412636", "0.5134092", "0.5121198", "0.5113408", "0.5082149", "0.5080894", "0.5078441", "0.50717795", "0.506248", "0.5046637", "0.5044801", "0.5039433", "0.50168574", "0.50157577", "0.5014744", "0.5008635", "0.50053596", "0.50028354", "0.4980441", "0.49763486", "0.49741283", "0.4953279", "0.49273732", "0.48917407", "0.48870945", "0.48867488", "0.48735243", "0.4861978", "0.48544535", "0.48528737", "0.48514682", "0.48507738", "0.48479134", "0.48394528", "0.48262423", "0.48220718", "0.48116305", "0.4808026", "0.4805002", "0.4804843", "0.4787176", "0.47831553", "0.47796148", "0.477458", "0.4772608", "0.4757455", "0.475671", "0.47507182", "0.47467965", "0.4745701", "0.47401977", "0.47368652", "0.47362375", "0.47262153", "0.47221163", "0.47151497", "0.47108984", "0.47100562", "0.47071463", "0.4706721", "0.47018802", "0.46884936", "0.46869", "0.4685712", "0.46833527", "0.4679971", "0.467986", "0.4665845", "0.46642557", "0.46638793", "0.46624744", "0.46497878", "0.4647458", "0.46460977", "0.46391934", "0.46391684" ]
0.6003605
0
The size of the component (i.e. the number of pixels)
public int size() { return size; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Dimension getSize();", "Dimension getSize();", "public Dimension getSize()\n {\n return new Dimension(300, 150);\n }", "public Dimension getSize ( )\r\n\t{\r\n\t\treturn new Dimension ( BORDER_X*2 + SQUARE_SIZE*size, BORDER_Y*2 + SQUARE_SIZE*size );\r\n\t}", "public Point2D.Float getSize() {\r\n\t\treturn size;\r\n\t}", "public int getSize() {\n return rows * cols;\n }", "public Dimension getSize() { return new Dimension(width,height); }", "public int getWidth() {\n return mySize.getWidth();\n }", "public int getPixelSize() {\n\t\treturn pixelSize;\n\t}", "public float getSize() {\n\t\treturn size;\n\t}", "public float getSize() {\n return size;\n }", "public final int getWidth() {\r\n return (int) size.x();\r\n }", "public int getSize() {\n\t\treturn width + length;\n\t}", "public double getWidth() {\n return this.size * 2.0; \n }", "public double getSize()\n\t{\n\t\treturn size;\n\t}", "public static int GetSize() {\n\t\t\treturn gridSize.getValue();\n\t\t}", "public float getSize()\n {\n return size;\n }", "public Dimension getSize()\n\t{\n\t\treturn rect.getSize();\n\t}", "double getSize();", "public Dimension getSize() {\r\n\t\treturn this.size;\r\n\t}", "public double getSize() {\n return getElement().getSize();\n }", "public Dimension getSize()\n\t{\n\t\treturn new Dimension(image.getWidth(),image.getHeight());\n\t}", "public double getSize() {\n return size_;\n }", "public double getSize() \n {\n return size;\n }", "public double getSize() {\n return size_;\n }", "@Override\n\tpublic double getSize() {\n\t\treturn Math.sqrt(getMySize())/2;\n\t}", "public Vector2i getSize() {\n return new Vector2i(getWidth(), getHeight());\n }", "@Override\n\tpublic Dimension getSize() \n\t{\n\t\treturn panel.getSize();\n\t}", "public Dimension3d getSize() {\n return size;\n }", "@Override\r\n\tpublic int getSize() {\n\t\treturn gridSize;\r\n\t}", "public abstract Dimension getSize();", "public RMSize getSize() { return new RMSize(getWidth(), getHeight()); }", "public final Vector2f getSize() {\r\n return size;\r\n }", "public int get_size() {\r\n return this.dimension * 2 * sizeof_float + 4 * sizeof_float + sizeof_dimension + sizeof_int;\r\n }", "public double getPixelSize() {\n\t\treturn 0;\n\t}", "public final Point getSize() {\r\n return new Point(config.width, config.height);\r\n }", "public mxRectangle getContainerSize()\n\t\t\t\t\t{\n\t\t\t\t\t\treturn graphComponent.getLayoutAreaSize();\n\t\t\t\t\t}", "public mxRectangle getContainerSize()\n\t\t\t\t\t{\n\t\t\t\t\t\treturn graphComponent.getLayoutAreaSize();\n\t\t\t\t\t}", "public mxRectangle getContainerSize()\n\t\t\t\t\t{\n\t\t\t\t\t\treturn graphComponent.getLayoutAreaSize();\n\t\t\t\t\t}", "public mxRectangle getContainerSize()\n\t\t\t\t\t{\n\t\t\t\t\t\treturn graphComponent.getLayoutAreaSize();\n\t\t\t\t\t}", "public double getMySize() {\n\t\treturn size;\n\t}", "public int getSize() {\r\n return this.radius;\r\n }", "public double getWidth();", "public double getWidth();", "@Override\n public Position getSize() {\n return new Position(this.w, this.h);\n }", "public int getSize() {\n return this.radius;\n }", "public Point getSize();", "@Override\n public int getWidth() {\n return graphicsEnvironmentImpl.getWidth(canvas);\n }", "int getAreaSize();", "public Dimension getSize() {\n\t\treturn size.getCopy();\n\t}", "public long getSize() {\n\t\treturn Math.abs(getXSize() * getYSize() * getZSize());\n\t}", "public int getSize()\n\t{\n\t\treturn setSize;\n\t}", "public Size getSize() {\n return size;\n }", "public final int getSize() {\n return size;\n }", "private double getCellSize() {\n double wr = canvas.getWidth() / board.getWidth();\n double hr = canvas.getHeight() / board.getHeight();\n\n return Math.min(wr, hr);\n }", "public int getWidth();", "public int getWidth();", "public int getWidth();", "int getCurrentSize();", "public int getWidth() {\r\n return Display.getWidth();\r\n }", "public Vector2 getMouseSize() {\n \tdimension.set(pointer.width, pointer.height);\n \treturn dimension;\n\t}", "public float getWidth();", "public float getSize() {\n return bufSize;\n }", "private int getSize() {\n\t\t\treturn size;\n\t\t}", "public Dimension getCanvasSize() {\n return transformManager.getCanvasSize();\n }", "int getTileSize();", "public double getWidth() {\n return getElement().getWidth();\n }", "public int getSize() {\r\n return size;\r\n }", "public Dimension getPreferredSize() {\r\n\t\treturn (new Dimension(this.width, this.height));\r\n\t}", "private int getSize() {\r\n\t\treturn this.size;\r\n\t}", "public int getSize() {\r\n\t\treturn size;\r\n\t}", "@Override\n public Size getSize() {\n Size size = new Size(0,0);\n for(UIComponent<Widget> component : components) {\n if( component instanceof UIContainer ) {\n\n // Merging children container size.\n size.mergeTo( component.getSize() );\n\n } else {\n\n // Merging children compoment sizes.\n Widget w = component.getNativeComponent();\n Size componentSize = component.getSize();\n size.mergeTo(\n w.getAbsoluteLeft() + componentSize.getWidth(),\n w.getAbsoluteTop() + componentSize.getHeight()\n );\n\n }\n }\n return size;\n }", "public int getSetSize(){ return Integer.parseInt(setSize.getText()); }", "public int getSize() {\n return size;\n }", "public int getSize() {\n return size;\n }", "public int getSize() {\n return size;\n }", "public int getSize() {\n return size;\n }", "public int getSize() {\n return size;\n }", "public int getSize() {\n return size;\n }", "public int getSize() {\n return size;\n }", "public int getSize() {\n return size;\n }", "public int getSize() {\n return size;\n }", "public int getSize() {\n\t\treturn WORLD_SIZE;\n\t}", "public Point getSize() {\n\t\treturn p_screenSize;\n\t}", "public int getSize() {\n return board.getSize();\n }", "public int getSize() {\n return iSize;\n }", "public int getSize() {\r\n return this.size;\r\n }", "public int getSize() {\n return this.size;\n }", "public static int getSIZE() {\n return SIZE;\n }", "public long getSize() {\n return mSize;\n }", "public int getSize() {\n return size;\n }", "public int getWidth() {\r\n return Width;\r\n }", "private float getRoughPixelSize() {\n\n\t\tfloat size = 380; // mm\n\t\tfloat pixels = getHeight();\n\t\treturn pixels > 0 ? size / pixels : 0;\n\n\t}", "public int getSize() {\n return size;\n }", "public float getSize2D() {\n\treturn pointSize;\n }", "public int getLargeur() {\n return getWidth();\n }", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "int getSize();" ]
[ "0.78833055", "0.78833055", "0.78630286", "0.7817988", "0.778315", "0.772468", "0.77134037", "0.7712959", "0.770201", "0.76795286", "0.7676519", "0.7671646", "0.76675886", "0.7657773", "0.76540273", "0.7623276", "0.76182985", "0.7564247", "0.7563216", "0.75582075", "0.74769163", "0.7472889", "0.74312097", "0.7422805", "0.741908", "0.7408011", "0.73946536", "0.7366203", "0.73559165", "0.7353017", "0.7319663", "0.73126155", "0.7271971", "0.72425455", "0.72329164", "0.71626747", "0.715331", "0.715331", "0.715331", "0.715331", "0.71510947", "0.71334034", "0.71263254", "0.71263254", "0.7123991", "0.7121091", "0.71147436", "0.7101852", "0.7095123", "0.7088183", "0.7074516", "0.70652676", "0.70548266", "0.70485866", "0.7041411", "0.70368296", "0.70368296", "0.70368296", "0.70058614", "0.6995062", "0.6987459", "0.6972065", "0.697143", "0.6971236", "0.6969582", "0.6965255", "0.69647604", "0.6956644", "0.6954514", "0.6953463", "0.6948966", "0.6946071", "0.69435596", "0.6932736", "0.6924526", "0.6924526", "0.6924526", "0.6924526", "0.6924526", "0.6924526", "0.6924526", "0.6924526", "0.69235486", "0.6922498", "0.6914627", "0.69138074", "0.69084376", "0.6905945", "0.6905571", "0.6902536", "0.68999755", "0.6898024", "0.6896733", "0.6895636", "0.6895506", "0.689516", "0.6893775", "0.6893775", "0.6893775", "0.6893775", "0.6893775" ]
0.0
-1
Get the feature at the given index
public ComponentFeature getFeature(int index) { if (index >= features.length) return null; return features[index]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "iet.distributed.telemetry.Feature getFeature(int index);", "public ISlideData getFeature(int index);", "java.lang.String getFeatures(int index);", "iet.distributed.telemetry.FeatureOrBuilder getFeatureOrBuilder(\n int index);", "public Example getExample(Feature f,int i){\n\t\treturn featureIndex(f).get(i);\n\t}", "@ZenCodeType.Operator(ZenCodeType.OperatorType.INDEXGET)\n default IData getAt(int index) {\n \n return notSupportedOperator(OperatorType.INDEXGET);\n }", "uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode getNode(int index);", "void addFeature(int index, Feature feature);", "public int get(int index);", "void setFeature(int index, Feature feature);", "public double getFeature(int i) {\n\t return _features[i];\r\n\t//return 0;\r\n}", "public Object get(int index) {\n\t\treturn trainlist.get(index);\n\t}", "com.google.protobuf.ByteString getFeaturesBytes(int index);", "public T getByIndex(int index) {\n\n return this.myList[index];\n }", "public T get(int index) {\n return v.get(index);\n }", "public T get(int index);", "public T get(int index);", "public T get(int index);", "public float get(int index) {\r\n RangeCheck(index);\r\n return elementData[index];\r\n }", "public GPoint get(int index) {\n\t\treturn points.get(index);\n\t}", "float get(int idx);", "Object get(int index);", "Object get(int index);", "public SimpleFeature get(String featureID) {\n\t\treturn idIndex.get(featureID);\n\t}", "uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNodeOrBuilder getNodeOrBuilder(\n int index);", "public uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode getNode(int index) {\n return node_.get(index);\n }", "public org.landxml.schema.landXML11.FeatureDocument.Feature getFeatureArray(int i)\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.landxml.schema.landXML11.FeatureDocument.Feature target = null;\r\n target = (org.landxml.schema.landXML11.FeatureDocument.Feature)get_store().find_element_user(FEATURE$6, i);\r\n if (target == null)\r\n {\r\n throw new IndexOutOfBoundsException();\r\n }\r\n return target;\r\n }\r\n }", "public org.landxml.schema.landXML11.FeatureDocument.Feature getFeatureArray(int i)\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.landxml.schema.landXML11.FeatureDocument.Feature target = null;\r\n target = (org.landxml.schema.landXML11.FeatureDocument.Feature)get_store().find_element_user(FEATURE$6, i);\r\n if (target == null)\r\n {\r\n throw new IndexOutOfBoundsException();\r\n }\r\n return target;\r\n }\r\n }", "int indexOfFeature(Feature feature);", "public org.landxml.schema.landXML11.FeatureDocument.Feature getFeatureArray(int i)\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.landxml.schema.landXML11.FeatureDocument.Feature target = null;\r\n target = (org.landxml.schema.landXML11.FeatureDocument.Feature)get_store().find_element_user(FEATURE$14, i);\r\n if (target == null)\r\n {\r\n throw new IndexOutOfBoundsException();\r\n }\r\n return target;\r\n }\r\n }", "public T get(int index) {\n return list.get(index);\n }", "public Object get(int index);", "public Object get(int index);", "T get(int index);", "T get(int index);", "T get(int index);", "T get(int index);", "T get(int index);", "public T get(int aIndex);", "Species getSpeciesById(int index);", "public float get(int index) {\n return storage[index];\n }", "public float get (int idx)\n {\n switch (idx) {\n case 0: return x;\n case 1: return y;\n }\n throw new IndexOutOfBoundsException(Integer.toString(idx));\n }", "public PointF get(int index)\n {\n int realIndex = wrap(index, size());\n return Geometry.clone(points.get(realIndex));\n }", "public Object get(int index) {\r\n return entry(index).element;\r\n }", "public E get(int index) {\r\n\t\tif (indices.get(index) == null) {\r\n\t\t\tthrow new NoSuchElementException();\r\n\t\t} else {\r\n\t\t\treturn indices.get(index).data;\t\t\r\n\t\t}\r\n\t}", "public Layer getElement(int index) {\n\t\treturn layers[index];\n\t}", "T getElementFromIndex(int index) throws ListException;", "public T get(int index) {\n return this.list[index];\n }", "abstract int get(int index);", "public int get(int index) {\n\t\treturn r[index];\n\t}", "public int get(final int index) {\n return mFactorBase[index];\n }", "public abstract T get(int index);", "public T get(int index) {\r\n return getNodeAtIndex(index).getData();\r\n }", "public RatPoly get(int index) {\n //TODO: Fill in this method, then remove the RuntimeException\n throw new RuntimeException(\"RatPolyStack->get() unimplemented!\\n\");\n }", "public E get(int index)\r\n {\r\n checkValidIndex(index);\r\n return listIterator(index).next();\r\n }", "public int getIndex();", "public int getIndex();", "public int getIndex();", "public T get(int index){\n if(!rangeCheck(index)){\n return null;\n }\n return (T)data[index];\n }", "public DomainElement elementForIndex(int index);", "public int index();", "float getIn(int index);", "int get(int idx);", "public int getElementAtIndex(int index){\r\n return mArray[index];\r\n }", "public GeometricalObject getObject(int index);", "@Override\n public T get(final int index) {\n this.checkIndex(index);\n return this.data[index];\n }", "@Override\r\n\tpublic T get(int index) {\n\t\treturn this._list.get(index);\r\n\t}", "public VehicleType get(int index){\n\t\tfor(int i = 0; i < types.size(); i++){\n\t\t\tif(i == index){\n\t\t\t\treturn types.get(i);\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "public FSMNode get(int index) {\n return get(root, index);\n }", "public Tuple get(int index){\r\n\t\treturn tuples.get(index);\r\n\t}", "@Override\n public E get(int index) {\n // todo: Students must code\n checkRange(index); // throws IndexOOB Exception if out of range\n return data[calculate(index)];\n }", "org.landxml.schema.landXML11.FeatureDocument.Feature getFeatureArray(int i);", "org.landxml.schema.landXML11.FeatureDocument.Feature getFeatureArray(int i);", "public T get(int index) throws IndexOutOfBoundsException {\n checkException(index);\n return arr[index];\n }", "@Override\n public T get(int index) {\n return list.get(index);\n }", "int index();", "public Evolvable getIndividual(int index){\n\t\treturn population[index];\n\t}", "E get( int index );", "public Type get(int index);", "int get(int index)\n\t{\n\t\treturn inputArray[index];\n\t}", "public E get(int index) {\n\t\tcheckBounds(index);\r\n\t\treturn getNode(index).getData();\r\n\t}", "public Object get( int index )\n {\n\treturn _data[index];\n }", "public Integer get(int index){\n return list.get(index);\n }", "public Object getValue(int index);", "public int get(int index) {\n\t checkIndex(index);\n\t return elementData[index];\n\t }", "public Object get(final int index) {\n return super.get(index);\n }", "public Set<SimpleFeature> getFeaturesForTile(OSMTile tileIdx) {\n\t\tsynchronized (tileIndex) {\n\t\t\treturn tileIndex.get( tileIdx );\n\t\t}\n\t}" ]
[ "0.806264", "0.8011654", "0.76206285", "0.7322323", "0.7067161", "0.6987749", "0.6893376", "0.6818856", "0.6680097", "0.66699797", "0.6659548", "0.6656404", "0.6656094", "0.6595553", "0.6589978", "0.6577756", "0.6577756", "0.6577756", "0.6547953", "0.65285116", "0.65210235", "0.6505855", "0.6505855", "0.65018374", "0.6492975", "0.64826304", "0.64814854", "0.64814854", "0.64712703", "0.6467027", "0.64667994", "0.6463251", "0.6463251", "0.64234793", "0.64234793", "0.64234793", "0.64234793", "0.64234793", "0.6403768", "0.64002717", "0.63324904", "0.6325036", "0.63048553", "0.63039714", "0.63003117", "0.6298027", "0.6286206", "0.62809867", "0.62802553", "0.6264765", "0.62501806", "0.6238497", "0.62323594", "0.6221889", "0.6208422", "0.6203105", "0.6203105", "0.6203105", "0.6195553", "0.6179553", "0.6155236", "0.6150044", "0.61476654", "0.61351955", "0.6133806", "0.61327505", "0.6125029", "0.61237806", "0.6118235", "0.6118235", "0.6118235", "0.6118235", "0.6118235", "0.6118235", "0.6118235", "0.6118235", "0.6118235", "0.6118235", "0.6118235", "0.6118235", "0.6118235", "0.61107993", "0.61086845", "0.61043817", "0.6087744", "0.6087744", "0.60784805", "0.6069865", "0.606442", "0.60597074", "0.605888", "0.60497814", "0.60482097", "0.60419595", "0.60407424", "0.60398936", "0.6035626", "0.6029446", "0.6025894", "0.6023185" ]
0.80257815
1
Get the feature matching the given class if it exists. If more than one feature of the given class exists, then the first will be returned.
@SuppressWarnings("unchecked") public <T extends ComponentFeature> T getFeature(Class<T> featureClass) { for (final ComponentFeature f : features) if (f.getClass().isAssignableFrom(featureClass)) return (T) f; return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static ClassifiedFeature getClassifiedFeature(Classification classification, Feature feature, boolean containedInView) {\n ClassifiedFeature result = null;\n EList<ClassifiedFeature> classifiedFeatures;\n if (containedInView) {\n classifiedFeatures = classification.getClassifiedFeatures();\n } else {\n classifiedFeatures = classification.getAutoCompleteFeatures();\n }\n\n for (ClassifiedFeature classifiedFeature : classifiedFeatures) {\n Feature classifiedReference = classifiedFeature.getFeature();\n if (EcoreUtil.equals(feature, classifiedReference)) {\n result = classifiedFeature;\n break;\n }\n }\n return result;\n }", "public static DialogFeature getFeature(Class<? extends ShareContent> cls) {\r\n if (ShareLinkContent.class.isAssignableFrom(cls)) {\r\n return ShareDialogFeature.SHARE_DIALOG;\r\n }\r\n if (SharePhotoContent.class.isAssignableFrom(cls)) {\r\n return ShareDialogFeature.PHOTOS;\r\n }\r\n if (ShareVideoContent.class.isAssignableFrom(cls)) {\r\n return ShareDialogFeature.VIDEO;\r\n }\r\n if (ShareOpenGraphContent.class.isAssignableFrom(cls)) {\r\n return OpenGraphActionDialogFeature.OG_ACTION_DIALOG;\r\n }\r\n if (ShareMediaContent.class.isAssignableFrom(cls)) {\r\n return ShareDialogFeature.MULTIMEDIA;\r\n }\r\n if (ShareCameraEffectContent.class.isAssignableFrom(cls)) {\r\n return CameraEffectFeature.SHARE_CAMERA_EFFECT;\r\n }\r\n if (ShareStoryContent.class.isAssignableFrom(cls)) {\r\n return ShareStoryFeature.SHARE_STORY_ASSET;\r\n }\r\n return null;\r\n }", "public ComponentFeature getFeature(int index) {\r\n\t\tif (index >= features.length)\r\n\t\t\treturn null;\r\n\r\n\t\treturn features[index];\r\n\t}", "public EStructuralFeature getFeatureByXMLElementName(String namespace, String xmlElementName) {\n \t\t\t// try to find the EStructural feature locally\n \t\t\t// TODO: consider namespace\n \t\t\tEStructuralFeature result = xmlNameToEStructuralFeatureMap.get(xmlElementName);\n \t\t\tif (null == result) {\n \t\t\t\tIterator<EStructuralFeature> allFeaturesIter = eClass.getEAllStructuralFeatures().iterator();\n \t\t\t\tList<EStructuralFeature> results = new ArrayList<EStructuralFeature>();\n \t\t\t\twhile (allFeaturesIter.hasNext()) {\n \t\t\t\t\tEStructuralFeature feature = allFeaturesIter.next();\n \t\t\t\t\tString xmlWrapperName = getRMFExtendedMetaData(feature).getXMLWrapperName();\n \n \t\t\t\t\t// search by feature wrapper\n \t\t\t\t\tif (xmlWrapperName.equals(xmlElementName)) {\n \t\t\t\t\t\tif (isIdentifiedByFeatureWrapper(feature)) {\n \t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t}\n \t\t\t\t\t} else {\n \t\t\t\t\t\t// search by feature name\n \t\t\t\t\t\tString xmlName = getRMFExtendedMetaData(feature).getXMLName();\n \t\t\t\t\t\tif (xmlName.equals(xmlElementName)) {\n \t\t\t\t\t\t\tif (isIdentifiedByFeature(feature)) {\n \t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t// search by type wrapper (assuming type is type of feature)\n \t\t\t\t\t\t\tString classifierWrapperXMLName = getRMFExtendedMetaData(feature.getEType()).getXMLWrapperName();\n \t\t\t\t\t\t\tif (classifierWrapperXMLName.equals(xmlElementName)) {\n \t\t\t\t\t\t\t\tif (isIdentifiedByClassifierWrapper(feature)) {\n \t\t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t// not found, continue with next feature\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\t// search by type wrapper name (assuming type not type of feature)\n \t\t\t\t\t\t\t\tEClassifier classifier = getTypeByXMLWrapperName(namespace, xmlElementName);\n \t\t\t\t\t\t\t\tif (null != classifier) {\n \t\t\t\t\t\t\t\t\tif (feature.getEType().equals(classifier)) {\n \t\t\t\t\t\t\t\t\t\tif (isIdentifiedByClassifierWrapper(feature)) {\n \t\t\t\t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t} else if (classifier instanceof EClass) {\n \t\t\t\t\t\t\t\t\t\tEClass eClass = (EClass) classifier;\n \t\t\t\t\t\t\t\t\t\tif (eClass.getEAllSuperTypes().contains(feature.getEType())) {\n \t\t\t\t\t\t\t\t\t\t\tif (isIdentifiedByClassifierWrapper(feature)) {\n \t\t\t\t\t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t// search by type name (assuming type not type of feature)\n \t\t\t\t\t\t\t\t\tclassifier = getTypeByXMLName(namespace, xmlElementName);\n \t\t\t\t\t\t\t\t\tif (null != classifier) {\n \t\t\t\t\t\t\t\t\t\tif (feature.getEType().equals(classifier)) {\n \t\t\t\t\t\t\t\t\t\t\tif (isIdentifiedByClassifier(feature)) {\n \t\t\t\t\t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t\t\t\t\t} else if (isNone(feature)) {\n \t\t\t\t\t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\t} else if (classifier instanceof EClass) {\n \t\t\t\t\t\t\t\t\t\t\tif (eClass.getEAllSuperTypes().contains(feature.getEType())) {\n \t\t\t\t\t\t\t\t\t\t\t\tif (isIdentifiedByClassifier(feature)) {\n \t\t\t\t\t\t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t\t\t\t\t\t} else if (isNone(feature)) {\n \t\t\t\t\t\t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\t\t} else if (isNone(feature)) {\n \t\t\t\t\t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\t} else if (isNone(feature)) {\n \t\t\t\t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t} else if (isNone(feature)) {\n \t\t\t\t\t\t\t\t\t\tresults.add(feature);\n \t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t// not found, continue with next feature\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t} // if (null != classifier && classifier instanceof EClass)\n \t\t\t\t\t\t\t} // if (classifierXMLName.equals(xmlElementName))\n \t\t\t\t\t\t} // if (xmlName.equals(xmlElementName))\n \t\t\t\t\t} // if (xmlWrapperName.equals(xmlElementName))\n \t\t\t\t} // while\n \n \t\t\t\t// if there are multiple valid features, we prefer the feature that is many and is not NONE\n \t\t\t\tint size = results.size();\n \t\t\t\tif (1 == size) {\n \t\t\t\t\tresult = results.get(0);\n \t\t\t\t} else if (0 < size) {\n \t\t\t\t\t// rule 1 we like the features that are explicitly selected\n \t\t\t\t\tList<EStructuralFeature> identifiedFeatures = new ArrayList<EStructuralFeature>();\n \t\t\t\t\tList<EStructuralFeature> noneFeatures = new ArrayList<EStructuralFeature>();\n \t\t\t\t\tfor (int i = 0; i < size; i++) {\n \t\t\t\t\t\tEStructuralFeature feature = results.get(i);\n \t\t\t\t\t\tif (isNone(feature)) {\n \t\t\t\t\t\t\tnoneFeatures.add(feature);\n \t\t\t\t\t\t} else {\n \t\t\t\t\t\t\tidentifiedFeatures.add(feature);\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \n \t\t\t\t\tif (identifiedFeatures.isEmpty()) {\n \t\t\t\t\t\t// there are none Features only\n \t\t\t\t\t\tresults = noneFeatures;\n \t\t\t\t\t} else {\n \t\t\t\t\t\tresults = identifiedFeatures;\n \t\t\t\t\t}\n \n \t\t\t\t\tresult = results.get(0);\n \n \t\t\t\t\t// try to find a better features that is many\n \t\t\t\t\tfor (EStructuralFeature feature : results) {\n \t\t\t\t\t\tif (feature.isMany()) {\n \t\t\t\t\t\t\tresult = feature;\n \t\t\t\t\t\t\tbreak;\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n\t\t\t}\n \n \t\t\t// TODO: fall back to standard serialization?\n \n \t\t\treturn result;\n \t\t}", "public static ClassifiedFeature getOrCreateClassifiedFeature(Classification classification, Feature feature) {\n ClassifiedFeature classifiedFeature = ClassificationUtil.getClassifiedFeature(classification, feature);\n if (classifiedFeature == null) {\n classifiedFeature = ClassificationUtil.createdClassifiedFeature(classification, feature);\n }\n return classifiedFeature;\n }", "Feature findById(Long featureId);", "Feature getFeature();", "Feature getFeature();", "public <T> T lookup(Class<T> clazz);", "Feature loadFeature(Integer id);", "iet.distributed.telemetry.Feature getFeature(int index);", "public gov.weather.graphical.xml.dwmlgen.schema.dwml_xsd.FeatureTypeType xgetFeatureType()\n {\n synchronized (monitor())\n {\n check_orphaned();\n gov.weather.graphical.xml.dwmlgen.schema.dwml_xsd.FeatureTypeType target = null;\n target = (gov.weather.graphical.xml.dwmlgen.schema.dwml_xsd.FeatureTypeType)get_store().find_element_user(FEATURETYPE$4, 0);\n return target;\n }\n }", "public static Feature get(int id) throws SQLException {\r\n\t\tString featureIdColumnName = \"FEATURE_ID\";\r\n\t\tResultSet rs = operation.getRow(\"FEATURE\", featureIdColumnName, id);\r\n\t\tFeature feature = new Feature();\r\n\t\t\r\n\t\twhile (rs.next()) {\r\n\t\t\tfeature.setFeatureId(rs.getString(\"FEATURE_ID\"))\r\n\t\t\t\t.setVideoId(rs.getString(\"VIDEO_ID\"))\r\n\t\t\t\t.setFeatureName(rs.getString(\"FEATURE_NAME\"))\r\n\t\t\t\t.setFeatureVector(rs.getString(\"FEATURE_VECTOR\"))\r\n\t\t\t\t.setCreationDate(rs.getString(\"CREATION_DATE\"));\r\n\t\t}\r\n\t\t\r\n\t\t//System.out.println(\"Name: \" + feature.getFeatureName());\r\n\t\treturn feature;\r\n\t}", "public SimpleFeature get(String featureID) {\n\t\treturn idIndex.get(featureID);\n\t}", "public boolean getFeature(@Nonnull Feature f) {\r\n return features.contains(f);\r\n }", "Fish findFish(){\r\n\t\t//step through GameCollection using iterator to find first instance of a fish\r\n\t\tIterator iterator = gc.getIterator();\r\n\t\twhile(iterator.hasNext()){\r\n\t\t\tGameObject g = iterator.getNext();\r\n\t\t\tif (g instanceof Fish)return (Fish)g;\r\n\t\t}\r\n\treturn nullFish;\r\n\t}", "@Override\n\tpublic MADlibFeature lookUpFeature(MADlibFeatureKey key) {\n\t\t// TODO Auto-generated method stub\n\t\treturn null;\n\t}", "public DasFeature getNextFeature() {\n String feature = iXml.substring(iXml.indexOf(\"<FEATURE\", lastFeatureEndPosition + 9), iXml.indexOf(\"</FEATURE>\", lastFeatureEndPosition + 9) + 10);\n lastFeatureEndPosition = iXml.indexOf(\"</FEATURE>\", lastFeatureEndPosition + 9);\n DasFeature f = new DasFeature(feature);\n return f;\n }", "private LanguageFeature getLanguageFeatureByLanguageModule(LanguageModule languageModule, ArrayList<LanguageFeature> featuresList) {\n\t\tfor (LanguageFeature languageFeature : featuresList) {\n\t\t\tif(languageFeature.getImplementationModule() != null && languageFeature.getImplementationModule().equals(languageModule))\n\t\t\t\treturn languageFeature;\n\t\t}\n\t\treturn null;\n\t}", "@Override\n public Classification<F, C> classify(Collection<F> features) {\n SortedSet<Classification<F, C>> probabilites = this.categoryProbabilities(features);\n\n if (probabilites.size() > 0) {\n return probabilites.last();\n }\n return null;\n }", "private SimpleFeature findFeature( FeatureStore<SimpleFeatureType, SimpleFeature> store, String fid) throws SOProcessException {\n \n try {\n FidFilter filter = FILTER_FACTORY.createFidFilter(fid);\n \n FeatureCollection<SimpleFeatureType, SimpleFeature> featuresCollection = store.getFeatures(filter);\n FeatureIterator<SimpleFeature> iter = featuresCollection.features();\n \n assert iter.hasNext();\n \n SimpleFeature feature = iter.next();\n \n return feature;\n \n } catch (IOException e) {\n final String msg = e.getMessage();\n LOGGER.severe(msg);\n throw new SOProcessException(msg);\n }\n }", "private static <T> Optional<T> find(ClassPath path, ClassNode in, Function<ClassNode, Optional<T>> get) {\n Optional<T> v = get.apply(in);\n if (v.isPresent()) {\n return v;\n }\n return supers(in).map(s -> {\n Optional<ClassNode> superClass = path.findClass(new ClassDescriptor(s));\n return superClass.<T>flatMap(c -> find(path, c, get));\n }).filter(Optional::isPresent).map(Optional::get).findFirst();\n }", "@SuppressWarnings(\"unchecked\")\n public <C extends T> C get(final Class<C> clazz) {\n return (C) data.stream()\n .filter(element -> clazz.isAssignableFrom(element.getClass()))\n .findAny()\n .orElse(null);\n }", "boolean containsFeature(Feature feature);", "@Override\r\n\t\tpublic Object getFeature(String feature, String version)\r\n\t\t\t{\n\t\t\t\treturn null;\r\n\t\t\t}", "public UMFeature getFeatureById(Long featureID) throws UMUserManagementException {\n return (featureService.getFeatureByFeatureId(featureID));\n }", "public FeatureProcessor getFeatureProcessor(String name) {\n\treturn (FeatureProcessor) featureProcessors.get(name);\n }", "public Features getFeatures (SootMethod method) {\n if (propagatedFeaturesMap.containsKey(method)) {\n return propagatedFeaturesMap.get(method);\n } else if (featuresMap.containsKey(method)) {\n return featuresMap.get(method);\n } else if (featuresLibMap.containsKey(method)) {\n return featuresLibMap.get(method);\n } else {\n Features features = new Features(method);\n featuresLibMap.put(method, features);\n return features;\n }\n }", "public AbstractMFeature2 getFeature() {\n return feature;\n }", "boolean contains(SimpleFeature feature);", "public boolean containsFeature(Feature f);", "int indexOfFeature(Feature feature);", "String getFeature();", "String getFeature();", "public java.util.List getFeature() \n {\n \tModelFacade instance = ModelFacade.getInstance(this.refOutermostPackage().refMofId());\n \tif (instance != null && \n \t\tinstance.isRepresentative(this.refMofId())&&\n \t\tinstance.hasRefObject(this.refMofId()))\n \t{ \t\n \t\tList list = instance.getFeature(this.refMofId());\n \t\tlist.addAll(super_getFeature());\n \t\t\n \t\treturn list; \t\t\n \t}\n \n \treturn super_getFeature();\n }", "iet.distributed.telemetry.FeatureOrBuilder getFeatureOrBuilder(\n int index);", "public org.pentaho.pms.cwm.pentaho.meta.core.CwmStructuralFeature getFeature();", "@SuppressWarnings(\"unchecked\")\n private Optional<Match> classMatchSearch(Class declaringClass) {\n// return memoizer.classMatches(result, declaringClass, () -> {\n List<Match> matches = new ArrayList<>();\n Stack<Class> classes = new Stack<>();\n classes.push(declaringClass);\n while(!classes.isEmpty()) {\n Class cls = classes.pop();\n Match match = result.getMatch(cls);\n\n if(match != null) {\n matches.add(match);\n }\n if(cls.getInterfaces() != null) {\n Stream.of(cls.getInterfaces()).forEach(c -> classes.push(c));\n }\n if(cls.getSuperclass() != null && !cls.getSuperclass().equals(Object.class)) {\n classes.push(cls.getSuperclass());\n }\n }\n\n if(matches.size() == 1) {\n return Optional.of(matches.get(0));\n } else if(matches.size() > 1) {\n // Join all the includes and excludes\n Match unionMatch = new Match();\n matches.forEach(m -> {\n unionMatch.getExcludes().addAll(m.getExcludes());\n unionMatch.getIncludes().addAll(m.getIncludes());\n unionMatch.getTransforms().putAll(m.getTransforms());\n });\n return Optional.of(unionMatch);\n } else {\n return Optional.empty();\n }\n// });\n }", "public String getFeature() {\r\n return feature;\r\n }", "FTCommand getFeature();", "public RTTIClass select(ClassFilter filter);", "@Override\n public Class<? extends Feature> getFeatureClass() {\n\treturn VersionFeatures.class;\n }", "default Optional<ClassElement> getClassElement(Class<?> type) {\n if (type != null) {\n return getClassElement(type.getName());\n }\n return Optional.empty();\n }", "private static FieldTypePair getAnnotatedFieldIfPresent(final Class clazz, Class<? extends Annotation> annotationClass) {\n for (final FieldTypePair fieldTypePair : getDeclaredAndInheritedFieldTypePairs(clazz, true)) {\n Field field = fieldTypePair.getField();\n if (field.isAnnotationPresent(annotationClass)) {\n return fieldTypePair;\n }\n }\n return null;\n }", "private Object getFeature (EObject o, String feature) {\n\n if(o == null){\n System.out.println(\"Null object given\");\n }\n\n return o.eGet(o.eClass().getEStructuralFeature(feature));\n }", "private static ServiceRegistry getRegistry(final String registryClass) {\n ServiceLoader<ServiceRegistry> registryServices\n = ServiceLoader.load(ServiceRegistry.class);\n for (ServiceRegistry serviceRegistry : registryServices) {\n if (registryClass.equals(serviceRegistry.getClass().getName())) {\n return serviceRegistry;\n }\n }\n return null;\n }", "XClass getClassOrElementClass();", "Feature createFeature();", "public Class getFeatureClassForType(Das2TypeI type) {\n return Das2FeatureI.class;\n }", "public T getFirst();", "public T getFirst();", "public HashMap<String, HashMap<String, String>> getNearestFacility() {\n if (this.featureInfoHashMap==null) {\n return null;\n }\n return (HashMap<String, HashMap<String, String>>) this.featureInfoHashMap.entrySet().iterator().next();\n }", "@SuppressWarnings(\"rawtypes\")\n\tfinal public List<Class<? extends Feature>> getFeatureClasses(String name) {\n\t\treturn this.featureClasses.get(name);\n\t}", "public static <T> T findByClass(Context ctx, Class<T> klass) throws NamingException {\n\t\tif(jndiClassCache.containsKey(klass)) {\n\t\t\treturn klass.cast(jndiClassCache.get(klass));\n\t\t}\n\t\tNamingEnumeration<NameClassPair> ne = ctx.list(\"\");\n\t\tif (ne.hasMoreElements()) {\n\t\t\twhile (ne.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tNameClassPair ncp = (NameClassPair) ne.nextElement();\n\t\t\t\t\tObject el = ctx.lookup(ncp.getName());\n\t\t\t\t\tif(klass.isAssignableFrom(el.getClass())) {\n\t\t\t\t\t\tjndiClassCache.put(klass, el);\n\t\t\t\t\t\treturn klass.cast(el);\n\t\t\t\t\t} else if (el instanceof Context) {\n\t\t\t\t\t\tObject o = findByClass((Context) el, klass);\n\t\t\t\t\t\tif (o != null)\n\t\t\t\t\t\t\treturn klass.cast(o);\n\t\t\t\t\t}\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "public Integer getFeature() {\n return feature;\n }", "public Vehicle getService(boolean service) {\n\t\tfor (int i = 0; i < vehicles.size(); i++) {\n\t\t\tVehicle temp = vehicles.get(i);\n\n\t\t\tif (temp.getService() == service) {\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "public void loadFeatures(Class<?> classToRun) throws Exception {\n List<Features> annos = FeaturesRunner.getScanner().getAnnotations(classToRun, Features.class);\n for (Features anno : annos) {\n for (Class<? extends RunnerFeature> cl : anno.value()) {\n loadFeature(new HashSet<>(), cl);\n }\n }\n\n }", "@SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n\tFeature<T, ?> convertFeature(Feature<T,?> feature) {\n\t\tFeature<T, ?> convertedFeature = feature;\n\t\tif (feature.getFeatureType().equals(StringFeature.class) && !(feature instanceof StringFeature)) {\n\t\t\tconvertedFeature = new StringFeatureWrapper(feature);\n\t\t} else if (feature.getFeatureType().equals(BooleanFeature.class) && !(feature instanceof BooleanFeature)) {\n\t\t\tconvertedFeature = new BooleanFeatureWrapper(feature);\n\t\t} else if (feature.getFeatureType().equals(DoubleFeature.class) && !(feature instanceof DoubleFeature)) {\n\t\t\tconvertedFeature = new DoubleFeatureWrapper(feature);\n\t\t} else if (feature.getFeatureType().equals(IntegerFeature.class) && !(feature instanceof IntegerFeature)) {\n\t\t\tconvertedFeature = new IntegerFeatureWrapper(feature);\n\t\t} else {\n\t\t\tconvertedFeature = this.convertFeatureCustomType(feature);\n\t\t\tif (convertedFeature==null)\n\t\t\t\tconvertedFeature = feature;\n\t\t}\n\t\treturn convertedFeature;\n\t}", "public String feature() {\n return feature;\n }", "private static EndpointProvider\n getEndpointProvider(final String providerClass) {\n ServiceLoader<EndpointProvider> providerServices\n = ServiceLoader.load(EndpointProvider.class);\n for (EndpointProvider provider : providerServices) {\n if (providerClass.equals(provider.getClass().getName())) {\n return provider;\n }\n }\n return null;\n }", "@Override\n public JavaClass findClass(final String className) {\n final SoftReference<JavaClass> ref = loadedClasses.get(className);\n if (ref == null) {\n return null;\n}\n return ref.get();\n }", "@Nullable JvmIdentifiableElement getFeature();", "public <T> T get(String name, Class<T> javaclass) {\n return null;\n }", "@NotNull\n public F getFirst() {\n return first;\n }", "default Optional<ClassElement> getClassElement(String name) {\n return Optional.empty();\n }", "FeatureMapper getFeatureMapper(\n String qualifiedClassName,\n FeatureMapper.Type type\n ) throws ServiceException;", "PolicyEngineFeatureApi getFeatureProvider(String featureName);", "public String isFirstClassSeat();", "public static <T> T getByClass(Collection<?> collection, Class<T> clazz) {\n for (Object elem : collection) {\n if (clazz.isInstance(elem)) return (T) elem;\n }\n return null;\n }", "public <T extends SocketService> T getSocketService(Class<T> cls){\n\t\ttry{\n\t\t\tfor(T candidate : _context.getBeansOfType(cls).values()){\n\t\t\t\tif(candidate.getClass().equals(cls)){\n\t\t\t\t\treturn candidate;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (BeansException ex){\n\t\t\tLOGGER.warn(ex, ex);\t\t\n\t\t}\n\t\treturn null;\n\t}", "public Class<? extends FormatFeature> getFormatReadFeatureType()\n/* */ {\n/* 415 */ return null;\n/* */ }", "@Override\n public <T> T getToolService(Class<T> serviceClass)\n {\n if (serviceClass.isAssignableFrom(getClass()))\n {\n return (T)this;\n }\n return null;\n }", "@Override\n\tpublic <ITF> Optional<ITF> getService(Class<ITF> itfClass, String servicePath) {\n\t\treturn IRegistryProvider.INSTANCE.getService(itfClass, servicePath);\n\t}", "public <T> T findElementUnder(int type, float[] detectionPoint, Class<T> elementClass) {\n\t\tList<Element> hitElements = new ArrayList<Element>(); \n\t\tfinal List<Element> elements = getDiagram().getElements();\n\t\tfinal float[] detectionRectangle = Geometry.rectangleFromPoints(detectionPoint, detectionPoint);\n\t\tGeometry.expandRectangle(detectionRectangle, 3f, 3f);\n\t\tfor ( int i=elements.size()-1; i >=0; i-- ) {\n\t\t\tElement element = elements.get(i);\n\t\t\telement.hitTesting(hitElements, detectionPoint, detectionRectangle, type, this);\n\t\t\tif ( !hitElements.isEmpty() ) {\n\t\t\t\tIterator<Element> iterator = hitElements.iterator();\n\t\t\t\twhile ( iterator.hasNext() ) {\n\t\t\t\t\tElement current = iterator.next();\n\t\t\t\t\tif ( elementClass.isInstance(current) ) return elementClass.cast(current);\n\t\t\t\t\titerator.remove();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "public <T extends Base> T findByName(Class<T> T, String name)\n\t\t\tthrows IOException, ClassNotFoundException {\n\t\tT result = null;\n\t\tfor (T t : list(T)) {\n\t\t\tif (t.getName().equals(name)) {\n\t\t\t\tresult = t;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "public abstract Feature<T, ?> convertFeatureCustomType(Feature<T,?> feature);", "public boolean hasFeature(T feature) {\n\t\tif (duplicates) {\n\t\t\treturn featuresList.contains(feature);\n\t\t}\n\t\treturn features.contains(feature);\n\t}", "public static synchronized String getOrDefault(Class<?> key){\n\t\tif (ClassRegistry.primitives.containsKey(key))\n\t\t\treturn ClassRegistry.primitives.get(key).getXML();\n\t\telse if (ClassRegistry.dictionary.containsKey(key))\n\t\t\treturn ClassRegistry.dictionary.get(key);\n\t\telse\n\t\t\treturn key.getName();\n\t}", "List<Feature> getFeatures();", "public MatchFeatures getMatchFeature(String nameTable) {\n String sql = \"SELECT * FROM \" + nameTable + \" ORDER BY RAND() LIMIT 2\";\n try (Statement st = conn.createStatement();\n ResultSet rs = st.executeQuery(sql)) {\n MatchFeatures matchFeatures = new MatchFeatures();\n if (rs.next()) {\n matchFeatures.setFeature1(new Feature(rs.getInt(1), rs.getString(2), rs.getInt(3),rs.getInt(4), rs.getString(5)));\n }\n if (rs.next()) {\n matchFeatures.setFeature2(new Feature(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getInt(4), rs.getString(5)));\n }\n return matchFeatures;\n } catch (SQLException e) {\n e.printStackTrace();\n }\n return null;\n }", "@Override\n public ClassInfo findClass(String fqcn) {\n if (classLookup == null) {\n buildClassLookupMap();\n }\n return classLookup.get(fqcn);\n }", "CabinClassModel findCabinClass(Integer cabinClassIndex);", "FeatureId getFeatureId();", "public String getBestClassByClassification(Features features,\r\n\t\t\tFileOneByOneLineWriter writer) {\r\n\t\tdouble[] categoryProb = getClassProbByClassification(features, writer);\r\n\t\tdouble maximumProb = -Double.MAX_VALUE;\r\n\t\tint maximumIndex = -1;\r\n\t\tfor (int i = 0; i < categoryProb.length; ++i) {\r\n\t\t\tif (maximumProb < categoryProb[i]) {\r\n\t\t\t\tmaximumProb = categoryProb[i];\r\n\t\t\t\tmaximumIndex = i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn mCategories[maximumIndex];\r\n\t}", "@SuppressWarnings(\"unchecked\")\n public <T extends OperationSet> T getOperationSet(Class<T> opsetClass)\n {\n return (T) supportedOperationSets.get(opsetClass.getName());\n }", "public static URI findMostSpecificClass(PartialHierarchyTree<URI> classHierarchy) {\n\t\tfinal Set<PartialHierarchyTree.Node<URI>> nodes = classHierarchy.getNodes();\n\t\tint maxDepth = 0;\n\t\tPartialHierarchyTree.Node<URI> deepestLeaf = classHierarchy.getRoot();\n\t\tfor (PartialHierarchyTree.Node<URI> node : nodes) {\n\t\t\tint depth = getDepth(node);\n\t\t\tif (depth >= maxDepth) {\n\t\t\t\tmaxDepth = depth;\n\t\t\t\tdeepestLeaf = node;\n\t\t\t}\n\t\t}\n\t\treturn deepestLeaf.getData();\n\t}", "public F first() {\n return this.first;\n }", "public ElemFeature selectByPrimaryKey(Integer id) throws SQLException {\r\n\t\tElemFeature key = new ElemFeature();\r\n\t\tkey.setId(id);\r\n\t\tElemFeature record = (ElemFeature) getSqlMapClientTemplate()\r\n\t\t\t\t.queryForObject(\r\n\t\t\t\t\t\t\"cementerio_elem_feature.ibatorgenerated_selectByPrimaryKey\",\r\n\t\t\t\t\t\tkey);\r\n\t\treturn record;\r\n\t}", "public static URI findMostSpecificClass(Rdf2GoCore core, URI concept) {\n\t\treturn findMostSpecificClass(getClassHierarchy(core, concept));\n\t}", "private Feature searchRefCatastral(Feature[] cache,Feature refCatFeature, Comparator comparator)\r\n {\r\n int featureIndex = Arrays.binarySearch(cache, refCatFeature,comparator);\r\n if(featureIndex<0) return null;\r\n return cache[featureIndex];\r\n }", "public static ClassifiedFeature createClassifiedFeature(Feature feature) {\n return createClassifiedFeature(feature, Classifier.UNCLASSIFIED);\n }", "private FeatureSet extractFeatureSet() {\n if (accountTypeGuestJRadioButton.isSelected()) {\n return FeatureSet.FREE;\n } else if (accountTypeStandardJRadioButton.isSelected()) {\n return FeatureSet.PREMIUM;\n } else {\n throw Assert.createUnreachable(\"Unknown account type selected.\");\n }\n }", "Collection<Feature> getReference();", "@ServiceMethod(returns = ReturnType.SINGLE)\n public DeviceClass getDeviceClass(String deviceClassId) {\n return this.serviceClient.getDeviceClass(deviceClassId);\n }", "private static PsiClass isReturnTypeExistedAsClass(PsiType _type, PsiClass _targetClass) {\r\n PsiFile file = _targetClass.getContainingFile();\r\n if (file == null) return null;\r\n\r\n List<PsiClass> classList = new ArrayList<>();\r\n for (PsiFile f : _targetClass.getContainingFile().getContainingDirectory().getFiles()) {\r\n if (f.equals(file)) continue;\r\n else {\r\n for (PsiClass c : ((PsiClassOwner) f).getClasses()) classList.add(c);\r\n }\r\n }\r\n\r\n for (PsiClass cls : classList) {\r\n if (_type.getPresentableText().equals(cls.getName()))\r\n return cls;\r\n }\r\n return null;\r\n }", "@Nullable\n @Override\n public Faction getFactionByTag(@NotNull String tag) {\n return getFaction(tag);\n }", "com.google.cloud.vision.v1p3beta1.Feature.Type getType();", "<T> T get(Class<T> clazz, Serializable id);", "public String getFClass() {\n\t\t\treturn this.fClass ;\n\t\t}", "public ClassItem SearchClass(String className) {\n\t\tfor(ClassItem classitem : classItem)\n\t\t{\n\t\t\tif(classitem.name==className)\n\t\t\t\treturn classitem;\n\t\t}\n\t\treturn null;\n\t}" ]
[ "0.6206799", "0.5886297", "0.5881514", "0.5861704", "0.57684344", "0.5707813", "0.5661889", "0.5661889", "0.55325437", "0.5513788", "0.54942745", "0.5415601", "0.5381699", "0.53585297", "0.53232926", "0.53206307", "0.52989197", "0.5264417", "0.5255051", "0.518691", "0.5185604", "0.51552314", "0.5150396", "0.5131252", "0.51229477", "0.50945413", "0.5086479", "0.50808287", "0.50584203", "0.5054521", "0.5026965", "0.50113225", "0.4994101", "0.4994101", "0.4992506", "0.49907726", "0.49658194", "0.4943688", "0.49411726", "0.4912483", "0.49034894", "0.4900466", "0.48958474", "0.48797908", "0.48449358", "0.4833414", "0.48303938", "0.4828389", "0.48215368", "0.48119298", "0.48119298", "0.48047426", "0.48015788", "0.47785804", "0.4766735", "0.4755646", "0.47482562", "0.47478345", "0.47474962", "0.47407025", "0.47390896", "0.47376224", "0.47363925", "0.47243282", "0.4722896", "0.47182938", "0.47115287", "0.4706184", "0.47060674", "0.46990162", "0.46842718", "0.46812168", "0.46796778", "0.46735767", "0.46683514", "0.46669996", "0.466597", "0.4665311", "0.4661437", "0.46557477", "0.4649792", "0.46460256", "0.46385488", "0.4638358", "0.4635512", "0.46237803", "0.46193627", "0.46187088", "0.4615478", "0.46153858", "0.4611183", "0.46082896", "0.45961013", "0.45806023", "0.45785302", "0.4571452", "0.4565572", "0.45648322", "0.4562089", "0.4561959" ]
0.770175
0
/ No super call because of splash gfx
@Override public void hit(Npc attacker, Mob defender, Hit hit) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void showSplash() {\n }", "private void splashScreen() {\r\n\t\t// Clear the screen, reset the level, and display the legend\r\n\t\tclear();\r\n\t\tdisplay.setLegend(\"Asteroids\");\r\n\r\n\t\t// Place four asteroids near the corners of the screen.\r\n\t\tplaceAsteroids();\r\n\t}", "static void renderSplashFrame(Graphics2D g) {\n\t\tfinal String version = \"Release: 2.1.1 - release date: 2022-07-31\";\r\n\t\tg.setComposite(AlphaComposite.Clear);\r\n\t\tg.fillRect(120, 140, 200, 40);\r\n\t\tg.setPaintMode();\r\n\t\tg.setColor(Color.BLACK);\r\n\t\tg.drawString(\"Loading \" + version + \"...\", 120, 350);\r\n\t}", "public SplashScreen() {\r\n instance = this;\r\n\r\n width = 600;\r\n height = 600;\r\n\r\n icon = \"graphics/application/icon_96.png\";\r\n }", "protected void init() {\n splashImg = new Texture(\"splash.png\");\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic void initGui() {\n\t\tthis.viewportTexture = new DynamicTexture(256, 256);\n\t\tthis.field_110351_G = this.mc.getTextureManager().getDynamicTextureLocation(\"background\", this.viewportTexture);\n\t\tCalendar var1 = Calendar.getInstance();\n\t\tvar1.setTime(new Date());\n\n\t\tif (var1.get(2) + 1 == 11 && var1.get(5) == 9) {\n\t\t\tthis.splashText = \"Happy birthday, ez!\";\n\t\t} else if (var1.get(2) + 1 == 6 && var1.get(5) == 1) {\n\t\t\tthis.splashText = \"Happy birthday, Notch!\";\n\t\t} else if (var1.get(2) + 1 == 12 && var1.get(5) == 24) {\n\t\t\tthis.splashText = \"Merry X-mas!\";\n\t\t} else if (var1.get(2) + 1 == 1 && var1.get(5) == 1) {\n\t\t\tthis.splashText = \"Happy new year!\";\n\t\t} else if (var1.get(2) + 1 == 10 && var1.get(5) == 31) {\n\t\t\tthis.splashText = \"OOoooOOOoooo! Spooky!\";\n\t\t} else {\n\t\t\tthis.splashText = \"\";\n\t\t}\n\n\t\tboolean var2 = true;\n\t\tint var3 = this.height / 4 + 48;\n\n\t\tthis.addSingleplayerMultiplayerButtons();\n\n\t\tthis.buttonList.add(new GuiButton(0, this.width - 120, 3, 60, 20, I18n.format(\"menu.options\", new Object[0])));\n\t\tthis.buttonList.add(new GuiButton(4, this.width - 54, 3, 50, 20, I18n.format(\"menu.quit\", new Object[0])));\n\n\t\t// Remove annoying language button\n\t\t// this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124,\n\t\t// var3 + 72 + 12));\n\n\t\tObject var4 = this.field_104025_t;\n\n\t\tsynchronized (this.field_104025_t) {\n\t\t\tthis.field_92023_s = this.fontRendererObj.getStringWidth(this.field_92025_p);\n\t\t\tthis.field_92024_r = this.fontRendererObj.getStringWidth(this.field_146972_A);\n\t\t\tint var5 = Math.max(this.field_92023_s, this.field_92024_r);\n\t\t\tthis.field_92022_t = (this.width - var5) / 2;\n\t\t\tthis.field_92021_u = ((GuiButton) this.buttonList.get(0)).yPosition - 24;\n\t\t\tthis.field_92020_v = this.field_92022_t + var5;\n\t\t\tthis.field_92019_w = this.field_92021_u + 24;\n\t\t}\n\t}", "public void startSplashGameOver(){\r\n\t\t\r\n\t\tpanel[CurrentPanel].stop();\r\n\t\t\r\n\t\tDriver.panel[CurrentPanel].setVisible(false);\r\n\t\tgame.remove(panel[CurrentPanel] );\r\n\t\t\r\n\t\tCurrentPanel = 0;\r\n\t\t\r\n\t\t\r\n\t\tpanel[CurrentPanel] = new Splash(this);\r\n\t\t\r\n\t\tadd( panel[CurrentPanel] );\r\n\t\tpanel[CurrentPanel].setVisible(true);\r\n\t\tgame.setVisible(true);\r\n\t\t\r\n\t\tpanel[CurrentPanel].start();\r\n\t\t\r\n\t}", "public ScreenSplash() {\n initComponents();\n this.setCursor(new Cursor(HAND_CURSOR));\n setBackground(new Color(0, 0, 0, 0));\n }", "@Override\r\n\tpublic void launch() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void launch() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void launch() {\n\t\t\r\n\t}", "@Override\n\tpublic void registerGFX() {\n\t\t\n\t}", "private void ini_Progressbar()\r\n\t{\r\n\r\n\t\tfloat ref = UiSizes.that.getWindowHeight() / 13;\r\n\t\tCB_RectF CB_LogoRec = new CB_RectF(this.getHalfWidth() - (ref * 2.5f), this.getHeight() - ((ref * 5) / 4.11f) - ref, ref * 5,\r\n\t\t\t\t(ref * 5) / 4.11f);\r\n\r\n\t\t// CB_Logo = new Image(CB_LogoRec, \"CB_Logo\");\r\n\t\t// CB_Logo.setDrawable(new SpriteDrawable(atlas.createSprite(\"cachebox-logo\")));\r\n\t\t// this.addChild(CB_Logo);\r\n\r\n\t\tString VersionString = Global.getVersionString();\r\n\t\tTextBounds bounds = Fonts.getNormal().getMultiLineBounds(VersionString + Global.br + Global.br + Global.splashMsg);\r\n\t\tdescTextView = new Label(0, CB_LogoRec.getY() - ref - bounds.height, this.getWidth(), bounds.height + 10, \"DescLabel\");\r\n\t\t// HAlignment.CENTER funktioniert (hier) (noch) nicht, es kommt rechtsbündig raus\r\n\t\tdescTextView.setWrappedText(VersionString + Global.br + Global.br + Global.splashMsg);\r\n\t\tdescTextView.setHAlignment(HAlignment.CENTER);\r\n\t\tthis.addChild(descTextView);\r\n\r\n\t\tDrawable ProgressBack = new NinePatchDrawable(atlas.createPatch(\"btn-normal\"));\r\n\t\tDrawable ProgressFill = new NinePatchDrawable(atlas.createPatch(\"progress\"));\r\n\r\n\t\tfloat ProgressHeight = Math.max(ProgressBack.getBottomHeight() + ProgressBack.getTopHeight(), ref / 1.5f);\r\n\r\n\t\tprogress = new ProgressBar(new CB_RectF(0, 0, this.getWidth(), ProgressHeight), \"Splash.ProgressBar\");\r\n\r\n\t\tprogress.setBackground(ProgressBack);\r\n\t\tprogress.setProgressFill(ProgressFill);\r\n\t\tthis.addChild(progress);\r\n\r\n\t\tfloat logoCalcRef = ref * 1.5f;\r\n\r\n\t\tCB_RectF rec_Mapsforge_Logo = new CB_RectF(200, 50, logoCalcRef, logoCalcRef / 1.142f);\r\n\t\tCB_RectF rec_FX2_Logo = new CB_RectF(rec_Mapsforge_Logo);\r\n\t\tfloat w = logoCalcRef * 2.892655367231638f;\r\n\t\tCB_RectF rec_LibGdx_Logo = new CB_RectF(this.getHalfWidth() - (w / 2), 50, w, w);\r\n\r\n\t\trec_FX2_Logo.setX(400);\r\n\r\n\t\tLasifant = new LasifantAnimation(rec_LibGdx_Logo, \"LibGdx_Logo\");\r\n\r\n\t\tLasifant.addFrame(atlas.createSprite(\"logo-1\"));\r\n\t\tLasifant.addFrame(atlas.createSprite(\"logo-2\"));\r\n\t\tLasifant.addFrame(atlas.createSprite(\"logo-3\"));\r\n\t\tLasifant.addFrame(atlas.createSprite(\"logo-4\"));\r\n\t\tLasifant.addFrame(atlas.createSprite(\"logo-5\"));\r\n\t\tLasifant.addFrame(atlas.createSprite(\"logo-6\"));\r\n\t\tLasifant.addFrame(atlas.createSprite(\"logo-7\"));\r\n\t\tLasifant.addLastFrame(atlas.createSprite(\"logo-8\"));\r\n\r\n\t\tLasifant.play();\r\n\r\n\t\tthis.addChild(Lasifant);\r\n\r\n\t}", "protected abstract void showFrontFace();", "private void setupSplash() {\n \t\tthis.splashInfoContainer = (LinearLayout) this.findViewById( R.id.edit_gpsfilter_area_splash );\n \n \t\tTextView textView = (TextView) this.splashInfoContainer.findViewById( R.id.edit_gpsfilter_area_splash_text );\n \t\ttextView.setText( Html.fromHtml( this.getString( R.string.edit_gpsfilter_area_splash_text ) ) );\n \n \t\t// Define fade out animation.\n \t\tthis.splashFadeOut = new AlphaAnimation( 1.00f, 0.00f );\n \t\tthis.splashFadeOut.setDuration( SPLASH_FADE_DELAY );\n \t\tthis.splashFadeOut.setAnimationListener( new AnimationListener() {\n \t\t\tpublic void onAnimationStart( Animation animation ) {\n \t\t\t}\n \n \t\t\tpublic void onAnimationRepeat( Animation animation ) {\n \t\t\t}\n \n \t\t\tpublic void onAnimationEnd( Animation animation ) {\n \t\t\t\tsplashInfoContainer.setVisibility( View.GONE );\n \t\t\t}\n \t\t} );\n \n \t\t// Don't show if not new and we got polygon.\n \t\tif ( !this.isConsideredFresh() ) {\n \t\t\tthis.splashInfoContainer.setVisibility( View.GONE );\n \t\t}\n \t}", "public void drawScreen(int mouseX, int mouseY, float partialTicks) {\n/* 50 */ super.drawScreen(mouseX, mouseY, partialTicks);\n/* */ \n/* 52 */ if (this.hasActivePotionEffects)\n/* */ {\n/* 54 */ drawActivePotionEffects();\n/* */ }\n/* */ }", "public void showSplashScreen() {\r\n\r\n JPanel content = (JPanel) getContentPane();\r\n content.setBackground(Color.white);\r\n\r\n // setting the window's properties\r\n \r\n int width = 700;\r\n int height = 438;\r\n Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();\r\n int x = (screen.width - width) / 2;\r\n int y = (screen.height - height) / 2;\r\n setBounds(x, y, width, height);\r\n\r\n // build the splash screen using an image \r\n \r\n JLabel gifImage = new JLabel(new ImageIcon(this.getClass().getResource(\"/splash.gif\")));\r\n content.add(gifImage, BorderLayout.CENTER);\r\n\r\n // display it\r\n setVisible(true);\r\n\r\n new resourceLoader().execute();\r\n }", "private void paintHand3(Graphics2D gfx)\r\n {\n \r\n }", "public Mesita()\r\n {\r\n super(\"mesa.png\"); \r\n }", "public StartScreen()\n { \n // Create a new world with 1111x602 cells with a cell size of 1x1 pixels.\n super(1111, 602, 1); \n prepare();\n background.playLoop();\n }", "@Override\n public void paint(Graphics g) {\n\tsuper.paint(g);\n\t// getContentPane().setBackground(Color.orange);\n\timg = Util.createImage(getContentPane());\n\tbackColor = new Color(img.getRGB(3, 3));\n\t// img.getGraphics().setColor(Color.blue);\n\t// img.getGraphics().fillRect(0, 0, img.getWidth(), img.getHeight());\n\tdrawEntrance(new Point(557, 70), 0, img.getGraphics());\n\tgetContentPane().getGraphics().drawImage(img, 0, 0, null);\n\tanimate(g);\n\t// img = Util.createImage(getContentPane());\n\n }", "@Override\n\tpublic void present(float deltaTime) {\n\t\tGraficos g = juego.getGraficos();\n\t\tg.drawPixmap(Assets.fondo, 0, 0);\n\t\t// g.drawPixmap(Assets.ayuda2, 64, 100);\n\t\tg.drawPixmap(Assets.ayuda2, 9, 80);\n\t\t// x =256 y = 416\n\t\tif (Control.autor) {\n\t\t\tg.drawPixmap(Assets.logotren, 20, 20);\n\t\t} else {\n\t\t\tg.drawPixmap(Assets.autor, 20, 20);\n\n\t\t}\n\t\tg.drawPixmap(Assets.botones1, 240, 10, 0, 0, 64, 64);\n\t}", "@Override\n\tpublic void render(Graphics g) {\n\t\t\n\t}", "@Override\n\tpublic void render(Graphics g) {\n\t\t\n\t}", "public void initGui()\r\n\t{\r\n\t\tthis.viewportTexture = new DynamicTexture(256, 256);\r\n\t\tthis.backgroundTexture = this.mc.getTextureManager().getDynamicTextureLocation(\"background\", this.viewportTexture);\r\n\t\tthis.widthCopyright = this.fontRenderer.getStringWidth(\"Copyright Mojang AB. Do not distribute!\");\r\n\t\tthis.widthCopyrightRest = this.width - this.widthCopyright - 2;\r\n\t\tCalendar calendar = Calendar.getInstance();\r\n\t\tcalendar.setTime(new Date());\r\n\r\n\t\tif (calendar.get(2) + 1 == 12 && calendar.get(5) == 24)\r\n\t\t{\r\n\t\t\tthis.splashText = \"Merry X-mas!\";\r\n\t\t}\r\n\t\telse if (calendar.get(2) + 1 == 1 && calendar.get(5) == 1)\r\n\t\t{\r\n\t\t\tthis.splashText = \"Happy new year!\";\r\n\t\t}\r\n\t\telse if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31)\r\n\t\t{\r\n\t\t\tthis.splashText = \"OOoooOOOoooo! Spooky!\";\r\n\t\t}\r\n\r\n\t\tint i = 24;\r\n\t\tint j = this.height / 4 + 48;\r\n\r\n\t\tif (this.mc.isDemo())\r\n\t\t{\r\n\t\t\tthis.addDemoButtons(j, 24);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.addSingleplayerMultiplayerButtons(j, 24);\r\n\t\t}\r\n\r\n\t\tthis.buttonList.add(new GuiButton(0, this.width / 2 - 100, j + 72 + 12, 98, 20, I18n.format(\"menu.options\")));\r\n\t\tthis.buttonList.add(new GuiButton(4, this.width / 2 + 2, j + 72 + 12, 98, 20, I18n.format(\"menu.quit\")));\r\n\r\n\t\tsynchronized (this.threadLock)\r\n\t\t{\r\n\t\t\tthis.openGLWarning1Width = this.fontRenderer.getStringWidth(this.openGLWarning1);\r\n\t\t\tthis.openGLWarning2Width = this.fontRenderer.getStringWidth(this.openGLWarning2);\r\n\t\t\tint k = Math.max(this.openGLWarning1Width, this.openGLWarning2Width);\r\n\t\t\tthis.openGLWarningX1 = (this.width - k) / 2;\r\n\t\t\tthis.openGLWarningY1 = (this.buttonList.get(0)).y - 24;\r\n\t\t\tthis.openGLWarningX2 = this.openGLWarningX1 + k;\r\n\t\t\tthis.openGLWarningY2 = this.openGLWarningY1 + 24;\r\n\t\t}\r\n\r\n\t\tthis.mc.setConnectedToRealms(false);\r\n\r\n\t\tif (Minecraft.getMinecraft().gameSettings.getOptionOrdinalValue(GameSettings.Options.REALMS_NOTIFICATIONS) && !this.hasCheckedForRealmsNotification)\r\n\t\t{\r\n\t\t\tRealmsBridge realmsbridge = new RealmsBridge();\r\n\t\t\tthis.realmsNotification = realmsbridge.getNotificationScreen(this);\r\n\t\t\tthis.hasCheckedForRealmsNotification = true;\r\n\t\t}\r\n\r\n\t\tif (this.areRealmsNotificationsEnabled())\r\n\t\t{\r\n\t\t\tthis.realmsNotification.setGuiSize(this.width, this.height);\r\n\t\t\tthis.realmsNotification.initGui();\r\n\t\t}\r\n\t}", "@Override\r\n\tprotected void paintComponent(Graphics g) {\n\t\tsuper.paintComponent(g);\r\n\t\tImageIcon img = new ImageIcon(this.getClass().getResource(\"After-Noon.png\"));\r\n\t\tg.drawImage(img.getImage(), 0, 0, this.getWidth(), this.getHeight(), null);\r\n\t}", "private void renderUI()\n\t{\n\t\ttry\n\t\t{\n\t\t\tFile image = new File(BASE_DIREC + \"foreground.png\");\n\t\t\tforeground = ImageResizer.resizeImage(ImageIO.read(image), scale * BASE_SCALE);\n\t\t}\n\t\tcatch (IOException ioe)\n\t\t{\n\t\t\t// System.err.println(ioe);\n\t\t\t// Oh well\n\t\t}\n\t\t\n\t\ttry\n\t\t{\n\t\t\tFile image = new File(BASE_DIREC + \"continue.png\");\n\t\t\tcontinueImage = ImageResizer.resizeImage(ImageIO.read(image), scale * BASE_SCALE);\n\t\t}\n\t\tcatch (IOException ioe)\n\t\t{\n\t\t\t// System.err.println(ioe);\n\t\t\t// Oh well\n\t\t}\n\t}", "public void initGui() {\n/* 27 */ super.initGui();\n/* 28 */ updateActivePotionEffects();\n/* */ }", "static void gfx_fix()\n\t{\n for(int i=0; i<0x4000; i++)\n {\n memory_region(REGION_GFX3).write(0x2c000+i, 0xff);\n }\n\t}", "public void startSplash(int nextPanel,Man m){\r\n\t\t\r\n\t\tpanel[CurrentPanel].stop();\r\n\t\t\r\n\t\tDriver.panel[CurrentPanel].setVisible(false);\r\n\t\tgame.remove(panel[CurrentPanel] );\r\n\t\t\r\n\t\tCurrentPanel = nextPanel;\r\n\t\t\r\n\t\t\r\n\t\tpanel[CurrentPanel] = new Splash(this,nextPanel,m);\r\n\t\t\r\n\t\tadd( panel[CurrentPanel] );\r\n\t\tpanel[CurrentPanel].setVisible(true);\r\n\t\tgame.setVisible(true);\r\n\t\t\r\n\t\tpanel[CurrentPanel].start();\r\n\t\t\r\n\t}", "public Splash() {\n initComponents();\n }", "public Splash() {\n initComponents();\n }", "Icon getSplashImage();", "@Override\r\n public void paintComponent(Graphics g) {\n super.paintComponent(g);\r\n Graphics2D g2d = (Graphics2D) g;\r\n g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r\n RenderingHints.VALUE_ANTIALIAS_ON);\r\n g2d.setRenderingHint(RenderingHints.KEY_RENDERING,\r\n RenderingHints.VALUE_RENDER_QUALITY);\r\n \r\n\r\n Image icon = new ImageIcon(getClass().getClassLoader().getResource(\"wallpaper.jpg\")).getImage();\r\n g2d.drawImage(icon,0,0,this);\r\n //drawScenario(g2d);\r\n if(currentState == Common.GAME_STATE.INGAME){\r\n drawGaming(g2d);\r\n }\r\n if(currentState == Common.GAME_STATE.MENU || currentState == Common.GAME_STATE.LOSE){\r\n drawMenu(g2d);\r\n }\r\n\r\n Toolkit.getDefaultToolkit().sync();\r\n }", "@Override\n protected void paint2d(Graphics2D g) {\n \n }", "public void factoryMainScreen()\n\t{\n\t\t\n\t}", "protected void preRender()\n {\n // subclass\n }", "@Override\n\tpublic Screen getStartScreen() {\n\t\treturn new Splash(this);\n\t}", "@Override\r\n\t\tpublic void paint(Graphics g) {\n\t\t\tsuper.paint(g);\r\n\t\t}", "@Override\r\n\tpublic void renderBackground() {\n\r\n\t}", "@Override\n\tpublic void render(Graphics g)\n\t{\n\t}", "public void death(){\n setCoordinate(super.getGameImage().getCoordInit());\n diminueVies();\n super.initAnimation();\n\n }", "@Override\n\tpublic void intro() {\n\t\t\n\t}", "private void showSplash() {\n \t\tthis.splashInfoContainer.setVisibility( View.VISIBLE );\n \t}", "public Inicio()\n { \n super(600, 400, 1);\n prepararInicio();\n\n }", "@Override\n\tpublic void createScene()\n\t\n\t{\n\t loading = new Sprite (0,0,resourceManager.loadingRegion,vbo); // тупо ставим спрайт с картинкой\n\t\tattachChild(loading);\n\t}", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n SplashScreen.show(this); // here\n super.onCreate(savedInstanceState);\n }", "@Override\n protected void animStart() {\n }", "@Override\r\n public void draw() {\n }", "@Override\n\tpublic void draw(Graphics g) {\n\t\t\n\t}", "@Override\n\tpublic void draw(Graphics g) {\n\t\t\n\t}", "void showMainLoadingWheel();", "public void screenShot() {\n\n\t}", "protected abstract void chooseSprite();", "@Override\n\tpublic void draw() {\n\t\t\n\t}", "@Override\n\tpublic void draw() {\n\t\t\n\t}", "private void procedureBasePrDessin(){\n if(courante == null){\n reset();\n courante = new Tortue(simpleLogo.getFeuille(), true);\n simpleLogo.setBarreOutilsVisible(true);\n }\n }", "public void foundationGrab(){\n\n }", "@Override\n public void draw() {\n }", "@Override\n public void draw()\n {\n }", "private static void splashScreen() {\n\t\t\n\t\tString message = \"Welcome to JProject v\"+VERSION+\"\\nby Gabriel Skoropada\";\n\t\t\n\t\tJOptionPane.showMessageDialog(null, message, \"JProject v\"+VERSION, JOptionPane.NO_OPTION, null);\n\t\t\n\t}", "@Override\n\t\t\t\t\tpublic boolean act(float delta) {\n\t\t\t\t\t\tchangeScreen(SplashScreen.class);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}", "@Override\n public void render(Painter g) {\n g.drawImage(this.getMenuBackground(),this.getxPos(), this.getyPos());\n resumeButton.render(g);\n restartButton.render(g);\n instructionsButton.render(g);\n saveGameButton.render(g);\n quitButton.render(g);\n if(SettingsState.getCurrentLanguage() == \"English\" && instructionsScreen){\n g.drawImage(Assets.howToPlayBackground, 0, 0);\n backArrowButton.render(g);\n } else if(SettingsState.getCurrentLanguage() == \"Polish\" && instructionsScreen){\n g.drawImage(Assets.howToPlayBackground_Polish,0,0);\n backArrowButton.render(g);\n }\n\n }", "@Override\n\tpublic void render () {\n super.render();\n\t}", "@Override\n public void render(float delta) {\n super.render(delta);\n stateTime += delta;\n loadingImage.setDrawable(loadingAnim.getKeyFrame(stateTime,true));\n switch (GameController.getInstance().getCurrentState()) {\n case PLAYING:\n //Game started\n xlpooLsionClient.setScreen(new ControlsScreen(xlpooLsionClient));\n break;\n case SERVER_FULL:\n xlpooLsionClient.setScreen(new ServerFullScreen(xlpooLsionClient));\n break;\n case LOST_CONNECTION:\n xlpooLsionClient.setScreen(new LostConnectionScreen(xlpooLsionClient));\n break;\n }\n }", "@Override\r\n\tpublic void draw() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void draw() {\n\t\t\r\n\t}", "@Override\n\tpublic void draw() {\n\t}", "@Override\n public void render() { super.render(); }", "private void initializeSplashScreenCycle()\n\t{\n\t\t// desabilitando os botoes antes de iniciar a animacao da splash screen:\n\t\tUtilidades.Views.disableViews(this.arrViewsBloqueaveis);\n\n\t\tAnimation animLayoutSplitLogo = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.splash_move);\n\t\tAnimation animLayoutContent = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.splash_fade_in);\n\n\t\tanimLayoutContent.setAnimationListener(new AnimationListener()\n\t\t{\n\t\t\t@Override\n\t\t\tpublic void onAnimationStart(Animation animation)\n\t\t\t{\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onAnimationRepeat(Animation animation)\n\t\t\t{\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onAnimationEnd(Animation animation)\n\t\t\t{\n\t\t\t\t// rehabilitando os botoes depois de finalizar a animacao da splash screen:\n\t\t\t\tUtilidades.Views.enableViews(arrViewsBloqueaveis);\n\t\t\t}\n\t\t});\n\n\t\t((RelativeLayout) findViewById(R.id.layout_split_logo)).startAnimation(animLayoutSplitLogo);\n\t\t((RelativeLayout) findViewById(R.id.layout_content)).startAnimation(animLayoutContent);\n\t}", "public static void main(String args[]) \n {\n //declare constant to hold the speed of the loader\n final int LOAD_SPEED = 10;\n //create the new splash screen called mySplash\n TspSplash mySplash = new TspSplash();\n //center splash\n mySplash.setLocationRelativeTo(null);\n //set icon \n mySplash.setIconImage(Toolkit.getDefaultToolkit().getImage\n (\"src/Images/Salesperson.png\")); \n //make splash visible\n mySplash.setVisible(true);\n \n try\n {\n //create a variable which will count loop to 100, incrementing by\n //one until it reaches 100\n for(int loader = 0; loader <= 100; loader++)\n {\n //set speed of counter (miliseconds)\n Thread.sleep(LOAD_SPEED);\n //display the counter in the loading label\n mySplash.loadingJLabel.setText(\"Loading \" \n + Integer.toString(loader) + \"%\");\n //increment the progress bar with the counter\n mySplash.splashJProgressBar.setValue(loader);\n //when the loop gets to 100, close the splash screen\n if (loader == 100)\n {\n //when loader is done, close the splash screen\n mySplash.dispose();\n }\n }\n }\n catch (Exception exp)\n {\n JOptionPane.showMessageDialog(null, \"Loading error--\" \n + \"Cannot load splash\");\n }\n /* Set the Nimbus look and feel */\n //<editor-fold defaultstate=\"collapsed\" desc=\" Look and feel setting code (optional) \">\n /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.\n * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html \n */\n try {\n for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {\n if (\"Nimbus\".equals(info.getName())) {\n javax.swing.UIManager.setLookAndFeel(info.getClassName());\n break;\n }\n }\n } catch (ClassNotFoundException ex) {\n java.util.logging.Logger.getLogger(TspGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);\n } catch (InstantiationException ex) {\n java.util.logging.Logger.getLogger(TspGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);\n } catch (IllegalAccessException ex) {\n java.util.logging.Logger.getLogger(TspGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);\n } catch (javax.swing.UnsupportedLookAndFeelException ex) {\n java.util.logging.Logger.getLogger(TspGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);\n }\n //</editor-fold>\n //</editor-fold>\n\n /* Create and display the form */\n java.awt.EventQueue.invokeLater(new Runnable() \n {\n public void run() \n {\n new TspGUI().setVisible(true);\n }\n });\n }", "protected abstract void showTopFace();", "@Override\n public void onCreate(Bundle savedInstanceState)\n {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.splash);\n\n }", "protected GraphicsEnvironment() {}", "private void mo71773u() {\n List imageInfos = this.f73950g.getImageInfos();\n if (imageInfos != null && !imageInfos.isEmpty()) {\n ImageInfo imageInfo = (ImageInfo) imageInfos.get(0);\n if (imageInfo != null) {\n this.mCoverView.setVisibility(0);\n this.mLineProgressBar.mo74361a();\n C23323e.m76524b(this.mCoverView, imageInfo.getLabelLarge());\n C23323e.m76502a(imageInfo.getLabelLarge(), (C23328a) new C23328a() {\n /* renamed from: a */\n public final void mo60609a(C13346c<C13326a<C13645c>> cVar) {\n FeedImageViewHolder.this.mLineProgressBar.mo74362b();\n }\n\n /* renamed from: a */\n public final void mo60610a(Exception exc) {\n FeedImageViewHolder.this.mLineProgressBar.mo74362b();\n }\n });\n }\n }\n }", "protected abstract void narisi(Graphics2D g, double wPlatno, double hPlatno);", "public LoadingScreen2()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(1280, 720, 1); \n tracker = new Tracker();\n }", "public static void showStartApp(FruitSlide _gameLib)//not full\n\t{\n\t\t\n\t}", "public static void splashScreen() {\n System.out.println(printLine(\"-\",100));\n System.out.println(\"Welcome to KaviBase\"); // Display the string.\n System.out.println(\"Version \" + getVersion());\n System.out.println(getCopyright());\n System.out.println(\"\\nType \\\"help;\\\" to display supported commands.\");\n System.out.println(\"\\nEvery command should end with semicolon ;\");\n System.out.println(printLine(\"-\",100));\n }", "@Override\n public void run() {\n\n mShimmerViewContainer.setBaseAlpha(1);\n\n Animation animation2 = AnimationUtils.loadAnimation(Splash_Activity.this, R.anim.alpha);\n\n mShimmerViewContainer.setAnimation(animation2);\n\n }", "private void drawHeart2 (float sx, float sy, float sz, Appearance[] app)\n {\n\tfloat x, y, z, r;\n \n BranchGroup tBG = new BranchGroup();\n\ttBG.setCapability (BranchGroup.ALLOW_DETACH);\n\n System.out.println(\"Aqui\");\n \n\tx = sx+0f; y = sy+0.04f; z = sz+0f; r = 1;\n\tdrawSphere (tBG, x, y, z, r, app[0]);\n\t//tBG.addChild (makeText (new Vector3d (sx+0,sy+1.1,sz+0), \"AP\"));\n\n\tx = sx-0.2f; y = sy-0.1f; z = sz+0.2f; r = 1;\n\tdrawSphere (tBG, x, y, z, r, app[1]);\n\t//tBG.addChild (makeText (new Vector3d (sx-2,sy+0,sz+1.5), \"IS_\"));\n\n\tx = sx+0.2f; y = sy-0.1f; z = sz+0.2f; r = 1;\n\tdrawSphere (tBG, x, y, z, r, app[2]);\n\t//tBG.addChild (makeText (new Vector3d (sx+2,sy+0,sz+1.5), \"IL\"));\n\n\tx = sx-0.32f; y = sy-0.1f; z = sz+0.1f; r = 1;\n\tdrawSphere (tBG, x, y, z, r, app[3]);\n\t//tBG.addChild (makeText (new Vector3d (sx-2.5,sy+0,sz+0.5), \"SI\"));\n\n\tx = sx+0.32f; y = sy-0.1f; z = sz+0.1f; r = 1;\n\tdrawSphere (tBG, x, y, z, r, app[4]);\n\t//tBG.addChild (makeText (new Vector3d (sx+2.5,sy+0,sz+0.5), \"LI\"));\n\n\tx = sx-0.32f; y = sy-0.1f; z = sz-0.1f; r = 1;\n\tdrawSphere (tBG, x, y, z, r, app[5]);\n\t//tBG.addChild (makeText (new Vector3d (sx-2.5,sy+0,sz-0.5), \"SA\"));\n\n\tx = sx+0.32f; y = sy-0.1f; z = sz-0.1f; r = 1;\n\tdrawSphere (tBG, x, y, z, r, app[6]);\n\t//tBG.addChild (makeText (new Vector3d (sx+2.5,sy+0,sz-0.5), \"LA\"));\n\n\tx = sx-0.2f; y = sy-0.1f; z = sz-0.2f; r = 1;\n\tdrawSphere (tBG, x, y, z, r, app[7]);\n\t//tBG.addChild (makeText (new Vector3d (sx-2,sy+0,sz-1.5), \"AS_\"));\n\n\tx = sx+0.2f; y = sy-0.1f; z = sz-0.2f; r = 1;\n\tdrawSphere (tBG, x, y, z, r, app[8]);\n\t//tBG.addChild (makeText (new Vector3d (sx+2,sy+0,sz-1.5), \"AL\"));\n\n\tsceneBG.addChild (tBG);\n }", "public void startFight() {\r\n\t\tmenu.setVisible(false);\r\n\t\tmenu.setThreadSuspended(true);\r\n\t\tadd(new Fight(WIDTH, HEIGHT, gfh.loadBackground(\"london_nationalgallery.jpg\")));\r\n\t\tsetVisible(false);\r\n\t\tsetVisible(true);\r\n\t}", "@Override\r\n\tpublic void paint(Graphics g) {\n\t\tg.drawImage(BG_LIST.get(this.dto.getNowlevel()%BG_LIST.size()), 0, 0,1200,700, null);\r\n\t\t\r\n\r\n\t}", "@Override\n\tprotected void enterEffect() {\n\t\t\n\t}", "@Override\n\t\t\t\t\t\t\tpublic void onAnimationStart(Animation arg0) {\n\n\t\t\t\t\t\t\t}", "@Override\n\t\t\t\t\t\t\tpublic void onAnimationStart(Animation arg0) {\n\n\t\t\t\t\t\t\t}", "@Override\n\tpublic void draw() {\n\n\t}", "@Override\n\tpublic void draw() {\n\n\t}", "public void showNet()\n/* */ {\n/* 482 */ update(getGraphics());\n/* */ }", "public void beginHostile()\r\n\t{\n\t\t\r\n\t}", "public void drawLoadMenu(){\n implementation.devDrawLoadMenu();\n }", "public SplashWindow() {\n imagem = new JLabel(new ToImageIcon().toImageIcon(new ImagemLoad().imageLoader(img)));\n imagem.setBorder(BorderFactory.createLineBorder(Color.black, 1));\n }", "public PrologueStart(int num){\n\t\t\n\timg = getImage(\"/textures/sheets/LookingBack\" +num +\".png\");\n\tthis.setPreferredSize(new Dimension(img.getWidth() - 15 , img.getHeight()-15));\n\t}", "@Override\n public void render() {\n super.render();\n }", "@Override\n public void render() {\n super.render();\n }", "@Override\n\tpublic void render() {\n\t\t\n\t}", "public static void main(String[] args) {\n\t\t// Define new Runnable for splash screen execution\n\t\tEventQueue.invokeLater(new Runnable() {\n\t\t\tSplashScreenView splash;\n\t\t\tTimer timer;\n\t\t\tpublic void run() {\n\t\t\t\ttry {\n\t\t\t\t\t// Create splash screen boundary object and set visible\n\t\t\t\t\tsplash = new SplashScreenView();\n\t\t\t\t\tsplash.setVisible(true);\n\n\t\t\t\t\t// Begin timer for 2 seconds to display\n\t\t\t\t\ttimer = new Timer(2000, new ActionListener(){ \n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t\t\t\t// Create event on timer completion that hide the splash screen, and creates\n\t\t\t\t\t\t\t// the Kabasuji and corresponding view for interactions\n\t\t\t\t\t\t\tsplash.setVisible(false);\n\t\t\t\t\t\t\tKabasuji game = new Kabasuji();\n\t\t\t\t\t\t\tLevelSelectorView window = new LevelSelectorView(game);\n\n\t\t\t\t\t\t\t// allow controller to set up GUI based on the levels loaded by 'game'\n\t\t\t\t\t\t\tStartLevelSelectorController selectorController = new StartLevelSelectorController(window, game);\n\t\t\t\t\t\t\tselectorController.process();\n\n\t\t\t\t\t\t\t// show window\n\t\t\t\t\t\t\twindow.setVisible(true);\n\t\t\t\t\t\t\tImageIcon image = new ImageIcon(StartKabasuji.class.getResource(\"/images/heineman.jpg\"));\n\t\t\t\t\t\t\twindow.setIconImage(image.getImage().getScaledInstance(40, 40, 0));\n\t\t\t\t\t\t\tSystem.out.println(image);\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// Start the timer and ensure it only runs once\n\t\t\t\t\ttimer.setRepeats(false);\n\t\t\t\t\ttimer.start();\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "public void drawScreen(int par1, int par2, float par3)\n {\n this.drawDefaultBackground();\n this.field_146844_r.func_148350_a(par1, par2, par3);\n this.drawCenteredString(this.fontRendererObj, I18n.format(\"mco.backup.title\", new Object[0]), this.width / 2, 20, 16777215);\n super.drawScreen(par1, par2, par3);\n }", "@Override\n\tpublic void draw3() {\n\n\t}", "public void onResume() {\n super.onResume();\n drawUI();\n }", "public static void splashScreen() {\n System.out.println(line(\"-\", 80));\n System.out.println(\"Welcome to DavisBaseLite\"); // Display the string.\n System.out.println(\"DavisBaseLite Version \" + getVersion());\n System.out.println(getCopyright());\n System.out.println(\"\\nType \\\"help;\\\" to display supported commands.\");\n System.out.println(line(\"-\", 80));\n }" ]
[ "0.7030121", "0.6544582", "0.6282674", "0.6148579", "0.61430687", "0.608103", "0.606244", "0.60585314", "0.60443026", "0.60443026", "0.60443026", "0.60231143", "0.60182434", "0.59847295", "0.5969386", "0.5948755", "0.59381646", "0.59193856", "0.5901768", "0.58950263", "0.5894866", "0.58812594", "0.58782786", "0.58782786", "0.5877961", "0.58670014", "0.58585733", "0.5856709", "0.5842672", "0.5838437", "0.58381414", "0.58381414", "0.58091044", "0.5805527", "0.5794478", "0.57916844", "0.57907355", "0.578652", "0.5784022", "0.57826024", "0.57814974", "0.57720447", "0.576336", "0.5757616", "0.5753295", "0.5749905", "0.57477486", "0.5739621", "0.57392603", "0.57295585", "0.57295585", "0.5729025", "0.57276946", "0.5724549", "0.5718792", "0.5718792", "0.5711021", "0.5708922", "0.5702897", "0.5694652", "0.56930006", "0.5692104", "0.5690525", "0.56895137", "0.56894314", "0.5684041", "0.5684041", "0.56728166", "0.5672259", "0.5664462", "0.5664205", "0.5662967", "0.56539905", "0.564628", "0.5644684", "0.56366616", "0.56362367", "0.56361663", "0.56327856", "0.5625277", "0.5618574", "0.56166995", "0.5612426", "0.56100464", "0.5609142", "0.5609142", "0.5600201", "0.5600201", "0.5593267", "0.55893", "0.5583493", "0.5581961", "0.55751073", "0.55730397", "0.55730397", "0.5569557", "0.55670834", "0.5558561", "0.55519223", "0.5550122", "0.55490917" ]
0.0
-1
Class constructor capturing information about the element change.
public EditChange(int tag, String oldValue, String newValue, String siUID) { this.tag = tag; this.oldValue = oldValue; this.newValue = newValue; this.siUID = siUID; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ElementChange getElementChange();", "public Change() {\n // Required for WebServices to work. Comment added to please Sonar.\n }", "public Changes() {\n }", "Element() {\n\t}", "public ElementObject(WebElement element) {\n // check null value\n super(0); //0 : Element is THERE\n this.element = element;\n this._originalStyle = element.getAttribute(\"style\");\n }", "protected AbstractPathElement(AbstractPathElement<V, E> original)\r\n/* */ {\r\n/* 117 */ this.nHops = original.nHops;\r\n/* 118 */ this.prevEdge = original.prevEdge;\r\n/* 119 */ this.prevPathElement = original.prevPathElement;\r\n/* 120 */ this.vertex = original.vertex;\r\n/* */ }", "public void newElement() {\r\n }", "Node(String e){\r\n this.element = e;\r\n }", "public ChangeData()\r\n\t\t{\r\n\t\t}", "public EventActionInfo(org.dom4j.Element el) throws Exception {\n this();\n readXML(el);\n }", "public Diff(DiffListener<E> listener) {\n li = listener;\n }", "public GenericElement() {\n\t}", "public XmlElement() {\n }", "public BaseElement() {\n }", "public SimpleTagListener() {\n }", "@Override\r\n\tpublic void updateElement() {\n\r\n\t}", "public AbstractElement() {\n }", "public LineView(Element elem) {\n super(elem);\n }", "@Override\n\tprotected abstract OpenableElementInfo createElementInfo();", "public ElementoInicial() {\r\n\t\tsuper();\r\n\t}", "public ChangeLog() {\n initComponents();\n }", "protected ICEvent() {}", "public NodeEvent() {\n\t\tthis(new Note(), DEFAULT_LIKELIHOOD);\n\t}", "public NodeInfo(String name, String attr, int lo, int hi, int size) {\n this.name = name;\n this.attributes = attr;\n this.lo = lo;\n this.hi = hi;\n this.size = size;\n }", "public Observer(Node<?> node) {\n observedNode = node;\n }", "public Element() {\r\n\t\tx = 0;\r\n\t\ty = 0;\r\n\t\tcolor = Color.gray;\r\n\t\thilite = true;\r\n\t}", "void instanceChanged();", "public Element(Element element) {\n\t\tElement src = element.clone();\n\n\t\tthis.attributes = src.attributes;\n\t\tthis.name = src.name;\n\t\tthis.defxmlns = src.defxmlns;\n\t\tthis.xmlns = src.xmlns;\n\t\tthis.children = src.children;\n\t}", "public BasicElementList() {\n\t}", "public void addResourceChangeListener() {\n\t\tif (elementChange == null) {\n\t\t\telementChange = new JavaElementChange();\n\t\t}\n\t}", "public void setElement(String newElem) { element = newElem;}", "public ListElement()\n\t{\n\t\tthis(null, null, null); //invokes constructor with 3 arguments\n\t}", "public PropertyChangedEventArgs2(T source, String properyName, Object newValue) {\n this.source = source;\n this.properyName = properyName;\n this.newValue = newValue;\n }", "public Node(T ele) {\r\n\t\t\tthis.ele = ele;\r\n\t\t}", "public NodeInfo() {\n }", "private LogEvent()\n\t{\n\t\tsuper();\n\t}", "public WebElement() {}", "private Node() {\n // Start empty.\n element = null;\n }", "public AttributeSet(Object elem) {\n\n elements = new Hashtable(1, 1);\n elements.put(elem, elem);\n }", "public XmlAdaptedReminder() {}", "@Override void init(Element element) {\n String name = element.getTagName();\n if (name.equals(\"published\")) {\n this.published = element.getTextContent().trim();\n }\n else if (name.equals(\"content\")) {\n this.content = parseContent(element);\n }\n else {\n super.init(element);\n }\n }", "protected SourceDocumentInformation() {\n }", "public InteractionTarget(Element _element, int _type) {\n element = _element;\n type = _type;\n }", "public HashObject(E element) {\n\t\tprobeCount = 0;\n\t\tduplicateCount = 0;\n\t\tthis.element = element;\n\t}", "@Test\n\tpublic static void testConstructorAndGetters() {\n\n\t\tCompoundMadeOfElement comp = new CompoundMadeOfElement(1, 2, 5);\n\t\tassertEquals(comp.getCompoundID(), 1);\n\t\tassertEquals(comp.getElementID(), 2);\n\t\tassertEquals(comp.getElementQuantity(), 5);\n\t}", "public Information()\n\t{\n\t\t// empty constructor\n\t}", "private DetailsEditWatcher() {\n }", "public ElementBean(ElementView elementView) {\n super(elementView);\n dao = new ElementDAO();\n this.elementView = elementView;\n }", "public EditeurSimple() {\n\t\tsuper();\n\t\tthis.buffer = new Buffer();\n\t\tthis.pressPapier = new PressePapier();\n\t\tthis.selection = new Selection();\n\t\tthis.fluxFile = new FluxFile();\n\t}", "private void init() {\n listeners = new PropertyChangeSupport(this);\n }", "InternalEventDebugLogEntry(InternalEvent internalEvent) {\r\n _internalEvent = internalEvent ;\r\n }", "public void init() {\r\n setEventType(4);\r\n }", "public ChemicalElement()\r\n\t{\r\n\t\tnameOfElement = \" \";\r\n\t\tchemicalSymbol = \" \";\r\n\t\tatomicNumber = 0;\r\n numOfElements++;\r\n\t}", "@Override\n\tpublic void setElement(Element element) {\n\t\t\n\t}", "public Changelog() {\n\t\tthis(\"changelog\", null);\n\t}", "public ElementSerializer() {\n _lock = new Object();\n }", "public ElementObjectSupport(ContainerI c, Element element) {\r\n\t\tthis(c, null, element);\r\n\t}", "public Event(String description, String checker, String info) {\n super(description, checker);\n this.details = new Date(info);\n this.info = info.trim();\n }", "protected IBDS()\r\n {\r\n \tthis.modifyBuffer = new StringBuffer(300); // all update operations belong to this only\r\n this.nodeList = new ArrayList<int []>(50);\r\n this.lastUpdated = System.nanoTime();\r\n //this.objectArray = new ArrayList();\r\n }", "public DocumentEvent() {}", "public LinkElement() { }", "public void elementAdded(Object element) {\n\t\tinitTransients();\r\n\t\tfor (int i = 0; i < listeners.size(); i++ )\r\t\t\ttry {\r\n\t\t\t((VectorListener) listeners.elementAt(i)).\r\n\t\t\t\t\t\t\tupdateVector(new VectorChangeEvent\r\n\t\t\t\t\t\t\t (changeable, VectorChangeEvent.AddComponentEvent,\r\n\t\t\t\t\t\t\t\t changeableCopy.size(),null, element, changeableCopy.size() + 1));\r\t\t } catch (Exception e) {\r\t\t \t e.printStackTrace();\r\t\t }\r\n\t\tfor (int i = 0; i < transientListeners.size(); i++ )\r\t\t\ttry {\r\n\t\t\t((VectorListener) transientListeners.elementAt(i)).\r\n\t\t\t\t\t\t\tupdateVector(new VectorChangeEvent\r\n\t\t\t\t\t\t\t (changeable, VectorChangeEvent.AddComponentEvent,\r\n\t\t\t\t\t\t\t\t changeableCopy.size(),null, element, changeableCopy.size() + 1));\r\t\t\t} catch (Exception e) {\r\t\t \t e.printStackTrace();\r\t\t }\r\n\t\tchangeableCopy.addElement(element);\r\n\t\tnotifyElementAdded(element);\r\n\t\t\r\n\t}", "public RemoveTileChange() {}", "public interface TElement extends HasID, THasPropertyChange, PropertyChangeListener, Serializable {\n\n /**\n * Used if a requested attribute is not a member of the TElement derived\n * Class.\n */\n public final Object NOT_DEFINED = \"ATT_NOT_DEFINED\";\n\n /**\n * return the attribute value or teal.sim.TElement.NOT_DEFINED\n **/\n public Object getProperty(String attName);\n\n /**\n * set the attribute value return value is success\n **/\n public boolean setProperty(String attName, Object value);\n\n public void addRoute(Route r);\n \n /** \n * Establish a route from this object's source attribute and the targeted \n * attribute of another TElement. \n **/\n public void addRoute(String attribute, TElement listener, String targetName);\n \n \n /** \n * Remove a route from this object's source attribute and the target's output attribute. \n **/\n public void removeRoute(String attribute, TElement listener, String targetName);\n}", "public XMLElement() {\n this(new Properties(), false, true, true);\n }", "private Node(E x) {\n\t\t\telement = x;\n\t\t\tnext = null;\n\t\t}", "public Attr() {\n\t\t\tsuper();\n\t\t}", "public Element(String name) {\n\t\tsetName(name);\n\t}", "Object create(Element element) throws IOException, SAXException, ParserConfigurationException;", "public ExperimentInfo() { }", "public ChangeSupport(Object source) {\n this.source = source;\n }", "public Notification()\n\t{\n\t\t\n\t}", "protected abstract M createNewElement();", "public LVInfo() {\r\n }", "public org.ccsds.moims.mo.mal.structures.Element createElement()\n {\n return new BasicUpdate();\n }", "@Override\n public Object getModifiedElement()\n {\n return null;\n }", "protected WrapperTickEvent()\n {\n }", "public void newElement() {\n Location = null;\n Name = null;\n MyFont = FontList.FONT_LABEL;\n }", "public Transition(NamedNodeMap node){\n\t\tthis.effect = new Effect();\n\t\tthis.guardRule = new Rule();\n\t\tthis.comment = new Comment();\n\t\tString delimiter =\"xmi:\";\n\t\tString temp[] = null;\n\t\tfor (int i=0; i < node.getLength(); i++){\n\t\t\ttemp = null;\n\t\t\tdelimiter =\"xmi:\";\n\t\t\ttemp = node.item(i).getNodeName().split(delimiter);\n\t\t\tif (temp[0].equalsIgnoreCase(\"\")) {\n\t\t\t\ttemp[0] = temp[1];\n\t\t\t}\n\t\t\tif (temp.length > 0){\n\t\t\t\t\n\t\t\t\tswitch (temp[0]){\n\t\t\t\tcase \"id\":\n\t\t\t\t\tthis.setId(node.item(i).getNodeValue());\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"name\":\n\t\t\t\t\tString tmp = node.item(i).getNodeValue();\n\t\t\t\t\ttmp = tmp.replace(\"-|.|!\", \"_\");\n\t\t\t\t\t\n\t\t\t\t\tthis.setName(tmp);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"source\":\n\t\t\t\t\tthis.setSource(node.item(i).getNodeValue());\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"target\":\n\t\t\t\t\tthis.setTarget(node.item(i).getNodeValue());\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"guard\":\n\t\t\t\t\tthis.setIdGuardRule(node.item(i).getNodeValue());\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public SiacTCronopElem() {\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "public void setElement(Object e) {\n element = e;\n }", "public Info() {\n super();\n }", "private StateChangeMonitor() {\n\t\t// Create the registry of StateChangeListeners\n\t\tlisteners = new Hashtable();\n\t}", "void notifyElementAdded(Object element) {\n\t\tinitTransients();\r\n\t\tfor (int i = 0; i < methodsListeners.size(); i++ ) {\r\n\t\t\t((VectorMethodsListener) methodsListeners.elementAt(i)).elementAdded(changeable, element, changeableCopy.size());\r\n\t\t}\r\n\t\tfor (int i = 0; i < transientMethodsListeners.size(); i++ ) {\r\n\t\t\t((VectorMethodsListener) transientMethodsListeners.elementAt(i)).elementAdded(changeable, element, changeableCopy.size());\r\n\t\t}\r\n\t}", "public Event() {\r\n\r\n\t}", "protected ChangeListener createChangeListener(JComponent paramJComponent) {\n/* 66 */ return new MotifChangeHandler((JMenu)paramJComponent, this);\n/* */ }", "public AppliedHoldInfo() {\n }", "public VibrationalStructureInfo() {\n }", "public ProcessInstrumenter(){\n\t\tparser = new DOMParser();\n\t\tnoActivity.add(\"variables\");\n\t\tnoActivity.add(\"correlationSets\");\n\t\tnoActivity.add(\"partnerLinks\");\n\t\tnoActivity.add(\"eventHandlers\");\n\t\tnoActivity.add(\"faultHandlers\");\n\t\tnoActivity.add(\"compensationHandlers\");\n\t}", "private Notifier(){}", "protected XMLClassDescriptorImpl() {\n attributeDescriptors = new List(7);\n elementDescriptors = new List(7);\n }", "public Attribute(String attributeName, short htmlVersions, AttrCheck check)\n {\n this.name = attributeName;\n this.versions = htmlVersions;\n this.attrchk = check;\n }", "protected AbstractPathElement(V vertex)\r\n/* */ {\r\n/* 130 */ this.vertex = vertex;\r\n/* 131 */ this.prevEdge = null;\r\n/* 132 */ this.prevPathElement = null;\r\n/* */ \r\n/* 134 */ this.nHops = 0;\r\n/* */ }", "@SuppressWarnings(\"unused\")\n Element(final String elementName, float h, float s, float b, Element sourceOf)\n {\n this(elementName, new Color(HSBtoRGB(h, s, b)), sourceOf);\n }", "public Notification()\n\t{\n\t\t// Start of user code constructor for Notification)\n\t\tsuper();\n\t\t// End of user code\n\t}", "public TagChainElement() {\n\t\tthis.db = TagDatabaseManager.getInstance();\n\t}", "public XmlAdaptedPerson() {}", "public TimeStamp(Element timestampElement) throws Exception {\r\n this(timestampElement, true);\r\n }", "public Eventd() {\n }", "public MouseCatElephantClientState(){}" ]
[ "0.63319033", "0.6199573", "0.598909", "0.58799726", "0.5802363", "0.5686221", "0.5685502", "0.56763273", "0.5604551", "0.5569987", "0.54793596", "0.5432919", "0.5414079", "0.53867507", "0.53858596", "0.532156", "0.53047884", "0.5297946", "0.52959204", "0.52615535", "0.52183366", "0.5185097", "0.51719743", "0.51604784", "0.516019", "0.513967", "0.51354593", "0.5132634", "0.5129032", "0.5121358", "0.51023483", "0.5097561", "0.50821924", "0.5079189", "0.5068106", "0.5060095", "0.5054595", "0.50525516", "0.50484425", "0.50370926", "0.50352204", "0.50329155", "0.50288904", "0.5027078", "0.50212777", "0.50165033", "0.501428", "0.5014004", "0.50092065", "0.5004102", "0.5001268", "0.49916252", "0.49899623", "0.49785176", "0.4977447", "0.4974285", "0.49738714", "0.49713683", "0.49626964", "0.496265", "0.49498892", "0.49334767", "0.4933129", "0.49165395", "0.49152854", "0.49140328", "0.49072975", "0.49068657", "0.49041468", "0.48976597", "0.48976538", "0.48865852", "0.4886435", "0.48863128", "0.48858765", "0.48782405", "0.48717463", "0.48685074", "0.48680857", "0.4864268", "0.48624834", "0.4861729", "0.48570666", "0.48540536", "0.4851091", "0.48479474", "0.48472017", "0.48432043", "0.48392057", "0.4838462", "0.48354188", "0.48353392", "0.48299277", "0.48236066", "0.4822543", "0.48209327", "0.48145995", "0.48110428", "0.48082685", "0.48067337", "0.48022732" ]
0.0
-1
Check if course exits
public boolean checkCourse(String nombre) { String[] campos = new String[] { "nombre" }; String[] args = new String[] { nombre }; Cursor c = db.query("Cursos", campos, "nombre=?", args, null, null, null); if (c.getCount() <= 0) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean courseExists(int courseCode){}", "private boolean checkCompletedCourse(int id) {\r\n boolean x = false;\r\n for (Registration registration : completeCourses) {\r\n if (id == registration.getCourseId()) {\r\n x = true;\r\n break;\r\n }\r\n x = false;\r\n }\r\n return x;\r\n }", "@Override\n\tpublic boolean checkCourse(String code) {\n\t\treturn false;\n\t}", "boolean checkCourse (String course){\r\n // If the course either .net or c/c++ or java, then return true\r\n if (course.equalsIgnoreCase(\".net\") \r\n || course.equalsIgnoreCase(\"c/c++\") \r\n || course.equalsIgnoreCase(\"java\"))\r\n return true;\r\n // else if it's not neither, return false\r\n else return false;\r\n \r\n }", "public synchronized boolean checkAvailabilityOfCourse(Character courseName){\n\t\treturn getCourseSeatsCount(courseName) < 60;\n\t}", "@Override\n\tpublic EnrollmentStatus isSatisfiedBy(Section section) {\n\t\tfor(Course c : palnOfStudy.getCourses()){\n\t\t\tSystem.out.println(\"section:\"+section.getRepresentedCourse().getCourseNo());\n\t\t\tSystem.out.println(\"courseNo:\"+c.getCourseNo());\n\t\t\tif(section.getRepresentedCourse().getCourseNo().equals(c.getCourseNo())){\n\t\t\t\treturn EnrollmentStatus.success;\n\t\t\t}\n\t\t}\n\t\treturn EnrollmentStatus.notInPlan;\n\t}", "public boolean containsCourse(int crn)\n\t{\n\t\tCourse dummy = dummyCourse(crn);\n\t\treturn courseOfferings.contains(dummy);\n\t}", "public boolean checkCourseExempted(Integer indexGroupID) {\r\n\t\tboolean success = false;\r\n\t\tCourse c1 = new Course();\r\n\t\tc1 = c1.retrieveCourseObjectByIndexGroup(indexGroupID);\r\n\r\n\t\tif (this.getExemptionCoursesList().contains(c1.getCourseID())) {\r\n\t\t\tsuccess = true;\r\n\t\t}\r\n\r\n\t\treturn success;\r\n\t}", "public boolean addCourse(Course c) {\n\t\treturn false;\n\t}", "public boolean isSelectedPredefinedCourse(){\n if(predefinedCourseName == null) return false;\n else return true;\n }", "public boolean addCourse(String user, String course){\n String[] tokens = usersRepository.getclassString(user).split(\" \");\r\n String[] courseids = new String[tokens.length];\r\n String courseid = classesRepository.getClassCourseid(course);\r\n for(int i =0; i < tokens.length; i++){\r\n courseids[i] = classesRepository.getClassCourseid(tokens[i]);\r\n }\r\n for(int f =0; f < tokens.length; f++) {\r\n if(courseids[f] == null){\r\n continue;\r\n }\r\n if(courseids[f].equals(courseid)){\r\n return false;\r\n }\r\n }\r\n //check for course space\r\n if(!classesRepository.checkCourseSpace(course)){\r\n return false;\r\n }\r\n\r\n //check here for prereqs\r\n //get student records\r\n String studentrecord = usersRepository.findUserRecords(user);\r\n String studentgrade = usersRepository.findUserGrades(user);\r\n String[] tokenrecords;\r\n String[] tokengrades;\r\n if(studentrecord==null){\r\n tokenrecords = new String[0];\r\n tokengrades = new String[0];\r\n }else{\r\n tokenrecords = studentrecord.split(\" \");\r\n tokengrades = studentgrade.split(\" \");\r\n }\r\n //get course prereq\r\n String[] prereqs = classesRepository.getCoursePrereqs(courseid);\r\n //compare all token records with course prereqs, must be in records without d or f\r\n boolean meetsreq1 = true, meetsreq2 = true;\r\n if(prereqs[0] != null){\r\n meetsreq1=false;\r\n }\r\n if(prereqs[1] != null){\r\n meetsreq2=false;\r\n }\r\n for(int s = 0; s < tokenrecords.length; s++){\r\n if(!tokengrades[s].equals(\"D\") && !tokengrades[s].equals(\"F\")){\r\n if(prereqs[0] != null){\r\n if(prereqs[0].equals(tokenrecords[s])){\r\n meetsreq1 = true;\r\n }\r\n }\r\n if(prereqs[1] != null){\r\n if(prereqs[1].equals(tokenrecords[s])){\r\n meetsreq2 = true;\r\n }\r\n }\r\n }\r\n\r\n }\r\n if(meetsreq1 && meetsreq2){\r\n usersRepository.addCourse(user, course);\r\n return true;\r\n }\r\n return false;\r\n }", "@Override\r\n\t/**The equals(Object o) method for the Course class */\r\n\tpublic boolean equals(Object objcourse) {\r\n\t\tif (objcourse == null) {\r\n\t\t\treturn false; \r\n\t\t} //if objcourse is null then return false\r\n\t\tif( objcourse instanceof Course) {\r\n\t\t\tCourse objcourse_confirmed = (Course) objcourse; //Cast objcourse to a course\r\n\t\t\treturn (this.getName() == objcourse_confirmed.getName() \r\n\t\t\t\t\t&& this.getCredithours() == objcourse_confirmed.getCredithours()); \r\n\t\t\t\t\t//Comparing Course's Name and credit hours\r\n\t\t} //Return true if the incoming courses have the same course name\r\n\t\telse {\r\n\t\t\treturn false;\r\n\t\t} //objcourse is not a Course... \r\n\t}", "public boolean contains(Course c) {\n return courseList.contains(c); \n }", "@Override\r\n\tpublic boolean takeCourse(String studentId,Course course) {\n\t\tList<String> hasTaken=db.findStudentCourseHistory( studentId);\r\n\t\tList<String> prerequisite=getPrerequisite(course.getDescription());\r\n\t\treturn false;\r\n\t}", "public boolean descriptionExists(String course_id);", "public boolean updateCourse(Course c) {\n\t\treturn false;\n\t}", "private boolean setLecture(Course course) {\n if (course.getLectures().size() > 0) {\n for (DetailedSection lecture : course.getLectures()) {\n if (canBeAdded(lecture)) {\n course.setSelectedLecture(lecture);\n if(setDiscussion(course)) {\n return true;\n }\n }\n }\n return false;\n }\n return setDiscussion(course);\n }", "public boolean checkCourseCompleted(Integer indexGroupID) {\r\n\t\tboolean success = false;\r\n\t\tCourse c1 = new Course();\r\n\t\tc1 = c1.retrieveCourseObjectByIndexGroup(indexGroupID);\r\n\r\n\t\tif (this.getCompletedCoursesList().contains(c1.getCourseID())) {\r\n\t\t\tsuccess = true;\r\n\t\t}\r\n\r\n\t\treturn success;\r\n\t}", "private void CourseExists(int courseCode) {\n\n if (courseDAO.findCourseByCourseCode(courseCode).isPresent()) {\n throw new CourseIsAlreadyExistException(\"Course Is Already Exist!\");\n }\n }", "private boolean shouldRegisterCourse(Progress progress) {\n return progress.name.equals(Progress.courseRegistration)\n || progress.name.equals(Progress.courseRegistrationCanceled)\n || progress.name.equals(Progress.courseRegistrationResponseNegative);\n }", "private void obtainCourseSafely() {\n System.out.println(\"What is the name of the Course you wish to add (eg. CPSC 210)\");\n String name = scanner.nextLine();\n\n System.out.println(\"How many Sub-Classes does this have? (eg. CPSC 210 201 and CPSC 210 202 would mean 2)\");\n subClassNames = getNames(obtainIntSafely(1, 999, \"Enter int > 0\"), \"Class\");\n subClassTimes = getTimes(name, subClassNames);\n\n boolean response1 = yesNoQuestion(\"Does this class have a separate lab component?\");\n if (response1) {\n System.out.println(\"How many Labs does this have?\");\n labNames = getNames(obtainIntSafely(1, 999, \"Enter int > 0\"), \"Lab\");\n labTimes = getTimes(name, labNames);\n }\n\n boolean response2 = yesNoQuestion(\"Does this class have a separate tutorial component?\");\n if (response2) {\n System.out.println(\"How many Tutorials does this have?\");\n tutorialNames = getNames(obtainIntSafely(1, 999, \"Enter int > 0\"), \"Tutorial\");\n tutorialTimes = getTimes(name, tutorialNames);\n }\n\n if (response1 || response2) {\n activeCourseList.add(new Course(name, subClassNames, subClassTimes, response1, labNames, labTimes,\n response2, tutorialNames, tutorialTimes));\n } else {\n activeCourseList.add(new Course(name, subClassNames, subClassTimes));\n }\n }", "public void enroll(String courseName, World world) {\n\t\tCourse course = world.dbCourses().get(courseName);\n\t\tif (course == null) {\n\t\t\tSystem.out.println(\"No course named: \" + courseName);\n\t\t\treturn;\n\t\t}\n\n\t\tList<Course> unfinishedCourses = super.getUnfinishedCourses();\n\t\tList<Course> finishedCourses = super.getFinishedCourses();\n\t\tif (unfinishedCourses.contains(course)) {\n\t\t\tSystem.out.println(\"You are already enrolled in \" + course + \".\");\n\t\t\treturn;\n\t\t}\n\t\tif (finishedCourses.contains(course)) {\n\t\t\tSystem.out.println(\"You have already completed \" + course + \"!\");\n\t\t\treturn;\n\t\t}\n\n\t\tRoom room = super.getRoom();\n\t\tList<Creature> roomCreatures = room.getCreatures();\n\t\tCreature creature;\n\t\tfor (int i = 0; i < roomCreatures.size(); i++) {\n \tcreature = roomCreatures.get(i);\n \tif (creature.isTeacher()) {\n \t\tTeacher teacher = (Teacher) creature;\n \t\tif (teacher.getCourse().equals(course)) { // Check that teacher for course is in room\n \t\t\tunfinishedCourses.add(course);\n \t\t\tSystem.out.println(\"You have enrolled in '\" + course + \"'.\");\n \t\t\treturn;\n \t\t}\n \t}\n\t\t}\n\t\tSystem.out.println(\"No teacher who teaches '\" + course + \"' in the room.\");\n\t}", "@Override\r\n\tpublic boolean updateCourse(Course course) {\n\t\treturn false;\r\n\t}", "@Override\n\tpublic boolean checkDuplicate(String course_name) {\n\t\tboolean isDuplicate = false;\n\t\tconn = DBUtils.connectToDb();\n\t\tString query = \"select course_name from course where course_name= ?;\";\n\t\tpst = DBUtils.getPreparedStatement(conn, query);\n\t\ttry {\n\t\t\tpst.setString(1, course_name);\n\t\t\trs = pst.executeQuery();\n\t\t\tif (rs.next())\n\t\t\t\tisDuplicate = true;\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\tDBUtils.closeConnections();\n\t\treturn isDuplicate;\n\t}", "private boolean checkSectionAvailability(int id, int section) throws SQLException {\r\n String query = \"SELECT * FROM sections WHERE courseid=? AND secnum=?\";\r\n PreparedStatement pstmt = conn.prepareStatement(query);\r\n pstmt.setInt(1, id);\r\n pstmt.setInt(2, section);\r\n ResultSet rs = pstmt.executeQuery();\r\n rs.next();\r\n if (rs.getInt(\"numofstudents\") < rs.getInt(\"seccap\")) {\r\n rs.close();\r\n return true;\r\n } else {\r\n rs.close();\r\n return false;\r\n }\r\n }", "@Override\n\tpublic boolean addCourse(Course course) {\n\t\tboolean isCourseAdded = false;\n\t\tconn = DBUtils.connectToDb();\n\t\tString query = \"insert into course (course_name,start_date,end_date,capacity) values (?,?,?,?);\";\n\t\tpst = DBUtils.getPreparedStatement(conn, query);\n\t\tint rows = 0;\n\t\ttry {\n\t\t\tpst.setString(1, course.getCourse_name());\n\t\t\tpst.setString(2, course.getStart_date());\n\t\t\tpst.setString(3, course.getEnd_date());\n\t\t\tpst.setInt(4, course.getCapacity());\n\n\t\t\trows = pst.executeUpdate();\n\t\t\tDBUtils.closeConnections();\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tif (rows > 0)\n\t\t\tisCourseAdded = true;\n\n\t\treturn isCourseAdded;\n\t}", "public static boolean doesCourseExist(List<MyStudent> list, String course){\n\t return list.stream().anyMatch(e->e.getMajor().equalsIgnoreCase(course));\n\t }", "public boolean hasCourseID(String courseID) {\r\n if (COURSE_ID.equals(courseID)) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "public boolean addCourse(String course) {\n // Check if the course already is in the course list\n for (int i = 0; i < numCourses; i++) {\n if (courses[i].equals(course)) return false;\n }\n courses[numCourses] = course;\n numCourses++;\n return true;\n }", "@Override\n public boolean exists(Course t) {\n boolean exists = true;\n \n String statement = EXISTS;\n ResultSet rs = data.makePreparedStatement(statement,new Object[]{(Object)t.getTitle(),(Object)t.getStream(),\n (Object)t.getType(),(Object)t.getStart_date(),(Object)t.getEnd_date()});\n try {\n if (rs.next() == false) {\n exists = false;\n }\n } catch (SQLException ex) {\n System.out.println(\"Problem with CourseDao.exists()\");\n }finally{\n data.closeConnections(rs,data.ps, data.conn);\n }\n\n return exists;\n }", "public boolean testEveningSlotRequirements(State state){\n\n\n if(state.getNumberOfFilledCourses() != 0){\n int slotIdForCurrentlyAssignedCourse = state.getCourses()[state.getNumberOfFilledCourses()-1];\n\n if(this.courses.get(state.getNumberOfFilledCourses()-1).isEvening()){\n\n Slot slot = this.courseSlots.get(slotIdForCurrentlyAssignedCourse-1);\n\n if(!slot.isEvening()){\n return false;\n }\n\n }\n\n }\n return true; \n }", "public Course validateCourseExistByteacher(String cNum, int teaId) throws SQLException {\n\t\tString sql=\"SELECT * FROM t_course WHERE tId = ? AND cNum = ?\";\n\t\tQueryRunner qr=new QueryRunner(JDBCUtils.getDataSource());\n\t\treturn qr.query(sql, new BeanHandler<Course>(Course.class), teaId,cNum);\n\t}", "private void retrieveStudentsEnrolledForACourse() {\n Scanner sc = new Scanner(System.in);\n Course c;\n while (true) {//Der Kursname sollte existieren\n System.out.print(\"Course ID: \");\n Long id = Long.parseLong(sc.next());\n c = ctrl.getCourse(id);\n if (c == null)\n System.out.println(\"Course with this ID doesn't exist! Please try again!\");\n else\n break;\n }\n\n //Wir rufen die eingeschriebenen Studenten Funktion von dem Controller\n System.out.println(\"Students enrolled for the course: \");\n ctrl.retrieveStudentsEnrolledForACourse(c);\n }", "public boolean contains(Course course) {\n\t\tfor (Course c : this.courses) {\n\t\t\tif (c.equals(course)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "private boolean checkPartials(Schedule sched)\n\t{\n\t\tArrayList<Course> coursesToCheck = new ArrayList<Course>();\n\t\tCourse workingPartialCourse, workingCourse;\n\t\tLab workingPartialLab, workingLab;\n\t\tTimeSlot workingPartialSlot, workingSlot;\n\t\t\n\t\tfor(int i = 0;i<partials.size();i++)\n\t\t{\n\t\t\tworkingPartialCourse = partials.get(i).getKey();\n\t\t\tworkingPartialSlot = partials.get(i).getValue();\n\t\t\t\n\t\t\t\n\t\t\t//If it's a lab...do some stuff\n\t\t\tif(workingPartialCourse.getClass() == Lab.class)\n\t\t\t{\n\t\t\t\tworkingPartialLab = (Lab) workingPartialCourse;\n\t\t\t\t\n\t\t\t\t//System.out.println(\"found a lab\");\n\t\t\t\tfor(int j = 0; j<sched.getLabs().size();j++)\n\t\t\t\t{\n\t\t\t\t\tworkingLab = sched.getLabs().get(j);\n\t\t\t\t\tworkingSlot = workingLab.getSlot();\n\t\t\t\t\t\n\t\t\t\t\tif(workingSlot != null)\n\t\t\t\t\t{\n\t\t\t\t\t\t//If they are the same lab\n\t\t\t\t\t\tif(workingLab.getDepartment().equals(workingPartialLab.getDepartment()) &&\n\t\t\t\t\t\t\t\tworkingLab.getLectureNum() == workingPartialLab.getLectureNum() &&\n\t\t\t\t\t\t\t\tworkingLab.getNumber() == workingPartialLab.getNumber() &&\n\t\t\t\t\t\t\t\tworkingLab.getSection() == workingPartialLab.getSection())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(workingSlot.getIsLab() != workingPartialSlot.getIsLab() ||\n\t\t\t\t\t\t\t\t\tworkingSlot.getDay() != workingPartialSlot.getDay() ||\n\t\t\t\t\t\t\t\t\tworkingSlot.getStartTime() != workingPartialSlot.getStartTime())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse //It's a course..\n\t\t\t{\n\t\t\t\tfor(int j = 0; j<sched.getCourses().size();j++)\n\t\t\t\t{\n\t\t\t\t\tworkingCourse = sched.getCourses().get(j);\n\t\t\t\t\tworkingSlot = workingCourse.getSlot();\n\t\t\t\t\t\n\t\t\t\t\tif(workingSlot != null)\n\t\t\t\t\t{\n\t\t\t\t\t\t//If they are the same course\n\t\t\t\t\t\tif(workingCourse.getDepartment().equals(workingPartialCourse.getDepartment()) &&\n\t\t\t\t\t\t\t\tworkingCourse.getNumber() == workingPartialCourse.getNumber() &&\n\t\t\t\t\t\t\t\tworkingCourse.getSection() == workingPartialCourse.getSection())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(workingSlot.getIsLab() != workingPartialSlot.getIsLab() ||\n\t\t\t\t\t\t\t\t\tworkingSlot.getDay() != workingPartialSlot.getDay() ||\n\t\t\t\t\t\t\t\t\tworkingSlot.getStartTime() != workingPartialSlot.getStartTime())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "@Override\r\n public boolean equals(Object object) {\n if (!(object instanceof Courses)) {\r\n return false;\r\n }\r\n Courses other = (Courses) object;\r\n if ((this.cno == null && other.cno != null) || (this.cno != null && !this.cno.equals(other.cno))) {\r\n return false;\r\n }\r\n return true;\r\n }", "public void finishCourse(Course course) {\n\t\tList<Course> unfinishedCourses = super.getUnfinishedCourses();\n\t\tList<Course> finishedCourses = super.getFinishedCourses();\n\n\t\tRoom room = super.getRoom();\n\t\tif (!room.hasTeacher()) {\n\t\t\t// throw new BLABLA SHOULD NEVER HAPPEN!\n\t\t}\n\t\tTeacher teacher = room.getTeacher();\n\t\tString teacherName = teacher.getName();\n\t\tif (unfinishedCourses.contains(course)) {\n\t\t\tunfinishedCourses.remove(course);\n\t\t\tfinishedCourses.add(course);\n\t\t\tthis.hp += course.getHp();\n\t\t\tSystem.out.println(teacherName + \": Excellent! You earned \" + course.getHp() + \"hp and are now done with \" + course + \".\");\n\t\t} else if (finishedCourses.contains(course)) {\n\t\t\tSystem.out.println(teacherName + \": Good job! You continue to have completed \" + course + \".\");\n\t\t}\n\t}", "private boolean checkEvenings(Schedule sched)\n\t{\n\t\tint tempSectionNumber; //In his example he has a course with lecture section 95\n\t\t//Traverse through all the courses and look at their time slot start time\n\t\tfor(int i = 0; i<sched.getCourses().size(); i++)\n\t\t{\n\t\t\tif(sched.getCourses().get(i).getSlot() != null)\n\t\t\t{\n\t\t\t\ttempSectionNumber = sched.getCourses().get(i).getSection();\n\t\t\t\t\n\t\t\t while (tempSectionNumber > 9) \n\t\t\t {\n\t\t\t tempSectionNumber /= 10;\n\t\t\t }\n\t\t\t \n\t\t\t\t//If a CPSC course has section number that starts in 9 and \n\t\t\t //starts before 1800 the check failed\n\t\t\t\tif((tempSectionNumber == 9) &&\n\t\t\t\t\t\t(sched.getCourses().get(i).getSlot().getStartTime() <1800) )\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//I commented this out because i don't think we need to for labs\n\t\t/*\n\t\t//Traverse through all the labs and look at their time slot start time\n\t\tfor(int i = 0; i<sched.getLabs().size(); i++)\n\t\t{\n\t\t\t//If a CPSC course has section number 9 and starts before 1800 the check failed\n\t\t\tif((sched.getLabs().get(i).getLectureNum() == 9) &&\n\t\t\t\t\t(sched.getLabs().get(i).getSlot().getStartTime() <1800) &&\n\t\t\t\t\t(sched.getCourses().get(i).getDepartment().equals(\"CSPC\")))\n\t\t\t\treturn false;\t\n\t\t}\n\t\t*/\n\t\t\n\t\t//If we made it here, there were no conflicts. Check passes\n\t\treturn true;\n\t}", "public void printNotfullcourses() {\n\t\tfor (int i = 0; i < CourseManager.courses.size(); i++) {\n\t\t\tif (CourseManager.courses.get(i).checkFull() == false) {\n\t\t\t\tSystem.out.println(i + 1 + \". \" + CourseManager.courses.get(i).getName());\n\t\t\t}\n\t\t}\n\t}", "public void addCourse(Course c) {\n if (this.contains(c) != true) { // checking if the course is in the courseList or not\n courseList.add(c);\n numOfCourses++;\n } else {\n // message if the course is already in the courseList\n System.out.println(\"The course is already in the list of courses.\");\n }\n }", "private boolean setLab(Course course) {\n if (course.getLabs().size() > 0) {\n for (DetailedSection lab : course.getLabs()) {\n if (canBeAdded(lab)) {\n course.setSelectedLab(lab);\n return true;\n }\n }\n return false;\n }\n return true;\n }", "public boolean add(Course course) {\n\t\tfor (Course c : this.courses) {\n\t\t\tif (c.inConflict(course)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tthis.courses.add(course);\n\t\treturn true;\n\t}", "public boolean deleteCourse(int id) {\n\t\treturn false;\n\t}", "protected abstract boolean approvedForClass(Course c);", "public boolean addCourse(Course addition)\n\t{\n\t\tboolean rVal = false;\n\n\t\tif (!courseOfferings.contains(addition))\n\t\t{\n\t\t\trVal = true;\n\t\t\tcourseOfferings.add(addition);\n\t\t\tDatabaseIO.serializeEverything();\n\t\t}\n\n\t\treturn rVal;\n\t}", "private boolean checkPre(int id) {\r\n boolean x = true;\r\n try {\r\n String query = \"SELECT * FROM preregs WHERE courseid=?\";\r\n PreparedStatement pstmt = conn.prepareStatement(query);\r\n pstmt.setInt(1, id);\r\n ResultSet rs = pstmt.executeQuery();\r\n if (rs != null) {\r\n while (rs.next()) {\r\n if (!checkCompletedCourse(rs.getInt(\"preregid\"))) {\r\n x = false;\r\n break;\r\n }\r\n }\r\n }\r\n pstmt.close();\r\n rs.close();\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n return x;\r\n }", "public boolean isProvidingCourse(String userid){\n\t\t\n\t\tboolean courseprovider = false;\n\t\t\n\t\tMongoConnection mongocon = new MongoConnection();\n\t\tDBCursor resultcursor = mongocon.getDBObject(\"userid\", userid, \"Course\");\n\t\tif(resultcursor.hasNext()){\n\t\t\tDBObject theObj = resultcursor.next();\n\t\t\n\t\t\tCourses courses = new Courses();\n\t\t\t\n\t\t\tcourses.setCourseCategory((String)theObj.get(\"courseCategory\"));\n\t\t\tcourses.setCoursecreatedate((String)theObj.get(\"coursecreatedate\"));\n\t\t\tcourses.setCoursecreatelocation((String)theObj.get(\"coursecreatelocation\"));\n\t\t\tcourses.setCourseDescription((String)theObj.get(\"courseDescription\"));\n\t\t\tcourses.setCourseFee((String)theObj.get(\"courseFee\"));\n\t\t\tcourses.setCourseid((String)theObj.get(\"courseid\"));\n\t\t\tcourses.setCourseimageid((String)theObj.get(\"courseimageid\"));\n\t\t\tcourses.setCourselinkid((String)theObj.get(\"courselinkid\"));\n\t\t\tcourses.setCourseName((String)theObj.get(\"courseName\"));\n\t\t\tcourses.setCourseownerid((String)theObj.get(\"courseownerid\"));\n\t\t\tcourses.setCoursepublisheddate((String)theObj.get(\"coursepublisheddate\"));\n\t\t\tcourses.setCoursepublishlocation((String)theObj.get(\"coursepublishlocation\"));\n\t\t\tcourses.setCourseReview((String)theObj.get(\"courseReview\"));\n\t\t\t\n\t\t\tString[] weekids = ((String)theObj.get(\"courseweekids\")).split(\",\");\n\t\t\t\n\t\t\tcourses.setCourseweekids(weekids);\n\t\t\tcourseprovider = true;\n\t\t\t\n\t\t\tcourselist.add(courses);\n\t\t\t\n\t\t}else{\n\t\t\tcourselist.add(\"\");\n\t\t}\n\t\t\n\t\t\n\t\treturn courseprovider;\n\t}", "@Override\r\n\tpublic Semester courseInSemester(Course course) {\n\t\treturn null;\r\n\t}", "public void unfinishCourse(Course course) {\n\t\tList<Course> unfinishedCourses = super.getUnfinishedCourses();\n\t\tList<Course> finishedCourses = super.getFinishedCourses();\n\n\t\tRoom room = super.getRoom();\n\t\tif (!room.hasTeacher()) {\n\t\t\t// throw new BLABLA SHOULD NEVER HAPPEN!\n\t\t}\n\t\tTeacher teacher = room.getTeacher();\n\t\tString teacherName = teacher.getName();\n\t\tif (unfinishedCourses.contains(course)) {\n\t\t\tSystem.out.println(teacherName + \": Unfortunate! You'll have to try again next exam!\");\n\t\t} else if (finishedCourses.contains(course)) {\n\t\t\tfinishedCourses.remove(course);\n\t\t\tunfinishedCourses.add(course);\n\t\t\tthis.hp -= course.getHp();\n\t\t\tSystem.out.println(teacherName + \": Sorry... Your earned hp for the course (\" + course.getHp() + \") has been withdrawn.\\nYou'll have to retake the course.\");\n\t\t}\n\t}", "public boolean isInPlanOfStudy(Course representedCourse) {\n\t\treturn false;\n\t}", "public String addCourse(String courseName, int section) {\r\n String result = \"\";\r\n try {\r\n System.out.println(courseName);\r\n String query = \"SELECT * FROM courses WHERE coursename=?\";\r\n PreparedStatement pstmt = conn.prepareStatement(query);\r\n pstmt.setString(1, courseName);\r\n ResultSet rs = pstmt.executeQuery();\r\n if (!rs.next()) {\r\n result = \"Course not found\";\r\n return result;\r\n }\r\n int courseid = rs.getInt(\"courseid\");\r\n if (checkDuplicate(courseid)) {\r\n result = \"Already registered in this course\";\r\n return result;\r\n }\r\n if (studentRegList.size() >= 6) {\r\n result = \"Maximum registration reached\";\r\n return result;\r\n }\r\n if (!checkPre(courseid)) {\r\n result = \"Prerequisite not met\";\r\n return result;\r\n }\r\n if (rs.getInt(\"numofsecs\") < section || section <= 0) {\r\n result = \"No such section\";\r\n return result;\r\n }\r\n if (!checkSectionAvailability(courseid, section)) {\r\n result = \"Section is full\";\r\n return result;\r\n }\r\n Registration reg = new Registration(id, courseid, section, \"TBA\", conn);\r\n System.out.print(id);\r\n studentRegList.add(reg);\r\n reg.ongoingRegistration();\r\n\r\n query = \"SELECT * FROM sections WHERE courseid=? AND secnum=?\";\r\n pstmt = conn.prepareStatement(query);\r\n pstmt.setInt(1, courseid);\r\n pstmt.setInt(2, section);\r\n\r\n rs = pstmt.executeQuery();\r\n rs.next();\r\n\r\n if (rs.getInt(\"numofstudents\") >= 8) {\r\n result = \"Minimum student fulfilled, section is run\";\r\n } else {\r\n result = \"Minimum student unfulfilled, waiting for more student before adding to offering list\";\r\n }\r\n\r\n pstmt.close();\r\n rs.close();\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n return result;\r\n }", "@Override\n\tpublic boolean checkEnrolment(Users userid, Course courseid) {\n\t\treturn false;\n\t}", "public static Course courseSelection() {\n\n System.out.println(\"\");\n System.out.println(\"Press number of course you want to enter\");\n\n int i = validation();\n\n System.out.println(\"Course selected\");\n\n Course course = listOfCourses.get(i);\n System.out.println(\"You have selected \" + course.getTitle() + \", \" + course.getStream() + \", \" + course.getType());\n\n return course;\n\n }", "private void checkVacancy(){\n String courseIndexID = null;\n ArrayList<CourseCompo> courseCompoList = new ArrayList<CourseCompo>();\n\n Scanner sc = new Scanner(System.in);\n\n System.out.println(\"\\nPlease enter course index\");\n courseIndexID = sc.nextLine();\n while(!courseIndexID.matches(\"^[0-9]+\")){\n System.out.println(\"Invalid input! Please enter a valid index number!\");\n courseIndexID = sc.nextLine();\n }\n System.out.println(courseIndexID);\n CourseIndex courseIndex = this.courseMgr.readCourseIndexbyID(courseIndexID);\n if (courseIndex==null){\n System.out.print(\"The course index does not exist.\");\n }\n else{\n int size = courseIndex.getCourseCompos().size();\n\n System.out.println(\"Hang on a moment while we load database....\\n\");\n System.out.println(\"------------------------------------------------------\");\n System.out.println(\"Number of Slot: \"+courseIndex.getSlot());\n System.out.println(\"------------------------------------------------------\");\n if (size==0){\n System.out.println(\"There's no vacancy for course index \"+courseIndexID);\n }\n else{\n courseCompoList = courseIndex.getCourseCompos();\n System.out.println(\" CLASS TYPE DATE TIME\");\n System.out.println(\"------------------------------------------------------\");\n for(CourseCompo courseComp : courseCompoList){\n System.out.println(String.format(\" %s %s %s\",courseComp.getCompoType(),courseComp.getDay(),courseComp.getDay()));\n\n }\n }\n System.out.println(\"------------------------------------------------------\\n\");\n\n }\n\n }", "@Override\r\n\tpublic void seCourse() {\n\t\tString coursename = \"\";\r\n int teacherid = 0;\r\n String inputStr = \"\";\r\n System.out.println(\"是否需要输入教师编号关键词(y/n):\");\r\n inputStr = input.next();\r\n if(inputStr.equals(\"y\")) {\r\n System.out.println(\"请输入教师编号关键词:\");\r\n teacherid = input.nextInt();\r\n }\r\n System.out.println(\"是否需要输入课程名称关键词(y/n):\");\r\n inputStr = input.next();\r\n if(inputStr.equalsIgnoreCase(\"y\")) {\r\n System.out.println(\"请输入课程名称关键词:\");\r\n coursename = input.next();\r\n }\r\n StudentDAO dao = new StudentDAOimpl();\r\n List<Course> list = dao.seCourse(coursename, teacherid);\r\n System.out.println(\"课程编号\\t课程名称\\t教师编号\\t课程课时\");\r\n for(Course c : list) {\r\n System.out.println(c.getCourseid()+\"\\t\"+c.getCoursename()+\"\\t\"+c.getTeacherid()+\"\\t\"+c.getCoursetime());\r\n }\r\n\t}", "@Override\r\n\tpublic boolean equals (Object o) {\r\n\t if (!(o instanceof Course) || o == null) {\r\n\t \treturn false; \r\n\t }\r\n\t \r\n\t Course c = (Course) o;\r\n\t return credit == c.credit && code.equals(c.code); // Returns if credit and code are equal\r\n\t}", "private void searchCourse()\r\n {\r\n \ttry\r\n \t{\r\n \tString courseFaculty = this.getClientIn().readLine();\r\n \tString courseNumberStr = this.getClientIn().readLine();\r\n\r\n \tint courseNumber = Integer.parseInt(courseNumberStr);\r\n \tCourse foundCourse = this.getDBManager().searchCourse(courseFaculty, courseNumber);\r\n \tif(foundCourse == null)\r\n \t{\r\n \t\tthis.getClientOut().printf(\"ERROR\\nCourse Not Found.\\n\");\r\n \t\treturn;\r\n \t}\r\n \tthis.getClientOut().printf(\"SUCCESS\\n%s\\n\", foundCourse.toString());\r\n \t}\r\n\t\tcatch(NumberFormatException e)\r\n\t\t{\r\n\t\t\tthis.getClientOut().printf(\"ERROR\\nPlease check the Course Number. It must be an integer.\\n\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tcatch (IOException e)\r\n\t\t{\r\n\t\t\tthis.getClientOut().printf(\"ERROR\\nIOException while getting data from user\\n\");\r\n\t\t\treturn;\r\n\t\t}\r\n \tfinally\r\n \t{\r\n \t\tthis.getClientOut().flush();\r\n \t}\r\n }", "public boolean registerCourse(Integer indexGroupID, Scanner sc) {\r\n\t\tboolean success = false;\r\n\t\tboolean validInput = false;\r\n\t\tint confirmation = 0;\r\n\t\tStudent s1 = new Student();\r\n\t\ts1 = s1.retrieveStudentObject(this.getStudentID());\r\n\t\tCourse c1 = new Course();\r\n\t\tc1 = c1.retrieveCourseObjectByIndexGroup(indexGroupID);\r\n\t\tCourse c2 = new Course();\r\n\t\tIndexGroup g1 = new IndexGroup();\r\n\t\tg1 = g1.retrieveIndexGroupObject(indexGroupID);\r\n\t\tWaitlist wl1 = new Waitlist();\r\n\t\twl1 = wl1.retrieveWaitListObjectByIndexGroup(indexGroupID);\r\n\t\tWaitlist wl2 = new Waitlist();\r\n\r\n\t\ttry {\r\n\t\t\tif (s1 == null) {\r\n\t\t\t\tSystem.out.println(\"No user has been logged in.\\n\");\r\n\t\t\t} else {\r\n\t\t\t\tif (c1 != null) {\r\n\t\t\t\t\tint temp = s1.getCourseList().size();\r\n\t\t\t\t\tint temp2 = s1.getWaitListIDList().size();\r\n\r\n\t\t\t\t\tif (temp == 0) {\r\n\t\t\t\t\t\tif (schedule.checkScheduleClash(indexGroupID)) {\r\n\t\t\t\t\t\t\tSystem.out.println(\"Period of lesson clash with current schedule\\n\");\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif (!(g1.checkVacancies())) {\r\n\t\t\t\t\t\t\t\tint flag = 0;\r\n\t\t\t\t\t\t\t\tfor (int i = 0; i < temp2; i++) {\r\n\t\t\t\t\t\t\t\t\tc2 = c2.retrieveCourseObjectByWaitList(s1.getWaitListIDList().get(i));\r\n\t\t\t\t\t\t\t\t\tif (s1.getWaitListIDList().get(i).equals(wl1.getWaitListID())) {\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"You are already in waitlist\\n\");\r\n\t\t\t\t\t\t\t\t\t\tflag = 1;\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t} else if (c2.getCourseID().equals(c1.getCourseID())) {\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\"You already in waitlist of another index group of the same course\\n\");\r\n\t\t\t\t\t\t\t\t\t\tflag = 1;\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (flag == 0) {\r\n\t\t\t\t\t\t\t\t\tg1.printGroupDetailsConfirmation();\r\n\t\t\t\t\t\t\t\t\tSystem.out.print(\r\n\t\t\t\t\t\t\t\t\t\t\t\"Confirm to join the waitlist of this group? 1 = Yes, Any other number = No: \");\r\n\t\t\t\t\t\t\t\t\tdo {\r\n\t\t\t\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\t\t\t\tconfirmation = sc.nextInt();\r\n\t\t\t\t\t\t\t\t\t\t\tif (confirmation >= 0) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tvalidInput = true;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsc.nextLine();\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t} catch (InputMismatchException e) {\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Enter a valid integer!\");\r\n\t\t\t\t\t\t\t\t\t\t\tsc.nextLine();\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t} while (!validInput);\r\n\t\t\t\t\t\t\t\t\tvalidInput = false;\r\n\r\n\t\t\t\t\t\t\t\t\tif (confirmation == 1) {\r\n\t\t\t\t\t\t\t\t\t\twl1.enqueueToWaitList(s1.getStudentID());\r\n\t\t\t\t\t\t\t\t\t\ts1.getWaitListIDList().add(wl1.getWaitListID());\r\n\t\t\t\t\t\t\t\t\t\tg1.printGroupDetailsConfirmation();\r\n\t\t\t\t\t\t\t\t\t\twl1.updateWaitListObject(wl1);\r\n\t\t\t\t\t\t\t\t\t\ts1.updateStudentObject(s1);\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"You have been added to the waitlist\\n\");\r\n\t\t\t\t\t\t\t\t\t\tsuccess = true;\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"You are not added to the waitlist\\n\");\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Returning to main menu...\\n\");\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"Course: \" + c1.getCourseID());\r\n\t\t\t\t\t\t\t\tg1.printGroupDetailsConfirmation();\r\n\t\t\t\t\t\t\t\tSystem.out.print(\r\n\t\t\t\t\t\t\t\t\t\t\"Confirm to register course under this index group? 1 = Yes, Any other number = No: \");\r\n\t\t\t\t\t\t\t\tdo {\r\n\t\t\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\t\t\tconfirmation = sc.nextInt();\r\n\t\t\t\t\t\t\t\t\t\tif (confirmation >= 0) {\r\n\t\t\t\t\t\t\t\t\t\t\tvalidInput = true;\r\n\t\t\t\t\t\t\t\t\t\t\tsc.nextLine();\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t} catch (InputMismatchException e) {\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Enter a valid integer!\");\r\n\t\t\t\t\t\t\t\t\t\tsc.nextLine();\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t} while (!validInput);\r\n\t\t\t\t\t\t\t\tvalidInput = false;\r\n\r\n\t\t\t\t\t\t\t\tif (confirmation == 1) {\r\n\t\t\t\t\t\t\t\t\tfor (int i = 0; i < temp2; i++) {\r\n\t\t\t\t\t\t\t\t\t\tc2 = c2.retrieveCourseObjectByWaitList(s1.getWaitListIDList().get(i));\r\n\t\t\t\t\t\t\t\t\t\tif (c2.getCourseID().equals(c1.getCourseID())) {\r\n\t\t\t\t\t\t\t\t\t\t\twl2 = wl2.retrieveWaitListObject(s1.getWaitListIDList().get(i));\r\n\t\t\t\t\t\t\t\t\t\t\twl2.dequeueFromWaitList(s1.getStudentID());\r\n\t\t\t\t\t\t\t\t\t\t\ts1.getWaitListIDList().remove(i);\r\n\t\t\t\t\t\t\t\t\t\t\twl2.updateWaitListObject(wl2);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\ts1.getCourseList().add(c1.getCourseID());\r\n\t\t\t\t\t\t\t\t\ts1.getIndexGroupList().add(indexGroupID);\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"Course: \" + c1.getCourseID());\r\n\t\t\t\t\t\t\t\t\tg1.printGroupDetailsConfirmation();\r\n\t\t\t\t\t\t\t\t\tg1.updateVacancies('-');\r\n\t\t\t\t\t\t\t\t\t// Add schedule\r\n\t\t\t\t\t\t\t\t\ts1.getSchedule().AddSchedule(indexGroupID);\r\n\t\t\t\t\t\t\t\t\tg1.updateIndexGroupObject(g1);\r\n\t\t\t\t\t\t\t\t\ts1.updateStudentObject(s1);\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"Course successfully registered!\");\r\n\t\t\t\t\t\t\t\t\tsuccess = true;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"Course has not been registered.\");\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"Returning to main menu...\");\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} else {\r\n\t\t\t\t\t\tfor (int j = 0; j < temp; j++) {\r\n\t\t\t\t\t\t\tif (s1.getCourseList().get(j).equals(c1.getCourseID())) {\r\n\t\t\t\t\t\t\t\tSystem.out\r\n\t\t\t\t\t\t\t\t\t\t.println(\"You are already registered in this course in another index group\\n\");\r\n\t\t\t\t\t\t\t} else if (j == (temp - 1)) {\r\n\t\t\t\t\t\t\t\tif (schedule.checkScheduleClash(indexGroupID)) {\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"Period of lesson clash with current schedule\\n\");\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tif (!(g1.checkVacancies())) {\r\n\t\t\t\t\t\t\t\t\t\tint flag = 0;\r\n\t\t\t\t\t\t\t\t\t\tfor (int i = 0; i < temp2; i++) {\r\n\t\t\t\t\t\t\t\t\t\t\tc2 = c2.retrieveCourseObjectByWaitList(s1.getWaitListIDList().get(i));\r\n\t\t\t\t\t\t\t\t\t\t\tif (s1.getWaitListIDList().get(i).equals(wl1.getWaitListID())) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"You are already in waitlist\\n\");\r\n\t\t\t\t\t\t\t\t\t\t\t\tflag = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t\t\t} else if (c2.getCourseID().equals(c1.getCourseID())) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"You are already in waitlist of another index group of the same course\\n\");\r\n\t\t\t\t\t\t\t\t\t\t\t\tflag = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tif (flag == 0) {\r\n\t\t\t\t\t\t\t\t\t\t\tg1.printGroupDetailsConfirmation();\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.print(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"Confirm to join the waitlist of this group? 1 = Yes, Any other number = No: \");\r\n\t\t\t\t\t\t\t\t\t\t\tdo {\r\n\t\t\t\t\t\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tconfirmation = sc.nextInt();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (confirmation >= 0) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalidInput = true;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsc.nextLine();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t} catch (InputMismatchException e) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Enter a valid integer!\");\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsc.nextLine();\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t} while (!validInput);\r\n\t\t\t\t\t\t\t\t\t\t\tvalidInput = false;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tif (confirmation == 1) {\r\n\t\t\t\t\t\t\t\t\t\t\t\twl1.enqueueToWaitList(s1.getStudentID());\r\n\t\t\t\t\t\t\t\t\t\t\t\ts1.getWaitListIDList().add(wl1.getWaitListID());\r\n\t\t\t\t\t\t\t\t\t\t\t\tg1.printGroupDetailsConfirmation();\r\n\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"You have been added to waitlist\\n\");\r\n\t\t\t\t\t\t\t\t\t\t\t\twl1.updateWaitListObject(wl1);\r\n\t\t\t\t\t\t\t\t\t\t\t\ts1.updateStudentObject(s1);\r\n\t\t\t\t\t\t\t\t\t\t\t\tsuccess = true;\r\n\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"You have not been added to waitlist\\n\");\r\n\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Returning to main menu...\\n\");\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Course: \" + c1.getCourseID());\r\n\t\t\t\t\t\t\t\t\t\tg1.printGroupDetailsConfirmation();\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.print(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\"Confirm to register course under this index group? 1 = Yes, Any other number = No: \");\r\n\t\t\t\t\t\t\t\t\t\tdo {\r\n\t\t\t\t\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\t\t\t\t\tconfirmation = sc.nextInt();\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (confirmation >= 0) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalidInput = true;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsc.nextLine();\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t} catch (InputMismatchException e) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Enter a valid integer!\");\r\n\t\t\t\t\t\t\t\t\t\t\t\tsc.nextLine();\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t} while (!validInput);\r\n\t\t\t\t\t\t\t\t\t\tvalidInput = false;\r\n\r\n\t\t\t\t\t\t\t\t\t\tif (confirmation == 1) {\r\n\t\t\t\t\t\t\t\t\t\t\tfor (int i = 0; i < temp2; i++) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tc2 = c2.retrieveCourseObjectByWaitList(s1.getWaitListIDList().get(i));\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (c2.getCourseID().equals(c1.getCourseID())) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\twl2 = wl2.retrieveWaitListObject(s1.getWaitListIDList().get(i));\r\n\t\t\t\t\t\t\t\t\t\t\t\t\twl2.dequeueFromWaitList(s1.getStudentID());\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts1.getWaitListIDList().remove(i);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\twl2.updateWaitListObject(wl2);\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\ts1.getCourseList().add(c1.getCourseID());\r\n\t\t\t\t\t\t\t\t\t\t\ts1.getIndexGroupList().add(indexGroupID);\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Course: \" + c1.getCourseID());\r\n\t\t\t\t\t\t\t\t\t\t\tg1.printGroupDetailsConfirmation();\r\n\t\t\t\t\t\t\t\t\t\t\tg1.updateVacancies('-');\r\n\t\t\t\t\t\t\t\t\t\t\ts1.getSchedule().AddSchedule(indexGroupID);\r\n\t\t\t\t\t\t\t\t\t\t\tg1.updateIndexGroupObject(g1);\r\n\t\t\t\t\t\t\t\t\t\t\ts1.updateStudentObject(s1);\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Course successfully registered!\");\r\n\t\t\t\t\t\t\t\t\t\t\tsuccess = true;\r\n\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Course has not been registered.\");\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Returning to main menu...\");\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\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}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn success;\r\n\t}", "private boolean checkCourseLabConflict(Schedule sched)\n\t{\n\t\tSchedule workingSchedule = sched;\n\t\tCourse workingCourse;\n\t\tLab workingLab, lab813 = null, lab913 = null;\n\t\t\t\n\t\t//Traverse through all the classes in the schedule and find their labs\n\t\tfor(int i = 0; i<workingSchedule.getCourses().size();i++)\n\t\t{\n\t\t\tworkingCourse = workingSchedule.getCourses().get(i);\n\t\t\t\n\t\t\t//Traverse through all the labs\n\t\t\tfor(int j = 0; j<workingSchedule.getLabs().size();j++)\n\t\t\t{\n\t\t\t\tworkingLab = workingSchedule.getLabs().get(j);\n\t\t\t\t\n\t\t\t\tif(workingLab.getNumber() == 813)\n\t\t\t\t{\n\t\t\t\t\tlab813 = workingLab;\n\t\t\t\t}\n\t\t\t\telse if(workingLab.getNumber() == 913)\n\t\t\t\t{\n\t\t\t\t\tlab913 = workingLab;\n\t\t\t\t}\n\t\t\t\t//If the lab is in fact a lab for this course and their time slots overlap\n\t\t\t\t//then we return false.\n\t\t\t\tif(isLabOf(workingCourse, workingLab) && !timeSlotConflict(workingCourse, workingLab))\n\t\t\t\t\treturn false;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//I need to making workingSchedule a deep copy of s, right now it's just a pointer to s\n\t\t\t\t\t//so if i remove something, we're deleting parts of the schedule\n\t\t\t\t\t//Have to override clone, just don't feel like doing it right now.\n\t\t\t\t\t//workingSchedule.getLabs().remove(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Does special cpsc 813 and 913 checking\n\t\tfor(int i = 0; i<workingSchedule.getLabs().size();i++)\n\t\t{\n\t\t\tworkingLab = workingSchedule.getLabs().get(i);\n\t\t\t\n\t\t\t//A 313 lab\n\t\t\tif(workingLab.getDepartment().equals(\"CPSC\") &&\n\t\t\t\t\tworkingLab.getNumber() == 313 &&\n\t\t\t\t\tworkingLab.getSlot() != null &&\n\t\t\t\t\tlab813.getSlot() != null)\n\t\t\t{\n\t\t\t\tif(workingLab.getSlot().getDay() == lab813.getSlot().getDay() &&\n\t\t\t\t\t\tworkingLab.getSlot().getStartTime() == lab813.getSlot().getStartTime())\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//A 413 lab\n\t\t\telse if(workingLab.getDepartment().equals(\"CPSC\") &&\n\t\t\t\t\tworkingLab.getNumber() == 413 && \n\t\t\t\t\tworkingLab.getSlot() != null &&\n\t\t\t\t\tlab913.getSlot() != null)\n\t\t\t{\n\t\t\t\tif(workingLab.getSlot().getDay() == lab913.getSlot().getDay() &&\n\t\t\t\t\t\tworkingLab.getSlot().getStartTime() == lab913.getSlot().getStartTime())\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//We've now checked all the courses and labs and found no conflict, return false\n\t\treturn true;\n\t}", "public boolean removeCourse(String course) {\n // Look for the course index\n int courseIndex = numCourses;\n for (int i = 0; i < numCourses; i++) {\n if (courses[i].equals(course)) {\n courseIndex = i;\n break;\n }\n }\n if (courseIndex == numCourses) { // cannot find the course to be removed\n return false; \n } else { // remove the course and re-arrange for courses array\n for (int i = courseIndex; i < numCourses-1; i++) {\n courses[i] = courses[i+1];\n }\n numCourses--;\n return true;\n }\n }", "public String getcourse() {\n\t\treturn course;\n\t}", "private void addCourse() throws IOException, InterruptedException {\n Scanner sc = new Scanner(System.in);\n Course course = new Course();\n\n System.out.println(\"\\nPlease enter the course code:\");\n String courseID = sc.nextLine();\n while(!courseID.matches(\"^[a-zA-Z]{2}[0-9]{4}$\"))\n {\n System.out.println(\"Invalid input! Please enter again!\");\n System.out.println(\"\\nPlease enter the course code:\");\n courseID = sc.nextLine();\n }\n courseID = courseID.toUpperCase();\n //Course course = new Course(courseID,null,-1)\n\n while(courseMgr.readCourseByID(courseID)!=null){\n ErrorCodeBoundary.printErrorCourseAlreadyExist();\n System.out.println(\"\\n***********What would you like to do next ?***********\");\n System.out.println(\" Course Information \");\n System.out.println(\"______________________________________________________\\n\");\n System.out.println(\"|1. Add another course |\");\n System.out.println(\"|2. Update information for this course |\");\n System.out.println(\"|----------------------------------------------------|\");\n System.out.println(\"|0. Return to admin menu page |\");\n System.out.println(\"|----------------------------------------------------|\");\n System.out.println(\"______________________________________________________\");\n\n //sc.nextLine();\n int choice;\n\n do {\n while (!sc.hasNextInt()) {\n System.out.println(\"Invalid input! Please enter your choice:\");\n sc.next();\n }\n choice = sc.nextInt();\n if((choice < 0) || (choice > 2))\n System.out.println(\"Invalid input! Please enter your choice:\");\n } while ((choice < 0) || (choice > 2));\n if(choice == 1){\n System.out.println(\"\\nPlease enter another course code:\");\n sc.nextLine();\n courseID = sc.nextLine();\n while(!courseID.matches(\"^[a-zA-Z]{2}[0-9]{4}$\"))\n {\n System.out.println(\"Invalid input! Please enter again!\");\n System.out.println(\"\\nPlease enter the course code:\");\n courseID = sc.nextLine();\n }\n\n }\n else if(choice ==2){\n this.courseIDExist = courseID;\n this.updCourse();\n return;\n }\n else\n return;\n\n\n }\n\n courseID = courseID.toUpperCase();\n course.setCourseID(courseID);\n\n\n System.out.println(\"Please enter the school:\");\n String school = sc.nextLine();\n while(!school.matches(\"^[a-zA-Z]*$\"))\n {\n System.out.println(\"Invalid input! Please enter again!\");\n System.out.println(\"Please enter the school:\");\n school = sc.nextLine();\n }\n school = school.toUpperCase();\n course.setSchool(school);\n\n System.out.println(\"\\n**************Please choose a course type**************\");\n System.out.println(\" Course Type Information \");\n System.out.println(\"______________________________________________________\\n\");\n System.out.println(\"|1. Lecture only |\");\n System.out.println(\"|2. Lecture with tutorial |\");\n System.out.println(\"|3. Lecture tutorial and lab |\");\n System.out.println(\"______________________________________________________\");\n\n\n int courseType;\n do {\n while (!sc.hasNextInt()) {\n System.out.println(\"Invalid input! Please enter the course type:\");\n sc.next();\n }\n courseType = sc.nextInt();\n if((courseType < 1) || (courseType > 3))\n System.out.println(\"Input number out of range! Please enter the course type:\");\n } while ((courseType < 1) || (courseType > 3));\n\n course.setCourseType(courseType-1);\n\n\n System.out.println(\"\\nHow many indices for this course?\");\n int noOfIndex;\n do {\n while (!sc.hasNextInt()) {\n System.out.println(\"Invalid input! Please enter the number of index for this course:\");\n sc.next();\n }\n noOfIndex = sc.nextInt();\n if(noOfIndex < 1)\n System.out.println(\"The number of index can't be less than 1.Please enter the number of index for this course:\");\n } while (noOfIndex < 1);\n\n ArrayList<String> dateAndTime = new ArrayList<String>();\n CourseIndex courseIndex = new CourseIndex();\n ArrayList<CourseCompo> courseCompoList = new ArrayList<CourseCompo>();\n\n for(int i=0;i<noOfIndex;i++){\n courseIndex = this.addCourseIndex(courseID);\n \n \n if (courseIndex==null)\n return;\n courseCompoList = this.addCourseComp(courseType);\n for(CourseCompo courseComp:courseCompoList){\n courseIndex.addCourseCompo(courseComp);\n }\n\n /*\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n }*/\n course.addCourseIndex(courseIndex);\n CourseManager courseManager = new CourseManager();\n courseManager.addCourseToDB(course);\n System.out.println(\"\\nThe course have been added successfully.\");\n printAllCourseInDB();\n\n\n }\n }", "private void viewCourse() {\n Scanner sc = new Scanner(System.in);\n System.out.print(\"ID of the course to be viewed: \");\n Long id = Long.parseLong(sc.next());\n\n Course c = ctrl.getCourse(id);\n if (c != null)\n System.out.println(c.toString());\n else\n System.out.println(\"Course with this ID doesn't exist!\");\n }", "public FinishedCourse(String name)\n\t{\n\t\tsuper (name);\n\t\t_grade = Grades.O;\n\t\t_passed = false;\n\t\t\n\t\t\n\t}", "@Override\r\n\tpublic Class courseHasClass(Course course) {\n\t\treturn null;\r\n\t}", "public void enroll() {\n\tdo {\n\t\tSystem.out.print(\"Enter Courses to enroll (Q for Quit Enrollment): \");\n\t\tScanner in = new Scanner(System.in);\n\t\tString course = in.nextLine();\n\t\t\n\t\tif(!course.equals(\"Q\")){\n\t\tcountCourses++;\n\t\tcourses = courses + \"\\n \" +course;\n\t\ttuitionBalance = tuitionBalance + costOfCourse;\n\t\t}else {System.out.println(\"You have decided to quit Enrolment\");\n\t\t break;}\t\t\n\t}while (1 != 0); \n\tint ccount = countCourses++;\n\t\tSystem.out.println(\"You have registered for \" + ccount + \" Courses: \" + courses + \"\\nYour tuition balance is \" + tuitionBalance);\n\t}", "@Test\n public void searchForCourse(){\n UoMSearchPage page = new UoMSearchPage(driver);\n page.get();\n page.searchForStudies(\"Software Development\");\n assertTrue(page.isSoftwareDevelopmentComponentPresent());\n }", "public static boolean canFinish(int numCourses, int[][] prerequisites) {\n Course clist[] = new Course[numCourses];\n\n // initialize array with new course objects\n for (int i = 0; i < numCourses; i++) {\n clist[i] = new Course();\n }\n\n // pair the course with the prerequisites from the params\n for (int[] couple : prerequisites) {\n Course c1 = clist[couple[0]];\n Course c2 = clist[couple[1]];\n c1.addPre(c2);\n }\n\n // check every course and its prerequisites for a cyclic graph\n for (int i = 0; i < numCourses; i++) {\n if (clist[i].isCyclic()) {\n return false;\n }\n }\n\n // if none is detected then we return true, we can complete all the courses\n return true;\n }", "@Test\n public void checkCourse_AddedToCart() throws InterruptedException {\n Login login = new Login(driver);\n login.login(\"[email protected]\",\"Dinnu@247\");\n\n HomePage homePage = new HomePage(driver);\n homePage.search();\n homePage.selectCourse();\n Thread.sleep(3000);\n\n Courses course = new Courses(driver);\n Boolean courseAdded = course.courseAddedToCart();\n\n Assert.assertTrue(courseAdded);\n }", "boolean hasInstructor(){\n\t\treturn instructor == null ? false : true;\n\t}", "private boolean canBeAdded(DetailedSection newSection) {\n for (Course course : courses) {\n // Lecture\n if (course.getSelectedLecture() != null) {\n if (newSection.conflictsWith(course.getSelectedLecture())) {\n return false;\n }\n }\n\n // Discussion\n if (course.getSelectedDiscussion() != null) {\n if (newSection.conflictsWith(course.getSelectedDiscussion())) {\n return false;\n }\n }\n\n // Lab\n if (course.getSelectedLab() != null) {\n if (newSection.conflictsWith(course.getSelectedLab())) {\n return false;\n }\n }\n }\n\n return true;\n }", "public void askCourseDetails() {\n\t\t\n\t\tString courseCode, courseName, facultyName;\n\t\tint courseVacancy = 10;\n\t\n\t\t\n\t\tSystem.out.println(\"-------The current faculties are-------\");\n\t\tfacultyNameList = acadCtrl.getFacultyNameList();\n\t\tfor(String fName : facultyNameList) {\n\t\t\tSystem.out.println(fName);\n\t\t}\n\t\twhile(true)\n\t\t{\n\t\t\tSystem.out.println(\"Enter faculty name: \");\n\t\t\tfacultyName = sc.nextLine().toUpperCase();\n\t\t\t\n\t\t\t//check if input data of faculty is correct\n\t\t\tif(checkFacName(facultyName)) {\n\t\t\t\tfacultyNameList.add(facultyName);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse System.out.println(\"Wrong faculty Name\");\n\t\t}\n\t\t\n\t\t\n\t\tcourseCodeList = acadCtrl.getCourseCodeList(facultyName);\n\t\tSystem.out.println(\"The current course codes are \");\n\t\tfor(String code : courseCodeList) {\n\t\t\tSystem.out.println(code);\n\t\t}\n\t\tSystem.out.println(\"Enter course code: \");\n\t\tcourseCode = sc.nextLine().toUpperCase();\n\t\t\n\t\t\n\t\tif(checkCourseCode(courseCode)) {\n\t\t\tSystem.out.println(\"Course code already exists. \\n Please try again\");\n\t\t\tcourseCode = sc.nextLine().toUpperCase();\n\t\t\tcourseCodeList.add(courseCode);\n\t\t}else courseCodeList.add(courseCode);\n\t\t\n\t\t\n\t\tcourseNameList = acadCtrl.getCourseNameList(facultyName);\n\t\tSystem.out.println(\"The current course names are \");\n\t\tfor(String name : courseNameList) {\n\t\t\tSystem.out.println(name);\n\t\t}\n\t\tSystem.out.println(\"Enter course name: \");\n\t\t\n\t\tcourseName = sc.nextLine().toUpperCase();\n\t\t\n\t\tif(checkCourseName(courseName)) {\n\t\t\tSystem.out.println(\"Course name already exists. \\n Please try again\");\n\t\t}else courseNameList.add(courseName);\n\t\t\n\t\t\n\t\t\n\t\tSystem.out.println(\"Choose your available professors\");\n\t\tprofNameList = acadCtrl.getProfessorNameList(facultyName);\n\t\tfor(String p : profNameList) {\n\t\t\tSystem.out.println(p);\n\t\t}\n\t\tSystem.out.println(\"Enter the professor's staff name\"); //input validation\n\t\tString ProfName = sc.nextLine();\n\t\t\n\t\tif(!CheckProfName(ProfName)) {\n\t\t\tSystem.out.println(\"Enter correct professor's name\");\n\t\t\tProfName = sc.nextLine();\n\t\t}\n\t\t\n\t\t// want to add if he's the coordinator?\n\t\t// input who is the coordinator\n\t\tSystem.out.println(\"Is he the course coordinator? Y for Yes / N for No\");\n\t\tchar yn = sc.nextLine().charAt(0);\n\n\t\tif(yn == 'Y' || yn == 'y') {\n\t\t\t// set ProfName to course coord\n\t\t\tacadCtrl.getProfessor(facultyName, ProfName).setCourseCoordinator(true);\n\t\t\tcourseCoordList.add(ProfName);\n\t\t}\n\t\telse if (yn == 'N' || yn == 'n') {\n\t\t\tSystem.out.println(\"Who is the course coordinator for the course?\");\n\t\t\tSystem.out.println();\n\t\t\tfor(String p : profNameList) {\n\t\t\t\tSystem.out.println(p);\n\t\t\t}\n\t\t\t// for course coord\n\t\t\tSystem.out.println(\"Enter the professor's staff name\"); //input validation\n\t\t\tString profNameCoord = sc.nextLine();\n\t\t\t\n\t\t\tif(!CheckProfName(profNameCoord)) {\n\t\t\t\tSystem.out.println(\"Enter correct professor's name\");\n\t\t\t\tprofNameCoord = sc.nextLine();\n\t\t\t\tacadCtrl.getProfessor(facultyName, profNameCoord).setCourseCoordinator(true);\n\t\t\t\tcourseCoordList.add(profNameCoord);\n\t\t\t}\n\t\t\tacadCtrl.getProfessor(facultyName, profNameCoord).setCourseCoordinator(true);\n\t\t\tcourseCoordList.add(profNameCoord);\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tSystem.out.println(\"Enter course Vacancy\");\n\t\tif(sc.hasNextInt()) {\n\t\t\tcourseVacancy = sc.nextInt();\n\t\t}else System.out.println(\"Enter only integers\");\n\t\t\n\t\tString dummy = sc.nextLine(); // dummy scan changes from sc int to string\n\t\t\n\t\tSystem.out.println(\"Lectures only? Y for Yes / N for No\");\n\t\tchar input = sc.nextLine().charAt(0);\n\n\t\tif(input == 'Y' || input == 'y') {\n\t\t\t// creation of course object, by default only exam, only 1 lecture\n\t\t\tacadCtrl.passCourseDetails(courseCode, courseName, facultyName, courseVacancy, ProfName); \n\t\t}\n\t\telse if (input == 'N' || input == 'n') {\n\t\t\t\n\t\t\tint tutVacancy = 0;\n\t\t\t\n\t\t\tSystem.out.println(\"Is there tutorial? Y for Yes / N for No\");\n\t\t\tinput = sc.nextLine().charAt(0);\n\t\t\t\n\t\t\tif (input == 'Y'|| input == 'y') {\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"What is the class vacancy for each group?\");\t\n\t\t\t\tif(sc.hasNextInt()) {\n\t\t\t\t\ttutVacancy = sc.nextInt(); // total tutorial vacancy > lecture size OK!\n\t\t\t\t}\n\t\t\t\ttutGroups = addTutorial(tutVacancy);\n\t\t\t\n\t\t\t\tdummy = sc.nextLine();\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"Is there Lab? Y for Yes / N for No\");\n\t\t\t\tinput = sc.nextLine().charAt(0);\n\t\t\t\t\n\t\t\t\tif(input == 'Y'|| input == 'y') {\n\t\t\t\t\tSystem.out.println(\"Lab group is same as Lecture group\");\n\t\t\t\t\t// creation of course object, with tutorials and lab group\n\t\t\t\t\tacadCtrl.passCourseDetailsWithTutorial(courseCode, courseName, facultyName, courseVacancy, ProfName, tutGroups, true, tutVacancy);\n\t\t\t\n\t\t\t\t}\n\t\t\t\telse if(input == 'N'|| input == 'n') {\n\t\t\t\t\t// creation of course object, with tutorials only\n\t\t\t\t\tacadCtrl.passCourseDetailsWithTutorial(courseCode, courseName, facultyName, courseVacancy, ProfName, tutGroups, false, tutVacancy);\n\t\t\t\t}\n\t\t\t\telse System.out.println(\"Please Enter Y or N only\");\n\t\t\t}\n\t\t}else System.out.println(\"Please Enter Y or N only\");\n\t\t\n\t\t//done and print\n\t\t\n\t\tSystem.out.println(\"Course added to System!\");\n\t\tSystem.out.println(\"The current Lists of courses in \"+ facultyName + \" is: \");\n\t\tprintCourses();\n\t\tSystem.out.println(\"To add sub components into Course Work use function 6 \");\n\t\tSystem.out.println();\n\t}", "void aDayPasses(){\n\t\t\n\t\t/**\n\t\t * Modify wait time if still exists\n\t\t */\n\t\tif(!daysUntilStarts.equals(0)){\n\t\t\tdaysUntilStarts--;\n\t\t\tif((!hasInstructor() || getSize() == 0) && daysUntilStarts.equals(0)){\n\t\t\t\tif(hasInstructor())\n\t\t\t\t\tinstructor.unassignCourse();\n\t\t\t\tfor(Student student : enrolled){\n\t\t\t\t\tstudent.dropCourse();\n\t\t\t\t}\n\t\t\t\tsubject.unassign();\n\t\t\t\tinstructor = null;\n\t\t\t\tenrolled = new ArrayList<Student>();\n\t\t\t\tcancelled = true;\n\t\t\t} else if (daysUntilStarts.equals(0)) {\n\t\t\t\tsubject.unassign();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t * Modify run time if still exists\n\t\t */\n\t\tif(!daysToRun.equals(0)){\n\t\t\tdaysToRun--;\n\t\t}\n\t\t/**\n\t\t * If couse finished un-assigned people from it\n\t\t */\n\t\tif(daysToRun.equals(0) && !finished){\n\t\t\tfor(Student student : enrolled){\n\t\t\t\tstudent.graduate(subject);\n\n\t\t\t}\n\t\t\tinstructor.unassignCourse();\n\t\t\tinstructor = null;\n\t\t\tfinished = true;\n\t\t}\n\t}", "protected void checkChapter(final Parade parade) {\n\t\tfinal Chapter chapter;\n\t\tfinal Area areaChapter;\n\t\tArea areaParade;\n\n\t\tchapter = this.chapterService.findByPrincipal();\n\t\tareaChapter = chapter.getArea();\n\t\tareaParade = this.areaService.findAreaByParade(parade.getId());\n\n\t\tAssert.isTrue(areaChapter.equals(areaParade));\n\t}", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof Course)) {\n return false;\n }\n Course other = (Course) object;\n if ((this.courseId == null && other.courseId != null) || (this.courseId != null && !this.courseId.equals(other.courseId))) {\n return false;\n }\n return true;\n }", "public void setcourse(String course) {\n\t\tthis.course = course;\n\t}", "public boolean canFinish(int numCourses, int[][] prerequisites) {\n\t\tint[][] graph = new int[numCourses][numCourses];\n\t\t// represents courses we are taking in degree\n\t\tint[] inDegree = new int[numCourses];\n\t\t\n\n\t\t// for all the edges\n\t\tfor (int i = 0; i < prerequisites.length; i++) {\n\t\t\t// vertex 0\n\t\t\tint course = prerequisites[i][0];\n\t\t\t// vertex 1\n\t\t\tint prereq = prerequisites[i][1];\n\t\t\t\n\t\t\tif (graph[prereq][course] == 0) {\n\t\t\t\t// handle duplicate case\n\t\t\t\tinDegree[course]++;\n\t\t\t}\n\t\t\t// mark edge is visited\n\t\t\tgraph[prereq][course] = 1;\n\t\t}\n\t\t\n\t\t// keep total count of courses we tool till now\n\t\tint count = 0;\n\t\t\n\t\tQueue<Integer> queue = new LinkedList<>();\n\t\tfor (int i = 0; i < numCourses; i++) {\n\t\t\t// all courses which are not visited/covered yet \n\t\t\tif (inDegree[i] == 0) {\n\t\t\t\tqueue.offer(i);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// BFS\n\t\twhile (!queue.isEmpty()) {\n\t\t\t// first course from the queue\n\t\t\tint course = queue.poll();\n\t\t\t// increment count for taken courses\n\t\t\tcount++;\n\t\t\t\n\t\t\t// for all other courses\n\t\t\t// consider i as prereq\n\t\t\tfor (int i = 0; i < numCourses; i++) {\n\t\t\t\tif (graph[course][i] != 0) {\n\t\t\t\t\tif (--inDegree[i] == 0) {\n\t\t\t\t\t\tqueue.offer(i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn count == numCourses;\n\t}", "private boolean hardCode(int index, boolean isCourse)\n\t{\n\t\tboolean isValid = testValue;\n\n\t\tif(isCourse)\n\t\t{\n\t\t\tCourses course = parser.coursesVector.get(index);\n\t\t\t\n\t\t\t//for the CPSC 813/913 courses\t\n\t\t\tif((course.getCourseNumber().equals(\"813\") || course.getCourseNumber().equals(\"913\")) && course.getDepartment().equals(\"CPSC\"))\n\t\t\t{\n\t\t\t\tisValid = child.assign13(index, parser.labSlotsVector.get(course.getPartAssign().get(0))) && course.constr(child, index) && parser.labSlotsVector.get(course.getPartAssign().get(0)).constr(child, index, !isCourse);\t\t\t\t\n\t\t\t}\n\n\t\t\telse if (course.getPartAssign().size() > 0)\n\t\t\t{//do the partial assignment\n\t\t\t\tisValid = child.assign(index, parser.courseSlotsVector.get(course.getPartAssign().get(0)), isCourse) && course.constr(child, index) && parser.courseSlotsVector.get(course.getPartAssign().get(0)).constr(child, index, isCourse);\n\t\t\t}\n\n\t\t\t//System.out.println(course);\n\t\t} \n\t\telse //its a lab\n\t\t{\n\t\t\tLabs lab = parser.labsVector.get(index) ;\n\t\t\n\t\t\tif (lab.getPartAssign().size() > 0)\n\t\t\t{//do the partial assignment\n\t\t\t\tisValid = child.assign(index, parser.labSlotsVector.get(lab.getPartAssign().get(0)), isCourse) && lab.constr(child, index) && parser.labSlotsVector.get(lab.getPartAssign().get(0)).constr(child, index, isCourse);\n\t\t\t}\t\t\n\n\t\t\t//System.out.println(lab);\n\t\t}//end if-else (not a lecture)\t\t\n\t\t\n\t\treturn isValid;\n\t}", "public void setCourse(String course) {\n\t\tCourse = course;\n\t}", "@Test\n public void test1() {\n CourseAdd Course_Adder = new CourseAdd(MPCS_52011,Amanda,con);\n int updates = Course_Adder.getState().addStudent(Course_Adder,MPCS_52011,Amanda);\n assertEquals(1,updates); // Assert that an update was made\n List<Integer> StudentIDs = new ArrayList<Integer>();\n assertTrue(MPCS_52011.getStudents().contains(Amanda)); // Check if Amanda Present in course\n try{ // Check Database\n Statement stmt=con.createStatement();\n ResultSet rs=stmt.executeQuery(\"select StudentID from Course_Student where course_code = '\" + MPCS_52011.getcode() + \"';\");\n while(rs.next()){\n StudentIDs.add(rs.getInt(1)); // Add each student ID from database\n }\n }catch (Exception e){\n System.out.println(e);\n }\n assertTrue(StudentIDs.contains(Amanda.getID())); // Check if Amanda present in course\n }", "@Test\n public void test2() {\n MPCS_52011.setStudentCount(60); // Set the course as full for testing purposes.\n CourseAdd Course_Adder = new CourseAdd(MPCS_52011,Sophia,con);\n int updates = Course_Adder.getState().addStudent(Course_Adder,MPCS_52011,Sophia);\n assertEquals(1,updates); // Assert that an update was made\n assertTrue(MPCS_52011.getWaitingList().contains(Sophia)); // Check if Sophia present in waitlist\n List<Integer> StudentIDs = new ArrayList<Integer>();\n try{ // Check Database\n Statement stmt=con.createStatement();\n ResultSet rs=stmt.executeQuery(\"select StudentID from Waitlisted_Students where course_code = '\" + MPCS_52011.getcode() + \"';\");\n while(rs.next()){\n StudentIDs.add(rs.getInt(1)); // Add each student ID from database\n }\n }catch (Exception e){\n System.out.println(e);\n }\n assertTrue(StudentIDs.contains(Sophia.getID())); // Check is Sophia present in waitlist\n }", "boolean hasAccY();", "boolean contemProfessor(String cpf);", "public static boolean courseIDDuplicate(String arg_courseID) {\n\n\t\tboolean courseIDFound = false;\n\n\t\tfor (Course c : courseInfoArray) /*need to make course Array*/{\n\t\t\tString currentCourseID = c.getCourseID();\n\n\t\t\tSystem.out.println(\"Current Course ID \" + currentCourseID + \"& Arg Course ID \" + arg_courseID) ;\n\t\t\tif (arg_courseID.toUpperCase().trim().equals(currentCourseID.toUpperCase().trim())) {\n\t\t\t\tcourseIDFound = true;\n\t\t\t\tbreak;\n\n\t\t\t} else {\n\t\t\t\tcourseIDFound = false;\n\t\t\t}\n\n\t\t}\n\t\treturn courseIDFound;\n\t}", "private void dropCourse()\r\n {\r\n\t\ttry\r\n\t\t{\r\n\t\t\tString courseFaculty = this.getClientIn().readLine();\r\n\t\t\tString courseNumberStr = this.getClientIn().readLine();\r\n\t\t\tint courseNumber = Integer.parseInt(courseNumberStr);\r\n\t \tfor(CourseRegistration courseReg : this.getDBManager().getStudent(this.studentId).getStudentRegList())\r\n\t \t{\r\n\t \t\tCourse courseForReg = courseReg.getTheOffering().getTheCourse();\r\n\t \t\tif((courseForReg.getCourseNum() == courseNumber) && (courseForReg.getCourseName().compareTo(courseFaculty) == 0))\r\n\t \t\t{\r\n\t \t\t\tcourseReg.cancelRegistration();\r\n\t \t\t\tthis.getClientOut().printf(\"SUCCESS\\nDropped course successfully.\\n\");\r\n\t \t\t\tthis.getClientOut().flush();\r\n\t \t\t\treturn;\r\n\t \t\t}\r\n\t \t}\r\n\t \tthis.getClientOut().printf(\"ERROR\\nCourse entered is not in student's list. \\n\");\r\n\t \tthis.getClientOut().flush();\r\n\t\t}\r\n\t\tcatch(NumberFormatException e)\r\n\t\t{\r\n\t\t\tthis.getClientOut().printf(\"ERROR\\nPlease check the Course Number. It must be an integer.\\n\");\r\n\t\t\tthis.getClientOut().flush();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tcatch(IOException e)\r\n\t\t{\r\n\t\t\tthis.getClientOut().printf(\"ERROR\\nIOException while reading user input.\\n\");\r\n\t\t\tthis.getClientOut().flush();\r\n\t\t\treturn;\r\n\t\t}\r\n }", "public void courseOperation() {\n\t\tthePerson.createCourseMenu();\n\t}", "public void setCourse(String course) {\n\t\tthis.course = course;\n\t}", "@Test\n\tpublic void testCourseSetsLoaded() throws Exception {\n\t\ttry {\n\t\t\tcmService.getCourseSet(\"ucb\");\n\t\t} catch (IdNotFoundException ide) {\n\t\t\tAssert.fail();\n\t\t}\n\t}", "boolean hasTutorial();", "@Override\r\n\tpublic int ifPrerequisitesExist(String courseId) {\r\n\t\t// TODO Auto-generated method stub\r\n\t\tString sql = \"SELECT count(*) FROM \\\"Registration DB\\\".\\\"Prerequisites\\\" where \\\"courseId\\\"='\" + courseId + \"'\";\r\n\t\treturn jdbcTemplate.queryForObject(sql, Integer.class);\r\n\r\n\t}", "boolean canCrit();", "public void printActiveCourses() \n {\n for (String c: courses.keySet()) \n {\n if (courses.get(c).getActive()) \n {\n System.out.println(courses.get(c)); \n }\n }\n }", "private boolean checkFifthYear(Schedule sched)\n\t{\n\t\tArrayList<Course> fifthYearCourses = new ArrayList<Course>(); //Only 500CPSC courses\n\t\t//A list we build with time slots that 5th year courses were assigned \n\t\tArrayList<TimeSlot> fifthYearSlots = new ArrayList<TimeSlot>(); \n\t\tCourse tempCourse;\n\t\tint tempCourseNumber;\n\t\tTimeSlot tempSlot;\n\t\t\n\t\t//Traverse through all the courses\n\t\tfor(int i = 0; i<sched.getCourses().size();i++)\n\t\t{\n\t\t\ttempCourse = sched.getCourses().get(i);\n\t\t\ttempCourseNumber = tempCourse.getNumber();\n\t\t\t\n\t\t\t//If its course number is between 500 and 600 and it's in the cpsc department\n\t\t\t// append it to the list of fifth year courses\n\t\t\tif(\n\t\t\t\t\t(tempCourseNumber >= 500) && \n\t\t\t\t\t(tempCourseNumber < 600))\n\t\t\t{\n\t\t\t\tfifthYearCourses.add(tempCourse);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//At this point, fifthYearCourses contains all the 500 level CPSC class\n\t\t//THis loop checks if the time slot for the current 500 level course has \n\t\t//already been added to our list. If it is, we know they are not all at different times.\n\t\t//\n\t\tfor(int i = 0; i<fifthYearCourses.size();i++)\n\t\t{\n\t\t\ttempSlot = fifthYearCourses.get(i).getSlot();\n\t\t\t\n\t\t\tif(tempSlot != null)\n\t\t\t{\n\t\t\t\n\t\t\t\tif(fifthYearSlots.contains(tempSlot))\n\t\t\t\t\treturn false;\n\t\t\t\telse\n\t\t\t\t\tfifthYearSlots.add(tempSlot);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "public double evalSecDiff(Schedule sched) {\n\t\t\n\t\tint failCount = 0;\n\t\tArrayList<Course> sectionsOfCourse = new ArrayList<Course>(); //A list of all the sections for a class\n\t\tArrayList<Course> alreadyDone = new ArrayList<Course>(); //List of courses already looked\n\t\tCourse workingCourse, tempCourse;\n\t\tTimeSlot workingTimeSlot;\n\t\t\n\t\tfor(int i = 0;i<sched.getCourses().size();i++)\n\t\t{\n\t\t\tsectionsOfCourse = new ArrayList<Course>();\n\t\t\tworkingCourse = sched.getCourses().get(i);\n\t\t\t\n\t\t\t//If we haven't already looked at this course\n\t\t\tif((!alreadyDone.contains(workingCourse)) && workingCourse.getDepartment().equals(\"CPSC\"))\n\t\t\t{\n\t\t\t\t\n\t\t\t\tsectionsOfCourse.add(workingCourse);\n\t\t\t\talreadyDone.add(workingCourse);\n\t\t\t\t\n\t\t\t\t//Traverse through the course list and find all the sections\n\t\t\t\t//of the selected working course\n\t\t\t\tfor(int j = 0;j<sched.getCourses().size();j++)\n\t\t\t\t{\n\t\t\t\t\ttempCourse = sched.getCourses().get(j);\n\t\t\t\t\t\n\t\t\t\t\t//If they are the same course (with different sections)\n\t\t\t\t\tif(tempCourse.getDepartment().equals(workingCourse.getDepartment()) &&\n\t\t\t\t\t\t\ttempCourse.getNumber() == workingCourse.getNumber() &&\n\t\t\t\t\t\t\ttempCourse.getSection() != workingCourse.getSection())\n\t\t\t\t\t{\n\t\t\t\t\t\tsectionsOfCourse.add(tempCourse);\n\t\t\t\t\t\talreadyDone.add(tempCourse);\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\tif(sectionsOfCourse.size() >1)\n\t\t\t\t{\n\t\t\t\t\t//System.out.println(sectionsOfCourse.size());\n\t\t\t\t\t//At this point, sections of course is all filled up with the sections of one course\n\t\t\t\t\t//Now we have to check that they all have different time slots\n\t\t\t\t\twhile(sectionsOfCourse.size() > 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tworkingTimeSlot = sectionsOfCourse.get(0).getSlot();\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(workingTimeSlot != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(int j = 1;j<sectionsOfCourse.size();j++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(workingTimeSlot.getDay().equals(sectionsOfCourse.get(j).getSlot().getDay()) &&\n\t\t\t\t\t\t\t\t\t\tworkingTimeSlot.getStartTime() == sectionsOfCourse.get(j).getSlot().getStartTime())\n\t\t\t\t\t\t\t\t\tfailCount++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsectionsOfCourse.remove(0);\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\n\t\treturn failCount * this.get_penSection();\n\t}", "public long addOrUpdateCourse(Course course) {\n\t\tSQLiteDatabase db = this.getWritableDatabase();\n\t\tContentValues values = new ContentValues();\n\t\tvalues.put(COURSE_C_VERSIONID, course.getVersionId());\n\t\tvalues.put(COURSE_C_TITLE, course.getTitleJSONString());\n\t\tvalues.put(COURSE_C_LOCATION, course.getLocation());\n\t\tvalues.put(COURSE_C_SHORTNAME, course.getShortname());\n\t\tvalues.put(COURSE_C_LANGS, course.getLangsJSONString());\n\t\tvalues.put(COURSE_C_IMAGE, course.getImageFile());\n\t\tvalues.put(COURSE_C_GROUP, course.getCourseGroup());\n\t\tvalues.put(COURSE_C_DATE, getDate());\n\n\t\tif (!this.isInstalled(course.getShortname())) {\n\t\t\tLog.v(TAG, \"Record added\");\n\t\t\treturn db.insertOrThrow(COURSE_TABLE, null, values);\n\t\t} else if(this.toUpdate(course.getShortname(), course.getVersionId())){\n\t\t\tlong toUpdate = this.getCourseID(course.getShortname());\n\t\t\tif (toUpdate != 0) {\n\t\t\t\tdb.update(COURSE_TABLE, values, COURSE_C_ID + \"=\" + toUpdate, null);\n\t\t\t\t// remove all the old activities\n\t\t\t\tString s = ACTIVITY_C_COURSEID + \"=?\";\n\t\t\t\tString[] args = new String[] { String.valueOf(toUpdate) };\n\t\t\t\tdb.delete(ACTIVITY_TABLE, s, args);\n\t\t\t\treturn toUpdate;\n\t\t\t}\n\t\t} \n\t\t\n\t\treturn -1;\n\t\t\n\t}", "@Test(priority = 3)\n public void checkCourseProgress() {\n \twait.until(ExpectedConditions.titleContains(\"Email Marketing Strategies\"));\n \t\n \t//Assert Course progress\n \tString courseProgress = driver.findElement(By.xpath(\"//div[contains(@class, 'ld-progress-percentage')]\")).getText();\n \tAssert.assertEquals(courseProgress, \"100% COMPLETE\");\n }", "public static SchoolCourse schoolCourseSelection() {\n Scanner input = new Scanner(System.in);\n printListOfSchoolCourses();\n int choice = validateInputArrayList(input.nextInt(), listOfSchoolCourses);\n return listOfSchoolCourses.get(choice - 1);\n\n }", "public String getCourse() {\n\t\treturn Course;\n\t}", "@Override\r\n\tpublic int addCourse(Courses course) {\n\t\tString sql=\"insert into courseshv values(?,?)\";\r\n\t\tPreparedStatement pstmt=null;\r\n\t\tint rowAdded=0;\r\n\t\ttry {\r\n\t\t\tpstmt=conn.prepareStatement(sql);\r\n\t\t\tpstmt.setLong(1, course.getCourseid());\r\n\t\t\tpstmt.setString(2, course.getCourseName());\r\n\t\t\trowAdded=pstmt.executeUpdate();\r\n\t\t} catch (Exception e) {\r\n\t\t\t// TODO: handle exception\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn rowAdded;\r\n\t}", "@Given(\"^The case \\\"(.*?)\\\" exists in \\\"(.*?)\\\"$\")\n public void the_case_exists(final String courtCase, final String court) throws Throwable {\n }" ]
[ "0.7260903", "0.7053023", "0.6878614", "0.6786076", "0.6618719", "0.6558518", "0.651185", "0.6433109", "0.6376631", "0.63494253", "0.63328546", "0.63290536", "0.62980485", "0.62974876", "0.6288006", "0.62830627", "0.6259484", "0.624456", "0.6217423", "0.61850476", "0.61810267", "0.61802113", "0.61739767", "0.61490965", "0.6146728", "0.6139251", "0.6131117", "0.61054474", "0.60976434", "0.6052193", "0.60410815", "0.59924823", "0.5989855", "0.59810054", "0.5975439", "0.59747344", "0.5953922", "0.59475845", "0.5931052", "0.5930953", "0.5908658", "0.58890647", "0.58826756", "0.5882455", "0.5869443", "0.58501685", "0.58415955", "0.58373535", "0.5836343", "0.5818107", "0.58120406", "0.58077884", "0.5797791", "0.5793733", "0.57841474", "0.5779283", "0.5757628", "0.57483524", "0.574626", "0.5740262", "0.5739509", "0.57353806", "0.5724839", "0.5712169", "0.5711728", "0.57098484", "0.57027644", "0.57017815", "0.5680585", "0.5663188", "0.5651475", "0.56450397", "0.5643881", "0.56268317", "0.5617293", "0.5615479", "0.56111336", "0.5588898", "0.55789006", "0.5578131", "0.5576094", "0.5553807", "0.55533504", "0.5536514", "0.55302924", "0.5529708", "0.5526231", "0.55240196", "0.55160165", "0.5495512", "0.5491276", "0.54858214", "0.5482567", "0.5472692", "0.54697204", "0.5461596", "0.54590434", "0.54529554", "0.54505754", "0.5450441" ]
0.63893306
8
Check if notification exits
public boolean checkNofitication(String titulo, String msg) { String[] campos = new String[] { "titulo" }; String[] args = new String[] { titulo }; String[] campos2 = new String[] { "mensaje" }; String[] args2 = new String[] { msg }; Cursor c = db.query("Notificaciones", campos, "titulo=?", args, null, null, null); if (c.getCount() <= 0) { return false; } else { Cursor c2 = db.query("Notificaciones", campos2, "mensaje=?", args2, null, null, null); if (c2.getCount() <= 0) { return false; } else return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean hasNotifications()\n {\n return !this.notifications.isEmpty();\n }", "public Boolean notificationPresent() {\n\t\tBoolean isPresent = false;\n\t\twait.resetImplicitTimeout(2);\n\t\ttry {\n\t\t\tif (elements(\"li_notificationCount\").size() == 1) {\n\t\t\t\tisPresent = true;\n\t\t\t}\n\t\t} catch (NoSuchElementException e) {\n\t\t\tisPresent = false;\n\t\t}\n\t\twait.resetImplicitTimeout(wait.timeout);\n\t\treturn isPresent;\n\t}", "public boolean hasPushEvent();", "public void ifNotificationOnChecked() {\n\t\tif (notificationOnChecked && bNotification) {\n\t\t\tnotifyMain(\"Autostop:\\n\" + upTime + \" s\", \"Recording...\");\n\t\t} else {\n\t\t\tif (notificationManager != null) {\n\t\t\t\tnotificationManager.cancelAll();\n\t\t\t}\n\t\t}\n\t}", "boolean isMonitoringTerminated();", "private boolean isNotificationMessage(Message message)\n {\n return message instanceof PoolFileFlushedMessage\n || message instanceof PoolRemoveFilesMessage\n || message instanceof PnfsDeleteEntryNotificationMessage;\n }", "boolean hasReceived();", "if(false==adhocTicket.hasExited()){\n System.out.println(\"hasExit() is passed\");\n }", "boolean isNotificationsEnabled();", "boolean isAlreadyTriggered();", "boolean hasUnReceived();", "public void showTestDoneNotification() {\n Intent intent = new Intent(this, MainActivity.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);\n Notification notification = new NotificationCompat.Builder(getApplicationContext())\n .setContentIntent(PendingIntent.getActivity(this, 0, intent, 0))\n .setSmallIcon(R.drawable.ic_launcher)\n .setContentText(getText(R.string.local_service_test_done))\n .setContentTitle(getText(R.string.local_service_notification)).build();\n notificationManager.notify(NOTIFICATION, notification);\n status = new Status(getString(R.string.ready), false);\n sendStatusMessage();\n }", "private void checkNewNotification() {\n toolbar.setTitle(R.string.notification);\n NotificationFragment notificationFragment = new NotificationFragment();\n displaySelectedFragment(notificationFragment);\n }", "public void verifyNoPendingNotification() {\n\t\twait.waitForLoaderToDisappear();\n\t\tAssert.assertFalse(notificationPresent(), \"Assertion Failed: There are pending notifications on the side bar\");\n\t\tlogMessage(\"Assertion Passed: There are no pending notifications on the side bar\");\n\t}", "public void waitForNotificationOrFail() {\n new PollingCheck(5000) {\n @Override\n protected boolean check() {\n return mContentChanged;\n }\n }.run();\n mHT.quit();\n }", "boolean hasMessage();", "boolean hasMessage();", "boolean hasMessage();", "boolean hasMessage();", "boolean hasMessage();", "boolean hasMessage();", "boolean hasMessage();", "boolean hasMessage();", "boolean hasStatusChanged();", "private void showNotification() {\n }", "private void showNotification() {\n\n }", "private void checkPendingCMMNotif()\n throws AlertException {\n\n NodeChange curNotif = null;\n while (true) {\n synchronized(cmmNotifications) {\n try {\n curNotif = (NodeChange) cmmNotifications.removeFirst();\n } catch (NoSuchElementException no) {\n return;\n }\n } \n processCMMNotif(curNotif);\n }\n }", "void notificationReceived(Notification notification);", "void onHisNotify();", "protected boolean isFinished() {\n return !isNotifierRunning();\n }", "boolean hasMsg();", "public boolean isNotificationOn(){\n return mSharedPreferences.getBoolean(SharedPrefContract.PREF_NOTIFICATION_TURNED_ON, true);\n }", "boolean isSetStatus();", "boolean hasEvent();", "@When(\"^I check whether to show a notification for rego$\")\n public void i_check_whether_to_show_a_notification_for_rego() throws Throwable {\n result = car.showRegistrationNotification();\n }", "boolean hasExitStatus();", "boolean hasBadge();", "protected void notificationOnExpiration() {\n }", "protected void checkNotifications() {\n List<PushNotification> polled;\n boolean onlyOne;\n\n // Leave this mutually exclusive section as fast as possible...\n lock.lock();\n try {\n if (stopped) {\n LOGGER.debug(\"Push notification service stopped. Aborting polling of queue...\");\n return;\n }\n\n PushNotification first = submittedNotifcations.poll();\n if (null == first) {\n // Queue has no notification with an expired delay\n LOGGER.debug(\"Queue has no notification with an expired delay and holds {} buffered notifications\", I(submittedNotifcations.size()));\n return;\n }\n\n // Check for more\n PushNotification notification = submittedNotifcations.poll();\n if (notification != null) {\n polled = new LinkedList<>();\n polled.add(first);\n LOGGER.debug(\"Polled notification \\\"{}\\\" for user {} in context {} from queue\", first.getTopic(), I(first.getUserId()), I(first.getContextId()));\n do {\n polled.add(notification);\n LOGGER.debug(\"Polled notification \\\"{}\\\" for user {} in context {} from queue\", notification.getTopic(), I(notification.getUserId()), I(notification.getContextId()));\n notification = submittedNotifcations.poll();\n } while (null != notification);\n onlyOne = false;\n } else {\n polled = Collections.singletonList(first);\n LOGGER.debug(\"Polled notification \\\"{}\\\" for user {} in context {} from queue\", first.getTopic(), I(first.getUserId()), I(first.getContextId()));\n onlyOne = true;\n }\n\n if (submittedNotifcations.isEmpty()) {\n cancelTimerTask();\n LOGGER.debug(\"Dropped polling timer task since queue is currently empty\");\n }\n } finally {\n lock.unlock();\n }\n\n if (onlyOne) {\n // There was only a single one available\n PushNotification first = polled.get(0);\n NotificationsHandler task = new NotificationsHandler(first);\n if (tryExecuteTask(task, first.getUserId(), first.getContextId())) {\n LOGGER.debug(\"Submitted delivery of polled notification with topic \\\"{}\\\" to user {} in context {}\", first.getTopic(), I(first.getUserId()), I(first.getContextId()));\n } else {\n // Processor rejected task execution. Perform with current thread.\n task.run();\n }\n } else {\n // Handle them all\n Map<ContextAndTopicKey, Map<Integer, List<PushNotification>>> polledNotificationsPerContextAndTopic = new LinkedHashMap<>();\n for (PushNotification notification : polled) {\n put(notification, polledNotificationsPerContextAndTopic);\n }\n for (Map.Entry<ContextAndTopicKey, Map<Integer, List<PushNotification>>> entry : polledNotificationsPerContextAndTopic.entrySet()) {\n ContextAndTopicKey key = entry.getKey();\n Map<Integer, List<PushNotification>> notificationsPerUser = entry.getValue();\n NotificationsHandler task = new NotificationsHandler(key.contextId, key.topic, notificationsPerUser);\n if (tryExecuteTask(task, -1, key.contextId)) {\n if (LOGGER.isDebugEnabled()) {\n int[] userIds = Coll2i(notificationsPerUser.keySet());\n Object sUserIds = userIds.length <= 10 ? toStringObjectFor(userIds) : null;\n userIds = null;\n if (sUserIds == null) {\n LOGGER.debug(\"Submitted delivery of polled notifications with topic \\\"{}\\\" to users in context {}\", key.topic, I(key.contextId));\n } else {\n LOGGER.debug(\"Submitted delivery of polled notifications with topic \\\"{}\\\" to users {} in context {}\", key.topic, sUserIds, I(key.contextId));\n }\n }\n } else {\n // Processor rejected task execution. Perform with current thread.\n task.run();\n }\n }\n }\n }", "@Override\n public int checkNotificationPermission() throws android.os.RemoteException {\n return 0;\n }", "public int checkNotificationPermission() throws android.os.RemoteException;", "public interface NotificationCleanupListener {\n void onStarted();\n void onStopped();\n //void onDismiss();\n}", "boolean hasHeartBeatMsg();", "public void checkIfWeShouldSendANotification() {\n \t// Determine which zone we are in\n \t//\n \t\n String zoneWeAreIn=null;\n \n double spartyLat = 42.731138;\n double spartyLong = -84.487508;\n \n double beaumontLat = 42.732829;\n double beaumontLong = -84.482467;\n \n double bresLat = 42.7284;\n double bresLong = -84.492033;\n\n \tfloat[] spartyDist = new float[1];\n \tLocation.distanceBetween(latitude,longitude, spartyLat, spartyLong, spartyDist);\n\n \tfloat[] beaumontDist = new float[1];\n \tLocation.distanceBetween(latitude,longitude, beaumontLat, beaumontLong, beaumontDist);\n \t\n \tfloat[] bresDist = new float[1];\n \tLocation.distanceBetween(latitude,longitude, bresLat, bresLong, bresDist);\n \t\n \tif(spartyDist[0]<20) zoneWeAreIn = \"Sparty\";\n \telse if (beaumontDist[0]<20) zoneWeAreIn = \"Beaumont Tower\";\n \telse if (bresDist[0]<20) zoneWeAreIn = \"the Breslin Center\";\n \n \t\n \t\n // Create an artificial back stack\n // This is so when we open the notification, back takes us to MainActivity\n TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);\n \n \n if(zoneWeAreIn!=null)\n {\n\t Intent newIntent = new Intent(); \n\t if(zoneWeAreIn==\"Sparty\")\n\t {\n\t \t // Set parent in artificial back stack\n\t\t stackBuilder.addParentStack(SpartyInfoActivity.class);\n\t\t \n\t\t // Make it start up SpartyInfoActivity\n\t \t newIntent.setClassName(this, \"edu.msu.cse.belmont.msuproximity.SpartyInfoActivity\"); \t\n\t }\n\t else if(zoneWeAreIn==\"Beaumont Tower\")\n\t {\n\t\t stackBuilder.addParentStack(BeaumontInfoActivity.class);\n\t \t newIntent.setClassName(this, \"edu.msu.cse.belmont.msuproximity.BeaumontInfoActivity\");\n\t }\n\t else if(zoneWeAreIn==\"the Breslin Center\")\n\t {\n\t\t stackBuilder.addParentStack(BreslinInfoActivity.class);\n\t \t newIntent.setClassName(this, \"edu.msu.cse.belmont.msuproximity.BreslinInfoActivity\");\n\t }\n\t else \n\t {\n\t \t // Default, if zoneWeAreIn is not one of the above\n\t\t Toast.makeText(this, \"Wrong zone string name\", Toast.LENGTH_LONG).show();\n\t\t newIntent.setClassName(this, \"edu.msu.cse.belmont.msuproximity.MainActivity\");\n\t }\n\t newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n\t \n\t \n\t // Finish setting up artifical back stack\n\t stackBuilder.addNextIntent(newIntent);\n\t \n\t // Create a pending intent so it's only launched if clicked\n\t PendingIntent pendingIntent =\n\t stackBuilder.getPendingIntent(\n\t 0,\n\t PendingIntent.FLAG_UPDATE_CURRENT\n\t );\n\t \t\n\t // Create the android notification\n\t NotificationCompat.Builder builder = new NotificationCompat.Builder(this);\n\t builder.setSmallIcon(R.drawable.ic_launcher);\n\t builder.setContentTitle(this.getString(R.string.app_name));\n\t builder.setContentText(this.getString(R.string.youre_at) + \" \"+zoneWeAreIn);\n\t builder.setAutoCancel(true);\n\t builder.setContentIntent(pendingIntent);\n\t NotificationManager mNotificationManager =\n\t (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);\n\t \n\t // Launch the android notification\n\t mNotificationManager.notify(0, builder.build());\n }\n else\n {\n \tLog.i(\"not in any zone. \"+spartyDist[0]+\" \"+beaumontDist[0]+\" \"+bresDist[0], \"Not in any zone right now.\");\n\t //Toast.makeText(this, \"Alarm went off but we are not in a zone\", Toast.LENGTH_LONG).show();\n }\n }", "@When(\"^I check whether to show a notification for license$\")\n public void i_check_whether_to_show_a_notification_for_license() throws Throwable {\n result = driverUser.showExpiryNotification();\n }", "@Test\n public void testHasToBeShownMaxNumberReached() {\n NotificationConfiguration notificationConfiguration = new NotificationConfiguration();\n notificationConfiguration.setExecutionPolicy(ExecutionPolicy.ALWAYS);\n notificationConfiguration.setNumberOfTotalViews(5);\n AlertDialogNotification notification = new AlertDialogNotification(notificationConfiguration);\n PersistentNotification persistentNotification = new PersistentNotification(notification);\n persistentNotification.setShownCounter(5);\n\n boolean hasToBeShown = persistentNotification.hasToBeShown(1);\n assertFalse(hasToBeShown);\n }", "private void sendNotification() {\n }", "boolean isShutdown();", "@Override\n public void notificationReceived(OSNotification notification) {\n Log.e(\"oneSignal\",\"new Notification\");\n\n }", "public MonitorResult checkNotifications() {\r\n MonitorResult result = new MonitorResult();\r\n result.setComponent(\"NOTIFICATIONS\");\r\n\r\n logger.info(\"Testing NOTIFICATIONS...\");\r\n\r\n double duration = 0;\r\n boolean success = false;\r\n Date start = new Date();\r\n long startTime = start.getTime();\r\n\r\n try {\r\n\r\n long currentDateMs = (new Date()).getTime();\r\n Date comparisonDate = new Date(currentDateMs - getMonitorConfiguration().getNotificationSendInterval());\r\n\r\n Long unsentNotificationCount = getNotificationDAO().getUnsentNotifications(comparisonDate);\r\n\r\n if (unsentNotificationCount > 0) {\r\n throw new AditInternalException(\"Number of notifications not sent in time: \" + unsentNotificationCount);\r\n } else {\r\n logger.info(\"No waiting notifications older than \" + comparisonDate + \" were found.\");\r\n \tsuccess = true;\r\n }\r\n\r\n Date end = new Date();\r\n long endTime = end.getTime();\r\n duration = (endTime - startTime) / 1000.0;\r\n result.setDuration(duration);\r\n result.setSuccess(success);\r\n\r\n } catch (Exception e) {\r\n logger.error(\"Error while testing NOTIFICATIONS: \", e);\r\n result.setSuccess(false);\r\n List<String> exceptions = new ArrayList<String>();\r\n exceptions.add(e.getMessage());\r\n result.setExceptions(exceptions);\r\n }\r\n\r\n return result;\r\n }", "boolean hasSignal();", "public boolean isLingering();", "@Test\n public void testHasToBeShownFirstTime() {\n PersistentNotification persistentNotification = new PersistentNotification(new AlertDialogNotification());\n\n boolean hasToBeShown = persistentNotification.hasToBeShown(1);\n assertTrue(hasToBeShown);\n }", "boolean hasUserMessage();", "@Override\r\n\tpublic void onServerDown() {\n\t\tString res=name + \" recived a notification\";\r\n\t\tLOGGER.info(res);\r\n\t\t\r\n\t}", "boolean hasRemsg();", "boolean hasChangeStatus();", "@Override\n\tpublic boolean isConnectionNotificationReceived(User me, User notifier) {\n\t\tList<Notification> notifications = notificationRepository.findNotificationReceivedFromNotifier(me.getId(),\n\t\t\t\tnotifier.getId());\n\t\tif (!notifications.isEmpty())\n\t\t\treturn true;\n\t\treturn false;\n\t}", "public boolean hasNewMessage() throws RemoteException {\r\n return !messages.isEmpty();\r\n }", "boolean hasSendPushNotifications();", "private void showEndOfTripNotification() {\n NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)\n .setSmallIcon(R.mipmap.ic_launcher)\n .setContentTitle(\"End of trip\")\n .setContentText(\"Notification text has been sent to \" + myFriendObject.getName());\n int mNotificationId = 001;\n NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\n manager.notify(mNotificationId, mBuilder.build());\n }", "@Override\n public boolean evaluate(CacheEntryEvent<? extends BinaryObject, ? extends BinaryObject> e) {\n if (!e.getOldValue().<Integer>field(\"population\").equals(\n e.getValue().<Integer>field(\"population\")))\n return true;\n\n // Don't send a notification in all other cases\n return false;\n }", "boolean onNotifyMessageChannelReady(@Nullable Bundle extras);", "public boolean isExit(){\n return true;\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 abstract boolean isDelivered();", "protected boolean notificationEnabled(SessionState state)\n\t{\n\t\treturn true;\n\n\t}", "private boolean\n shouldPostNotification(PdpConnection.PdpFailCause cause)\n {\n boolean shouldPost = true;\n // TODO CHECK\n // if (dataLink != null) {\n // shouldPost = dataLink.getLastLinkExitCode() != DataLink.EXIT_OPEN_FAILED;\n //}\n return (shouldPost && cause != PdpConnection.PdpFailCause.UNKNOWN);\n }", "boolean hasStateChange();", "@Test\n public void testHasToBeShownMaxNumberNotReached() {\n NotificationConfiguration notificationConfiguration = new NotificationConfiguration();\n notificationConfiguration.setExecutionPolicy(ExecutionPolicy.ALWAYS);\n notificationConfiguration.setNumberOfTotalViews(5);\n\n AlertDialogNotification notification = new AlertDialogNotification(notificationConfiguration);\n PersistentNotification persistentNotification = new PersistentNotification(notification);\n persistentNotification.setShownCounter(3);\n\n boolean hasToBeShown = persistentNotification.hasToBeShown(1);\n assertTrue(hasToBeShown);\n }", "public void checkEvents()\n\t{\n\t\t((MBoxStandalone)events).processMessages();\n\t}", "public void checkNotificationBroadcastSupport() {\n int i = 0;\n this.mShouldBroadcastNotifications = false;\n WallpaperManager wallpaperManager = (WallpaperManager) this.mContext.getSystemService(WallpaperManager.class);\n if (wallpaperManager != null) {\n WallpaperInfo wallpaperInfo = wallpaperManager.getWallpaperInfo();\n if (wallpaperInfo != null) {\n ComponentName component = wallpaperInfo.getComponent();\n String packageName = component.getPackageName();\n if (NOTIFYABLE_PACKAGES.contains(packageName)) {\n this.mWallpaperPackage = packageName;\n String className = component.getClassName();\n String[] strArr = NOTIFYABLE_WALLPAPERS;\n int length = strArr.length;\n while (true) {\n if (i >= length) {\n break;\n } else if (className.startsWith(strArr[i])) {\n this.mShouldBroadcastNotifications = true;\n break;\n } else {\n i++;\n }\n }\n }\n }\n }\n }", "public void didReceivedNotification(int r7, int r8, java.lang.Object... r9) {\n /*\n r6 = this;\n int r0 = org.telegram.messenger.NotificationCenter.appDidLogout\n if (r7 != r0) goto L_0x0010\n int r7 = r6.lastResumedAccount\n if (r8 != r7) goto L_0x01c5\n r6.onFinish()\n r6.finish()\n goto L_0x01c5\n L_0x0010:\n int r0 = org.telegram.messenger.NotificationCenter.pushMessagesUpdated\n r1 = 3\n r2 = 1\n r3 = 0\n if (r7 != r0) goto L_0x0089\n boolean r7 = r6.isReply\n if (r7 != 0) goto L_0x01c5\n java.util.ArrayList<org.telegram.messenger.MessageObject> r7 = r6.popupMessages\n r7.clear()\n r7 = 0\n L_0x0021:\n if (r7 >= r1) goto L_0x003b\n org.telegram.messenger.UserConfig r8 = org.telegram.messenger.UserConfig.getInstance(r7)\n boolean r8 = r8.isClientActivated()\n if (r8 == 0) goto L_0x0038\n java.util.ArrayList<org.telegram.messenger.MessageObject> r8 = r6.popupMessages\n org.telegram.messenger.NotificationsController r9 = org.telegram.messenger.NotificationsController.getInstance(r7)\n java.util.ArrayList<org.telegram.messenger.MessageObject> r9 = r9.popupMessages\n r8.addAll(r9)\n L_0x0038:\n int r7 = r7 + 1\n goto L_0x0021\n L_0x003b:\n r6.getNewMessage()\n java.util.ArrayList<org.telegram.messenger.MessageObject> r7 = r6.popupMessages\n boolean r7 = r7.isEmpty()\n if (r7 != 0) goto L_0x01c5\n r7 = 0\n L_0x0047:\n if (r7 >= r1) goto L_0x01c5\n int r8 = r6.currentMessageNum\n int r8 = r8 - r2\n int r8 = r8 + r7\n java.util.ArrayList<org.telegram.messenger.MessageObject> r9 = r6.popupMessages\n int r9 = r9.size()\n if (r9 != r2) goto L_0x0061\n if (r8 < 0) goto L_0x005f\n java.util.ArrayList<org.telegram.messenger.MessageObject> r9 = r6.popupMessages\n int r9 = r9.size()\n if (r8 < r9) goto L_0x0061\n L_0x005f:\n r8 = 0\n goto L_0x007d\n L_0x0061:\n r9 = -1\n if (r8 != r9) goto L_0x006c\n java.util.ArrayList<org.telegram.messenger.MessageObject> r8 = r6.popupMessages\n int r8 = r8.size()\n int r8 = r8 - r2\n goto L_0x0075\n L_0x006c:\n java.util.ArrayList<org.telegram.messenger.MessageObject> r9 = r6.popupMessages\n int r9 = r9.size()\n if (r8 != r9) goto L_0x0075\n r8 = 0\n L_0x0075:\n java.util.ArrayList<org.telegram.messenger.MessageObject> r9 = r6.popupMessages\n java.lang.Object r8 = r9.get(r8)\n org.telegram.messenger.MessageObject r8 = (org.telegram.messenger.MessageObject) r8\n L_0x007d:\n org.telegram.messenger.MessageObject[] r9 = r6.setMessageObjects\n r9 = r9[r7]\n if (r9 == r8) goto L_0x0086\n r6.updateInterfaceForCurrentMessage(r3)\n L_0x0086:\n int r7 = r7 + 1\n goto L_0x0047\n L_0x0089:\n int r0 = org.telegram.messenger.NotificationCenter.updateInterfaces\n if (r7 != r0) goto L_0x00f1\n org.telegram.messenger.MessageObject r7 = r6.currentMessageObject\n if (r7 == 0) goto L_0x00f0\n int r7 = r6.lastResumedAccount\n if (r8 == r7) goto L_0x0096\n goto L_0x00f0\n L_0x0096:\n r7 = r9[r3]\n java.lang.Integer r7 = (java.lang.Integer) r7\n int r7 = r7.intValue()\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_NAME\n r8 = r8 & r7\n if (r8 != 0) goto L_0x00b2\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_STATUS\n r8 = r8 & r7\n if (r8 != 0) goto L_0x00b2\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_CHAT_NAME\n r8 = r8 & r7\n if (r8 != 0) goto L_0x00b2\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_CHAT_MEMBERS\n r8 = r8 & r7\n if (r8 == 0) goto L_0x00b5\n L_0x00b2:\n r6.updateSubtitle()\n L_0x00b5:\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_AVATAR\n r8 = r8 & r7\n if (r8 != 0) goto L_0x00bf\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_CHAT_AVATAR\n r8 = r8 & r7\n if (r8 == 0) goto L_0x00c2\n L_0x00bf:\n r6.checkAndUpdateAvatar()\n L_0x00c2:\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_USER_PRINT\n r7 = r7 & r8\n if (r7 == 0) goto L_0x01c5\n org.telegram.messenger.MessageObject r7 = r6.currentMessageObject\n int r7 = r7.currentAccount\n org.telegram.messenger.MessagesController r7 = org.telegram.messenger.MessagesController.getInstance(r7)\n org.telegram.messenger.MessageObject r8 = r6.currentMessageObject\n long r8 = r8.getDialogId()\n java.lang.CharSequence r7 = r7.getPrintingString(r8, r3, r3)\n java.lang.CharSequence r8 = r6.lastPrintString\n if (r8 == 0) goto L_0x00df\n if (r7 == 0) goto L_0x00eb\n L_0x00df:\n if (r8 != 0) goto L_0x00e3\n if (r7 != 0) goto L_0x00eb\n L_0x00e3:\n if (r8 == 0) goto L_0x01c5\n boolean r7 = r8.equals(r7)\n if (r7 != 0) goto L_0x01c5\n L_0x00eb:\n r6.updateSubtitle()\n goto L_0x01c5\n L_0x00f0:\n return\n L_0x00f1:\n int r0 = org.telegram.messenger.NotificationCenter.messagePlayingDidReset\n r4 = 300(0x12c, float:4.2E-43)\n if (r7 != r0) goto L_0x013d\n r7 = r9[r3]\n java.lang.Integer r7 = (java.lang.Integer) r7\n android.view.ViewGroup r9 = r6.messageContainer\n if (r9 == 0) goto L_0x01c5\n int r9 = r9.getChildCount()\n L_0x0103:\n if (r3 >= r9) goto L_0x01c5\n android.view.ViewGroup r0 = r6.messageContainer\n android.view.View r0 = r0.getChildAt(r3)\n java.lang.Object r2 = r0.getTag()\n java.lang.Integer r2 = (java.lang.Integer) r2\n int r2 = r2.intValue()\n if (r2 != r1) goto L_0x013a\n java.lang.Integer r2 = java.lang.Integer.valueOf(r4)\n android.view.View r0 = r0.findViewWithTag(r2)\n org.telegram.ui.Components.PopupAudioView r0 = (org.telegram.ui.Components.PopupAudioView) r0\n org.telegram.messenger.MessageObject r2 = r0.getMessageObject()\n if (r2 == 0) goto L_0x013a\n int r5 = r2.currentAccount\n if (r5 != r8) goto L_0x013a\n int r2 = r2.getId()\n int r5 = r7.intValue()\n if (r2 != r5) goto L_0x013a\n r0.updateButtonState()\n goto L_0x01c5\n L_0x013a:\n int r3 = r3 + 1\n goto L_0x0103\n L_0x013d:\n int r0 = org.telegram.messenger.NotificationCenter.messagePlayingProgressDidChanged\n if (r7 != r0) goto L_0x0186\n r7 = r9[r3]\n java.lang.Integer r7 = (java.lang.Integer) r7\n android.view.ViewGroup r9 = r6.messageContainer\n if (r9 == 0) goto L_0x01c5\n int r9 = r9.getChildCount()\n L_0x014d:\n if (r3 >= r9) goto L_0x01c5\n android.view.ViewGroup r0 = r6.messageContainer\n android.view.View r0 = r0.getChildAt(r3)\n java.lang.Object r2 = r0.getTag()\n java.lang.Integer r2 = (java.lang.Integer) r2\n int r2 = r2.intValue()\n if (r2 != r1) goto L_0x0183\n java.lang.Integer r2 = java.lang.Integer.valueOf(r4)\n android.view.View r0 = r0.findViewWithTag(r2)\n org.telegram.ui.Components.PopupAudioView r0 = (org.telegram.ui.Components.PopupAudioView) r0\n org.telegram.messenger.MessageObject r2 = r0.getMessageObject()\n if (r2 == 0) goto L_0x0183\n int r5 = r2.currentAccount\n if (r5 != r8) goto L_0x0183\n int r2 = r2.getId()\n int r5 = r7.intValue()\n if (r2 != r5) goto L_0x0183\n r0.updateProgress()\n goto L_0x01c5\n L_0x0183:\n int r3 = r3 + 1\n goto L_0x014d\n L_0x0186:\n int r9 = org.telegram.messenger.NotificationCenter.emojiLoaded\n if (r7 != r9) goto L_0x01ba\n android.view.ViewGroup r7 = r6.messageContainer\n if (r7 == 0) goto L_0x01c5\n int r7 = r7.getChildCount()\n L_0x0192:\n if (r3 >= r7) goto L_0x01c5\n android.view.ViewGroup r8 = r6.messageContainer\n android.view.View r8 = r8.getChildAt(r3)\n java.lang.Object r9 = r8.getTag()\n java.lang.Integer r9 = (java.lang.Integer) r9\n int r9 = r9.intValue()\n if (r9 != r2) goto L_0x01b7\n r9 = 301(0x12d, float:4.22E-43)\n java.lang.Integer r9 = java.lang.Integer.valueOf(r9)\n android.view.View r8 = r8.findViewWithTag(r9)\n android.widget.TextView r8 = (android.widget.TextView) r8\n if (r8 == 0) goto L_0x01b7\n r8.invalidate()\n L_0x01b7:\n int r3 = r3 + 1\n goto L_0x0192\n L_0x01ba:\n int r9 = org.telegram.messenger.NotificationCenter.contactsDidLoad\n if (r7 != r9) goto L_0x01c5\n int r7 = r6.lastResumedAccount\n if (r8 != r7) goto L_0x01c5\n r6.updateSubtitle()\n L_0x01c5:\n return\n */\n throw new UnsupportedOperationException(\"Method not decompiled: org.telegram.ui.PopupNotificationActivity.didReceivedNotification(int, int, java.lang.Object[]):void\");\n }", "@Test\n public void testAlarmActive() {\n AlarmManager alarm = (AlarmManager) context.getSystemService(ALARM_SERVICE);\n Intent alarmIntent = new Intent(context, MyNotification.class);\n PendingIntent sendBroadcast = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_NO_CREATE);\n alarm.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+60*1000, sendBroadcast);\n boolean active = (PendingIntent.getBroadcast(context,0,alarmIntent,PendingIntent.FLAG_NO_CREATE))!=null;\n assertFalse(\"failed, \",active);\n }", "public abstract boolean isExit();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean addNotification(EventNotificationDTO notification);", "boolean hasAck();", "@When(\"^I check whether to show a notification for rego twice$\")\n public void i_check_whether_to_show_a_notification_for_rego_twice() throws Throwable {\n result = car.showRegistrationNotification();\n result = car.showRegistrationNotification();\n }", "protected final boolean existMessage(DoorPulseCriterion dpc) {\n\t\ttry {\n\t\t\tthis.getProc().runningControl();\n\t\t\treturn !this.getProc().emptyVQueue(dpc);\n\t\t} catch (Exception e) {\n\t\t\tthrow new SimulationAbortError();\n\t\t}\n\t}", "public int checkForAlert() {\n return 0;\n }", "public boolean seenNotification(int notificationId) throws SQLException{\n try{\n ps = connection.prepareStatement(\"UPDATE notification SET seen=1 WHERE id=?\");\n ps.setInt(1,notificationId);\n rs = ps.executeQuery();\n int result = ps.executeUpdate();\n return result==1;\n }\n finally{\n Db.close(rs);\n Db.close(ps);\n// Db.close(connection);\n }\n }", "private void showNotificationCourse(Bundle data) {\n\n/* try {\n int unreadNotificationCount = Integer.valueOf(data.getString(\"total_unread_notification\"));\n NotificationCountEventBus.Event event = new NotificationCountEventBus.Event(unreadNotificationCount);\n NotificationCountEventBus.getInstance().post(event);\n } catch (Exception ignored) {\n\n }*/\n\n // check the type_push from data and navigate to activity\n Intent intent = navigateNotification(data);\n\n PendingIntent pendingIntent = PendingIntent.getActivity(this, notificationId, intent,\n PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);\n\n\n Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)\n .setSmallIcon(getNotificationIcon())\n .setContentTitle(data.getString(\"title\"))\n .setContentText(data.getString(\"body\"))\n .setAutoCancel(true)\n .setSound(defaultSoundUri)\n .setContentIntent(pendingIntent);\n\n NotificationManager notificationManager =\n (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);\n\n notificationManager.notify(notificationId++, notificationBuilder.build());\n }", "boolean hasAreSystemMessages();", "public boolean isSelfMessageProcessingEvent();", "private static void checkStatus() {\n\r\n\t\tDate date = new Date();\r\n\t\tSystem.out.println(\"Checking at :\"+date.toString());\r\n\t\tString response = \"\";\r\n\t\ttry {\r\n\t\t\tresponse = sendGET(GET_URL_COVAXIN);\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\t//System.out.println(response.toString());\r\n\t\tArrayList<Map> res = formatResponse(response);\r\n\r\n\t\tres = checkAvailability(res);\r\n\t\tif(res.size()>0)\r\n\t\t\tnotifyUser(res);\r\n\t\t//System.out.println(emp.toString());\r\n\t}", "public boolean exitChecker() {\n isExit = false;\n return isExit;\n }", "boolean isSetCurrentrun();", "boolean hasLastAction();", "boolean isMonitoring();", "boolean isMonitoring();", "@Override\n public boolean isExit() {\n return true;\n }", "private boolean checkIfReadyToRemoveFromTracking(long messageID) {\n MsgData messageTrackingData = getTrackingData(messageID);\n return messageTrackingData.messageStatus.isOKToRemove();\n }", "private void handleNotification() {\r\n\r\n Intent intent = getIntent();\r\n\r\n if (intent == null)\r\n return;\r\n\r\n fromNotification = intent.getBooleanExtra(Constants.FROM_NOTIFICATION, false);\r\n\r\n if (isFromNotification())\r\n sendNotificationAnalytics(feedId);\r\n\r\n }", "@When(\"^I check whether to show a notification for WOF$\")\n public void i_check_whether_to_show_a_notification_for_WOF() throws Throwable {\n result = car.showWofNotification();\n }", "boolean hasGameEndedResponse();" ]
[ "0.6512311", "0.6481535", "0.6303759", "0.6235143", "0.62153214", "0.620207", "0.6188001", "0.6164279", "0.6146369", "0.61272943", "0.6123018", "0.60983974", "0.6080617", "0.60793066", "0.6058805", "0.6023727", "0.6023727", "0.6023727", "0.6023727", "0.6023727", "0.6023727", "0.6023727", "0.6023727", "0.60097975", "0.59816813", "0.59766805", "0.5971184", "0.59706515", "0.5922178", "0.5913816", "0.58834606", "0.5861917", "0.58341616", "0.58334655", "0.58204687", "0.58096856", "0.5800849", "0.57863194", "0.5780405", "0.5779264", "0.5764166", "0.57462746", "0.57381964", "0.56941974", "0.56884104", "0.56814384", "0.5678921", "0.5676547", "0.567562", "0.5667721", "0.5666053", "0.56309855", "0.56294405", "0.56294376", "0.5626143", "0.5623231", "0.5618042", "0.5616715", "0.5615687", "0.56120044", "0.5596476", "0.55884093", "0.55882823", "0.558444", "0.5580802", "0.55729914", "0.5564325", "0.556427", "0.55582154", "0.55470043", "0.5543763", "0.55404013", "0.5537197", "0.55292547", "0.5525318", "0.5522942", "0.5522942", "0.5522942", "0.5522942", "0.5522942", "0.5522942", "0.55023", "0.5498562", "0.5496855", "0.54937255", "0.54913956", "0.54855365", "0.5481865", "0.54739493", "0.5464771", "0.5460304", "0.54592896", "0.54509336", "0.5444882", "0.54448426", "0.54448426", "0.5441819", "0.5441053", "0.5439058", "0.5419397", "0.54006" ]
0.0
-1
Retorna el String en formato Json con los datos del proyecto: nombre y descripcion.
@Override public String traerProyecto(Proyecto p) { JSONObject json = new JSONObject(); //json.put("codigo", 0004); json.put("nombre", p.getNombre()); json.put("descripcion", p.getDescripcion()); json.put("duracionSprints", p.getDuracionDeSprints()); json.put("numeroSprints", p.getNumeroSprints()); JSONArray jHUs = new JSONArray(); for (HistoriaDeUsuario h : p.getProductBacklog().getHistorias()) { JSONObject historia = new JSONObject(); historia.put("nombre", h.getNombre()); historia.put("descripcion", h.getDescripcion()); historia.put("puntos", h.getPuntosHistoria()); historia.put("estado", h.getEstado()); historia.put("prioridad", h.getPrioridad()); ArrayList<Criterio> criteriosH = h.getListaCriterios(); JSONArray criterios = new JSONArray(); for (Criterio crit : criteriosH) { criterios.add(crit.getDescripcion()); } historia.put("criterios", criterios); jHUs.add(historia); } json.put("historias", jHUs); return json.toJSONString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String toString(){\n return \"Codigo Produto: \"+this.idProduto+\n \"\\nNome do Produto \"+this.nomePro+\n \"\\nDescrição \"+this.descricao+\n \"\\nPreço: \"+this.preco;\n }", "public java.lang.String getProyecto() {\n return proyecto;\n }", "public java.lang.String getProyecto() {\n return proyecto;\n }", "@Override\r\n public String toString() {\n return this.descripcion;\r\n }", "public String toString() {\n\t\treturn tipo + \" : \" + descripcion;\n\t}", "@Override\r\n public String toString() {\r\n return \"Datos de Jugador: \"\r\n + \"\\n\" + \"Alias : \" + this.getAlias()\r\n + \"\\n\" + \"Nombre: \" + this.getNombre()\r\n + \"\\n\" + \"Edad : \" + this.getEdad()\r\n + \"\\n\" + \"Partidas Ganadas: \" + this.getPartidasGanadasToString()\r\n + \"\\n\" + \"Partidas Perdidas: \" + this.getPartidasPerdidasToString()\r\n + \"\\n\" + \"Partidas Empatadas: \" + this.getPartidasEmpatadasToString();\r\n }", "public String visualizzaCampo(){\n\t\tString info= new String(\"Nome: \"+ nome +\"\\n\" +\"Descrizione: \" + descrizione+ \"\\n\"+ \"Obbligatoria: \" + obbligatorio +\"\\n\");\n\t\treturn info;\n\t}", "@Override\n public String toString() {\n return getDescricao();\n }", "@GET\n @Produces(\"application/json\")\n public String getJson() {\n MultivaluedMap<String, String> params = context.getQueryParameters();\n String catId = params.getFirst(Propuesta.FIELDS.CATEGORYID);\n// MultivaluedMap<String, String> params = context.getQueryParameters();\n// for (String param : params.keySet()) {\n// String val = params.getFirst(param);\n// System.out.println(\"Param:\"+param+\", value:\"+val);\n// }\n //System.out.println(headers.getRequestHeader(HttpHeaders.AUTHORIZATION).get(0));\n return getProposalsJSON(catId);\n }", "public String getStringRepresentation() {\n JSONObject obj = new JSONObject();\n obj.put(\"title\", title);\n obj.put(\"authors\", authors);\n return obj.toString();\n }", "@Override\n\tpublic String toString() {\n\t\treturn this.nombre;\n\t}", "@GET\n @Path(\"/json\")\n @Produces(MediaType.APPLICATION_JSON)\n public String getXCRIJson() {\n if (!(new File(xcriSession.getCourseFileName())).exists()) {\n xcriSession.createCoursesFile(false);\n }\n Gson gson;\n gson = new GsonBuilder().setPrettyPrinting().create();\n JsonParser jp = new JsonParser();\n JsonElement je = jp.parse(xcriSession.getJSONCourses().toString());\n return gson.toJson(je);\n }", "public static void generarFicheroJSON(App aplicacion) throws IOException {\n\n ObjectMapper mapeador = new ObjectMapper();\n\n mapeador.configure(SerializationFeature.INDENT_OUTPUT, true);\n\n // Escribe en un fichero JSON el objeto que le pasamos\n mapeador.writeValue(new File(\"./aplicaciones/\" + aplicacion.getNombre() + \".json\"), aplicacion);\n\n }", "public String getAsJson() {\n StringBuffer sb = new StringBuffer();\n sb.append(\"{\\\"code\\\": \\\"\").append(this.code).append(\"\\\", \");\n sb.append(\"\\\"color\\\": \\\"\").append(this.color).append(\"\\\", \");\n\n /* Append a size only if the product has a Size */\n if (this.size.getClass() != NoSize.class) {\n sb.append(\"\\\"size\\\": \\\"\").append(this.size).append(\"\\\", \");\n }\n\n sb.append(\"\\\"price\\\": \").append(this.price).append(\", \");\n sb.append(\"\\\"currency\\\": \\\"\").append(this.currency).append(\"\\\"}, \");\n\n return sb.toString();\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 }", "public String CriteriatoJson() {\n\t\t\tJsonb jsonb = JsonbBuilder.create((new JsonbConfig().withFormatting(true)));\n\t\t \tString json = jsonb.toJson(criteria);\n\t\t\treturn json;\n\n\t }", "@Override\n\tpublic String toString() {\n\t\treturn this.nome + \" (\" + this.funcao + \") - \" + this.biografia + \" - \" + this.email + \" - \" + this.foto + \" - \"\n\t\t\t\t+ this.formacao + \" - \" + this.unidade + \" - \" + this.data;\n\t}", "@Override//sobrescribir metodo\n public String getDescripcion(){\n return hamburguesa.getDescripcion()+\" + lechuga\";//retorna descripcion del oobj hamburguesa y le agrega +lechuga\n }", "public String getDescricao();", "private String autores(Proyecto proyecto) {\r\n String resultado = \"\";\r\n Item estadoRenunciado = itemService.buscarPorCatalogoCodigo(CatalogoEnum.ESTADOAUTOR.getTipo(), EstadoAutorEnum.RENUNCIADO.getTipo());\r\n if (proyecto.getAutorProyectoList() == null) {\r\n return \"\";\r\n }\r\n int contador = 0;\r\n for (AutorProyecto autorProyecto : proyecto.getAutorProyectoList()) {\r\n if (estadoRenunciado.getId().equals(autorProyecto.getEstadoAutorId())) {\r\n continue;\r\n }\r\n EstudianteCarrera estudianteCarrera = estudianteCarreraService.buscarPorId(new EstudianteCarrera(autorProyecto.getAspiranteId().getId()));\r\n Persona persona = personaService.buscarPorId(new Persona(estudianteCarrera.getEstudianteId().getId()));\r\n if (contador == 0) {\r\n if (persona == null) {\r\n continue;\r\n }\r\n resultado = (persona.getApellidos() + \" \" + persona.getNombres());\r\n } else {\r\n resultado = (resultado + \", \" + persona.getApellidos() + \" \" + persona.getNombres());\r\n }\r\n contador++;\r\n }\r\n return resultado;\r\n }", "@JsonIgnore\n @Override\n public String getDescription()\n {\n return description;\n }", "String getDescripcion();", "String getDescripcion();", "@Override\n\t\t\tpublic String toString() {\n\t\t\t\treturn nome;\n\t\t\t}", "@Override\n public String toString() {\n return \"Libro{\" + \"idLibro=\" + idLibro + \", titulo=\" + titulo + \", autor=\" + autor + \", editorial=\" + editorial + \", isbn=\" + isbn + \", genero=\" + genero + \", cantidadTotal=\" + cantidadTotal + \", cantidadDisponible=\" + cantidadDisponible + \", descargable=\" + descargable + \", linkDescarga=\" + linkDescarga + \", bibliotecario=\" + bibliotecario + '}';\n }", "@Override\r\n\tpublic String toString() {\r\n\t\t\r\n\t\t// Variables declaration\r\n\t\t\r\n\t\tString output = null;\r\n\t\t\r\n\t\t// Data processing\r\n\t\t\r\n\t\toutput = String.format(\"\\n ID Veículo: %s\", idVeiculo != null ? idVeiculo.toString() : \"\");\r\n\r\n\t\toutput += String.format(\"\\n Placa: %s\", placaVeiculo != null ? placaVeiculo : \"\");\r\n\t\t\r\n\t\toutput += String.format(\"\\n Modelo: %s\", modeloVeiculo != null ? modeloVeiculo : \"\");\r\n\t\t\r\n\t\toutput += String.format(\"\\n Marca: %s\", marcaVeiculo != null ? marcaVeiculo : \"\");\r\n\t\t\r\n\t\toutput += String.format(\"\\n Cor: %s\", corVeiculo != null ? corVeiculo : \"\");\r\n\t\t\r\n\t\toutput += String.format(\"\\n Acentos: %s\", acentosVeiculos != null ? acentosVeiculos : \"\");\r\n\t\t\r\n\t\t// Information output\r\n\t\t\r\n\t\treturn output;\r\n\t}", "@Override\n public String toString(){\n\n return \"\\n\\n\"+super.toString()+\",\" + \"Dni: \"+ this.dni +\",\"+ \" Nombre: \"+this.Nombre+\",\"+\" ciudad: \"\n +\", \"+\"Ubicacion: \"+this.ubicacion+\", \"+\"Tarjeta de Crédito: \"+this.tarjetaCredito+\", \"+\n \"\\nProductos en Venta{\"+this.productosEnVenta+\"}\"+\", \" + \"\\nProductos Vendidos{\"+this.productosVendidos+\"}\"+\n \", \"+\"\\nProductos Comprados{\"+this.productosComprados+\"}\";\n }", "public String toJSONResult() {\n StringBuilder pageJSON = new StringBuilder();\n pageJSON.append(\"{\\\"id\\\": \");\n pageJSON.append(\"\\\"\");\n pageJSON.append(getID());\n pageJSON.append(\"\\\"\");\n pageJSON.append(\", \\\"title\\\": \");\n try {\n pageJSON.append(\"\\\"\").append(URLEncoder.encode(getTitle(), \"UTF-8\")).append(\"\\\"\");\n } catch (UnsupportedEncodingException e) {\n pageJSON.append(\"null\");\n }\n pageJSON.append(\", \\\"url\\\": \\\"\").append(getUrl())\n .append(\"\\\", \\\"preview\\\": \");\n try {\n pageJSON.append(\"\\\"\").append(URLEncoder.encode(getPreview(), \"UTF-8\"))\n .append(\"\\\"\");\n } catch (UnsupportedEncodingException e) {\n pageJSON.append(\"null\");\n }\n pageJSON.append(\"}\");\n\n return pageJSON.toString();\n }", "public String toJson()\n\t{\n\t\tJsonStringEncoder encoder = JsonStringEncoder.getInstance();\n\n\t\tStringBuilder builder = new StringBuilder();\n\t\tbuilder.append('{');\n\n\t\tboolean needComma = true;\n\t\tif (m_Message != null)\n\t\t{\n\t\t\tchar [] message = encoder.quoteAsString(m_Message.toString());\n\t\t\tbuilder.append(\"\\n \\\"message\\\" : \\\"\").append(message).append('\"').append(',');\n\t\t\tneedComma = false;\n\t\t}\n\n\t\tif (m_ErrorCode != null)\n\t\t{\n\t\t\tbuilder.append(\"\\n \\\"errorCode\\\" : \").append(m_ErrorCode.getValueString());\n\t\t\tneedComma = true;\n\t\t}\n\n\t\tif (m_Cause != null)\n\t\t{\n\t\t\tif (needComma)\n\t\t\t{\n\t\t\t\tbuilder.append(',');\n\t\t\t}\n\t\t\tchar [] cause = encoder.quoteAsString(m_Cause.toString());\n\t\t\tbuilder.append(\"\\n \\\"cause\\\" : \\\"\").append(cause).append('\"');\n\t\t}\n\n\t\tbuilder.append(\"\\n}\\n\");\n\n\t\treturn builder.toString();\n\t}", "java.lang.String getMetadataJson();", "public static String convertirGson(Partida partida) {\n Gson gson = new Gson();\n String objeto = gson.toJson(partida);\n return objeto;\n }", "public String obtenirDesription() {\n String description = new String(\"\");\n switch (typePlancher) {\n case CERAMIQUE:\n description = CERAMIQUE_DESC;\n break;\n case TUILESDEVINYLE:\n description = TUILESDEVINYLE_DESC;\n break;\n case LINOLEUM:\n description = LINOLEUM_DESC;\n break;\n case BOISFRANC:\n description = BOISFRANC_DESC;\n break;\n case FLOTTANT:\n description = FLOTTANT_DESC;\n }\n return description;\n }", "public String toString() {\n\t String resultJson=\"\";\t \n\t ObjectToJson jsonObj = new ObjectToJson(this.paperAuthorsList);\n\t try {\n\t\t resultJson = jsonObj.convertToJson(); \n\t }\n\t catch(Exception ex) {\n\t\t System.out.println(\"problem in conversion \"+ex.getMessage());\t\t \n\t }\n\t return resultJson;\n }", "@Override\n public String toString() {\n return nome + placa;\n }", "public String getDescrizione() {\r\n\t\treturn descrizione;\r\n\t}", "public String dameDescripcion(){\n return \"Este empleado tiene un id = \"+getId()+\" con un sueldo de \"+getSueldo();\n }", "@Override\r\n public String toString() {\r\n \treturn \"{ id : \" + getId() + \", costo : \\\"\" + getCosto() + \", fecha : \\\"\" + getFecha() + \"\\\" }\" ; \r\n }", "public java.lang.String toString() {\n return \"Project name=\" + name;\n }", "public String getPerfilDescripcion();", "public String getDescripcion() {\n\t\tif (logger.isDebugEnabled()) {\n\t\t\tlogger.debug(\"getDescripcion() - start\");\n\t\t}\n\n\t\tif (logger.isDebugEnabled()) {\n\t\t\tlogger.debug(\"getDescripcion() - end\");\n\t\t}\n\t\treturn descripcion;\n\t}", "public java.lang.String getDescrizione() {\r\n return descrizione;\r\n }", "@Override\r\n\tpublic String toString() {\r\n\t\treturn \"Libro [paginas=\" + paginas + \", titulo=\" + titulo + \"]\";\r\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn String.format(\"nombre:%s, direccion: %s, telefono: %s\", nombre_banco, direccion, telefono);\n\t}", "public String toString()\r\n {\r\n final String TAB = \"\\n\\t\";\r\n \r\n String retValue = \"\";\r\n \r\n retValue = \"JogadorVO ( \"\r\n + super.toString() + TAB\r\n + \"mestre = \" + this.mestre + TAB\r\n + \"nome = \" + this.nome + TAB\r\n + \"conn = \" + this.conn + TAB\r\n + \" )\";\r\n \r\n return retValue;\r\n }", "public String getNombre(){\r\n return beneficiario[1].toString();\r\n }", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public String consultarSolicitudes()\n {\n Object objeto = sdao.consultaGeneral();\n return gson.toJson(objeto);\n }", "@Override\n public String toString() {\n Gson gson = new Gson();\n\n String json = gson.toJson(this);\n System.out.println(\"json \\n\" + json);\n return json;\n }", "public String getDescricao() {\n\t\treturn this.descricao;\n\t}", "public String getDescrizione() {\n\t\treturn descrizione;\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn \"Nombre: \"+this.nombre+\" Cantidad: \"+this.cantidad+\" \"+this.unidadMedida;\n\t}", "@Override\n\tpublic String getDescription() {\n\t\tString ret = Localization.SINGLETON.getElement(\"POTION_GETDESCRIPTION\");\n\t\tret = ret.replace(\"[[POTION_NAME]]\", this.name);\n\t\tret = ret.replace(\"[[POTION_ENERGY]]\", \"\" + ENERGY);\n\t\tret = ret.replace(\"[[POTION_STRENGTH]]\", \"\" + STRENGTH);\n\t\treturn ret;\n\t}", "@Override\n public String toString() {\n // TODO this is a sudo method only for testing puroposes\n return \"{name: 5aled, age:15}\";\n }", "@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 }", "public String toString() {\n\t\treturn this.titel + \" \" + this.name + \" (\" + this.mail + \")\";\n\t}", "public String getDescripcion() {\n return this.descripcion.get();\n }", "public String getDescripcion() { return this.descripcion; }", "@Override\n\tpublic String toString() {\n\t\treturn this.nombre + \" \" + this.apellidos + \" (ID empleado - \" + this.id + \")\";\n\t}", "public String getNomeProduto() {\r\n\t\treturn nomeProduto;\r\n\t}", "public String getInfoTitulos(){\r\n String infoTitulos = \"\";\r\n \r\n if(this.propriedadesDoJogador.size() > 0 || this.companhiasDoJogador.size() > 0){\r\n for(int i = 0; i < this.propriedadesDoJogador.size(); i++){\r\n infoTitulos += propriedadesDoJogador.get(i).getDescricao()+\"\\n\";\r\n }\r\n for(int i = 0; i < this.companhiasDoJogador.size(); i++){\r\n infoTitulos += companhiasDoJogador.get(i).getDescricao()+\"\\n\";\r\n }\r\n return infoTitulos;\r\n \r\n }else{\r\n return \"Você não possui títulos\";\r\n }\r\n }", "@Override\r\n\tpublic String obtenerDescripcion() {\n\t\treturn this.combo.obtenerDescripcion() + \"+ Porcion de Carne\";\r\n\t}", "public String toString() {\r\n\t\tSimpleDateFormat sdf=new SimpleDateFormat(\"dd/MM/yyyy\"); //Mostraremos la fecha en formato DD/MM/AAAA\r\n\t\tString nacEdad=sdf.format(fechaNac)+ \"(\"+obtenerAnios()+\" años)\";\r\n\t\treturn \"Persona [nombre=\" + nombre + \", fechaNac=\" + nacEdad + \", DNI=\" + dni\r\n\t\t\t\t+ \", sexo=\" + sexo + \", peso=\" + peso + \", altura=\" + altura\r\n\t\t\t\t+ \"]\";\r\n\t}", "public String toString() {\n\t\tString knjigaToString = \"Name: \" + naziv + \"\\nCijena: \" + cijena + \"\\nStanje: \"\n\t\t\t\t+ stanje + \"\\nAutor\"+ autorKnjige +\"\\n\\n\";\n\t\treturn knjigaToString;\n\t}", "@Override\n public String toString(){\n StringBuilder retorno = new StringBuilder(\" ( *\");\n for(INodo descendiente : getDescendientes()){\n retorno.append(descendiente);\n }\n retorno.append(\" )\");\n\n return String.valueOf(retorno);\n }", "public String getNombre() {\n\t\treturn producto.getNombre();\n\t}", "public String getDescricao() {\n return descricao;\n }", "public String getDescricao() {\n return descricao;\n }", "@Override\n\tpublic String toJSON()\n\t{\n\t\tStringJoiner json = new StringJoiner(\", \", \"{\", \"}\")\n\t\t.add(\"\\\"name\\\": \\\"\" + this.name + \"\\\"\")\n\t\t.add(\"\\\"id\\\": \" + this.getId());\n\t\tString locationJSON = \"\"; \n\t\tif(this.getLocation() == null)\n\t\t{\n\t\t\tlocationJSON = null;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlocationJSON = this.getLocation().toJSON(); \n\t\t}\n\t\tjson.add(\"\\\"location\\\": \" + locationJSON);\n\t\tStringJoiner carsJSON = new StringJoiner(\", \", \"[\", \"]\");\n\t\tfor(Object r : cars)\n\t\t{\n\t\t\tcarsJSON.add(((RollingStock) r).toJSON());\n\t\t}\n\t\tjson.add(\"\\\"cars\\\": \" + carsJSON.toString());\n\t\treturn json.toString(); \n\t}", "@Override\n @SuppressWarnings(\"unchecked\")\n public JSONObject toJSON() {\n JSONObject main = new JSONObject();\n JSONObject pocJSON = new JSONObject();\n pocJSON.put(JSON_NAME, this.getName());\n pocJSON.put(JSON_DESCRIPTION, this.getDescription());\n pocJSON.put(JSON_COLOR,this.colorConstraint.getColor().name());\n main.put(SharedConstants.TYPE, SharedConstants.PRIVATE_OBJECTIVE_CARD);\n main.put(SharedConstants.BODY,pocJSON);\n return main;\n }", "public String toString(){\n\t\tif(categoria == 1)\n\t\t\treturn \"Profesor Ayudante\\n\" + super.toString() + \"\\n\" + \"Horario = \" + tutoria;\n\t\telse if(categoria == 2)\n\t\t\treturn \"Profesor Titular de Universidad\\n\" + super.toString() + \"\\n\" + \"Horario = \" + tutoria;\n\t\telse\n\t\t\treturn \"Profesor Catedrático de Universidad\\n\" + super.toString() + \"\\n\" + \"Horario = \" + tutoria;\n\t}", "@Override\r\n\tpublic String getNombrePrograma() {\n\t\treturn this.getObjectZulCode();\r\n\t}", "public String getDescripcionGrupo() {\n\t\treturn descripcionGrupo;\n\t}", "@Override\r\n\tpublic String toString() {\n\t\treturn this.nome;\r\n\t}", "@Override\n public String toString() {\n return \"Id del Libro: \"+id+\" Nombre del Libro: \"+nombre+\" Disponibilidad: \"+disponibilidad;\n }", "@Override\n public String toString(){\n StringBuilder s = new StringBuilder();\n\n s.append(\"User\\n\");\n s.append(\"User's name: \" + this.name + \"\\n\");\n s.append(\"User's email: \" + this.email + \"\\n\");\n s.append(\"User's projects:\\n\");\n for(Project p : this.projects.getProjects().values()){\n s.append(\" -> \" + p.toString() + \"\\n\");\n }\n\n return s.toString();\n }", "public String toJSON(){\n Gson gson = new Gson();\n return gson.toJson(this);\n }", "String getNombreProducto();", "public String toString() {\r\n\t\treturn _sNombre;\r\n\t}", "@Override\r\n\tpublic String toString() {\r\n\t\treturn String.format(\"%s: %s\", getName(), getDescription());\r\n\t}", "@Override\r\n\tpublic String toString() {\r\n\t\tString entregado;\r\n\t\tif (this.dataDeDevolucao == null)\r\n\t\t\tentregado = \"Emprestimo em andamento\";\r\n\t\telse\r\n\t\t\tentregado = this.dataDevolucaoStr;\r\n\t\treturn \"EMPRESTIMO - De: \" + this.emprestimoid.getNomeDonoItem() + \", Para: \"\r\n\t\t\t\t+ this.emprestimoid.getNomeRequerenteItem() + \", \" + this.emprestimoid.getNomeItem() + \", \"\r\n\t\t\t\t+ this.dataInicialEmprestimoStr + \", \" + this.numeroDiasParaEmprestimo + \" dias, ENTREGA: \" + entregado;\r\n\t}", "public String getDescricao() {\n\t\treturn descricao;\n\t}", "public String getDescricao() {\n\t\treturn descricao;\n\t}", "public String toString()\n\t{\n\t final String TAB = \" \";\n\t \n\t String retValue = \"\";\n\t \n\t retValue = \"Pessoa ( \"\n\t + super.toString() + TAB\n\t + \"idPessoa = \" + this.idPessoa + TAB\n\t + \"nome = \" + this.nome + TAB\n\t + \"sobreNome = \" + this.sobreNome + TAB\n\t + \"foneResidencial = \" + this.foneResidencial + TAB\n\t + \"celular = \" + this.celular + TAB\n\t + \" )\";\n\t\n\t return retValue;\n\t}", "public String getNamePro() {\n return namePro;\n }", "public String getProdotto() {\r\n\t\treturn prodotto;\r\n\t}", "@Override\r\n public String getDescripcion() {\r\n return this.descripcion;\r\n }", "@Override\r\n\tpublic String toString() {\r\n\t\t\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\t\r\n String dataInicioFormatada = this.dataInicio;\r\n\t\t\t\r\n\t\tsb.append(this.designacaoTorneio + \" | \");\r\n\t\tsb.append(dataInicioFormatada + \" | \");\r\n\t\tsb.append(this.jogadorAdversario.getNome() + \"\\t| \");\r\n\t\tsb.append(this.qtdEncontros + \" | \");\r\n\t\t\t\r\n\t\t\t\r\n\t\tdouble diferenca = jogadorCorrente.getPontos() - this.jogadorAdversario.getPontos();\r\n\t\t\t\r\n\t\tif (diferenca < 0.0)\r\n\t\t\tsb.append((Math.round(diferenca * 100) / 100.0) + \"\\n\");\r\n\t\t\t\r\n\t\telse\r\n\t\t\tsb.append(\"+\" + (Math.round(diferenca * 100) / 100.0));\r\n\r\n\t\tif (sb.length() == 0)\r\n\t\t\tsb.append(VisualizarEncontroDTO.NAO_EXISTEM_CONFRONTOS);\r\n\t\t\r\n\t\treturn sb.toString();\r\n\t}", "@Override\n\tpublic String toString() {\n\t\tString ret = \"\";\n\t\t\n\t\tfor(Articulo articulo: articulos) {\n\t\t\tret += articulo.toString() + '\\n';\n\t\t}\n\t\t\n\t\treturn ret;\n\t}", "public String toJSON() {\n\t JSONObject outer = new JSONObject();\r\n\t JSONObject inner = new JSONObject();\r\n\t // Now generate the JSON output\r\n\t try {\r\n\t outer.put(\"articleMobile\", inner); // the outer object name\r\n\t inner.put(\"codeArticle\", codeArticle); // a name/value pair\r\n\t inner.put(\"designation\", designation); // a name/value pair\r\n\t inner.put(\"prixVente\", prixVente); // a name/value pair\r\n\t inner.put(\"stockTh\", stockTh);\r\n\t inner.put(\"error\", error); // a name/value pair\r\n\t inner.put(\"gisement\", gisement); // a name/value pair\r\n\t } catch (JSONException ex) {\r\n\t ex.printStackTrace();\r\n\t }\r\n\t return outer.toString(); // return the JSON text\r\n\t}", "public String getDescripcion() { return (this.descripcion == null) ? \"\" : this.descripcion; }", "@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}", "public String toString() {\r\n \t\treturn \"\\\"\" + _name + \"\\\" by \" + _creator;\r\n \t}", "public String toString()\n {\n String textoADevolver = \"\";\n if (tareaCompletada)\n {\n textoADevolver += \"HECHA \";\n }\n textoADevolver += descripcion + \" (\" +prioridad+ \").\";\n return textoADevolver;\n }", "public String getDescription(){\n return getString(KEY_DESCRIPTION);\n }", "protected String toJSONFragment() {\n StringBuffer json = new StringBuffer();\n boolean first = true;\n if (isSetProductCategoryId()) {\n if (!first) json.append(\", \");\n json.append(quoteJSON(\"ProductCategoryId\"));\n json.append(\" : \");\n json.append(quoteJSON(getProductCategoryId()));\n first = false;\n }\n if (isSetProductCategoryName()) {\n if (!first) json.append(\", \");\n json.append(quoteJSON(\"ProductCategoryName\"));\n json.append(\" : \");\n json.append(quoteJSON(getProductCategoryName()));\n first = false;\n }\n if (isSetParent()) {\n if (!first) json.append(\", \");\n json.append(\"\\\"Parent\\\" : {\");\n Categories parent = getParent();\n\n\n json.append(parent.toJSONFragment());\n json.append(\"}\");\n first = false;\n }\n return json.toString();\n }", "@Override\n\tpublic String toString() {\n\t\treturn \"TipoDocumento [codigoPais=\" + codigoPais + \", codigo=\" + codigo\n\t\t\t\t+ \", nombreEntidad=\" + nombreEntidad\n\t\t\t\t+ \", oidTipoDoc=\" + oidTipoDoc \n\t\t\t\t+ \", estado=\" + estado\n\t\t\t\t+ \", obligatorio=\" + obligatorio\n\t\t\t\t+ \", siglas=\" + siglas\n\t\t\t\t+ \", longitud=\" + longitud\n\t\t\t\t+ \", dni=\" + dni\n\t\t\t\t+ \", fiscal=\" + fiscal\n\t\t\t\t+ \", tipoDocu=\" + tipoDocu\n\t\t\t\t+ \", descripcion=\" + descripcion + \"]\";\n\t}", "@Override\n public String toString() {\n return this.codigo + \" - \" + this.descricao + \" - \" + this.campoDeInteresse;\n }", "public String toJson() {\n try{\n return new JsonSerializer().getObjectMapper().writeValueAsString(this);\n } catch (IOException e){\n throw new RuntimeException(e);\n }\n }", "public String toString() {\n return \"\" +getNombre() + \",\" + getPuntos();\n }", "public void setProyecto(java.lang.String proyecto) {\n this.proyecto = proyecto;\n }", "public void setProyecto(java.lang.String proyecto) {\n this.proyecto = proyecto;\n }" ]
[ "0.6470369", "0.63247776", "0.63247776", "0.62886244", "0.6166494", "0.59421736", "0.59261644", "0.59228927", "0.59198606", "0.5876993", "0.5852564", "0.58309364", "0.57811844", "0.5755048", "0.5751802", "0.57358336", "0.5725861", "0.57206625", "0.571163", "0.5687529", "0.5667781", "0.5654941", "0.5654941", "0.56542534", "0.564756", "0.56391287", "0.5618066", "0.5595223", "0.5591611", "0.55607307", "0.5558436", "0.5558019", "0.5545131", "0.55426955", "0.55350333", "0.55343467", "0.55315137", "0.55312467", "0.5528416", "0.5515439", "0.5513484", "0.5513333", "0.5512903", "0.5511777", "0.55116326", "0.55073524", "0.5506985", "0.5501429", "0.55010164", "0.5494663", "0.5494533", "0.5490328", "0.54883826", "0.54870206", "0.54813707", "0.5469089", "0.54605454", "0.54519916", "0.54399675", "0.54398584", "0.54383534", "0.54346037", "0.5431784", "0.54312617", "0.54310435", "0.54310435", "0.5430534", "0.5428384", "0.5427583", "0.54135126", "0.540645", "0.5406287", "0.54009885", "0.5399141", "0.5398628", "0.5398137", "0.5395734", "0.5394132", "0.5391837", "0.53907955", "0.53907955", "0.5384122", "0.53817743", "0.5374271", "0.53721005", "0.53670764", "0.53628945", "0.53616834", "0.53569263", "0.5354356", "0.5353857", "0.5353287", "0.53527015", "0.5349889", "0.5349217", "0.5344813", "0.5342846", "0.5339416", "0.5337223", "0.5337223" ]
0.6717185
0
set response output to PDF format
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/pdf"); Document document = new Document(); try { //PdfWriter - a class from third party library PdfWriter.getInstance(document, response.getOutputStream()); document.open(); document.addTitle("MY WEBSITE - Profile Details"); //create a font object and set size and style Font datetime_f = new Font(); datetime_f.setStyle(Font.ITALIC); datetime_f.setSize(8); //create a paragraph object and set alignment to right Paragraph datetime_p = new Paragraph(LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd-LLL-uuuu, HH:mm:ss")), datetime_f); datetime_p.setAlignment(Element.ALIGN_RIGHT); Font sitename_f = new Font(); sitename_f.setStyle(Font.BOLD); sitename_f.setSize(22); Paragraph sitename_p = new Paragraph("MY WEBSITE", sitename_f); sitename_p.setAlignment(Element.ALIGN_CENTER); //create an empty paragraph, to print empty line Paragraph empty_p = new Paragraph(" "); Font title_f = new Font(); title_f.setStyle(Font.BOLD); title_f.setSize(18); Paragraph title_p = new Paragraph("Profile Information", title_f); Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/my_website_db", "user1", "1111"); //query user information Statement stmt = conn.createStatement(); String sql_query = "SELECT * FROM `usr_accnt` WHERE `usr_unq_name` = '" + (String)request.getSession().getAttribute("UNAME_KEY") + "';"; ResultSet results = stmt.executeQuery(sql_query); //#if data is found // create paragraph and set the content to PDF //#else if no data found // print error in PDF if(results.next()) { Paragraph firstname_p = new Paragraph(String.format("%-20s : %s", "First Name", results.getString("usr_firstName"))); Paragraph lastname_p = new Paragraph(String.format("%-20s : %s", "Last Name", results.getString("usr_lastName"))); Paragraph username_p = new Paragraph(String.format("%-20s : %s", "Username", results.getString("usr_unq_name"))); Paragraph emailAddress_p = new Paragraph(String.format("%-20s : %s", "Email Address", results.getString("usr_emailAddress"))); Paragraph password_p = new Paragraph(String.format("%-20s : %s", "Password", results.getString("usr_password"))); Paragraph gender_p = new Paragraph(String.format("%-20s : %s", "Gender", results.getString("usr_gender"))); Paragraph country_p = new Paragraph(String.format("%-20s : %s", "Country", results.getString("usr_country"))); Paragraph dateOfBirth_p = new Paragraph(String.format("%-20s : %s", "Date of Birth", results.getString("usr_dateOfBirth"))); document.add(datetime_p); document.add(sitename_p); document.add(empty_p); document.add(title_p); document.add(empty_p); document.add(firstname_p); document.add(lastname_p); document.add(username_p); document.add(emailAddress_p); document.add(password_p); document.add(gender_p); document.add(country_p); document.add(dateOfBirth_p); } else { Font err_f = new Font(); err_f.setSize(24); err_f.setStyle(Font.BOLD); err_f.setColor(255, 0, 0); Paragraph err_p = new Paragraph("Error occured", err_f); err_p.setAlignment(Element.ALIGN_CENTER); document.add(err_p); } document.close(); } catch (DocumentException de) { throw new IOException(de.getMessage()); } catch(Exception ex) { System.out.println("Exception thrown : " + ex.toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void sendPDF(byte[] content, HttpServletResponse response) throws IOException {\n response.setContentType(\"application/pdf\");\n response.setContentLength(content.length);\n response.getOutputStream().write(content);\n response.getOutputStream().flush();\n }", "@GetMapping(value = \"/pdf\", produces = MediaType.APPLICATION_JSON_VALUE)\n public ResponseEntity<String> generatePDFReport() {\n LOGGER.info(\"Generating Fund PDF report.\");\n\n // ReportPdfExporter pdfExporter = context.getBean(ReportPdfExporter.class);\n boolean success =false;\n if(configFilter().getJasperPrint() != null) {\n pdfExporter.setJasperPrint(configFilter().getJasperPrint());\n success = pdfExporter.exportToPdf(\"fundReport.pdf\");\n }\n if (success) {\n return new ResponseEntity<>(\"PDF Report is successfully generated \", HttpStatus.OK);\n } else {\n return new ResponseEntity<>(\"PDF Report cannot be generated \", HttpStatus.OK);\n }\n }", "private void getPDF(){\r\n\t\t\r\n\t\tif(request.getParameter(\"exportType\").equals(PDFGenerator.EXPORT_ADMIN)){\r\n\t\t\tgetAdministration(); // pdf uses same data\r\n\t\t} else if(request.getParameter(\"exportType\").equals(PDFGenerator.EXPORT_TEACHER)){\r\n\t\t\tgetEventRegistration(); // pdf uses same data\r\n\t\t}\r\n\t\t\r\n\t\tPDFGenerator pdfGen = new PDFGenerator();\r\n\t\tpdfGen.createDocument(request, response);\r\n\t\t\r\n\t\tString eventTitle = \"all\";\r\n\t\t\r\n\t}", "@RequestMapping(value = \"/report/pdf\")\r\n\tpublic ModelAndView generatePDFReport(HttpServletRequest request, HttpServletResponse response) {\r\n\r\n\t\tMap<String, Object> parameterMap = new HashMap<String, Object>();\r\n\r\n\t\tList<Person> personList = personService.getAll();\r\n\r\n\t\tJRDataSource person_list = new JRBeanCollectionDataSource(personList);\r\n\r\n\t\tparameterMap.put(\"person_list\", person_list);\r\n\r\n\t\treturn new ModelAndView(\"personReportList\", parameterMap);\r\n\r\n\t}", "@Override\r\n\tpublic void createPDF(HttpServletRequest request, OutputStream os) {\n\t\t\r\n\t}", "@SuppressWarnings(\"unchecked\")\n private void generatePDFReport(IReportRunnable report, HttpServletResponse response, HttpServletRequest request) {\n IRunAndRenderTask runAndRenderTask = birtEngine.createRunAndRenderTask(report);\n response.setContentType(birtEngine.getMIMEType(\"pdf\"));\n IRenderOption options = new RenderOption();\n PDFRenderOption pdfRenderOption = new PDFRenderOption(options);\n pdfRenderOption.setOutputFormat(\"pdf\");\n runAndRenderTask.setRenderOption(pdfRenderOption);\n runAndRenderTask.getAppContext().put(EngineConstants.APPCONTEXT_PDF_RENDER_CONTEXT, request);\n\n try {\n pdfRenderOption.setOutputStream(response.getOutputStream());\n runAndRenderTask.run();\n } catch (Exception e) {\n throw new RuntimeException(e.getMessage(), e);\n } finally {\n runAndRenderTask.close();\n }\n }", "@RequestMapping(value = \"/getpdfitext\", method = RequestMethod.GET,\n produces = MediaType.APPLICATION_PDF_VALUE)\n public ResponseEntity<InputStreamResource> citiesReport() {\n\n List<City> cities = CityService.getCities();\n\n ByteArrayInputStream bis = GeneratePdfIText.citiesReport(cities);\n\n HttpHeaders headers = new HttpHeaders();\n headers.add(\"Content-Disposition\", \"inline; filename=citiesreport.pdf\");\n\n return ResponseEntity\n .ok()\n .headers(headers)\n .contentType(MediaType.APPLICATION_PDF)\n .body(new InputStreamResource(bis));\n }", "@RequestMapping(value = \"/getpdfReport\", method = RequestMethod.GET)\n public ModelAndView doSalesReportPDF(HttpServletRequest request,\n \t\tHttpServletResponse response) \n\t\t {\n\t\t//logger.debug(\"Received request to download PDF report\");\n\t\t\n\t\t// Retrieve our data from a mock data provider\n\t\tMockDataFactory dataprovider = new MockDataFactory();\n\t\t\n\t\t// Assign the datasource to an instance of JRDataSource\n\t\t// JRDataSource is the datasource that Jasper understands\n\t\t// This is basically a wrapper to Java's collection classes\n\t\tJRDataSource categoryData = dataprovider.getCategoriesData();\n\n\t\t// parameterMap is the Model of our application\n\t\tMap<String,Object> parameterMap = new HashMap<String,Object>();\n\t\t\n\t\t// must have the empty data source!!!\n\t\tJREmptyDataSource emptyData = new JREmptyDataSource();\n\t\t\n\t\t//parameterMap.put(\"userList\", emptyData);\n\t\tList list = new ArrayList();\n\t\tCountry country = new Country();\n\t\tcountry.setName(\"tjw\");\n\t\tlist.add(country);\n\t\tcountry = new Country();\n\t\tcountry.setName(\"gkrong\");\n\t\tlist.add(country);\n\t\t//country.setLastUpdate(new Date());\n\t\t\n\t\tString uri = request.getRequestURI();\n\t\tString format = uri.substring(uri.lastIndexOf(\".\") + 1);\t\n\t\tparameterMap.put(\"datasource\", list);\n\t\tparameterMap.put(\"format\", format);\t\n\t\t//parameterMap.put(\"categoryData\", categoryData);\n\t\tparameterMap.put(\"Country\", country);\n\t\treturn new ModelAndView(\"simpleReport\", parameterMap);\t\t\n\t}", "private void setContentType(HttpServletResponse response, Format format) {\r\n switch (format) {\r\n case html:\r\n case htmlfragment:\r\n response.setContentType(\"text/html;charset=UTF-8\");\r\n break;\r\n case kml:\r\n response.setContentType(\"application/vnd.google-earth.kml+xml;charset=UTF-8\");\r\n response.setHeader(\"Content-Disposition\",\"attachment; filename=\\\"document.kml\\\"\");\r\n break;\r\n case json:\r\n response.setContentType(\"application/json;charset=UTF-8\");\r\n response.setHeader(\"Content-disposition\", \"attachment; filename=\\\"document.json\\\"\");\r\n break;\r\n case pjson:\r\n\t response.setContentType(\"text/plain;charset=UTF-8\");\r\n\t break; \r\n default:\r\n case xml:\r\n response.setContentType(\"text/xml;charset=UTF-8\");\r\n break;\r\n }\r\n}", "@Override\n\tpublic void buildPdfDocument(Map<String, Object> model, Document doc, PdfWriter writer,\n\t\t\tHttpServletRequest request, HttpServletResponse response) throws Exception {\n\t\tExportExam exportExam = (ExportExam) model.get(\"exportExam\");\n\t\tExportExam exportExam2 = (ExportExam) model.get(\"exportExam2\");\n\t\tListExam listExam = null;\n\t\tListExam listExam2 = null;\n\t\tif(exportExam!=null){\n\t\tlistExam = exportExam.listExam;\n\t\t}\n\t if(exportExam2!=null){\n\t\tlistExam2 = exportExam2.listExam;\n\t\t}\n\t\n\t\tString url = request.getRequestURL().toString();\n\t\tString baseURL = url.substring(0, url.length() - request.getRequestURI().length()) + request.getContextPath();\n\t\tString path = baseURL + \"/resources/fonts/vuArial.ttf\";\n\t\tFontFactory.register(path);\n\t\t\n\t\t//\"C:\\\\Users\\\\HennessyVox\\\\Downloads\\\\Compressed\\\\vuArial.ttf\"\n\t\t//Font fontHeader = FontFactory.getFont(FONT, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);\n\t\tBaseFont base = BaseFont.createFont(path, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);\n\t\t Font fontHeader = new Font(base, 10, Font.NORMAL);\n\t\t Font fontHeader2 = new Font(base, 10, Font.UNDERLINE);\n\t\t Font fontContent = new Font(base, 11, Font.NORMAL);\n\t\t Font fontAnswent = new Font(base, 11, Font.NORMAL, BaseColor.RED);\n\t\t Font fontTitle = new Font(base, 12, Font.BOLD);\n\t\t Font fontNumber = new Font(base, 11, Font.BOLD);\n\t\t//Font fontHeader = new Font(FontFamily.TIMES_ROMAN, 12, Font.NORMAL);\n\t String SchoolHeader = \"TRƯỜNG ĐẠI HỌC BÁCH KHOA TP HCM\";\n\t\t\n\t // Get faulty info.\n\t\n\t \n\t\ttry {\n\t\t\t\n\t\t\t if(listExam!=null){\n\t\t\t\t System.out.println(\"=============================================================\");\n\t\t\t\t int CoutExam = 1;\n\t\t\t String FacultyHeader = exportExam.getFaulty().toUpperCase();\n\t\t\t \t\n\t\t\t /// String FacultyHeader = \"KHOA KHOA HỌC VÀ KỸ THUẬT MÁY TÍNH\";\n\t\t\t String InfoStudentHeader1 = \"Họ Tên : ..........................\";\n\t\t\t String InfoStudentHeader2 = \"MSSV : ..........................\";\n\t\t\t PdfPTable table = new PdfPTable(new float[] { 75, 25 });\n\t\t\t table.setWidthPercentage(100);\n\t\t\t \n\t\t\t table.addCell(getCell(new Paragraph(SchoolHeader,fontHeader), PdfPCell.ALIGN_LEFT));\n\t\t\t \n\t\t\t table.addCell(getCell(new Paragraph(InfoStudentHeader1,fontHeader), PdfPCell.ALIGN_RIGHT));\n\t\t\t table.addCell(getCell(new Paragraph(FacultyHeader,fontHeader2), PdfPCell.ALIGN_LEFT));\n\t\t\t table.addCell(getCell(new Paragraph(InfoStudentHeader2,fontHeader), PdfPCell.ALIGN_RIGHT));\n\t\t\t table.setSpacingAfter(10);\n\t\t\t doc.add(table);\n\t\t\t \n\t\t\t // ADD title\n\t\t\t //Font fontTitle = FontFactory.getFont(FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);\n\t\t\t //String titleExam = \"ĐỀ KIỂM TRA CUỐI KÌ 2017\";\n\t\t\t // System.out.println(exportExam.getExamName().toUpperCase());\n\t\t\t String titleExam = exportExam.getExamName().toUpperCase();\n\t\t\t \n\t\t\t Paragraph pHeader = new Paragraph(titleExam,fontTitle);\n\t\t\t pHeader.setAlignment(Paragraph.ALIGN_CENTER);\n\t\t\t doc.add(pHeader);\n\t\t\t \n\t\t\t String SubjectExam = \"Môn Thi : \" +exportExam.getSubjectName();\n\t\t\t String CodeExam = \"Mã đề : \" + exportExam.getCode();\n\t\t\t String timeExam = \"Thời gian : \" + exportExam.getTime();\n\t\t\t Font fontSubject = new Font(base, 10, Font.NORMAL);\n\t\t\t Font fontExam = new Font(base, 10, Font.NORMAL);\n\t\t\t \n\t\t\t PdfPTable table2 = new PdfPTable(2);\n\t\t\t table2.setWidthPercentage(80);\n\t\t\t //System.out.println(Charset.forName(\"UTF-8\").encode(SchoolHeader));\n\n\t\t\t table2.addCell(getCell(new Paragraph(SubjectExam,fontSubject), PdfPCell.ALIGN_LEFT));\n\t\t\t \n\t\t\t table2.addCell(getCell(new Paragraph(timeExam,fontExam), PdfPCell.ALIGN_RIGHT));\n\t\t\t table2.addCell(getCell(new Paragraph(CodeExam,fontExam), PdfPCell.ALIGN_LEFT));\n\t\t\t table2.addCell(getCell(new Paragraph(\"\",fontHeader), PdfPCell.ALIGN_RIGHT));\n\t\t\t table2.setSpacingBefore(5);\n\t\t\t doc.add(table2);\n\t\t\t \n\t\t\t String noteExam = exportExam.getNoteExam();\n\t\t\t Font fontNote = new Font(base, 8, Font.ITALIC);\n\t\t\t \n\t\t\t Paragraph pNote = new Paragraph(noteExam, fontNote);\n\t\t\t pNote.setAlignment(Paragraph.ALIGN_MIDDLE);\n\t\t\t doc.add(pNote);\n\t\t\t PdfPTable table3 = new PdfPTable(1);\n\t\t\t table3.setSpacingBefore(5);\n\t\t\t table3.setWidthPercentage(80);\n\t\t\t Font finalExam = new Font(base, 10, Font.NORMAL);\n\t\t\t table3.addCell(getCell(new Paragraph(\"*****\",finalExam), PdfPCell.ALIGN_CENTER));\n\t\t\t doc.add(table3);\n\t\t\t\t \n\t\t\t for(int i = 0; i < listExam.blockRootQuestion.size() ; i++){\n\t\t\t\t System.out.println(\"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\");\n\t\t\t\t \n\t\t\t\t List listBlock = new List(List.UNORDERED);\n\t\t\t\t listBlock.setAutoindent(false);\n\t\t\t\t // listBlock.setSymbolIndent(20);\t\n\t\t\t\t listBlock.add(new ListItem(new Paragraph(listExam.blockRootQuestion.get(i).rootQuestionBlock.getContent(),fontContent)));\n\t\t\t System.out.println(\"########### Block NAME \" +listExam.blockRootQuestion.get(i).rootQuestionBlock.getContent());\n\t\t\t\t \n\t\t\t\t doc.add(listBlock);\n\t\t\t \n\t\t\t \n\t\t \tSystem.out.println(\"########### SIZE QUESTION \" +listExam.blockRootQuestion.get(i).questionList.size());\n \n\t\t\t for(int j = 0 ; j < listExam.blockRootQuestion.get(i).questionList.size(); j++){\t\n\t\t\t \tSystem.out.println(\"########### QUESTION NAME \" +listExam.blockRootQuestion.get(i).questionList.get(j).question.getContent());\n\t\t\t\t\t\t\n\t\t\t \t List listQuestion = new List(List.UNORDERED);\n\t\t\t\t\t listQuestion.setListSymbol(\"\");\n\t\t\t \t\n\t\t\t \t//SingleQuestion questionPDF = null;\n\t\t\t \t//questionPDF = listExam.blockRootQuestion.get(i).questionList.get(j);\n\t\t\t \tStringBuilder sb = new StringBuilder();\n\t\t\t\t\t\tsb.append(\"Câu \");\n\t\t\t\t\t\tsb.append(CoutExam);\n\t\t\t\t\t\tsb.append(\". \");\n\t\t\t\t\t\tString strI = sb.toString();\n\t\t\t \t//strI = new Paragraph(strI, fontNumber);\n\t\t\t \t//listQuestion.setPostSymbol(strI);\n\t\t\t \tSystem.out.println(strI);\n\t\t\t listQuestion.add(new ListItem(new Paragraph(strI + listExam.blockRootQuestion.get(i).questionList.get(j).question.getContent(), fontContent)));\n\t\t\t listQuestion.setIndentationLeft(10);\n\t\t\t doc.add(listQuestion);\n\t\t\t List listAnswerPDF = new List(List.ORDERED, List.ALPHABETICAL);\n\t\t\t for(int k = 0; k < listExam.blockRootQuestion.get(i).questionList.get(j).answerList.size(); k++){\n\t\t\t\t\t System.out.println(\"########### Answer NAME \" +listExam.blockRootQuestion.get(i).questionList.get(j).answerList.get(k).getContent());\n\t\t\t \t listAnswerPDF.add(new ListItem(new Paragraph(listExam.blockRootQuestion.get(i).questionList.get(j).answerList.get(k).getContent(), fontContent))); \t \n\t\t\t }\n\t\t\t listAnswerPDF.setIndentationLeft(25);\n\t\t\t doc.add(listAnswerPDF);\n\t\t\t CoutExam++;\n\t\t\t }\n\t\t\t doc.add( Chunk.NEWLINE ); \n\t\t\t }\n\t\t\t // doc.close();\n\t\t\t listExam =null;\n\t\t\t }\n\t\t\t /*\n\t\t\t * Export Answer\n\t\t\t */\n\t\t\telse if(listExam2!=null){\n\t\t\t\t int CoutExam = 1;\n\t\t\t\t System.out.println(\"#######################################################\");\n\t\t\t\t String FacultyHeader = exportExam2.getFaulty().toUpperCase();\n\t\t\t \t\n\t\t\t\t /// String FacultyHeader = \"KHOA KHOA HỌC VÀ KỸ THUẬT MÁY TÍNH\";\n\t\t\t\t String InfoStudentHeader1 = \"Họ Tên : ..........................\";\n\t\t\t\t String InfoStudentHeader2 = \"MSSV : ..........................\";\n\t\t\t\t PdfPTable table = new PdfPTable(new float[] { 75, 25 });\n\t\t\t\t table.setWidthPercentage(100);\n\t\t\t\t \n\t\t\t\t table.addCell(getCell(new Paragraph(SchoolHeader,fontHeader), PdfPCell.ALIGN_LEFT));\n\t\t\t\t \n\t\t\t\t table.addCell(getCell(new Paragraph(InfoStudentHeader1,fontHeader), PdfPCell.ALIGN_RIGHT));\n\t\t\t\t table.addCell(getCell(new Paragraph(FacultyHeader,fontHeader2), PdfPCell.ALIGN_LEFT));\n\t\t\t\t table.addCell(getCell(new Paragraph(InfoStudentHeader2,fontHeader), PdfPCell.ALIGN_RIGHT));\n\t\t\t\t table.setSpacingAfter(10);\n\t\t\t\t doc.add(table);\n\t\t\t\t \n\t\t\t\t // ADD title\n\t\t\t\t //Font fontTitle = FontFactory.getFont(FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);\n\t\t\t\t //String titleExam = \"ĐỀ KIỂM TRA CUỐI KÌ 2017\";\n\t\t\t\t // System.out.println(exportExam.getExamName().toUpperCase());\n\t\t\t\t String titleExam = exportExam2.getExamName().toUpperCase();\n\t\t\t\t \n\t\t\t\t Paragraph pHeader = new Paragraph(titleExam,fontTitle);\n\t\t\t\t pHeader.setAlignment(Paragraph.ALIGN_CENTER);\n\t\t\t\t doc.add(pHeader);\n\t\t\t\t \n\t\t\t\t String SubjectExam = \"Môn Thi : \" +exportExam2.getSubjectName();\n\t\t\t\t String CodeExam = \"Mã đề : \" + exportExam2.getCode();\n\t\t\t\t String timeExam = \"Thời gian : \" + exportExam2.getTime();\n\t\t\t\t Font fontSubject = new Font(base, 10, Font.NORMAL);\n\t\t\t\t Font fontExam = new Font(base, 10, Font.NORMAL);\n\t\t\t\t \n\t\t\t\t PdfPTable table2 = new PdfPTable(2);\n\t\t\t\t table2.setWidthPercentage(80);\n\t\t\t\t //System.out.println(Charset.forName(\"UTF-8\").encode(SchoolHeader));\n\n\t\t\t\t table2.addCell(getCell(new Paragraph(SubjectExam,fontSubject), PdfPCell.ALIGN_LEFT));\n\t\t\t\t \n\t\t\t\t table2.addCell(getCell(new Paragraph(timeExam,fontExam), PdfPCell.ALIGN_RIGHT));\n\t\t\t\t table2.addCell(getCell(new Paragraph(CodeExam,fontExam), PdfPCell.ALIGN_LEFT));\n\t\t\t\t table2.addCell(getCell(new Paragraph(\"\",fontHeader), PdfPCell.ALIGN_RIGHT));\n\t\t\t\t table2.setSpacingBefore(5);\n\t\t\t\t doc.add(table2);\n\t\t\t\t \n\t\t\t\t String noteExam = exportExam2.getNoteExam();\n\t\t\t\t Font fontNote = new Font(base, 8, Font.ITALIC);\n\t\t\t\t \n\t\t\t\t Paragraph pNote = new Paragraph(noteExam, fontNote);\n\t\t\t\t pNote.setAlignment(Paragraph.ALIGN_MIDDLE);\n\t\t\t\t doc.add(pNote);\n\t\t\t\t PdfPTable table3 = new PdfPTable(1);\n\t\t\t\t table3.setSpacingBefore(5);\n\t\t\t\t table3.setWidthPercentage(80);\n\t\t\t\t Font finalExam = new Font(base, 10, Font.NORMAL);\n\t\t\t\t table3.addCell(getCell(new Paragraph(\"*****\",finalExam), PdfPCell.ALIGN_CENTER));\n\t\t\t\t doc.add(table3);\n\t\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t for(int i = 0; i < listExam2.blockRootQuestion.size() ; i++){\n\t\t\t\t\t System.out.println(\"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\");\n\t\t\t\t\t \n\t\t\t\t\t List listBlock = new List(List.UNORDERED);\n\t\t\t\t\t listBlock.setAutoindent(false);\n\t\t\t\t\t // listBlock.setSymbolIndent(20);\t\n\t\t\t\t\t listBlock.add(new ListItem(new Paragraph(listExam2.blockRootQuestion.get(i).rootQuestionBlock.getContent(),fontContent)));\n\t\t\t\t System.out.println(\"########### Block NAME \" +listExam2.blockRootQuestion.get(i).rootQuestionBlock.getContent());\n\t\t\t\t\t \n\t\t\t\t\t doc.add(listBlock);\n\t\t\t\t \n\t\t\t\t \n\t\t\t \tSystem.out.println(\"########### SIZE QUESTION \" +listExam2.blockRootQuestion.get(i).questionList.size());\n\t \n\t\t\t\t for(int j = 0 ; j < listExam2.blockRootQuestion.get(i).questionList.size(); j++){\t\n\t\t\t\t \tSystem.out.println(\"########### QUESTION NAME \" +listExam2.blockRootQuestion.get(i).questionList.get(j).question.getContent());\n\t\t\t\t\t\t\t\n\t\t\t\t \t List listQuestion = new List(List.UNORDERED);\n\t\t\t\t\t\t listQuestion.setListSymbol(\"\");\n\t\t\t\t \t\n\t\t\t\t \t//SingleQuestion questionPDF = null;\n\t\t\t\t \t//questionPDF = listExam.blockRootQuestion.get(i).questionList.get(j);\n\t\t\t\t \tStringBuilder sb = new StringBuilder();\n\t\t\t\t\t\t\tsb.append(\"Câu \");\n\t\t\t\t\t\t\tsb.append(CoutExam);\n\t\t\t\t\t\t\tsb.append(\". \");\n\t\t\t\t\t\t\tString strI = sb.toString();\n\t\t\t\t \t//strI = new Paragraph(strI, fontNumber);\n\t\t\t\t \t//listQuestion.setPostSymbol(strI);\n\t\t\t\t \tSystem.out.println(strI);\n\t\t\t\t listQuestion.add(new ListItem(new Paragraph(strI + listExam2.blockRootQuestion.get(i).questionList.get(j).question.getContent(), fontContent)));\n\t\t\t\t listQuestion.setIndentationLeft(10);\n\t\t\t\t doc.add(listQuestion);\n\t\t\t\t List listAnswerPDF = new List(List.ORDERED, List.ALPHABETICAL);\n\t\t\t\t for(int k = 0; k < listExam2.blockRootQuestion.get(i).questionList.get(j).answerList.size(); k++){\n\t\t\t\t\t\t System.out.println(\"########### Answer NAME \" +listExam2.blockRootQuestion.get(i).questionList.get(j).answerList.get(k).getContent());\n\t\t\t\t\t\t if(listExam2.blockRootQuestion.get(i).questionList.get(j).answerList.get(k).getIssolution())\n\t\t\t\t \t listAnswerPDF.add(new ListItem(new Paragraph(listExam2.blockRootQuestion.get(i).questionList.get(j).answerList.get(k).getContent(), fontAnswent)));\n\t\t\t\t \t else \n\t\t\t\t\t \tlistAnswerPDF.add(new ListItem(new Paragraph(listExam2.blockRootQuestion.get(i).questionList.get(j).answerList.get(k).getContent(), fontContent)));\n\t\t\t\t }\n\t\t\t\t listAnswerPDF.setIndentationLeft(25);\n\t\t\t\t doc.add(listAnswerPDF);\n\t\t\t\t CoutExam++;\n\t\t\t\t }\n\t\t\t\t doc.add( Chunk.NEWLINE );\n\t\t\t\t }\n\t\t\t\t doc.close();\n\t\t\t\t listExam2=null;\n\t\t\t }\n\t\t\t model.clear();\n\t\t\t doc.close();\n\t\t\t exportExam = null;\n\t\t\t// exportExam2 = null;\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(\"ERROR \"+ e.getMessage());\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "private void createPDF(OutputStream os,String htmlFileName) {\n\t\tLog.info(\"url : \"+htmlFileName);\r\n //String HTML_TO_PDF = \"D:\\\\ConvertedFile.pdf\";\r\n // OutputStream os = new FileOutputStream(HTML_TO_PDF); \r\n \r\n /* File myhtml = new File(htmlFileName);\r\n FileInputStream fileinput = null;\r\n BufferedInputStream mybuffer = null;\r\n DataInputStream datainput = null;\r\n\r\n fileinput = new FileInputStream(myhtml);\r\n mybuffer = new BufferedInputStream(fileinput);\r\n datainput = new DataInputStream(mybuffer);\r\n\r\n while (datainput.available() != 0) {\r\n \t\r\n \tif(datainput.readLine().)\r\n \tSystem.out.println(datainput.readLine());\r\n \t}\r\n*/\r\n try {\r\n\t ITextRenderer renderer = new ITextRenderer();\r\n\t Log.info(\"Skill PDF Export->Create PDF->File name: \" + htmlFileName);\r\n\t renderer.setDocument(new File(htmlFileName)); \r\n\t renderer.layout();\r\n\t renderer.createPDF(os); \r\n\t os.close();\r\n }catch (Exception e) {\r\n \tLog.error(\"Error in SkillPdfExport\",e);\r\n }\r\n\t}", "@Override\r\n\tpublic File createPDF() {\n\t\treturn null;\r\n\t}", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"application/pdf\");\n String fileName = request.getParameter(\"license_name\");\n String ext = fileName.substring(fileName.lastIndexOf(\".\") + 1);\n String path = System.getProperty(\"user.dir\") + \"/documents/licenses/\" + fileName;\n path = path.replaceAll(\"%20\", \" \");\n if (ext.equalsIgnoreCase(\"pdf\")) {\n FileInputStream baos = new FileInputStream(path);\n\n OutputStream os = response.getOutputStream();\n\n byte buffer[] = new byte[8192];\n int bytesRead;\n\n while ((bytesRead = baos.read(buffer)) != -1) {\n os.write(buffer, 0, bytesRead);\n }\n\n os.flush();\n os.close();\n } else {\n try {\n // Document Settings //\n Document document = new Document();\n PdfWriter.getInstance(document, response.getOutputStream());\n document.open();\n\n // Loading MC //\n PdfPTable table = new PdfPTable(1);\n table.setWidthPercentage(100);\n // the cell object\n PdfPCell cell;\n\n Image img = Image.getInstance(path);\n int indentation = 0;\n float scaler = ((document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin() - indentation) / img.getWidth()) * 100;\n img.scalePercent(scaler);\n //img.scaleAbsolute(80f, 80f);\n cell = new PdfPCell(img);\n cell.setBorder(Rectangle.NO_BORDER);\n table.addCell(cell);\n document.add(table);\n //-----------------------------------//\n document.close();\n } catch (DocumentException de) {\n throw new IOException(de.getMessage());\n }\n }\n\n }", "@GetMapping(\"/GeneratePDF\")\n public String getPDFView(Model model) throws Exception {\n util.createPdf(\"homepage\");\n model.addAttribute(\"message\", \"PDF Downloaded successfully..\");\n return \"success\";\n }", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n \r\n String url = request.getParameter(\"text\");\r\n \r\n response.setContentType(\"application/pdf\");\r\n ServletOutputStream out = response.getOutputStream();\r\n convertToPdf(url,out);\r\n out.flush();\r\n out.close();\r\n }", "private void createPdf(CartReceiptResponse receiptResponse, HttpServletResponse response, Locale localeObj)\n throws DocumentException, IOException {\n /* Get the output stream for writing PDF object */\n final OutputStream out = response.getOutputStream();\n Document document = new Document();\n PdfWriter writer = PdfWriter.getInstance(document, out);\n document.open();\n\n\t\t/* Start Add Image */ \n /* add Logo image based on application id Getting Image path from Resource bundle*/\n final String logoFileClasspath = getMessage(localeObj, \"pdf.receipt.logoImageUrl\");\n URL path = PdfServlet.class.getClassLoader().getResource(logoFileClasspath);\n if (null == path) {\n throw new FileNotFoundException(\"unable to find logoImage in classpath: \" + logoFileClasspath);\n }\n Image logoImage = Image.getInstance(path);\n\n\t\t/* Start of Bill Submit Section */\n PdfPTable logoImageTable = new PdfPTable(1);/* Table for the Logo Image */\n /* Logo added to PDF cell constructor */\n PdfPCell logoImageCell = new PdfPCell(logoImage);\n PdfPCell logoBlankSpaceCell = new PdfPCell(new Phrase(\" \", getFont(WHITE_COLOR, 8, Font.BOLD)));\n cellAlignment(logoImageCell, Element.ALIGN_CENTER, \"\", 0);\n cellAddingToTable(logoImageTable, logoImageCell, Rectangle.LEFT | Rectangle.TOP | Rectangle.RIGHT, 0, 0);\n\n cellAlignment(logoImageCell, Element.ALIGN_LEFT, \"\", 0);\n cellAddingToTable(logoImageTable, logoBlankSpaceCell, Rectangle.LEFT | Rectangle.RIGHT, 0, 0);\n document.add(logoImageTable);\n /* End Add Logo Image */ \n\n\t\t/* create PDF header section */\n pdfReceiptIdSection(receiptResponse, document, localeObj);\n /* Designing bill transaction information to show biller name and amount*/\n designBillTransactionInfo(receiptResponse, document, localeObj);\n /* create payment method section */\n pdfPaymentMethod(receiptResponse, document, localeObj);\n /* Appending line below the document */\n pdfInfoMessage(document, localeObj);\n /* New page creating for merging existing PdF page in to current PDF */\n document.newPage();\n try {\n getPdfFromAwsLink(writer, localeObj);/* Call to merge existing PDF to current PDf */\n } catch (final Exception e) {\n LOGGER.error(\"trouble while merging PDF disclosure\", e);\n }\n document.close();\n LOGGER.debug(\"End PDF Created \");\n }", "private void setResponseHeaders(final HttpServletResponse response, final boolean isSave) {\n /* Browser will open the document only if this is set */\n LOGGER.debug(\"Inside response headers\");\n response.reset();\n response.setHeader(\"Expires\", \"0\");\n response.setHeader(\"Cache-Control\", \"must-revalidate, post-check=0,pre-check=0\");\n response.setHeader(\"Pragma\", \"public\");\n response.setHeader(\"Pragma\", \"no-cache\"); // HTTP 1.0\n response.setDateHeader(\"Expires\", 0); /* prevents caching at the proxy */\n response.setHeader(\"Cache-Control\", \"no-cache\"); // HTTP 1.1\n response.setHeader(\"Cache-Control\", \"max-age=0\");\n\n if (isSave) {\n response.setHeader(\"Content-Disposition\", \"attachment; filename=paymentReceipt.pdf\");\n } else {\n response.setHeader(\"Content-disposition\", \"inline; filename=paymentReceipt.pdf\");\n }\n /* Set content type to application / pdf */\n response.setContentType(\"application/pdf\");\n }", "@Override\n public byte[] toPdf() {\n return content.getBytes();\n }", "@Override\n protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {\n ByteArrayOutputStream baos = createTemporaryOutputStream();\n\n // Apply preferences and build metadata.\n Document document = new Document();\n PdfWriter writer = PdfWriter.getInstance(document, baos);\n prepareWriter(model, writer, request);\n buildPdfMetadata(model, document, request);\n\n // Build PDF document.\n writer.setInitialLeading(16);\n document.open();\n buildPdfDocument(model, document, writer, request, response);\n document.close();\n\n // Flush to HTTP response.\n writeToResponse(response, baos);\n\n }", "private void generarDocP(){\n generarPdf(this.getNombre());\n }", "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 }", "@RequestMapping(\"/venPdf\")\r\n\tpublic String doPdfExport(ModelMap map){\r\n\t\tList<Vendor> venList=service.getAllVendors();\r\n\t\tmap.addAttribute(\"venList\",venList);\r\n\t\treturn \"VenPdfView\";\r\n\t}", "protected DownloadAction.StreamInfo getStreamInfo(ActionMapping mapping,\n ActionForm form,\n HttpServletRequest request,\n HttpServletResponse response)\n throws Exception {\n String contentType = \"application/pdf\";\n System.out.println(\"\");\n\n String fileDir=\"/tratado\"; //directory where all files are created and located \n String fileName=\"/tratado.pdf\"; \n \n File file = new File(request.getRealPath(\"/WEB-INF\")+fileDir+fileName);\n\n\n FileOutputStream f = new FileOutputStream(file);\n Document document = new Document();\n\n try {\n PdfWriter writer = PdfWriter.getInstance(document, f);\n// PdfContentByte cb = writer.getDirectContent();\n Rectangle rct = new Rectangle(36, 54, 559, 788);\n //Definimos un nombre y un tamaño para el PageBox los nombres\n //posibles son: “crop”, “trim”, “art” and “bleed”.\n writer.setBoxSize(\"art\", rct);\n //HeaderFooter event = new HeaderFooter(this.getId(), this.getNumAutenticacion());\n //writer.setPageEvent(event);\n document.open();\n \n PdfContentByte cb = writer.getDirectContent();\n cb.saveState();\n cb.setColorStroke(new CMYKColor(1f, 0f, 0f, 0f));\n cb.setColorFill(new CMYKColor(1f, 0f, 0f, 0f));\n cb.rectangle(20,10,10,820);\n cb.fill();\n cb.restoreState();\n \n //Encabezado\n Font fuenteEnc = new Font(Font.getFamily(\"ARIAL\"), 10, Font.BOLD);\n Font fuenteTitulo = new Font(Font.getFamily(\"ARIAL\"), 12, Font.BOLD);\n Font fuenteText = new Font(Font.getFamily(\"ARIAL\"), 10);\n DateFormat dates = new SimpleDateFormat(\"dd/MM/yyyy\");\n Date date = new Date();\n //Logos\n //http://upload.wikimedia.org/wikipedia/commons/2/21/USB_logo.svg USB\n \n Image usblogo = Image.getInstance(request.getRealPath(\"/interfaz/imagenes/StickerIAEAL2.png\"));\n usblogo.scaleAbsolute(100f, 50f);\n usblogo.setAbsolutePosition(430f, 740f);\n document.add(usblogo);\n \n usblogo = Image.getInstance(request.getRealPath(\"/interfaz/imagenes/logoUSB.png\"));\n usblogo.scaleAbsolute(80f, 45f);\n usblogo.setAbsolutePosition(90f, 740f);\n document.add(usblogo);\n \n\n String encabezado = \"\\nSartenejas \" + dates.format(date) + \"\\n\"\n + \"República Bolivariana de Venezuela \\n\"\n + \"Universidad Simón Bolívar \\n\"\n + \"Instituto de Altos Estudios de América Latina \\n\"\n + \"Sistema de Tratados y Acuerdos Internacionales de Venezuela\\n\";\n Paragraph pa = new Paragraph(encabezado, fuenteEnc);\n pa.setSpacingBefore(50);\n pa.setSpacingAfter(50);\n pa.setIndentationLeft(50);\n document.add(pa);\n\n // Titulo del Tratado.\n\n PdfPTable cuadro = new PdfPTable(1);\n Paragraph p = new Paragraph(\"Título: \\n\\n\\n\\n\\n\", fuenteTitulo);\n cuadro.addCell(p);\n document.add(cuadro);\n\n PdfPTable cuadro1 = new PdfPTable(2);\n\n String s = \"Fecha de Firma: \";\n p = new Paragraph(s, fuenteText);\n PdfPCell cell1 = new PdfPCell(p);\n cuadro1.addCell(cell1);\n\n s = \"Lugar de Firma: \\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n s = \"Fecha de Depósito: \\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n s = \"Entrada en Vigor: \\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n s = \"Fecha de Publicación en Gaceta Oficial: \\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n s = \"Numero de Gaceta Oficial: \\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n s = \"Duración: \\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n s = \"Período: \\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n s = \"Volúmen: \\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n s = \"Página: \\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n s = \"Países: \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n s = \"Grupos: \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\";\n cuadro1.addCell(new Paragraph(s, fuenteText));\n\n document.add(cuadro1);\n document.close();\n f.flush();\n f.close();\n } catch (Exception e) {\n //imprimimos los errores\n System.err.println(e);\n e.printStackTrace();\n }\n return new DownloadAction.FileStreamInfo(contentType, file);\n }", "public static void respondReportOutput(CusJasperReportDef jasperReport, boolean forceDownload,HttpServletResponse response) throws IOException {\n if (jasperReport == null || jasperReport.getContent() == null) {\n \n } else {\n \t\n String outputFileName = (jasperReport.getOutputFilename()) + \".\" + jasperReport.getReportFormat().getExtension();\n String contentDisposition = forceDownload == true ? \"attachment;filename=\\\"\"+outputFileName+\"\\\"\": \"filename=\\\"\"+outputFileName+\"\\\"\";\n response.setContentType(jasperReport.getReportFormat().getMimeType());\n response.setHeader(\"Content-Disposition\", contentDisposition);\n response.addHeader(\"Content-Length\",Integer.toString(jasperReport.getContent().length));\n OutputStream os = response.getOutputStream();\n\n try {\n os.write(jasperReport.getContent() , 0, jasperReport.getContent().length);\n } catch (Exception excp) {\n //handle error\n } finally {\n os.close();\n }\n \n }\n\n }", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException\n {\n response.setContentType(\"text/html;charset=UTF-8\");\n PrintWriter out = response.getWriter();\n try\n {\n Connection con = conexao.abrirConexao();\n HashMap parametros = new HashMap();\n \n HttpSession session = request.getSession();\n \n ServletContext sc = getServletContext();\n String nomeArquivo = sc.getRealPath(\"/\") + \"RelatorioPC.pdf\";\n JasperPrint jp = JasperFillManager.fillReport(sc.getRealPath(\"/jasper/RelatorioPC.jasper\"), parametros, con);\n JasperExportManager.exportReportToPdfFile(jp, nomeArquivo); \n \n response.sendRedirect(\"RelatorioPC.pdf\");\n\n }\n catch (Exception e)\n {\n System.err.println(\"Erro3: \" + e);\n }\n finally\n {\n //out.close();\n }\n }", "@Override\n public List<OmOrderHeaders> printPDF(IRequest requestCtx, @StdWho List<OmOrderHeaders> States) {\n PDFReport pdfPrint = new PDFReport();\n\n OmOrderHeaders notice=null;\n //List<OmOrderHeaders> trade=new ArrayList<OmOrderHeaders>();\n\n for (OmOrderHeaders state : States) {\n if (state.getHeaderId() != null) {\n notice=state;\n }\n }\n\n File file = new File(\"C:\\\\Users\\\\PB\\\\Desktop\\\\\"+notice.getOrderNumber()+\".pdf\");\n List<OmOrderLines> omOrderLines = omOrderLinesMapper.selectSumPrice(notice);\n\n\n try {\n\n BaseFont bfChinese=PDFReport.bfChinese;\n Font headfont =PDFReport.headfont;\n Font keyfont=PDFReport.keyfont;\n Font textfont=PDFReport.textfont;\n\n file.createNewFile();\n Document document = new Document();\n\n document.setPageSize(PageSize.A4);\n PdfWriter.getInstance(document, new FileOutputStream(file));\n document.open();\n PdfPTable table= pdfPrint.createTable(6);\n\n table.addCell(pdfPrint.createCell(\".订单打印:\", headfont, Element.ALIGN_LEFT,6,false));\n table.addCell(pdfPrint.createCell(\" \", keyfont, Element.ALIGN_LEFT,6,false));\n table.addCell(pdfPrint.createCell(\" \", keyfont, Element.ALIGN_LEFT,6,false));\n\n\n table.addCell(pdfPrint.createCell(\"订单编号:\", keyfont, Element.ALIGN_RIGHT,0,false));\n //table.addCell(pdfPrint.createCell(notice.getOrderNumber(), textfont, Element.ALIGN_CENTER));\n table.addCell(pdfPrint.createCell(notice.getOrderNumber(), textfont,Element.ALIGN_LEFT));\n table.addCell(pdfPrint.createCell(\"公司名称:\", keyfont, Element.ALIGN_RIGHT,0,false));\n OrgCompanys orgCompanys = orgCompanysMapper.selectByPrimaryKey(notice.getCompanyId());\n table.addCell(pdfPrint.createCell(orgCompanys.getCompanyName(), textfont, Element.ALIGN_LEFT));\n ArCustomers arCustomers = arCustomersMapper.selectByPrimaryKey(notice.getCustomerId());\n table.addCell(pdfPrint.createCell(\"客户名称:\", keyfont, Element.ALIGN_RIGHT,0,false));\n table.addCell(pdfPrint.createCell(arCustomers.getCustomerName(), textfont, Element.ALIGN_LEFT));\n table.addCell(pdfPrint.createCell(\" \", keyfont, Element.ALIGN_LEFT,6,false));\n\n\n table.addCell(pdfPrint.createCell(\"订单日期:\", keyfont, Element.ALIGN_RIGHT,0,false));\n table.addCell(pdfPrint.createCell(new SimpleDateFormat(\"yyyy/MM/dd\").format(notice.getOrderDate()), textfont, Element.ALIGN_LEFT));\n long sum = 0;\n for(int i=0;i<omOrderLines.size();i++) {\n OmOrderLines ot = new OmOrderLines();\n ot = omOrderLines.get(i);\n sum = sum + ot.getOrderdQuantity()*ot.getUnitSellingPrice();\n\n }\n\n\n table.addCell(pdfPrint.createCell(\"订单总金额:\", keyfont, Element.ALIGN_RIGHT,0,false));\n table.addCell(pdfPrint.createCell(String.valueOf(sum), textfont, Element.ALIGN_LEFT));\n table.addCell(pdfPrint.createCell(\"订单状态:\", keyfont, Element.ALIGN_RIGHT,0,false));\n String s=\"\";\n if(notice.getOrderStatus().equals(\"NEW\")){\n s=\"新建\";\n }else if(notice.getOrderStatus().equals(\"SUBMITED\")){\n s=\"已提交\";\n }else if(notice.getOrderStatus().equals(\"APPROVED\")){\n s=\"已审批\";\n }else if(notice.getOrderStatus().equals(\"REJECTED\")){\n s=\"已拒绝\";\n }\n table.addCell(pdfPrint.createCell(s, textfont, Element.ALIGN_LEFT));\n table.addCell(pdfPrint.createCell(\" \", keyfont, Element.ALIGN_LEFT,6,false));\n table.addCell(pdfPrint.createCell(\" \", keyfont, Element.ALIGN_LEFT,6,false));\n\n table.addCell(pdfPrint.createCell(\"主要:\", headfont, Element.ALIGN_LEFT,6,false));\n\t\ttable.addCell(pdfPrint.createCell(\"物料编码\", textfont, Element.ALIGN_CENTER));\n\t\ttable.addCell(pdfPrint.createCell(\"物料描述\", textfont, Element.ALIGN_CENTER));\n\t\ttable.addCell(pdfPrint.createCell(\"产品单位\", textfont, Element.ALIGN_CENTER));\n\t\ttable.addCell(pdfPrint.createCell(\"数量\", textfont, Element.ALIGN_CENTER));\n table.addCell(pdfPrint.createCell(\"销售单价\", textfont, Element.ALIGN_CENTER));\n table.addCell(pdfPrint.createCell(\"金额\", textfont, Element.ALIGN_CENTER));\n\n\t\tfor(int i=0;i<omOrderLines.size();i++){\n OmOrderLines ot = new OmOrderLines ();\n ot = omOrderLines.get(i);\n InvInventoryItems invInventoryItems = invInventoryItemsMapper.selectByPrimaryKey(ot.getInventoryItemId());\n\t\t\ttable.addCell(pdfPrint.createCell(invInventoryItems.getItemCode(), textfont));\n\t\t\ttable.addCell(pdfPrint.createCell(invInventoryItems.getItemDescription(), textfont));\n\t\t\ttable.addCell(pdfPrint.createCell(ot.getOrderQuantityUom(), textfont));\n\t\t\ttable.addCell(pdfPrint.createCell(String.valueOf(ot.getOrderdQuantity()), textfont));\n table.addCell(pdfPrint.createCell(String.valueOf(ot.getUnitSellingPrice()), textfont));\n table.addCell(pdfPrint.createCell(String.valueOf(ot.getOrderdQuantity()*ot.getUnitSellingPrice()), textfont));\n\t\t}\n\t\ttry {\n\t\t\tdocument.add(table);\n\n\t\t}catch(Exception e){e.printStackTrace(); }\n\n\t\tdocument.close();\n }catch(Exception e){e.printStackTrace();}\n\n\n return States;\n }", "ByteArrayOutputStream createPDF(String templateName, Map<String, Object> params,\n String companyId, String notificationType);", "protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException\n\t{\n\t\t ServletOutputStream os = response.getOutputStream();\n\t\t response.setContentType(\"application/pdf\"); \n\t\t Document doc = new Document();\n\n\t\t //create some special styles and font sizes\n\t\t Font bfBold18 = new Font(FontFamily.TIMES_ROMAN, 18, Font.BOLD, new BaseColor(0, 0, 0)); \n\t\t Font bfBold12 = new Font(FontFamily.TIMES_ROMAN, 12, Font.BOLDITALIC, new BaseColor(0, 0, 0)); \n\t\t Font bf12 = new Font(FontFamily.TIMES_ROMAN, 12); \n\n\t\t Connection conn = null; \n\t\t PreparedStatement stmt = null; \n\t\t String sql = null;\n\t\t \n\t\t try{\n\t\t\t \n\t\t\t //create an instance of the PdfWriter using the output stream\n\t\t\t PdfWriter.getInstance(doc, os); \n\n\t\t\t //document header properties\n\t\t\t doc.addAuthor(\"betterThanZero\");\n\t\t\t doc.addCreationDate();\n\t\t\t doc.addProducer();\n\t\t\t doc.addCreator(\"MySampleCode.com\");\n\t\t\t doc.addTitle(\"DemoPDF\");\n\t\t\t doc.setPageSize(PageSize.LETTER);\n\t\t\t doc.open();\n\n\t\t\t //add a new paragraph\n\t\t\t doc.add( new Paragraph(\"List of Countries...\", bfBold18));\n\t\t\t \n\t\t\t //connection to the MySQL database\n\t\t\t Context ctx = (Context) new InitialContext().lookup(\"java:comp/env\");\n\t\t\t conn = ((DataSource) ctx.lookup(\"jdbc/mysql\")).getConnection(); \n\n\t\t\t //just get 10 countries from my database for demo\n\t\t\t sql = \"Select * from country where name >= 'C' order by name,code LIMIT 0,10\"; \n\t\t\t stmt = conn.prepareStatement(sql);\n\n\t\t\t ResultSet rs = stmt.executeQuery(); \n\t\t\t while(rs.next()){ \n\t\t\t //create an anchor reference\n\t\t\t Anchor anchor = new Anchor(rs.getString(\"name\").trim(),bfBold12);\n\t\t\t anchor.setReference(\"#\" + rs.getString(\"code\").trim());\n\t\t\t //add the anchor to the document\n\t\t\t doc.add(anchor);\n\t\t\t //add an empty line\n\t\t\t doc.add( Chunk.NEWLINE );\n\t\t\t } \n\t\t\t \n\t\t\t // Move cursor to the first row\n\t\t\t rs.first();\n\n\t\t\t while(rs.next()){ \n\t\t\t //start a new page here\n\t\t\t doc.newPage();\n\t\t\t //create a new paragraph for each country\n\t\t\t Paragraph countryParagraph = new Paragraph();\n\t\t\t //create an anchor\n\t\t\t Anchor anchor = new Anchor(rs.getString(\"name\"), bfBold18);\n\t\t\t anchor.setName(rs.getString(\"code\").trim());\n\t\t\t //add the anchor to the paragraph\n\t\t\t countryParagraph.add(anchor);\n\t\t\t //add the paragraph to the document\n\t\t\t doc.add(countryParagraph);\n\t\t\t \n\t\t\t //add some detail information about the country\n\t\t\t doc.add( new Paragraph(\"Country Code: \" + rs.getString(\"code\").trim(), bf12));\n\t\t\t doc.add( new Paragraph(\"Continent: \" + rs.getString(\"continent\").trim(), bf12));\n\t\t\t doc.add( new Paragraph(\"Region: \" + rs.getString(\"region\").trim(), bf12));\n\t\t\t doc.add( new Paragraph(\"Life Expectancy: \" + rs.getString(\"lifeExpectancy\").trim(), bf12));\n\t\t\t doc.add( new Paragraph(\"GNP: \" + rs.getString(\"gnp\").trim(), bf12));\n\t\t\t }\n\n\t\t\t rs.close(); \n\t\t\t stmt.close(); \n\t\t\t stmt = null; \n\n\t\t\t conn.close(); \n\t\t\t conn = null; \n\n\n\t\t\t doc.close(); \n\n\t\t\t }catch(DocumentException e){\n\t\t\t e.printStackTrace();\n\t\t\t }\n\t\t\t catch(Exception e){\n\t\t\t e.printStackTrace();\n\t\t\t }\n\n\t\t\t \n\t}", "@RequestMapping(value = \"/getpdfopenpdf\", method = RequestMethod.GET,\n produces = MediaType.APPLICATION_PDF_VALUE)\n public ResponseEntity<InputStreamResource> getOpenPdfReports() {\n\n List<City> cities = CityService.getCities();\n\n ByteArrayInputStream bis = GeneratePdfOpenPdf.getOpenPdfReport();\n\n HttpHeaders headers = new HttpHeaders();\n headers.add(\"Content-Disposition\", \"inline; filename=citiesreport.pdf\");\n\n return ResponseEntity\n .ok()\n .headers(headers)\n .contentType(MediaType.APPLICATION_PDF)\n .body(new InputStreamResource(bis));\n }", "@SneakyThrows\n private void pdfReport() {\n NotificationUtil.warningAlert(\"Warning\", \"Nothing to export\", NotificationUtil.SHORT);\n ServiceFactory.getPdfService().projectReport(table.getItems());\n }", "ByteArrayOutputStream createPDF(String pdfTextUrl);", "@GetMapping(\"/getPdf\")\n\tpublic ResponseEntity<byte[]> getPdf(@RequestParam (name=\"id\")long id,\n\t\t\t@RequestParam (name=\"start\")String start,@RequestParam (name=\"end\")String end,\n\t\t\t@RequestParam (name=\"period\", required=false,defaultValue=\"0\") int period)\n\t{\n\t\tAppraisal appraisal=null;\n\t\ttry{\n\t\t\tappraisal=appraisalService.getOneAppraisal(id);\n\t\t}catch(Exception e)\n\t\t{\n\t\t\terror(id);\n\t\t}\n\t\tlong attVal=appraisal.getAttendance();\n\t\tlong punVal=appraisal.getPunctuality();\n\t\tlong codeVal=appraisal.getCodeQuality();\n\t\tlong policyVal=appraisal.getCompanyPolicy();\n\t\tlong targetVal=appraisal.getMeetingTargets();\n\t\tString att=getComment(attVal);\n\t\tString pun=getComment(punVal);\n\t\tString code=getComment(codeVal);\n\t\tString policy=getComment(policyVal);\n\t\tString target=getComment(targetVal);\n\n\t\tString month=\"Random Days\";\n\t\tif(period>0)month=new DateFormatSymbols().getMonths()[period-1]+\" Month\";\n\t\tbyte[] pdfContents=null;\n\t\ttry {\n\t\t\tpdfContents=jasperService.getReportAsPdfUsingDatabase(id,att,pun,code,policy,target,start,end,month);\n\t\t} catch (JRException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tHttpHeaders headers=new HttpHeaders();\n\t\theaders.setContentType(MediaType.parseMediaType(\"application/pdf\"));\n\t\tString fileName=\"Appraisal.pdf\";\n\t\theaders.add(\"content dis-position\",\"attachment: filename=\"+fileName);\n\t\tResponseEntity<byte[]> response=new ResponseEntity<byte[]>(pdfContents,headers,HttpStatus.OK);\n\t\treturn response;\n\t}", "@RequestMapping(value = \"/downloadBulkPdf\", method = RequestMethod.GET)\r\n\tpublic @ResponseBody\r\n\tString downloadBulkPdf(@ModelAttribute(\"groupDownload\") BulkDownloadTO bulkDownloadTO, HttpServletRequest request, HttpServletResponse response) throws Exception {\r\n\t\tlogger.log(IAppLogger.INFO, \"Enter: downloadBulkPdf()\");\r\n\t\tString currentUser = (String) request.getSession().getAttribute(IApplicationConstants.CURRUSER);\r\n\t\tString currentUserId = (String) request.getSession().getAttribute(IApplicationConstants.CURRUSERID);\r\n\t\tString currentOrg = (String) request.getSession().getAttribute(IApplicationConstants.CURRORG);\r\n\t\tString customer = (String) request.getSession().getAttribute(IApplicationConstants.CUSTOMER);\r\n\t\tlong currCustomer = (customer == null) ? 0 : Long.parseLong(customer);\r\n\t\tString status = \"Error\";\r\n\t\ttry {\r\n\t\t\t// remove retain bulk value\r\n\t\t\trequest.getSession().removeAttribute(\"retainBulkDownloadTO\");\r\n\t\t\tString fileType = request.getParameter(\"fileType\");\r\n\t\t\tString nodeid = (String) request.getParameter(\"tenantId\");\r\n\t\t\tString adminYear = (String) request.getParameter(\"AdminYear\");\r\n\t\t\tString reportUrl = (String) request.getParameter(\"reportUrl\");\r\n\t\t\tString docName = CustomStringUtil.appendString(currentUser, \" \", Utils.getDateTime(), \"_Querysheet.pdf\");\r\n\r\n\t\t\tString school = null, corp = null, orgClass = null, testProgram = null, grade = null;\r\n\t\t\tif (!\"CR\".equals(fileType)) {\r\n\t\t\t\tMap<String, Object> parameters = null;\r\n\t\t\t\tparameters = (Map<String, Object>) request.getSession().getAttribute(IApplicationConstants.REPORT_TYPE_CUSTOM + \"parameters\" + reportUrl);\r\n\t\t\t\twhile (parameters == null) {\r\n\t\t\t\t\tlogger.log(IAppLogger.WARN, \"Waiting for custom report parameter .... \");\r\n\t\t\t\t\tThread.sleep(2000);\r\n\t\t\t\t\tparameters = (Map<String, Object>) request.getSession().getAttribute(IApplicationConstants.REPORT_TYPE_CUSTOM + \"parameters\" + reportUrl);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tadminYear = (String) parameters.get(\"p_adminYear\");\r\n\t\t\t\tschool = (String) parameters.get(\"p_school\");\r\n\t\t\t\tcorp = (String) parameters.get(\"p_corp\");\r\n\t\t\t\torgClass = (String) parameters.get(\"p_class\");\r\n\t\t\t\tgrade = (String) parameters.get(\"p_gradeid\");\r\n\t\t\t\ttestProgram = (String) parameters.get(\"p_testProgram\");\r\n\t\t\t}\r\n\t\t\tbulkDownloadTO.setQuerysheetFile(docName);\r\n\t\t\tbulkDownloadTO.setUdatedBy((currentUserId == null) ? 0 : Long.parseLong(currentUserId));\r\n\t\t\tbulkDownloadTO.setUsername(currentUser);\r\n\t\t\tbulkDownloadTO.setTestAdministration(adminYear);\r\n\t\t\tbulkDownloadTO.setSchool(school);\r\n\t\t\tbulkDownloadTO.setCorp(corp);\r\n\t\t\tbulkDownloadTO.setOrgClass(orgClass);\r\n\t\t\tbulkDownloadTO.setTestProgram(testProgram);\r\n\t\t\tbulkDownloadTO.setGrade(grade);\r\n\t\t\tbulkDownloadTO.setCustomerId(customer);\r\n\t\t\tbulkDownloadTO.setReportUrl(reportUrl);\r\n\t\t\tbulkDownloadTO.setRequestType(fileType);\r\n\t\t\tbulkDownloadTO.setDownloadMode(request.getParameter(\"mode\"));\r\n\r\n\t\t\tbulkDownloadTO = inorsService.createJob(bulkDownloadTO);\r\n\r\n\t\t\tString querysheetFile = PdfGenerator.generateQuerysheet(bulkDownloadTO, propertyLookup);\r\n\r\n\t\t\tlogger.log(IAppLogger.INFO, \"sending messsage --------------- \");\r\n\t\t\tmessageProducer.sendJobForProcessing(String.valueOf(bulkDownloadTO.getJobId()), Utils.getContractName());\r\n\r\n\t\t\tif (bulkDownloadTO.getJobId() != 0)\r\n\t\t\t\tstatus = \"Success\";\r\n\r\n\t\t\tresponse.setContentType(\"application/json\");\r\n\t\t\tresponse.getWriter().write(\"\");\r\n\t\t\tresponse.getWriter().write(\"{\\\"status\\\":\\\"\" + status + \"\\\"}\");\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.log(IAppLogger.ERROR, e.getMessage(), e);\r\n\t\t\te.printStackTrace();\r\n\t\t\tresponse.getWriter().write(\"{\\\"status\\\":\\\"\" + status + \"\\\"}\");\r\n\t\t}\r\n\t\tlogger.log(IAppLogger.INFO, \"Exit: downloadBulkPdf()\");\r\n\t\treturn null;\r\n\t}", "private CIProperties getPdfProperties() {\n CIProperties pdfProps = new CIProperties();\n pdfProps.put(\"RESPONSE\",\"HTTP/1.0 200 OK\");\n pdfProps.put(\"Date\", \"Fri, 06 Apr 2012 18:22:49 GMT\");\n pdfProps.put(\"Server\", \"Apache/2.2.3 (CentOS)\");\n pdfProps.put(\"X-Powered-By\", \"PHP/5.2.17\");\n pdfProps.put(\"Expires\", \"Thu, 19 Nov 1981 08:52:00 GMT\");\n pdfProps.put(\"Cache-Control\", \"no-store, no-cache, must-revalidate, post-check=0, pre-check=0\");\n pdfProps.put(\"Pragma\", \"no-cache\");\n pdfProps.put(\"X-Lockss-content-type\", \"application/pdf; charset=UTF-8\");\n pdfProps.put(\"X-Cache\", \"MISS from lockss.org\");\n pdfProps.put(\"X-Cache-Lookup\", \"MISS from lockss.org:8888\");\n pdfProps.put(\"Via\", \"1.1 lockss.org:8888 (squid/2.7.STABLE7)\");\n pdfProps.put(\"Connection\", \"close\");\n return pdfProps;\n }", "private void writeText(HttpServletResponse response, String outText) throws IOException {\n\t\tresponse.setContentType(CONTENT_TYPE);\n\t\tPrintWriter out = response.getWriter();\n\t\tout.print(outText);\n\t\t// 將輸出資料列印出來除錯用\n\t\tSystem.out.println(\"output: \" + outText);\n\n\t}", "@Override\r\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n try {\r\n processRequest(request, response);\r\n } catch (ClassNotFoundException ex) {\r\n Logger.getLogger(generaPDF.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (SQLException ex) {\r\n Logger.getLogger(generaPDF.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }", "@GetMapping(\"/report\")\n\tpublic ResponseEntity<byte[]> report(@RequestParam (name=\"month\")String month)\n\t{\n\t\tSystem.out.println(month+\" ///////////////////////////////////////////\");\n\t\tbyte[] pdfContents=null;\n\t\ttry {\n\t\t\tpdfContents=jasperService.getReportAsPdfUsingJavaBeans(reportList,month);\n\t\t} catch (JRException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tHttpHeaders headers=new HttpHeaders();\n\t\theaders.setContentType(MediaType.parseMediaType(\"application/pdf\"));\n\t\tString fileName=\"Appraisal.pdf\";\n\t\theaders.add(\"content dis-position\",\"attachment: filename=\"+fileName);\n\t\tResponseEntity<byte[]> response=new ResponseEntity<byte[]>(pdfContents,headers,HttpStatus.OK);\n\t\treturn response;\n\t}", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n\n\n // creating the document object\n Document document = new Document(PageSize.A4, 30, 30, 30, 30);\n\n // creating an OutputStream\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n\n // get data from session\n LLAppMain llAppMain = new LLAppMain();\n long oidLLAppMain = FRMQueryString.requestLong(request, \"oidLLAppMain\");\n try\n {\n llAppMain = PstLLAppMain.fetchExc(oidLLAppMain);\n }\n catch(Exception e)\n {\n System.out.println(\"Exc : \"+e.toString());\n }\n \n //First Config\n String[] aTitle = {\n \"LONG LEAVE (LL) REQUEST\"\n };\n\n //Setting Footer\n String strFooterText = \"Hard Rock Hotel - Bali | \";\n boolean isUsePageFooter = false;\n String strFooterDateFormat = \"MMMM dd, yyyy\";\n\n boolean isUseLogo = true;\n \n try {\n\n // creating an instance of the writer\n PdfWriter writer = PdfWriter.getInstance(document, baos);\n \n // step 3.1: adding some metadata to the document\n document.addSubject(\"This is a subject.\");\n document.addSubject(\"This is a subject two.\"); \n \n // FOOTER\n HeaderFooter footer = new HeaderFooter(new Phrase(strFooterText+Formater.formatDate(new Date(), strFooterDateFormat), fontHeaderSmall),isUsePageFooter);\n footer.setAlignment(Element.ALIGN_RIGHT);\n footer.setBorder(Rectangle.TOP);\n footer.setBorderColor(blackColor);\n // document.setFooter(footer);\n \n // step 3.4: opening the document\n document.open();\n \n //INFORMATION\n //Header\n Table tableHeader = createHeader(aTitle,isUseLogo);\n document.add(tableHeader);\n \n //Emp Date\n Table tableEmpDetail = createEmpId(llAppMain);\n createDetail(llAppMain, tableEmpDetail);\n createApproval(llAppMain, tableEmpDetail);\n document.add(tableEmpDetail);\n \n //Menampilkan Report\n \n \n //End -- Menampilkan Report\n \n }\n catch(DocumentException de) \n {\n System.err.println(de.getMessage());\n de.printStackTrace();\n }\n\n // closing the document \n document.close();\n\n // we have written the pdfstream to a ByteArrayOutputStream, now going to write this outputStream to the ServletOutputStream\n\t// after we have set the contentlength \n response.setContentType(\"application/pdf\");\n response.setContentLength(baos.size());\n ServletOutputStream out = response.getOutputStream();\n baos.writeTo(out);\n out.flush();\n }", "@RequestMapping(\"/pdf\")\r\n\tpublic ModelAndView showPdf(@RequestParam(required=false) Integer id) {\r\n\t\tList<UomType> uoms=null;\r\n\t\tif(id==null)\r\n\t\t\tuoms=service.getAllUomTypes();\r\n\t\telse\r\n\t\t\tuoms=Arrays.asList(service.getOneUomType(id));\r\n\t\t//read data from db\r\n\t\tModelAndView m=new ModelAndView();\r\n\t\tm.setView(new UomTypePdfView());\r\n\t\tm.addObject(\"list\", uoms);\r\n\t\treturn m;\r\n\t\t\r\n\t}", "@RequestMapping(value = \"generateCreditLedgerReportPdf\", method = { RequestMethod.POST })\n\tpublic ResponseEntity<JsonResponse<List<RestDebitCreditLedgerModel>>> getCreditLedgerReportPdf(\n\t\t\t@RequestBody DataTableRequest request) {\n\t\tlogger.info(\"Method : getCreditLedgerReportPdf starts\");\n\t\tlogger.info(\"Method : getCreditLedgerReportPdf ends\");\n\t\treturn creditLedgerDao.getCreditLedgerReportPdf(request);\n\t}", "public void createPDF(Loan loan, boolean isSwedish, String path, int count, String pathname) \n throws FileNotFoundException, DocumentException {\n log.info(\"createPDF : {} -- {}\", path, isSwedish);\n\n this.isSwedish = isSwedish;\n\n switch (pathname) {\n case \"local\":\n externalPath = LOCAL_EXTERNAL_FILES;\n break;\n case \"dina-loans\":\n externalPath = REMOTE_EXTERNAL_FILES_LOANS;\n break;\n default:\n externalPath = REMOTE_EXTERNAL_FILES_AS;\n break;\n }\n\n StringBuilder sb = new StringBuilder();\n sb.append(path);\n sb.append(\"/loanrequest_\");\n sb.append(loan.getId());\n\n File summaryAdminFile = new File(sb.toString() + \"_admin.pdf\"); \n sb.append(\".pdf\");\n File summaryFile = new File(sb.toString().trim()); \n\n document = new Document(PageSize.LETTER);\n adminDocument = new Document(PageSize.LETTER);\n PdfWriter.getInstance(document, new FileOutputStream(summaryFile));\n PdfWriter.getInstance(adminDocument, new FileOutputStream(summaryAdminFile));\n document.open();\n adminDocument.open();\n\n addTitle(loan);\n addContact(loan);\n\n switch (count) {\n case 9:\n addLoanRequestForScientificPurpose(loan);\n addLoanSampleList(loan);\n if (!RequestType.Information.isInformation(loan.getType())) {\n if (RequestType.Physical.isPhysical(loan.getType())) {\n addDestructiveInformation(loan);\n } else {\n addPhotoInformation(loan);\n }\n addCITESInformation(loan);\n } break;\n case 7:\n addEducationRequest(loan);\n break;\n default:\n addCommercialInformation(loan);\n break;\n }\n\n if (!RequestType.Information.isInformation(loan.getType())) {\n addTermsOfLoanAgreement();\n }\n document.close();\n adminDocument.close();\n }", "public void doGet(HttpServletRequest request, HttpServletResponse response)\n\t\tthrows IOException, ServletException\n\t{\n Document document=null;\n\n try {\n HttpSession session = request.getSession(true);\n com.emesa.gestinm.portalframework.UserProfile oProfile=(com.emesa.gestinm.portalframework.UserProfile)session.getAttribute(\"_profile_\");\n Vector vHeader=(Vector)session.getAttribute(\"inf_header\");\n Vector vRtado=(Vector)session.getAttribute(\"inf_rtado\");\n String sNombreConsulta=(String)session.getAttribute(\"inf_nombre\");\n String sDescripcionConsulta=(String)session.getAttribute(\"inf_descripcion\");\n\n if(vHeader==null)\n vHeader=new Vector();\n if(vRtado==null)\n vRtado=new Vector();\n if(sNombreConsulta==null)\n sNombreConsulta=\"Informe\";\n if(sDescripcionConsulta==null)\n sDescripcionConsulta=\"\";\n\n // step 1: creation of a document-object\n document = new Document(PageSize.A4.rotate());\n\n // step 2:\n // we create a writer that listens to the document\n // and directs a PDF-stream to a file\n File tmpFile = new File(oProfile.getUsuario()+\"_gestinm.pdf\");\n String sOutputFile=(sOutputDir+\"/\"+tmpFile.getName()).replace('\\\\','/');\n\n PdfWriter.getInstance(document, new FileOutputStream(sOutputFile));\n\n\n //-- seh\n addMetaData(document);\n addHeader(document);\n //-- eoseh\n\n // step 3: we open the document\n document.open();\n\n // step 4: we add a paragraph to the document\n document.add(new Paragraph(sNombreConsulta+\": \"+sDescripcionConsulta,new Font(Font.TIMES_ROMAN,12)));\n\n PdfPTable table = new PdfPTable(vHeader.size());\n table.setHeaderRows(1);\n //table.setPadding(2);\n //table.setCellsFitPage(true);\n\n //---------------------\n // Cabecera...\n PdfPCell cell=null;\n for(int i=0; i<vHeader.size(); i++) {\n cell = new PdfPCell(\n new Phrase(vHeader.elementAt(i).toString(),\n new Font(Font.HELVETICA,10)\n ));\n //cell.setHeader(true);\n cell.setBackgroundColor(Color.orange);\n cell.setHorizontalAlignment(Element.ALIGN_CENTER);\n cell.setVerticalAlignment(Element.ALIGN_CENTER);\n table.addCell(cell);\n }\n\n //---------------------\n // Resultados\n Vector vRow=null;\n for(int i=0;i<vRtado.size(); i++) {\n vRow=(Vector)vRtado.elementAt(i);\n for(int j=0; j<vRow.size();j++) {\n cell=new PdfPCell(\n new Phrase((vRow.elementAt(j)==null?\"\":vRow.elementAt(j).toString()),\n new Font(Font.TIMES_ROMAN,9)\n ));\n if(i%2!=0)\n cell.setBackgroundColor(Color.LIGHT_GRAY);\n\n cell.setVerticalAlignment(Element.ALIGN_TOP);\n table.addCell(cell);\n }\n }\n\n document.add(table);\n\n String sRedirect=request.getParameter(\"redir\");\n if(sRedirect==null || sRedirect.trim().equals(\"\"))\n sRedirect=sRedirFolder+\"/pdf.jsp\";\n\n\n request.setAttribute(\"f\",sRedirFolder+\"/\"+tmpFile.getName());\n RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(sRedirect);\n dispatcher.forward(request,response);\n\n // step 5: we close the document\n document.close();\n\n }\n catch(DocumentException de) {\n System.err.println(de.getMessage());\n // step 5: we close the document\n if(document!=null)\n document.close();\n }\n catch(IOException ioe) {\n System.err.println(ioe.getMessage());\n // step 5: we close the document\n if(document!=null)\n document.close();\n }\n\n }", "public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {\n String filePath = \"/home/harun/Downloads/Q3.pdf\";\n File downloadFile = new File(filePath);\n FileInputStream inputStream = new FileInputStream(downloadFile);\n\n // Get the mimeType of the file\n ServletContext context = getServletContext();\n String mimeType = context.getMimeType(filePath);\n\n // Fetch file in binary there's no MimeType mapping\n if(mimeType==null) mimeType = \"application/octet-stream\";\n // Log the mimeType in the console\n System.out.println(mimeType);\n\n\n //Set the response mimeType/contentType and file length\n response.setContentType(\"Mime Tyoe: \" + mimeType);\n int fileLength = (int) downloadFile.length();\n response.setContentLength(fileLength);\n\n // Set the response header value// Force download\n String headerKey = \"Content-Disposition\";\n String headerValue = String.format(\"attachment; filename=\\\"%s\\\"\", downloadFile.getName());\n response.setHeader(headerKey,headerValue);\n\n // read the input stream in buffered chunks to the output stream\n OutputStream outputStream = response.getOutputStream();\n byte[] buffer = new byte[4096]; // Buffers of 4MB's\n int c = -1;\n\n while((c = inputStream.read(buffer)) != -1){\n outputStream.write(buffer, 0, c);\n }\n\n // Close the input and output streams\n inputStream.close();\n outputStream.close();\n\n }", "protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n \t\n \tresponse.setContentType(\"application/pdf\");\n\n \tHttpSession session = request.getSession(false);\n\n \tif(session.getAttribute(\"usserHabitat\") != null)\n \t{ \n \t\tlong idEmpleado \t\t= Long.parseLong(request.getParameter(\"id_Empleado\"));\n \t\tString valor \t\t\t= request.getParameter(\"value_send\");\n \t\tlong idFormulario\t\t= Long.parseLong(request.getParameter(\"id_formulario\"));\n \t\tlong idEncuesta\t\t\t= Long.parseLong(request.getParameter(\"id_encuesta\")); \t\t\n \t\t\n \t\tSystem.out.println(\"VALOR RECIBIDO: \" + valor);\n \t\tSystem.out.println(\"Formulario recibido: \" + idFormulario + \", Id de encuesta: \" + idEncuesta);\n\n \t\tif(valor.equals(\"1\")) {\n\n \t\t\tOutputStream out \t\t\t= response.getOutputStream();\n \t\t\t\n \t\t\ttry {\n\n \t\t\t\tDocument document \t= new Document();\n \t\t\t\tPdfWriter.getInstance(document, out);\n \t\t\t\tImage image1 \t\t= null ;\n \t\t\t\timage1 \t\t\t= Image.getInstance(\"images/imagenempresa.png\");\n\n \t\t\t\tdocument.open();\n\n \t\t\t\timage1.setAlignment(Element.ALIGN_CENTER);\n \t\t\t\timage1.scaleAbsolute(120.0f, 50.0f);\n \t\t\t\tdocument.add(image1);\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\n \t\t\t\tdocument.add(new Paragraph(\"Nombre de solicitante:\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" _____________________________________________________________________________________\",catFont));\n \t\t\t\t\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\n \t\t\t\tdocument.add(new Paragraph(\"Departamento:\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" _____________________________________________________________________________________\",catFont));\n \t\t\t\t\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\n \t\t\t\tdocument.add(new Paragraph(\"1. ¿Cómo considera la ubicación de nuestra oficina?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"2. ¿Cómo califica el orden y limpieza de nuestras instalaciones?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"3. ¿Cómo considera el ambiente de nuestra oficina?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"4. ¿Cómo fue el trato que recibió por parte del personal?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"5. ¿Recibió información clara de nuestros productos y servicios?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"6. ¿Resolvieron sus dudas correctamente y con rapidez?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"7. ¿Recibió asesoría para completar los requisitos solicitados?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"8. ¿Entregaron su producto en el tiempo ofrecido? \" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"9. ¿Cómo califica la calidad de los materiales de construcción?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"10. ¿Cómo califica la calidad de los acabados de su vivienda?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"11. ¿Considera últil el contenido de las capacitaciones?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"12. ¿Ha puesto en práctica el conocimiento recibido?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"13. ¿Cómo considera la asistencia técnica constructiva que recibió?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"14. En general ¿Cómo considera su experiencia con nosotros?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Muy Bueno Bueno Regular Malo Muy Malo\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"15. ¿Cómo se entero de nuestros productos y servicios?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\" Television Radio Prensa/Revista Perifoneo Ferias Ferreterías\",catFont));\n\n \t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\tdocument.add(new Paragraph(\"16. ¿Recomendaría nuestros productos y servicios?\" ,catFont));\n \t\t\t\tdocument.add(new Paragraph(\"Observación: Considerando que 1 es la nota más baja y 5 la más alta.\",catFont));\n \t\t\t\tdocument.add(new Paragraph(\" 1 2 3 4 5\",catFont));\n\n \t\t\t\tdocument.close();\n\n \t\t\t}catch (DocumentException exc){\n \t\t\t\tthrow new IOException(exc.getMessage());\n \t\t\t}\n \t\t\tfinally { \n \t\t\t\tout.close();\n \t\t\t}\n\n \t\t}else if(valor.equals(\"2\")){\n\n \t\t\tif(idEncuesta != 0){\n\n \t\t\t\tauxSolicitudGeneral\t\t= solucionesService.obtenerDataFormularioRegistrado(idFormulario);\n \t\t\t\tauxEncuesta\t\t\t\t= solucionesService.consultaEncuestaSatisfaccion(idFormulario, idEncuesta);\n\n \t\t\t\tOutputStream out \t\t\t= response.getOutputStream();\n\n \t\t\t\ttry {\n\n \t\t\t\t\tDocument document \t= new Document();\n \t\t\t\t\tPdfWriter.getInstance(document, out);\n \t\t\t\t\tImage image1 \t\t= null ;\n \t\t\t\t\timage1 \t\t\t= Image.getInstance(\"images/imagenempresa.png\");\n\n \t\t\t\t\tdocument.open();\n\n \t\t\t\t\timage1.setAlignment(Element.ALIGN_CENTER);\n \t\t\t\t\timage1.scaleAbsolute(120.0f, 50.0f);\n \t\t\t\t\tdocument.add(image1);\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\"Nombre de solicitante:\" ,catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + auxSolicitudGeneral.getNombreSolicitante() ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\"Departamento:\" ,catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getDepartamento(auxEncuesta.getDepartamento()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\"1. ¿Cómo considera la ubicación de nuestra oficina?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo1()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"2. ¿Cómo califica el orden y limpieza de nuestras instalaciones?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo2()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"3. ¿Cómo considera el ambiente de nuestra oficina?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo3()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"4. ¿Cómo fue el trato que recibió por parte del personal?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo4()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"5. ¿Recibió información clara de nuestros productos y servicios?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo5()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"6. ¿Resolvieron sus dudas correctamente y con rapidez?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo6()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"7. ¿Recibió asesoría para completar los requisitos solicitados?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo7()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"8. ¿Entregaron su producto en el tiempo ofrecido? \",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo8()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"9. ¿Cómo califica la calidad de los materiales de construcción?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo9()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"10. ¿Cómo califica la calidad de los acabados de su vivienda?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo10()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"11. ¿Considera últil el contenido de las capacitaciones?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo11()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"12. ¿Ha puesto en práctica el conocimiento recibido?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo12()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"13. ¿Cómo considera la asistencia técnica constructiva que recibió?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo13()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"14. En general ¿Cómo considera su experiencia con nosotros?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getPregunta(auxEncuesta.getPreguntaNo14()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"15. ¿Cómo se entero de nuestros productos y servicios?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + getServicio(auxEncuesta.getPreguntaNo15()) ,catFont2));\n\n \t\t\t\t\tdocument.add(new Paragraph(\"\\t\",catFont));\t\t \n \t\t\t\t\tdocument.add(new Paragraph(\"16. ¿Recomendaría nuestros productos y servicios?\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\"Observación: Considerando que 1 es la nota más baja y 5 la más alta.\",catFont));\n \t\t\t\t\tdocument.add(new Paragraph(\" \" + auxEncuesta.getPreguntaNo16() ,catFont2));\n\n \t\t\t\t\tdocument.close();\n\n \t\t\t\t}catch (DocumentException exc){\n \t\t\t\t\tthrow new IOException(exc.getMessage());\n \t\t\t\t}\n \t\t\t\tfinally { \n \t\t\t\t\tout.close();\n \t\t\t\t}\n\n \t\t\t}else{\n\n \t\t\t\tSystem.out.println(\"No existen datos almacenados\");\n\n \t\t\t}\n \t\t}\n \t\t\n \t}\n }", "protected void render(Source src, Transformer transformer, HttpServletResponse response)\n throws FOPException, TransformerException, IOException {\n\n FOUserAgent foUserAgent = getFOUserAgent();\n\n //Setup output\n ByteArrayOutputStream out = new ByteArrayOutputStream();\n\n //Setup FOP\n Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);\n\n //Make sure the XSL transformation's result is piped through to FOP\n Result res = new SAXResult(fop.getDefaultHandler());\n\n //Start the transformation and rendering process\n transformer.transform(src, res);\n\n //Return the result\n sendPDF(out.toByteArray(), response);\n }", "public void outputToBrowser(HttpServletResponse res, String output) {\n\t\tPrintWriter out;\n\t\ttry {\n\t\t\tout = new PrintWriter(res.getOutputStream());\n\t\t\tint length = output.length();\n\t\t\tres.setContentType(\"text/html\");\n\t\t\tres.setContentLength(length);\n\t\t\tout.println(output);\n\t\t\tout.flush();\n\t\t\tout.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public String getConsentPDF();", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n \r\n logger.info(\"--->>>GeneradorReportesAdapter:RequestURI=\"+request.getRequestURI());\r\n String param_dynamic = request.getParameter(\"dynamic\");\r\n \r\n if(param_dynamic==null){\r\n param_dynamic=\"false\";\r\n }else if(!param_dynamic.equals(\"true\")){\r\n param_dynamic=\"false\";\r\n }\r\n String absoluteURL = \r\n request.getScheme() + \"://\" + // \"http\" + \"://\r\n request.getServerName() + // \"localhost\"\r\n \":\" + // \":\"\r\n request.getServerPort() + // \"8080\"\r\n request.getContextPath(); // \"/AMX-PAB-Web\"\r\n \r\n if(request.getRequestURI().indexOf(TSU_REPORTES_PATH)>TSU_REPORTES_PATH.length()+2){\r\n logger.info(\"--->>>GeneradorReportesAdapter:TSU Report !\");\r\n }\r\n \r\n String cveTsu = null; \r\n cveTsu = request.getRequestURI().substring(request.getRequestURI().indexOf(TSU_REPORTES_PATH)+TSU_REPORTES_PATH.length());\r\n logger.info(\"--->>>GeneradorReportesAdapter:tsuUri=\"+cveTsu);\r\n \r\n \r\n InputStream is=null;\r\n OutputStream os = null;\r\n byte[] contentPdf = null;\r\n \r\n try{\r\n logger.info(\"--->>>GeneradorReportesAdapter: calling EJB, param_dynamic=\"+param_dynamic+\", absoluteURL=\"+absoluteURL);\r\n\r\n contentPdf = generadorReportesPDF.generarReporteTSU(cveTsu,param_dynamic.equals(\"true\"), absoluteURL);\r\n \r\n logger.info(\"--->>>GeneradorReportesAdapter: after call, contentPdf=\"+contentPdf);\r\n if(contentPdf == null){\r\n throw new IOException(\"Erro generating, not generated\");\r\n }\r\n }catch(IOException ex){\r\n logger.error(\"Error Searchibg:\",ex);\r\n response.setStatus(HttpServletResponse.SC_NOT_FOUND);\r\n return;\r\n }catch(Exception ex){\r\n logger.error(\"Error Searchibg:\",ex);\r\n response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);\r\n return;\r\n }\r\n \r\n try{\r\n is=new ByteArrayInputStream(contentPdf);\r\n response.getOutputStream();\r\n\r\n response.setStatus(HttpServletResponse.SC_OK);\r\n response.setContentLength(contentPdf.length);\r\n response.setContentType(\"application/pdf\"); \r\n response.setHeader(\"Content-Disposition\", \"inline; filename=TSU_212123.PDF\");\r\n \r\n byte[] buffer = new byte[1024*32];\r\n int r;\r\n os = response.getOutputStream();\r\n logger.info(\"--->>>GeneradorReportesAdapter: contentn.length=\"+contentPdf.length);\r\n while((r = is.read(buffer, 0, buffer.length))!= -1){\r\n os.write(buffer, 0, r);\r\n os.flush();\r\n }\r\n os.close();\r\n is.close();\r\n logger.info(\"--->>>GeneradorReportesAdapter: END Dispatching !\"); \r\n }catch(IOException io){\r\n logger.error(\"Error Rendering\",io);\r\n response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);\r\n return;\r\n } \r\n }", "public void writePDF(RMPDFWriter aWriter)\n{\n List refs = new ArrayList(getPageCount());\n PDFXTable xref = aWriter.getXRefTable();\n for(int i=0, iMax=getPageCount(); i<iMax; i++)\n refs.add(xref.getRefString(getPage(i)));\n \n // \n _dict.put(\"Kids\", refs);\n _dict.put(\"Count\", getPageCount());\n \n // \n aWriter.writeXRefEntry(_dict);\n}", "void setResponseFormatError(){\n responseFormatError = true;\n }", "@Override\r\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n try {\r\n processRequest(request, response);\r\n } catch (ClassNotFoundException ex) {\r\n Logger.getLogger(generaPDF.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (SQLException ex) {\r\n Logger.getLogger(generaPDF.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }", "public byte[] runPdfExport() throws DocumentException, IOException, JRException, TalentStudioException {\n\n ByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n\n if (isResultSetEmpty(jasperPrint.getPages())) {\n document = new Document(PageSize.A4);\n writer = PdfWriter.getInstance(document, outputStream);\n document.open();\n final Paragraph noResult = new Paragraph(getHeading(getMessage(\"no.results\")));\n noResult.setAlignment(Rectangle.ALIGN_CENTER);\n document.add(noResult);\n document.add(new Paragraph(\"\\n\"));\n\n } else {\n createDocument(jasperPrint.getPages());\n writer = PdfWriter.getInstance(document, outputStream);\n document.open();\n //below three lines force to be zoom at 100 and focus page 1\n document.newPage();\n PdfDestination destination = new PdfDestination(PdfDestination.XYZ, 0, -1, 1);\n writer.setOpenAction(PdfAction.gotoLocalPage(1, destination, writer));\n\n\n List<JRPrintPage> pages = jasperPrint.getPages();\n\n\n addPageHeader(document);\n\n for (JRPrintPage page : pages) {\n\n JRExporterGridCell[][] grid = getGrid(page);\n\n PdfPTable table = getTable(1);\n table.getDefaultCell().setBorder(Rectangle.BOX);\n int emptyRowCount = 0;\n for (int i = 0; i < grid.length; i++) {\n JRExporterGridCell[] jrExporterGridCells = grid[i];\n if (!isNullRow(jrExporterGridCells)) {\n\n\n int oddEvenNo = i - emptyRowCount;\n Color rowColor = null;\n if (oddEvenNo > 0) {\n\n if (oddEvenNo % 2 == 0) {\n rowColor = getDataBackgroundEvenColor();\n } else {\n rowColor = getDataBackgroundOddColor();\n }\n\n }\n\n PdfPTable subTable = getTable(jrExporterGridCells.length);\n subTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);\n subTable.getDefaultCell().setPadding(0);\n\n for (int j = 0; j < jrExporterGridCells.length; j++) {\n JRExporterGridCell jrExporterGridCell = jrExporterGridCells[j];\n\n final JRPrintElement jrPrintElement = jrExporterGridCell.getElement();\n\n\n if (jrPrintElement instanceof JRPrintText) {\n final JRPrintText element = (JRPrintText) jrExporterGridCell.getElement();\n\n String style = element.getStyle() != null ? element.getStyle().getName() : \"\";\n\n final String text = element.getText();\n\n if (TEMPLATE_HEADER.equalsIgnoreCase(style)) {\n final Paragraph paragraph = getHeading(text);\n final PdfPCell pCell = new PdfPCell(paragraph);\n pCell.setBackgroundColor(getHeaderBackgroundColor());\n subTable.addCell(pCell);\n } else if (TEMPLATE_GROUP.equalsIgnoreCase(style)) {\n if (StringUtils.hasText(text)) {\n Paragraph paragraph = getGroupHeading(text);\n PdfPCell groupHeader = new PdfPCell(paragraph);\n groupHeader.setColspan(jrExporterGridCells.length);\n groupHeader.setBackgroundColor(getHeaderGroupBackgroundColor());\n\n subTable.addCell(groupHeader);\n } else {\n //empty header\n final PdfPCell pCell = new PdfPCell();\n pCell.setBackgroundColor(rowColor);\n subTable.addCell(pCell);\n }\n\n } else {\n\n if (!isAddImageColumn(j, text, subTable, rowColor)) {\n final Paragraph paragraph = getText(text);\n final PdfPCell pdfPCell = new PdfPCell(paragraph);\n pdfPCell.setBackgroundColor(rowColor);\n subTable.addCell(pdfPCell);\n }\n }\n\n\n } else if (jrPrintElement instanceof JRTemplatePrintRectangle) {\n final PdfPCell pCell = new PdfPCell();\n pCell.setBackgroundColor(rowColor);\n subTable.addCell(pCell);\n\n } else if (jrPrintElement instanceof JRBasePrintElement) {\n\n } else {\n\n\n final PdfPCell pCell = new PdfPCell();\n pCell.setBackgroundColor(rowColor);\n subTable.addCell(pCell);\n }\n }\n\n table.getDefaultCell().setPadding(0);\n subTable.completeRow();\n\n clearEmptyRows(subTable);\n\n table.addCell(subTable);\n\n synchronizeTableMemory(table, i);\n\n } else {\n emptyRowCount++;\n }\n }\n document.add(table);\n }\n }\n document.close();\n\n return outputStream.toByteArray();\n }", "@RequiresApi(api = Build.VERSION_CODES.KITKAT)\n public void CreatePdf(View view) throws IOException {\n\n // file path and file name\n int i = 1;\n String dir = Environment.getExternalStorageDirectory() + \"/Documents/\";\n String filePath = new File(dir, sName + \"_result_\" + i + \".pdf\").toString();\n File pdfFile = new File(filePath);\n while (pdfFile.exists()) {\n i++;\n filePath = new File(dir, sName + \"_result_\" + i + \".pdf\").toString();\n pdfFile = new File(filePath);\n }\n\n FileOutputStream fOut = new FileOutputStream(filePath);\n PdfWriter pdfWriter = new PdfWriter(fOut);\n\n PdfDocument pdfDocument = new PdfDocument(pdfWriter);\n Document document = new Document(pdfDocument);\n\n // setting title\n document.add(new Paragraph(sName)\n .setBold()\n .setUnderline()\n .setFontSize(30)\n .setTextAlignment(TextAlignment.CENTER));\n document.add(new Paragraph(\" \"));\n\n Table table = new Table(new float[] { 80, 80, 80, 80, 80, 80, 80 });\n\n //setting column headings\n for (String header : columnHeaders)\n table.addCell(new Paragraph(header).setBold());\n\n // fill data\n for (FinalCompetitorData competitorData : competitorsList) {\n table.addCell(new Paragraph(competitorData.rank + \"\"));\n table.addCell(new Paragraph(competitorData.boatClass + \"\"));\n table.addCell(new Paragraph(competitorData.sailNo + \"\"));\n table.addCell(new Paragraph(competitorData.helmName + \"\"));\n table.addCell(new Paragraph(competitorData.crewName + \"\"));\n table.addCell(new Paragraph(competitorData.PY + \"\"));\n table.addCell(new Paragraph(competitorData.points + \"\"));\n }\n\n document.add(table);\n document.close();\n Toast.makeText(DisplaySeriesResult.this, \"PDF created, check Documents!!\", Toast.LENGTH_LONG).show();\n }", "public void onCreatePdf(View view) {\n\n\t\t// Images used in the PDF should be JPG images, stored as Assets\n\t\tbyte[] stickerBmp = Pdf.getAssetJpgBytes(this, JPG_SRC);\n\n\t\t// Create a new PDF\n\t\tPdf pdf = new Pdf();\n\t\tStream stream = pdf.addPage();\n\n\t\t// Add some text at a specific position\n\t\t// The coordinate system is setup where the origin (0,0) is at the\n\t\t// bottom left corner\n\t\tstream.addText(\"This is a test pdf.\", PDF_HEADER_FONT_SIZE, 100, 50, RED);\n\n\t\t// Add some text with a different color\n\t\tstream.addText(userText.getText().toString(), BLUE, PDF_HEADER_FONT_SIZE);\n\n\t\t// Add a line with a color and a width\n\t\tstream.addHorizontalLine(GREEN, LINE_WIDTH);\n\n\t\t// Add an image at a specific coordinate (top right corner of the page)\n\t\tstream.addBmpImage(Pages.PAGE_WIDTH - (int) Stream.MARGIN_HORIZONTAL - JPG_WIDTH, Pages.PAGE_HEIGHT - (int) Stream.MARGIN_VERTICAL - JPG_HEIGHT,\n\t\t\t\tJPG_WIDTH, JPG_HEIGHT, stickerBmp);\n\n\t\t// Get the raw PDF bytes like this:\n\t\tbyte[] pdfBytes = pdf.getPDF();\n\n\t\t// Optionally, write the bytes out to a file:\n\t\tFile file = Pdf.writePdf(this, pdfBytes, PDF_PDFNAME);\n\n\t\t// Show the PDF in an external viewer\n\t\tIntent intent = new Intent(Intent.ACTION_VIEW);\n\t\tUri uri = Uri.fromFile(file);\n\t\tintent.setDataAndType(uri, MIME_TYPE_PDF);\n\t\tstartActivity(intent);\n\n\t}", "private void writeResponse(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException {\n\t\tresponse.setContentType(\"text/html\");\n\t\tresponse.setCharacterEncoding(\"utf-8\");\n\t\tPrintWriter pw = response.getWriter();\n\t\tpw.print(\"This is a CQ5 Response ... \");\n\t\tpw.print(getPageContent(request, \"/content/helloworld\"));\n\t\tpw.flush();\n\t\tpw.close();\n\t}", "@Test\n public void Test_Output_Font() throws Exception {\n String actual_value = \"\";\n String expected_value = \"1 0 obj \\n<< \\n/ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] \\n\";\n expected_value += \"/Font \\n<< \\n/F2 \\n<< \\n/Type /Font \\n/BaseFont /Helvetica \\n/SubType /Type1 \\n\";\n expected_value += \">> \\n>> \\n>> \\n\";\n\n PdfResource resrc = new PdfResource();\n resrc.addFont(new PdfFont(PdfFont.HELVETICA, false, false));\n actual_value = new String(resrc.dumpInfo());\n \n assertThat(actual_value, equalTo(expected_value));\n }", "public PDF()\n {\n \n i_hdl = create_Handler();\n }", "public void printPdf(View view) {\n PrintManager printManager = (PrintManager) getSystemService(PRINT_SERVICE);\n printManager.print(\"print_job_name\", new ViewPrintAdapter(this, pageViews), null);\n Context context = App.getContext();\n LogManager.reportStatus(context, \"INSPECTOR\", \"printPdf\");\n }", "private void createPdf()\n {\n Document document = new Document();\n try {\n String path = Environment.getExternalStorageDirectory().getAbsolutePath()+\"/Meal Counter\";\n File directory = new File(path);\n if(!directory.exists())\n directory.mkdir();\n\n File file = new File(directory,sharedPreferenceData.getmyCurrentSession()+\".pdf\");\n reportPath = file.getAbsolutePath();\n FileOutputStream fileOutputStream = new FileOutputStream(file);\n PdfWriter.getInstance(document,fileOutputStream);\n document.setPageSize(PageSize.A4);\n document.open();\n Paragraph paragraph;\n Font smallFont = new Font(Font.FontFamily.TIMES_ROMAN,22.0f,Font.NORMAL, BaseColor.BLACK);\n Font largeFont = new Font(Font.FontFamily.TIMES_ROMAN,30.0f,Font.BOLD, BaseColor.BLACK);\n paragraph = new Paragraph(\"Session : #\"+sharedPreferenceData.getmyCurrentSession()+\"\\n\\n\"+\n \"Total Taka ------ \"+monthlyTaka+\"\\n\"+\n \"Total Meal ------ \"+monthlyMeal+\"\\n\"+\n \"Total Cost ------ \"+monthlyCost+\"\\n\"+\n \"Remain ------ \"+remain+\"\\n\"+\n \"Meal rate ------ \"+mealRate+\"\\n\\n\\n\",largeFont);\n paragraph.setAlignment(Paragraph.ALIGN_CENTER);\n //document.add(paragraph);\n\n float[] columnWidth = {6f,9f,9f,9f,9f,9f};\n PdfPTable table = new PdfPTable(columnWidth);\n table.setWidthPercentage(90f);\n\n insertDataIntoTable(table,\"Serial\", Element.ALIGN_CENTER,1,smallFont);\n insertDataIntoTable(table,\"Name\", Element.ALIGN_CENTER,1,smallFont);\n insertDataIntoTable(table,\"Taka\", Element.ALIGN_CENTER,1,smallFont);\n insertDataIntoTable(table,\"Meal\", Element.ALIGN_CENTER,1,smallFont);\n insertDataIntoTable(table,\"Cost\", Element.ALIGN_CENTER,1,smallFont);\n insertDataIntoTable(table,\"Status\", Element.ALIGN_CENTER,1,smallFont);\n table.setHeaderRows(1);\n\n for(int i=0;i<modelList.size();i++)\n {\n insertDataIntoTable(table,String.valueOf(i+1),Element.ALIGN_CENTER,1,smallFont);\n insertDataIntoTable(table,modelList.get(i).getId(),Element.ALIGN_CENTER,1,smallFont);\n insertDataIntoTable(table,modelList.get(i).getTaka(),Element.ALIGN_CENTER,1,smallFont);\n insertDataIntoTable(table,modelList.get(i).getName(),Element.ALIGN_CENTER,1,smallFont);\n insertDataIntoTable(table,modelList.get(i).getDate(),Element.ALIGN_CENTER,1,smallFont);\n insertDataIntoTable(table,modelList.get(i).getStatus(),Element.ALIGN_CENTER,1,smallFont);\n }\n\n paragraph.add(table);\n document.add(paragraph);\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (DocumentException e) {\n e.printStackTrace();\n }finally {\n document.close();\n\n }\n }", "@RequestMapping(method = RequestMethod.GET, params = { \"pdf\" })\n\tpublic ModelAndView pdfMethod() {\n\t\tList<Book> listBooks = new ArrayList<Book>();\n\t\tlistBooks.add(new Book(\"Spring in Action\", \"Craig Walls\", \"1935182358\", \"June 29th 2011\", 31.98F));\n\t\tlistBooks.add(\n\t\t\t\tnew Book(\"Spring in Practice\", \"Willie Wheeler, Joshua White\", \"1935182056\", \"May 16th 2013\", 31.95F));\n\t\tlistBooks.add(new Book(\"Pro Spring 3\", \"Clarence Ho, Rob Harrop\", \"1430241071\", \"April 18th 2012\", 31.85F));\n\t\tlistBooks.add(\n\t\t\t\tnew Book(\"Spring Integration in Action\", \"Mark Fisher\", \"1935182439\", \"September 26th 2012\", 28.73F));\n\n\t\t// return a view which will be resolved by an excel view resolver\n\t\treturn new ModelAndView(\"pdfView\", \"listBooks\", listBooks);\n\n\t}", "private void createPdf(String name, String date, String address, String price) {\r\n Calendar calanderInstance = Calendar.getInstance();\r\n SimpleDateFormat currentDate = new SimpleDateFormat(\"MM dd,yyyy\");\r\n String mdate = currentDate.format(calanderInstance.getTime());\r\n String html = \"<!doctype html>\\n\" +\r\n \"<html lang=\\\"en\\\">\\n\" +\r\n \" <head>\\n\" +\r\n \" <title>Title</title>\\n\" +\r\n \" <!-- Required meta tags -->\\n\" +\r\n \" <meta charset=\\\"utf-8\\\">\\n\" +\r\n \" <meta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1, shrink-to-fit=no\\\">\\n\" +\r\n \"\\n\" +\r\n \" <!-- Bootstrap CSS -->\\n\" +\r\n \" <link rel=\\\"stylesheet\\\" href=\\\"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\\\" integrity=\\\"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T\\\" crossorigin=\\\"anonymous\\\">\\n\" +\r\n \" </head>\\n\" +\r\n \" <body>\\n\" +\r\n \" <div class=\\\"container\\\">\\n\" +\r\n \" <h2 class=\\\" text-center\\\">Invoice</h2>\\n\" +\r\n \" <h5 class=\\\"text-center\\\">Designer Club Order History </h5>\\n\" +\r\n \" <h3 >\" + name + \"</h3>\\n\" +\r\n \" <P>Service Details and shipped status</p>\\n\" +\r\n \" <div class=\\\"container row\\\">\\n\" +\r\n \" <p style=\\\"font-weight:bold; margin-right:10px;\\\">Date:</p><p>\" + mdate + \"</p>\\n\" +\r\n \" </div>\\n\" +\r\n \" <table class=\\\"table table-bordered table-sm table-striped m-10px\\\">\\n\" +\r\n \" <thead class=\\\"thead-inverse\\\">\\n\" +\r\n \" <tr>\\n\" +\r\n \" <th>Order Date</th>\\n\" +\r\n \" <th>Address</th>\\n\" +\r\n \" <th>Shipped Status</th>\\n\" +\r\n \" <th>Shipped Date</th>\\n\" +\r\n \" <th>Payment</th>\\n\" +\r\n \" </tr>\\n\" +\r\n \" </thead>\\n\" +\r\n \" <tbody>\\n\" +\r\n \" <tr>\\n\" +\r\n \" <td>\" + date + \"</td>\\n\" +\r\n \" <td>\" + address + \"</td>\\n\" +\r\n \" <td>\" + shippedStatus + \"</td>\\n\" +\r\n \" <td>\" + shippedDate + \"</td>\\n\" +\r\n \" <td>Cash On delevary</td>\\n\" +\r\n \" </tr>\\n\" +\r\n \" </tbody>\\n\" +\r\n \" </table>\\n\" +\r\n \" \\n\" +\r\n \" <h4 class=\\\"text-right\\\" style=\\\"font-weight:bold;\\\">Total</h4>\\n\" +\r\n \" <h4 class=\\\"text-right\\\">\" + price + \"</h4>\\n\" +\r\n \" \\n\" +\r\n \" </div>\\n\" +\r\n \" <!-- Optional JavaScript -->\\n\" +\r\n \" <!-- jQuery first, then Popper.js, then Bootstrap JS -->\\n\" +\r\n \" <script src=\\\"https://code.jquery.com/jquery-3.3.1.slim.min.js\\\" integrity=\\\"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo\\\" crossorigin=\\\"anonymous\\\"></script>\\n\" +\r\n \" <script src=\\\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js\\\" integrity=\\\"sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1\\\" crossorigin=\\\"anonymous\\\"></script>\\n\" +\r\n \" <script src=\\\"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js\\\" integrity=\\\"sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM\\\" crossorigin=\\\"anonymous\\\"></script>\\n\" +\r\n \" </body>\\n\" +\r\n \"</html>\";\r\n webView.loadDataWithBaseURL(null, html, \"text/html\", \"utf-8\", null);\r\n }", "void setContentType(HttpServletResponse response);", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n HttpSession session=request.getSession();\n response.setHeader(\"Cache-Control\",\"no-store\"); //HTTP 1.1\n response.setHeader(\"Pragma\",\"no-cache\"); //HTTP 1.0\n response.setDateHeader(\"Expires\", 0);\n response.setDateHeader(\"Last-Modified\", 0); \n try {\n boolean isMultipart = ServletFileUpload.isMultipartContent( request );\n if ( !isMultipart )\n {\n String modo=request.getParameter(\"modo\"); \n if(modo.equals(\"abrirPdf\")) {\n //if(objetoSesion.isSuperAdministrador() || objetoSesion.getPerfilSelected().getCoreDerechoSistemaList().toString().indexOf(\"D_VER_DEPOSITO\")>-1){ \n CoreDocumento documento=documentoEJBLocal.find(Integer.parseInt(request.getParameter(\"coreDocumentoId\")));\n response.setContentType(\"application/pdf\"); \n response.setHeader(\"Content-Disposition\",\"attachment; filename=\\\"\" + documento.getNombreArchivo() + \"\\\"\"); \n response.getOutputStream().write(documento.getDocumento());\n //}else\n // response.getWriter().println(\"{\\\"success\\\":false,\\\"msg\\\":\\\"Usted no cuenta con los permisos necesarios.\\\"}\");\n }\n }else{ \n ServletFileUpload upload = new ServletFileUpload(); \n try\n {\n byte[] bytes=null;\n String name=null;\n Integer documentoId=null;\n FileItemIterator iter = upload.getItemIterator( request );\n while ( iter.hasNext() )\n {\n FileItemStream item = iter.next();\n String fieldName = item.getFieldName();\n if ( fieldName.equals( \"PDFFile\" ) )\n {\n name=item.getName();\n String[] aname=name.split(\"Id=\");\n bytes = IOUtils.toByteArray( item.openStream() ); \n documentoId=Integer.parseInt(aname[1]);\n }else if(fieldName.equals( \"coreDocumentoId\" ))\n documentoId=Integer.parseInt(Streams.asString(item.openStream()));\n }\n if(documentoId!=null){\n CoreDocumento documento=documentoEJBLocal.find(documentoId);\n documento.setDocumento(bytes);\n response.getWriter().print(documentoEJBLocal.persistir(documento,\"editar\"));\n }\n }\n catch ( IOException ex )\n {\n throw ex;\n }\n catch ( Exception ex )\n {\n throw new ServletException( ex );\n }\n\n }\n }catch (Exception e) {\n if(request.getParameter(\"modo\")==null || request.getParameter(\"modo\").equals(\"listaDocumentos\"))\n response.getWriter().print(\"{\\\"data\\\":[],\\\"total\\\":0}\"); \n else\n response.getWriter().print(\"{\\\"success\\\":false,\\\"msg\\\":\\\"Error al realizar la operacion.\\\"}\");\n }\n }", "@RequestMapping(value = \"/download/demoStatementReportPDF\", method = RequestMethod.GET)\n\tpublic ModelAndView doStatementReportPDF(ModelAndView modelAndView) {\n\t\tLOGGER.debug(\"Received request to download PDF report\");\n\t\tLOGGER.info(\"Received request to download PDF report\");\n\t\tSystem.out.println(\"---------------Received request to download PDF report\");\n\n\t\t// Retrieve our data from a custom data provider\n\t\t// Our data comes from a DAO layer\n\t\t// DemoDAO dataprovider = new DemoDAO();\n\t\tDemoDAO dataprovider = new DemoDAO();\n\n\t\t// Assign the datasource to an instance of JRDataSource\n\t\t// JRDataSource is the datasource that Jasper understands\n\t\t// This is basically a wrapper to Java's collection classes\n\t\tJRDataSource datasource = dataprovider.getDataSource();\n\n\t\t// In order to use Spring's built-in Jasper support,\n\t\t// We are required to pass our datasource as a map parameter\n\t\t// parameterMap is the Model of our application\n\t\tMap<String, Object> parameterMap = new HashMap<String, Object>();\n\t\tparameterMap.put(\"datasource\", datasource);\n\n\t\t// pdfReport is the View of our application\n\t\t// This is declared inside the /WEB-INF/jasper-views.xml\n\t\tmodelAndView = new ModelAndView(\"ilm_statement_pdfReport\", parameterMap);\n\n\t\t// Return the View and the Model combined\n\t\treturn modelAndView;\n\t}", "private static void initializeResponse(String contentType, String header){\r\n\t\t // Initialize response.\r\n\t response.reset(); // Some JSF component library or some Filter might have set some headers in the buffer beforehand. We want to get rid of them, else it may collide.\r\n\t response.setContentType(contentType); // Check http://www.iana.org/assignments/media-types for all types. Use if necessary ServletContext#getMimeType() for auto-detection based on filename.\r\n\t response.setHeader(\"Content-disposition\", header); // The Save As popup magic is done here. You can give it any filename you want, this only won't work in MSIE, it will use current request URL as filename instead.\r\n\r\n\t}", "@Test\r\n\tpublic void testCreatePdf(){\n\t}", "@Override\r\n\tprotected void buildPdfDocument(Map<String, Object> model, Document document, PdfWriter writer,\r\n\t\t\tHttpServletRequest request, HttpServletResponse response) throws Exception {\n\t\tresponse.addHeader(\"Content-Disposition\", \"attachment;filename=Item.pdf\");\r\n\r\n\t\t// create element\r\n\t\tParagraph p = new Paragraph(\"WELCOME TO PDF\");\r\n\r\n\t\t// add to document\r\n\t\tdocument.add(p);\r\n\r\n\t\t// read data from map\r\n\t\t@SuppressWarnings(\"unchecked\")\r\n\t\tList<Item> it = (List<Item>) model.get(\"item\");\r\n\r\n\t\t// create Table\r\n\t\tPdfPTable t = new PdfPTable(6);\r\n\r\n\t\t// Add to heading Column\r\n\t\tt.addCell(\"ID\");\r\n\t\tt.addCell(\"CODE\");\r\n\t\tt.addCell(\"DIMENSION\");\r\n\t\tt.addCell(\"COST\");\r\n\t\tt.addCell(\"CURRENCY\");\r\n\t\tt.addCell(\"DESCRIPTION\");\r\n\r\n\t\t// Add to DB Table\r\n\t\tfor (Item i : it) {\r\n\t\t\tt.addCell(i.getItemId().toString());\r\n\t\t\tt.addCell(i. getItemCode());\r\n\t\t\tt.addCell(i.getWidth()+\"\");\r\n\t\t\tt.addCell(i.getLength()+\"\");\r\n\t\t\tt.addCell(i.getHeight()+\"\");\r\n\t\t\tt.addCell(i.getBaseCost()+\"\");\r\n\t\t\tt.addCell(i. getBaseCurrency());\r\n\t\t\tt.addCell(i. getDcpt());\r\n\t\t}\r\n\t\tdocument.add(t);\r\n\r\n\t\tdocument.add(new Paragraph(new Date().toString()));\r\n\r\n\t}", "@Override\r\n\tpublic BatchResult generatePDFOutputBatch(Map<String, PathOrUrl> templates, Map<String, Document> data, PDFOutputOptions pdfOutputOptions, BatchOptions batchOptions)\r\n\t\t\tthrows OutputServiceException {\n\t\tthrow new UnsupportedOperationException(\"Not implemented yet.\");\r\n\t}", "@Override\n\tpublic String exportMyPaper(HttpServletRequest request, HttpServletResponse response) {\n\t\tString line = request.getParameter(\"line\");\n\t\tString zhuzhuangtu = request.getParameter(\"pie\");\n\t\tString bingtu = request.getParameter(\"bar\");\n\t\tString listpb= request.getParameter(\"ids\");\n\t\tString pos= request.getParameter(\"pos\");\n\t\tString neg= request.getParameter(\"neg\");\n\t\tString[] netinfo = listpb.split(\",\");\n\t\tString[] poslist = pos.split(\",\");\n\t\tString[] neglist = neg.split(\",\");\n\t\tString name = request.getParameter(\"name\");\n\t\tString[] url1 = line.split(\",\");\n\t\tString u1 = url1[1];\n\t\tSystem.out.println(u1 + \"u1\");\n\t\tString[] url2 = zhuzhuangtu.split(\",\");\n\t\tString u2 = url2[1];\n\t\tString[] url3 = bingtu.split(\",\");\n\t\tString u3 = url3[1];\n\t\tbyte[] b1 = null;\n\t\ttry {\n\t\t\tb1 = new BASE64Decoder().decodeBuffer(u1);\n\t\t} catch (IOException e1) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tLog.info(e1.getMessage());\n\t\t\tLog.error(e1.getMessage(),e1);\n\t\t}\n\t\tbyte[] b2 = null;\n\t\ttry {\n\t\t\tb2 = new BASE64Decoder().decodeBuffer(u2);\n\t\t} catch (IOException e1) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tLog.info(e1.getMessage());\n\t\t\tLog.error(e1.getMessage(),e1);\n\t\t}\n\t\tbyte[] b3 = null;\n\t\ttry {\n\t\t\tb3 = new BASE64Decoder().decodeBuffer(u3);\n\t\t} catch (IOException e1) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tSystem.out.println(e1.getMessage());\n\t\t\tLog.info(e1.getMessage());\n\t\t\tLog.error(e1.getMessage(),e1);\n\t\t}\n XWPFParagraph paragraph = null; \n XWPFTable table1 = null; \n User user = (User)request.getSession().getAttribute(\"user\");\n \n CustomXWPFDocument doc = new CustomXWPFDocument(); \n \n paragraph = doc.createParagraph();\n XWPFRun run = paragraph.createRun();\n if(name!=null&&!name.equals(\"\")){\n \t run.setText(name+\"的报纸\");\n }else{\n \t run.setText(\"我的报纸\");\n }\n run.setFontFamily(\"楷体\");\n \t\t run.setFontSize(20);\n \t\t run.setColor(\"FF0000\");\n paragraph.setAlignment(ParagraphAlignment.CENTER);\n //今日概况\n paragraph = doc.createParagraph();\n run = paragraph.createRun();\n run.setText(\"今日概况:\");\n run.setFontFamily(\"黑体\");\n \t\t run.setFontSize(14);\n XWPFTable tab = doc.createTable(3, 11);\n setTableWidth(tab, \"8200\");\n\t\t//\ttab.setCellMargins(50, 45, 50, 450);// top, left, bottom, right\n\t\t\ttab.getRow(0).getCell(0).setText(\"媒体类型\");\n\t\t\ttab.getRow(0).getCell(1).setText(\"新闻\");\n\t\t\ttab.getRow(0).getCell(2).setText(\"论坛\");\n\t\t\ttab.getRow(0).getCell(3).setText(\"贴吧\");\n\t\t\ttab.getRow(0).getCell(4).setText(\"微博\");\n\t\t\ttab.getRow(0).getCell(5).setText(\"微信\");\n\t\t\ttab.getRow(0).getCell(6).setText(\"视频\");\n\t\t\ttab.getRow(0).getCell(7).setText(\"博客\");\n\t\t\ttab.getRow(0).getCell(8).setText(\"平媒\");\n\t\t\ttab.getRow(0).getCell(9).setText(\"APP\");\n\t\t\ttab.getRow(0).getCell(10).setText(\"其他\");\n\t\t\ttab.getRow(1).getCell(0).setText(\"正面\");\n\t\t\tfor(int i=0;i<poslist.length;i++){\n\t\t\t\t \n\t\t\t\t\t tab.getRow(1).getCell(i+1).setText(poslist[i]);\n\t\t\t\t \n\t\t\t\t\n\t\t\t}\n\t\t\t/*tab.getRow(0).getCell(0).setText(poslist[0]);\n\t\t\ttab.getRow(0).getCell(1).setText(\"字段二:\");\n\t\t\ttab.getRow(0).getCell(2).setText(\"字段二:\");\n\t\t\ttab.getRow(0).getCell(3).setText(\"字段二:\");\n\t\t\ttab.getRow(0).getCell(4).setText(\"字段二:\");\n\t\t\ttab.getRow(0).getCell(5).setText(\"字段二:\");*/\n\t\t\ttab.getRow(2).getCell(0).setText(\"负面\");\n\t\t\tfor(int i=0;i<neglist.length;i++){\n\t\t\t\t\n\t\t\t\ttab.getRow(2).getCell(i+1).setText(neglist[i]);\n\t\t\t}\n\t\t\t\n\t\t\t/*tab.getRow(1).getCell(1).setText(\"字段四:\");\n\t\t\ttab.getRow(1).getCell(2).setText(\"字段四:\");\n\t\t\ttab.getRow(1).getCell(3).setText(\"字段四:\");\n\t\t\ttab.getRow(1).getCell(4).setText(\"字段四:\");\n\t\t\ttab.getRow(1).getCell(5).setText(\"字段四:\");\n */\n \n \n //全网动态列表\n paragraph = doc.createParagraph();\n run = paragraph.createRun();\n run.setText(\"全网动态:\");\n run.setFontFamily(\"黑体\");\n \t\t run.setFontSize(14);\n \t\t XWPFTable tableOne = doc.createTable(7,4);\n \t\t setTableWidth(tableOne, \"8200\");\n \t\t // tableOne.setCellMargins(50, 45, 50, 1000);\n \t\t XWPFTableRow tableOneRowOne = tableOne.getRow(0);\n \t\t \n \t\t tableOneRowOne.getCell(0).setText(\"文章标题\");\n \t\t \n \t\t tableOneRowOne.getCell(1).setText(\"文章来源\");\n \t\t tableOneRowOne.getCell(2).setText(\"发布时间\");\n \t\t tableOneRowOne.getCell(3).setText(\"是否关注\");\n \t\t \n for(int i=0;i<netinfo.length;i++){\n \t Personmanagemarticle pm = new Personmanagemarticle();\n \t pm = this.selectPersonMInfo(netinfo[i]);\n \t PersonmanagemarticleBo pb = new PersonmanagemarticleBo();\n \t if(pm!=null){\n \t\t BeanUtils.copyProperties(pm, pb);\n \t\t\t\t Date date = pm.getPubdate();\n \t\t\t\t SimpleDateFormat df=new SimpleDateFormat(\"yyyy-MM-dd\");\n \t\t\t\t String d = df.format(date);\n \t\t\t\t Date dat=new Date();\n \t\t\t\t String current = df.format(new Date());\n \t\t\t\t if(d.equals(current)){\n \t\t\t\t\t pb.setUpdatetime(DateFormatUtil.timeString(pm.getPubdate()));\n \t\t\t\t }else{\n \t\t\t\t\t pb.setUpdatetime(d);\n \t\t\t\t }\n \t\t\t\t String attention = \"\";\n \t if(pb!=null){\n \t \t if(pb.getAttention()){\n \t \t attention = \"取消关注\";\n \t }else{\n \t \t attention = \"关注\";\n \t }\n \t \t System.out.println(i);\n \t XWPFTableRow tableOneRow = tableOne.getRow(i+1);\n \t tableOne.getRow(i+1).getCell(0).setText(pb.getTitle());\n \t tableOne.getRow(i+1).getCell(1).setText(pb.getSource());\n \t tableOne.getRow(i+1).getCell(2).setText(pb.getUpdatetime());\n \ttableOne.getRow(i+1).getCell(3).setText(attention);\n \t }\n \t }\n \t\t\t \n }\n paragraph = doc.createParagraph();\n run = paragraph.createRun();\n run.setText(\"趋势分析:\");\n run.setFontFamily(\"黑体\");\n \t\t run.setFontSize(14);\n //\n paragraph = doc.createParagraph(); \n try {\n\t\t\tdoc.addPictureData(b3,XWPFDocument.PICTURE_TYPE_PNG);\n\t\t } catch (InvalidFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tSystem.out.println(e.getMessage());\n\t\t\tLog.error(e.getMessage(),e);\n\t\t }\n doc.createPicture(paragraph,doc.getAllPictures().size()-1, 650,230,\"\");\n //table表格\n \n paragraph = doc.createParagraph();\n run = paragraph.createRun();\n run.setText(\"媒体top:\");\n run.setFontFamily(\"黑体\");\n \t\t run.setFontSize(14);\n \t\t \n \t paragraph = doc.createParagraph();\n paragraph = doc.createParagraph();\n try {\n\t\t\t doc.addPictureData(b2,XWPFDocument.PICTURE_TYPE_PNG);\n\t\t } catch (InvalidFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\t//System.out.println(e.getMessage());\n\t\t\tLog.info(e.getMessage());\n\t\t\tLog.error(e.getMessage(),e);\n\t\t }\n doc.createPicture(paragraph,doc.getAllPictures().size()-1, 650,300,\"\");\n paragraph = doc.createParagraph();\n run = paragraph.createRun();\n run.setText(\"媒体分布:\");\n run.setFontFamily(\"黑体\");\n \t\t run.setFontSize(14);\n paragraph = doc.createParagraph();\n try {\n\t\t\tdoc.addPictureData(b1,XWPFDocument.PICTURE_TYPE_PNG);\n\t\t } catch (InvalidFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\t\tLog.error(e.getMessage(),e);\n\t\t\tSystem.out.println(e.getMessage());\n\t\t }\n doc.createPicture(paragraph,doc.getAllPictures().size()-1, 650,300,\"\");\n String filename1 = new SimpleDateFormat(\"yyyyMMddhhmmss\").format(new Date()) + \".docx\";\n \t\t String url = request.getContextPath() + \"/upload/\";\n \t\t System.out.println(url);\n \t\t String path = request.getSession().getServletContext().getRealPath(\"/upload\");\n \t\t File targetFile = new File(path, filename1);\n \t\t if (!targetFile.getParentFile().exists()) {\n \t\t\ttargetFile.getParentFile().mkdirs();\n \t\t }\n \t\t if (!targetFile.exists()) {\n \t\t\ttry {\n\t\t\t\ttargetFile.createNewFile();\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\tSystem.out.println(e.getMessage());\n\t\t\t\tLog.error(e.getMessage(),e);\n\t\t\t}\n \t\t }\n \t\t String filename = path + \"/\" + filename1;\n \t\t OutputStream os = null;\n\t\ttry {\n\t\t\tos = new FileOutputStream(filename);\n\t \n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\n\t\t\t//System.out.println(e.getMessage());\n\t\t\tLog.info(e.getMessage());\n\t\t\tLog.error(e.getMessage(),e);\n\t\t} \n\t\ttry {\n\t\t\tdoc.write(os);\n\t\t\tif(null!=os){\n\t\t\t\tos.flush();\n\t\t os.close();\n\t\t\t}\n\t\t\t\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\t//System.out.println(e.getMessage());\n\t\t\tLog.info(e.getMessage());\n\t\t\tLog.error(e.getMessage(),e);\n\t\t}\n \t\t System.out.println(filename);\n String addurl = \"upload/\" + filename1;\n\t\treturn addurl;\n\t}", "@RequestMapping(\"/locPdfExport\")\n\tpublic String exportDataToPdf(ModelMap map){\n\t\tmap.addAttribute(\"locListObj\",service.getAllLocations());\n\t\treturn \"locPdfView\";\n\t}", "protected void generateReport(HttpServletRequest request, HttpServletResponse response, Integer reportType, JasperPrint jasperPrint) throws Exception {\r\n\t\t\r\n\t\tOutputStream ouputStream = response.getOutputStream();\r\n\t\tJRExporter exporter = null;\r\n\t\t\r\n\t\tFormatoReporteEnum formatoReporte = FormatoReporteEnum.findById(reportType);\r\n\t\tswitch (formatoReporte) {\r\n\t\t\tcase PDF:\r\n\t\t\t\tsetContentHeader(response, getFileName(), formatoReporte.getExtension());\r\n\t\t\t exporter = new JRPdfExporter();\r\n\t\t\t exporter.setParameter(JASPER_PRINT, jasperPrint);\r\n\t\t\t exporter.setParameter(OUTPUT_STREAM, ouputStream);\r\n\t\t\t\tbreak;\r\n\t\t\tcase RTF:\r\n\t\t\t\tsetContentHeader(response, getFileName(), formatoReporte.getExtension());\r\n\t\t\t exporter = new JRRtfExporter();\r\n\t\t\t exporter.setParameter(JASPER_PRINT, jasperPrint);\r\n\t\t\t exporter.setParameter(OUTPUT_STREAM, ouputStream);\r\n\t\t\t\tbreak;\r\n\t\t\tcase XLS:\r\n\t\t\t\tsetContentHeader(response, getFileName(), formatoReporte.getExtension());\r\n\t\t\t exporter = new JRXlsExporter();\r\n\t\t\t exporter.setParameter(JASPER_PRINT, jasperPrint);\r\n\t\t\t exporter.setParameter(OUTPUT_STREAM, ouputStream);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CSV:\r\n\t\t\t\tsetContentHeader(response, getFileName(), formatoReporte.getExtension());\r\n\t\t\t exporter = new JRCsvExporter();\r\n\t\t\t exporter.setParameter(JASPER_PRINT, jasperPrint);\r\n\t\t\t exporter.setParameter(OUTPUT_STREAM, ouputStream);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault: break;\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t exporter.exportReport();\r\n\t\t} finally {\r\n\t\t if (ouputStream != null) {\r\n\t\t try {\r\n\t\t ouputStream.close();\r\n\t\t } catch (IOException ex) {\r\n\t\t }\r\n\t\t }\r\n\t\t}\r\n\t}", "public void manipulatePdf(String dest) throws IOException, SQLException {\n DatabaseConnection connection = new HsqldbConnection(\"filmfestival\");\n\n PdfDocument pdfDoc = new PdfDocument(new PdfWriter(DEST));\n Document doc = new Document(pdfDoc);\n doc.setMargins(54, 36, 36, 36);\n\n HeaderHandler headerHandler = new HeaderHandler();\n pdfDoc.addEventHandler(PdfDocumentEvent.START_PAGE, headerHandler);\n\n WatermarkHandler watermarkHandler = new WatermarkHandler();\n pdfDoc.addEventHandler(PdfDocumentEvent.END_PAGE, watermarkHandler);\n\n template = new PdfFormXObject(new Rectangle(550, 803, 30, 30));\n PdfCanvas canvas = new PdfCanvas(template, pdfDoc);\n\n\n bold = PdfFontFactory.createFont(StandardFonts.HELVETICA_BOLD);\n italic = PdfFontFactory.createFont(StandardFonts.HELVETICA_OBLIQUE);\n normal = PdfFontFactory.createFont(StandardFonts.HELVETICA);\n\n Statement stm = connection.createStatement();\n ResultSet rs = stm.executeQuery(\n \"SELECT country, id FROM film_country ORDER BY country\");\n int d = 1;\n while (rs.next()) {\n headerHandler.setHeader(rs.getString(\"country\"));\n if (1 != d) {\n doc.add(new AreaBreak());\n }\n Set<Movie> movies =\n new TreeSet<>(new MovieComparator(MovieComparator.BY_YEAR));\n movies.addAll(PojoFactory.getMovies(connection, rs.getString(\"id\")));\n for (Movie movie : movies) {\n doc.add(new Paragraph(movie.getMovieTitle()).setFont(bold));\n if (movie.getOriginalTitle() != null)\n doc.add(new Paragraph(movie.getOriginalTitle()).setFont(italic));\n doc.add(new Paragraph(String.format(\"Year: %d; run length: %d minutes\",\n movie.getYear(), movie.getDuration())).setFont(normal));\n doc.add(PojoToElementFactory.getDirectorList(movie));\n }\n d++;\n }\n\n canvas.beginText();\n try {\n canvas.setFontAndSize(PdfFontFactory.createFont(StandardFonts.HELVETICA), 12);\n } catch (IOException e) {\n e.printStackTrace();\n }\n canvas.moveText(550, 803);\n canvas.showText(Integer.toString(pdfDoc.getNumberOfPages()));\n canvas.endText();\n canvas.stroke();\n\n doc.close();\n connection.close();\n }", "public File createPDF(File file) {\n //\tReportEngine re = ReportEngine.get (getCtx(), ReportEngine.PAYMENT, getC_Payment_ID());\n //\tif (re == null)\n return null;\n //\treturn re.getPDF(file);\n }", "public static void responseFormat(Map<String,Object> respFormat,HttpServletResponse resp) throws IOException\n\t{\n\t\t Iterator<Map.Entry<String,Object>> response = respFormat.entrySet().iterator();\n resp.getWriter().println(\"{\");\n\t while(response.hasNext())\n\t {\n\t Map.Entry<String, Object> entry = response.next();\n\t resp.getWriter().println(entry.getKey() +\":\"+ entry.getValue());\n\t }\n\t resp.getWriter().println(\"}\");\n\t}", "@RequestMapping(value=\"/receiveFile\", method = RequestMethod.POST)\n public ResponseEntity<JsonResponse> receiveFile(@RequestBody JsonRequest request) {\n \n try{\n byte[] decodedContent = Base64.getDecoder().decode(request.getContent());\n\n PDFSecure pdfDoc = new PDFSecure(new ByteArrayInputStream(decodedContent), null);\n\n // Load the keystore that contains the digital id to use in signing\n FileInputStream pkcs12Stream = new FileInputStream (System.getenv(\"KEYSTORE_PATH\"));\n KeyStore store = KeyStore.getInstance(\"PKCS12\");\n \n store.load(pkcs12Stream, \"mypassword\".toCharArray());\n pkcs12Stream.close();\n\n // Create signing information\n SigningInformation signInfo = new SigningInformation (store, \"myalias\", \"mypassword\");\n\n // Customize the signature appearance\n SignatureAppearance signAppear = signInfo.getSignatureAppearance();\n\n // Create signature field on the first page\n Rectangle2D signBounds = new Rectangle2D.Double (36, 36, 144, 48);\n SignatureField signField = pdfDoc.addSignatureField(0, \"signature\", signBounds);\n\n // Apply digital signature\n pdfDoc.signDocument(signField, signInfo);\n \n ByteArrayOutputStream signedContent = new ByteArrayOutputStream();\n\n pdfDoc.saveDocument (signedContent);\n\n String encodedSignedContent = Base64.getEncoder().encodeToString(signedContent.toByteArray());\n\n log.info(request.getFileName());\n\n return new ResponseEntity<>(new JsonResponse(request.getFileName(), encodedSignedContent, \"sucess\"), HttpStatus.CREATED);\n } catch (Exception e) {\n \n e.printStackTrace();\n return new ResponseEntity<>(new JsonResponse(request.getFileName(), \"null\", \"exception\"), HttpStatus.INTERNAL_SERVER_ERROR);\n }\n\n }", "public void onStartPage(PdfWriter writer, Document document){}", "public static boolean writeJasperReport (HttpServletResponse response, String reportPath, \r\n\t\t\tMap reportParams, DBConnection conn) throws AppException{\r\n\t\tboolean returnValue = false;\r\n\t\ttry\t{\r\n\t\t\t//Wrap the data in a Jasper object\r\n\t\t //Create the PDF document\r\n\t\t String contentType = \"application/pdf\";\r\n\t\t byte[] myPdfBytes = null;\r\n\t\t\tmyPdfBytes = JasperRunManager.runReportToPdf(reportPath, reportParams, conn);\r\n\r\n\t\t response.setHeader(\"Content-disposition\", \"inline; filename=report.pdf\");\r\n\t\t response.setContentType(contentType);\r\n\t\t response.getOutputStream().write(myPdfBytes);\r\n\t\t \r\n\t\t \r\n\t\t returnValue = true;\r\n\t\t} catch(IllegalStateException ise) {\r\n\t\t ise.printStackTrace();\r\n\t\t} catch(Exception e) {\r\n\t\t\te.printStackTrace();\r\n throw new AppException(\"error.general.sql.processing\");\r\n\t\t}\r\n\t\treturn returnValue;\r\n\t}", "private void serviceResponser(ServiceJSResponse sresp, HttpServletResponse resp) throws Exception {\r\n\t\tString ret = \"\";\r\n\t\tswitch (sresp.getFormat()) {\r\n\t\t\tcase XML:\r\n\t\t\t\tret = new GenerateXmlWithCDATA().generate(sresp.getData());\r\n\t\t\t\tresp.setContentType(\"text/xml\");\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tresp.setContentLength(ret.length());\r\n\t\tresp.getWriter().println(ret);\r\n\t\tresp.getWriter().close();\r\n\t}", "private void createPdf(String sometext) {\n PdfDocument document = new PdfDocument();\n // crate a page description\n PdfDocument.PageInfo pageInfo = new PdfDocument.PageInfo.Builder(300, 600, 1).create();\n // start a page\n PdfDocument.Page page = document.startPage(pageInfo);\n Canvas canvas = page.getCanvas();\n Paint paint = new Paint();\n paint.setColor(Color.RED);\n canvas.drawCircle(50, 50, 30, paint);\n paint.setColor(Color.BLACK);\n canvas.drawText(sometext, 80, 50, paint);\n //canvas.drawt\n // finish the page\n document.finishPage(page);\n // draw text on the graphics object of the page\n // Create Page 2\n pageInfo = new PdfDocument.PageInfo.Builder(300, 600, 2).create();\n page = document.startPage(pageInfo);\n canvas = page.getCanvas();\n paint = new Paint();\n paint.setColor(Color.BLUE);\n canvas.drawCircle(100, 100, 100, paint);\n document.finishPage(page);\n\n // write the document content\n String directory_path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + \"/mypdf/\";\n File file = new File(directory_path);\n if (!file.exists()) {\n file.mkdirs();\n }\n double random_double = Math.random() * (999999 - 999 + 1) + 999;\n String targetPdf = directory_path + String.valueOf(random_double) + \".pdf\";\n File filePath = new File(targetPdf);\n try {\n document.writeTo(new FileOutputStream(filePath));\n Toast.makeText(this, \"Done\", Toast.LENGTH_LONG).show();\n } catch (IOException e) {\n Log.e(\"main\", \"error \" + e.toString());\n Toast.makeText(this, \"Something wrong: \" + e.toString(), Toast.LENGTH_LONG).show();\n }\n // close the document\n document.close();\n }", "public void crearPDF()\r\n\t{\r\n\t\tif (!new File(ruta).exists())\r\n\t\t\t(new File(ruta)).mkdirs();\r\n\r\n\t\tFile[] files = (new File(ruta)).listFiles();\r\n\t\tString ruta = \"\";\r\n\t\tif (files.length == 0) {\r\n\t\t\truta = this.ruta + huesped + \"0\" + \".pdf\";\r\n\t\t} else {\r\n\t\t\tString path = files[files.length - 1].getAbsolutePath();\r\n\t\t\tString num = path.substring(path.length() - 5, path.length() - 4);\r\n\r\n\t\t\truta = this.ruta + huesped + (Integer.parseInt(num) + 1) + \".pdf\";\r\n\t\t}\r\n\r\n\t\tSimpleDateFormat formato = new SimpleDateFormat(\"dd/MM/YYYY\");\r\n\t\t\r\n\t\tcabecera = \"\\n\"+\"Resonance Home\" + \"\\n\"+ \r\n \"Armenia, Quindio\" + \"\\n\" + \r\n \"Colombia\" + \"\\n\\n\" + \r\n\t\t\t\t\"Fecha \" + reserva.getFecha().toString() + \"\\n\\n\\n\";\r\n\t\tcontenido = \"Reserva de hospedaje: \"+ reserva.getHospedaje().getId() + \"\\n\" + \r\n \t\"Titulo del Hospedaje: \" + reserva.getHospedaje().getTitulo() + \" \" + \"\\n\" +\r\n \t\"Dirección: \" + reserva.getHospedaje().getDireccion().getDireccion() + \", \" + reserva.getHospedaje().getDireccion().toString() + \"\\n\" +\r\n\t\t\t\t\"Anfitrion: \" + nombreAnfitrion + \"\\n\" + \"Correo: \" + emailAnfitrion + \"\\n\\n\\n\" + \"Huesped: \"\r\n\t\t\t\t+ nombreHuesped + \"\\n\" +\r\n \t\"Metodo de pago: \" + reserva.getTarjeta().getNumeroT() + \" Tarjeta de credito\" + \"\\n\\n\" +\r\n \tformato.format(reserva.getFechaInicial()) + \" hasta \"+ formato.format(reserva.getFechaFinal()) +\"\\n\\n\" +\r\n \t\"Descripcion\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalor\" + \"\\n\\n\" + \r\n\t\t\t\t\"Huespedes\" + \"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \"\r\n\t\t\t\t+ reserva.getNumeroHuespedes() + \"\\n\" +\r\n\t\t\t\t\"Alojamiento\" + \"\t\t\t\t\t\t\t\t\t\t\t\t\t \" + precioCompleto + \"\\n\"\r\n\t\t\t\t+ \"Tarifa de limpieza\" + \"\t\t\t\t \t \" + precioLimpieza + \"\\n\" + \"Comision por servicio\"\r\n\t\t\t\t+ \"\t\t\t\t\t\" + precioComision + \"\\n\\n\";\r\n\t\tpiePagina = \"TOTAL \" + \" \" + \"$ \" + reserva.getValor() + \"\\n\" ;\r\n\t\t\r\n\t\ttry {\r\n\t\t\tFileOutputStream archivo = new FileOutputStream(ruta);\r\n\t\t\tDocument doc = new Document(PageSize.A5, 10, 10, 10, 10);\r\n\t\t\tPdfWriter.getInstance(doc, archivo);\r\n\t\t\tdoc.open();\r\n\t\t\tdoc.add(obtenerCabecera(cabecera));\r\n\t\t\tdoc.add(obtenerContenido(contenido));\r\n\t\t\tdoc.add(obtenerPiePagina(piePagina));\r\n\t\t\tdoc.close();\r\n\t\t\tthis.ruta = ruta;\r\n\t\t}\r\n\t\tcatch (Exception e) {\r\n\t\t\tSystem.out.println(\"\" + e);\r\n\t\t}\r\n\r\n\t}", "public interface PdfProvider {\n /**\n * Create a thumbnail image for a given PDF file.\n *\n * @param inputFile Input file.\n * @param outputStream OutputStream, to which the thumbnail is written. Important: Stream is not closed!\n * @param format Output file format given as a MIME type.\n * @param width Width in pixel.\n * @param height Height in pixel.\n * @param quality Quality factor for output compression.\n * @param speedHint Speed factor for conversion.\n * @throws Exception on any error opening the file, converting the file or writing to the output.\n */\n\n void createThumbNail(File inputFile, OutputStream outputStream,\n String format, int width, int height,\n ConversionCommand.CompressionQuality quality,\n ConversionCommand.SpeedHint speedHint) throws Exception;\n\n PdfDocumentInformation getDocumentInformation(File pdfFile) throws Exception;\n\n int countPages(File pdfFile) throws Exception;\n\n void createPdfFromImages(File[] imageFiles, PdfDocumentInformation documentInformation, File outputPdfFile) throws Exception;\n\n void createPdfFromImages(byte[][] imageFileByteArrays, PdfDocumentInformation documentInformation,\n int width, int height, OutputStream outputStream) throws Exception;\n}", "protected void startResponseOutput(Response response, Writer writer) throws ScalarActionException {\r\n // No wrapping if there is no tag\r\n\t\tString tag = response.getTag();\r\n\t\tif ( (null == tag) || (tag.length() == 0) ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\twriter.write('{');\r\n\t\t\taddOutputAttribute(TYPE, response.getTag(), writer, false);\r\n\r\n\t\t\tMap<String, String> data = response.getOutputAttributes();\r\n\t\t\tfor ( Map.Entry<String, String> entry : data.entrySet() ) {\r\n\t\t\t\tString key = entry.getKey();\r\n\t\t\t\tString value = entry.getValue();\r\n\t\t\t\tif(value != null && tag.equals(ErrorResponse.FUI_ERROR) &&\r\n\t\t\t\t\t\t( key.equals(ErrorResponse.MESSAGE_ATTRIBUTE) || key.equals(ErrorResponse.ROOT_MESSAGE_ATTRIBUTE) )){\r\n\t\t\t\t\tvalue = value.replace('\\n', ' ');\r\n\t\t\t\t\tvalue = value.replace('\\r', ' ');\r\n\t\t\t\t\tvalue = value.replace('\\t', ' ');\r\n\t\t\t\t}\r\n\t\t\t\taddOutputAttribute(key, value, writer, true);\r\n\t\t\t}\r\n\r\n\r\n\t\t\twriter.write(\",\\\"\" + CONTENT + \"\\\": \\\"\");\r\n\t\t} catch ( IOException e ) {\r\n\t\t\tMsgObject msgObject = MsgObjectUtil.getMsgObject(FrameworkResource.BASE_NAME, FrameworkResource.WRITE_OUTPUT_FAILURE);\r\n\t\t\tthrow ScalarActionException.create(msgObject, e);\r\n\t\t}\r\n }", "private void selectPdf() {\n\n Intent intent = new Intent();\n intent.setType(\"application/pdf\");\n intent.setAction(Intent.ACTION_GET_CONTENT);//to fetch files\n startActivityForResult(intent,86);\n\n\n\n }", "public static boolean writeJasperReport (HttpServletResponse response, String reportPath, \r\n\t\t\tMap reportParams, ResultSet reportData) {\r\n\t\tboolean returnValue = false;\r\n\t\ttry\t{\r\n\t\t\t//Wrap the data in a Jasper object\r\n\t\t //Create the PDF document\r\n\t\t String contentType = \"application/pdf\";\r\n\t\t byte[] myPdfBytes = null;\r\n\t\t\tmyPdfBytes = JasperRunManager.runReportToPdf(reportPath, reportParams, new JRResultSetDataSource(reportData));\r\n\t\t response.setHeader(\"Content-disposition\", \"inline; filename=report.pdf\");\r\n\t\t response.setContentType(contentType);\r\n\t\t response.getOutputStream().write(myPdfBytes);\r\n\t\t returnValue = true;\r\n\t\t} catch(Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn returnValue;\r\n\t}", "protected abstract void output(DavServletResponse response)\n throws IOException;", "public void btnGenerarReporteDestruccionPDF() {\n try {\n byte[] bytesFile;\n bytesFile = null;\n Map parameters = new HashMap();\n\n parameters.put(\"rfc\", produccionCigarrosHelper.getTabacalera().getRfc());\n parameters.put(\"incidencia\", \"Desperdicios y destrucción\");\n parameters.put(\"fecha\", new Date());\n parameters.put(\"folio\", desperdiciosHelper.getIdAcuseRecibo());\n parameters.put(\"cadenaOriginal\", firmaFormHelper.getCadenaOriginal());\n parameters.put(\"selloDigital\", selloDigital.generaSelloDigital(firmaFormHelper.getCadenaOriginal()));\n parameters.put(\"codigo_qr\", QRCodeUtil.getQr(desperdiciosHelper.getIdAcuseRecibo(), produccionCigarrosHelper.getTabacalera().getRfc(), Constantes.CINCUENTA, Constantes.CINCUENTA, Constantes.ARCHIVO_PNG));\n\n if (reporterService != null) {\n bytesFile = reporterService.makeReport(ReportesTabacosEnum.REPORTE_ACUSE_DESPERDICIO_DESTRUCCION, ARCHIVO_PDF, parameters, null);\n if (bytesFile != null) {\n generaDocumento(bytesFile, MIMETypesEnum.PDF, \"AcuseDescargapDesperdiciosDestruccion_\" + desperdiciosHelper.getIdAcuseRecibo(), FileExtensionEnum.PDF);\n }\n }\n } catch (ReporterJasperException e) {\n super.addErrorMessage(ERROR, \"Error al generar el acuse\");\n LOGGER.error(\"Error al generar el Reporte en PDF\" + e.getMessage());\n } catch (QRCodeUtilException ex) {\n super.addErrorMessage(ERROR, \"Error al generar el acuse\");\n LOGGER.error(\"Error al generar el Reporte en PDF\" + ex.getMessage());\n } catch (SelloDigitalException ex) {\n super.addErrorMessage(ERROR, \"Error al generar el acuse\");\n LOGGER.error(\"Error al generar el Reporte en PDF\" + ex.getMessage());\n }\n\n }", "public void generateReport(TaxChallan bean, HttpServletRequest request, HttpServletResponse response, String reportPath) {\r\n\t\ttry {\r\n\t\t\t\r\n\t\t\tReportDataSet rds = new ReportDataSet();\r\n\t\t\tString type = bean.getReportType();\r\n\t\t\trds.setReportType(type);\r\n\t\t\tString fileName = \"T.D.S.-TCS TAX CHALLAN\"+Utility.getRandomNumber(1000);\r\n\t\t\tString reportPathName=reportPath+fileName+\".\"+type;\r\n\t\t\trds.setFileName(fileName);\r\n\t\t\trds.setPageSize(\"A4\");\r\n\t\t\trds.setReportHeaderRequired(false);\r\n\t\t\trds.setShowPageNo(true);\r\n\t\t\torg.paradyne.lib.ireportV2.ReportGenerator rg=null;\r\n\t\t\t/* Added by Prashant*/\r\n\t\t\tif(reportPath.equals(\"\")){\r\n\t\t\t\trg = new org.paradyne.lib.ireportV2.ReportGenerator(rds, session, context, request);\r\n\t\t\t}else{\r\n\t\t\t\tlogger.info(\"################# ATTACHMENT PATH #############\"+reportPath+fileName+\".\"+type);\r\n\t\t\t\trg = new org.paradyne.lib.ireportV2.ReportGenerator(rds, reportPath ,session, context, request);\r\n\t\t\t\trequest.setAttribute(\"reportPath\", reportPath+fileName+\".\"+type);\r\n\t\t\t\trequest.setAttribute(\"fileName\", fileName+\".\"+type);\r\n\t\t\t\trequest.setAttribute(\"action\", \"TaxChallan_input.action\");\r\n\t\t\t}\r\n\t\t\trg = getReport(rg, bean);\r\n\t\t\trg.process();\r\n\t\t\tif(reportPath.equals(\"\")){\r\n\t\t\t\trg.createReport(response);\r\n\t\t\t}else{\r\n\t\t\t\t/* Generates the report as attachment*/\r\n\t\t\t\trg.saveReport(response);\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "@RequestMapping(value = \"/admin/account/paymentHistory/invoice/{paymentId}\")\n public void getPaymentHistoryInvoicePdf(@PathVariable String paymentId, Authentication token,\n HttpServletResponse httpServletResponse) {\n process(helper::getPaymentHistoryInvoicePdf, token, paymentId, httpServletResponse);\n }", "public void createPdf(String dest) throws IOException, DocumentException, XMPException {\n Document document = new Document(PageSize.A4.rotate());\n //PDF/A-3b\n //Create PdfAWriter with the required conformance level\n PdfAWriter writer = PdfAWriter.getInstance(document, new FileOutputStream(dest), PdfAConformanceLevel.ZUGFeRD);\n writer.setPdfVersion(PdfWriter.VERSION_1_7);\n //Create XMP metadata\n writer.createXmpMetadata();\n writer.getXmpWriter().setProperty(PdfAXmpWriter.zugferdSchemaNS, PdfAXmpWriter.zugferdDocumentFileName, \"invoice.xml\");\n //====================\n document.open();\n //PDF/A-3b\n //Set output intents\n ICC_Profile icc = ICC_Profile.getInstance(new FileInputStream(ICC));\n writer.setOutputIntents(\"Custom\", \"\", \"http://www.color.org\", \"sRGB IEC61966-2.1\", icc);\n //===================\n\n Paragraph p = new Paragraph();\n //PDF/A-3b\n //Embed font\n p.setFont(FontFactory.getFont(FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 20));\n //=============\n Chunk c = new Chunk(\"The quick brown \");\n p.add(c);\n Image i = Image.getInstance(FOX);\n c = new Chunk(i, 0, -24);\n p.add(c);\n c = new Chunk(\" jumps over the lazy \");\n p.add(c);\n i = Image.getInstance(DOG);\n c = new Chunk(i, 0, -24);\n p.add(c);\n document.add(p);\n\n PdfDictionary parameters = new PdfDictionary();\n parameters.put(PdfName.MODDATE, new PdfDate());\n PdfFileSpecification fileSpec = writer.addFileAttachment(\n \"ZUGFeRD invoice\", null, XML,\n \"invoice.xml\", \"application/xml\",\n AFRelationshipValue.Alternative, parameters);\n PdfArray array = new PdfArray();\n array.add(fileSpec.getReference());\n writer.getExtraCatalog().put(PdfName.AF, array);\n\n document.close();\n }", "public static String prepareQuoteReport(HttpServletRequest request, HttpServletResponse response) {\n GenericDelegator delegator = (GenericDelegator) request.getAttribute(\"delegator\");\n LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute(\"dispatcher\");\n GenericValue userLogin = (GenericValue) request.getSession().getAttribute(\"userLogin\");\n Locale locale = UtilHttp.getLocale(request);\n String quoteId = UtilCommon.getParameter(request, \"quoteId\");\n \n try {\n // get parameter for jasper\n Map<String, Object> jasperParameters = prepareQuoteReportParameters(delegator, dispatcher, userLogin, locale, quoteId);\n request.setAttribute(\"jrParameters\", jasperParameters.get(\"jrParameters\"));\n request.setAttribute(\"jrDataSource\", jasperParameters.get(\"jrDataSource\"));\n \n } catch (GeneralException e) {\n UtilMessage.createAndLogEventError(request, e, locale, MODULE);\n }\n \n return \"success\";\n }", "@RequestMapping(value = \"/download\", method = RequestMethod.GET)\n public String download(HttpServletRequest request, HttpServletResponse response, Model model)\n throws IOException, TemplateException {\n FreemarkerCfg reportCfg = FreemarkerCfg.newInstance();\n WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();\n ServletContext servletContext = webApplicationContext.getServletContext();\n reportCfg.setServletContextForTemplateLoading(servletContext, \"/views/ftl\");\n // reportCfg.setDirectoryForTemplateLoading(templateDir);\n // Template t = reportCfg.getTemplate(\"scaleList.flt\");\n Template t = reportCfg.getTemplate(\"report.flt\");\n response.setCharacterEncoding(\"utf-8\");\n response.setContentType(\"application/msword\");\n // 设置浏览器以下载的方式处理该文件默认名为resume.doc\n response.addHeader(\"Content-Disposition\", \"attachment;filename=resume.doc\");\n // Writer out = response.getWriter();\n ServletOutputStream out = response.getOutputStream();\n Map root = new HashMap();\n\n String name = \"temp\" + (int) (Math.random() * 100000) + \".doc\";\n File f = new File(name);\n Writer w = new OutputStreamWriter(new FileOutputStream(f), \"utf-8\");\n\n // root.put(\"scaleList\", scaleList);\n root.put(\"name\", \"\");\n t.process(root, w);\n w.close();\n FileInputStream fin = new FileInputStream(f);\n IOUtils.copy(fin, out);\n IOUtils.closeQuietly(out);\n IOUtils.closeQuietly(fin);\n return null;\n // return viewName(\"scaletablelist\");\n }", "public void loadPdfFile() {\n PDFView.Configurator configurator;\n RelativeLayout relativeLayout = (RelativeLayout)this.pdfView.getParent();\n this.errorTextView = (TextView)relativeLayout.findViewById(2131296408);\n this.progressBar = (ProgressBar)relativeLayout.findViewById(2131296534);\n this.sharedPreferences = Factory.getInstance().getMainNavigationActivity().getSharedPreferences(\"AppsgeyserPrefs\", 0);\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"pdf_saved_page_\");\n stringBuilder.append(this.initialTabId);\n savedPageKey = stringBuilder.toString();\n if (this.pathFile.startsWith(\"file:///\")) {\n String string2 = this.pathFile.replace((CharSequence)\"file:///android_asset/\", (CharSequence)\"\");\n configurator = this.pdfView.fromAsset(string2);\n } else {\n boolean bl = this.pathFile.startsWith(\"http\");\n configurator = null;\n if (bl) {\n String string3 = this.pathFile;\n new LoaderPdf().execute((Object[])new String[]{string3});\n }\n }\n this.pdfView.useBestQuality(true);\n if (configurator == null) return;\n try {\n this.loadConfigurator(configurator);\n return;\n }\n catch (Exception exception) {\n exception.printStackTrace();\n this.progressBar.setVisibility(8);\n }\n }", "public DstPdfGuideline(Connection conn, OutputStream os){\n searchEngine = new DDSearchEngine(conn);\n this.os = os;\n \t\tsetShowedAttributes();\n }", "public void FileDownloadView(PojoPropuestaConvenio pojo) throws IOException {\n BufferedOutputStream out = null;\n try {\n String extension = null;\n String nombre = null;\n String contentType = null;\n InputStream stream = null;\n listadoDocumento = documentoService.getDocumentFindCovenio(pojo.getID_PROPUESTA());\n\n for (Documento doc : listadoDocumento) {\n if (doc.getIdTipoDocumento().getNombreDocumento().equalsIgnoreCase(TIPO_DOCUMENTO)) {\n if (getFileExtension(doc.getNombreDocumento()).equalsIgnoreCase(\"pdf\")) {\n stream = new ByteArrayInputStream(doc.getDocumento());\n nombre = doc.getNombreDocumento();\n extension = \"pdf\";\n }\n }\n }\n\n if (extension != null) {\n if (extension.equalsIgnoreCase(\"pdf\")) {\n contentType = \"Application/pdf\";\n }\n content = new DefaultStreamedContent(stream, contentType, nombre);\n } else {\n FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, \"Documento\", \"No se cuenta con documento firmado para descargar\"));\n }\n\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n if (out != null) {\n out.close();\n }\n }\n\n }", "@SuppressWarnings(\"unchecked\")\n @Override\n protected void buildPdfDocument(Map<String, Object> model, Document document, PdfWriter writer,\n HttpServletRequest request, HttpServletResponse response) throws Exception {\n createNewPdfByTemplate(model,document,writer,request,response);\n\n }", "public void writePDF(PDFWriter aWriter)\n {\n List refs = new ArrayList(getPageCount());\n PDFXTable xref = aWriter.getXRefTable();\n for (int i = 0, iMax = getPageCount(); i < iMax; i++)\n refs.add(xref.getRefString(getPage(i)));\n\n //\n _dict.put(\"Kids\", refs);\n _dict.put(\"Count\", getPageCount());\n\n //\n aWriter.writeXRefEntry(_dict);\n }", "public static boolean writeJasperReport (HttpServletResponse response, String reportPath, \r\n\t\t\tMap reportParams, JRMapArrayDataSource reportData) {\r\n\t\tboolean returnValue = false;\r\n\t\ttry\t{\r\n\t\t\t//Wrap the data in a Jasper object\r\n\t\t //Create the PDF document\r\n\t\t String contentType = \"application/pdf\";\r\n\t\t byte[] myPdfBytes = null;\r\n\t\t\tmyPdfBytes = JasperRunManager.runReportToPdf(reportPath, reportParams, reportData);\r\n\t\t response.setHeader(\"Content-disposition\", \"inline; filename=report.pdf\");\r\n\t\t response.setContentType(contentType);\r\n\t\t response.getOutputStream().write(myPdfBytes);\r\n\t\t returnValue = true;\r\n\t\t} catch(Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn returnValue;\r\n\t}", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException, ClassNotFoundException {\n // setting the content type\n response.setContentType(\"application/pdf\");\n try {\n HttpSession session=request.getSession();\n if(session.getAttribute(\"username\")!=null) {\n // Get the text that will be added to the PDF\n \n String month=request.getParameter(\"month\");\n String year=request.getParameter(\"year\");\n //String id=request.getParameter(\"empid\");\n // System.out.println(id);\n // String text = request.getParameter(\"text\");\n // if (text == null || text.trim().length() == 0) {\n // text = \"You didn't enter any text.\";\n // }\n //String id=\"Ultimate01\"; \n Class.forName(\"com.mysql.jdbc.Driver\").newInstance();\n \n Connection con=DriverManager.getConnection(\"jdbc:mysql://localhost:3306/payroll123\",\"root\",\"\");\n \n PreparedStatement ps = con.prepareStatement(\"SELECT SUM(basicsalary) as sum1 FROM payslip where month=? and year=?\");\n ps.setString(1, month);\n ps.setString(2, year);\n System.out.println(\"hey1\");\n PreparedStatement ps1 = con.prepareStatement(\"SELECT COUNT(DISTINCT employeeid) as emps FROM payslip where month=? and year=?\");\n ps1.setString(1, month);\n ps1.setString(2, year);\n System.out.println(\"hey1\");\n \n ResultSet rs = ps.executeQuery();\n //System.out.println(rs.getInt(1));\n\n rs.next();\n// System.out.println(rs.getInt(\"sum1\"));\n ResultSet rs1 = ps1.executeQuery();\n rs1.next(); \nif(rs.getFloat(\"sum1\")==0.0 && rs1.getFloat(\"emps\")==0.0)\n{\n response.sendRedirect(\"generatereportbyaccz.jsp?id=Report of \"+month+\"/\"+year+\" is not generated OR Record of this Report is not available in our Database\");\n}\n// step 1\n Float[] val = new Float[9];\n val[0]=rs.getFloat(\"sum1\");\n val[1]=6000.00f*rs1.getFloat(\"emps\");\n val[2]=1000.00f*rs1.getFloat(\"emps\");\n val[3]=1000.00f*rs1.getFloat(\"emps\");\n val[4]=val[0]/2;\n val[5]=1000.00f*rs1.getFloat(\"emps\");\n val[6]=val[4];\n val[7]=val[0]*12/100;\n val[8]=0.00f;\n if((val[0]+val[4]+val[6])*12>250000.00f)\n {\n val[8]=(val[0]+val[4]+val[6])/10;\n }\n \n //System.out.println(\"sssssssssssssssssss\");\n \n Document document = new Document();\n // step 2\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n PdfWriter.getInstance(document, baos);\n\n \n Font font0 = new Font(Font.FontFamily.TIMES_ROMAN , 11);\n Font font1 = new Font(Font.FontFamily.HELVETICA , 11, Font.BOLD);\n Font font2 = new Font(Font.FontFamily.HELVETICA , 18, Font.BOLD);\n Font font3 = new Font(Font.FontFamily.HELVETICA , 9, Font.BOLD);\n Font font4 = new Font(Font.FontFamily.HELVETICA , 10);\n Font font5 = new Font(Font.FontFamily.HELVETICA , 12, Font.BOLD);\n Font font6 = new Font(Font.FontFamily.HELVETICA , 12);\n\n//font1.setColor(BaseColor.WHITE);\n BaseColor myColor = WebColors.getRGBColor(\"#F78181\");\n BaseColor myColor1 = WebColors.getRGBColor(\"#FAFAFA\");\n \n\n//step 3\n document.open();\n // step 3.5\n PdfPTable table1 = new PdfPTable(3); // 1 columns.\n // table1.setWidthPercentage(75);\n \n PdfPCell cell00 = new PdfPCell(new Paragraph(\"Monthly Payroll Summary\\nFEB-2015\",font2));\n cell00.setBorder(PdfPCell.NO_BORDER);\n cell00.setPaddingTop(18);\n cell00.setColspan(2);\n \n Image image = Image.getInstance(\"cc.jpg\");\n PdfPCell cell0 = new PdfPCell(image, true);\ncell0.setBorder(PdfPCell.NO_BORDER);\n \n // cell0.setHorizontalAlignment(Element.ALIGN_RIGHT);\n //PdfPCell cell1 = new PdfPCell(new Paragraph(\"Mr. NILESH POPATBHAI LATHIYA\"));\n table1.addCell(cell00);\n // table1.addCell(cell0);\n table1.addCell(cell0);\n // table1.addCell(cell1);\n// table.addCell(cell2);\n // table.addCell(cell3);\n table1.setWidthPercentage(100);\n table1.setSpacingAfter(8f);\n //table1.setSpacingBefore(20f);\n\n//table1.setSpacingAfter(10f);\n \n document.add(table1);\n // table1.setWidthPercentage(100);\n PdfPTable table21 = new PdfPTable(2); // 3 columns.\n table21.setWidthPercentage(100);\n \n PdfPCell cell151 = new PdfPCell(new Paragraph(\"Total Number of Employees\",font3));\n //cell15.setLeading(10f, 0f);\n cell151.setPadding(3);\n cell151.setBorderWidth(1f);\n cell151.setBackgroundColor(myColor1);\n \n PdfPCell cell161 = new PdfPCell(new Paragraph(Integer.toString(rs1.getInt(\"emps\")),font4));\n // cell16.setLeading(10f, 0f);\n cell161.setPadding(3);\n cell161.setBorderWidth(1f);\n cell161.setBackgroundColor(myColor1);\n \n table21.addCell(cell151);\n table21.addCell(cell161);\n \n table21.setSpacingAfter(12f);\n \n document.add(table21); \n \n PdfPTable table2 = new PdfPTable(2); // 3 columns.\n \n table2.setWidthPercentage(100);\n \n PdfPCell cell15 = new PdfPCell(new Paragraph(\"Total Basic Salary\",font3));\n //cell15.setLeading(10f, 0f);\n cell15.setPadding(3);\n cell15.setBorderWidth(1f);\n cell15.setBackgroundColor(myColor1);\n \n PdfPCell cell16 = new PdfPCell(new Paragraph(Float.toString(val[0]),font4));\n // cell16.setLeading(10f, 0f);\n cell16.setPadding(3);\n cell16.setBorderWidth(1f);\n cell16.setBackgroundColor(myColor1);\n \n PdfPCell cell17 = new PdfPCell(new Paragraph(\"Total House Rent Allowance\",font3));\n //cell17.setLeading(10f, 0f);\n cell17.setPadding(3);\n cell17.setBorderWidth(1f);\n cell17.setBackgroundColor(myColor1);\n PdfPCell cell18 = new PdfPCell(new Paragraph(Float.toString(val[1]),font4));\n //cell18.setLeading(10f, 0f);\n cell18.setPadding(3);\n cell18.setBorderWidth(1f);\n cell18.setBackgroundColor(myColor1);\n PdfPCell cell19 = new PdfPCell(new Paragraph(\"Total Medical Allowance\",font3));\n //cell19.setLeading(10f, 0f);\n cell19.setPadding(3);\n cell19.setBorderWidth(1f);\n cell19.setBackgroundColor(myColor1);\n PdfPCell cell20 = new PdfPCell(new Paragraph(Float.toString(val[2]),font4));\n //cell20.setLeading(10f, 0f);\n cell20.setPadding(3);\n cell20.setBorderWidth(1f);\n cell20.setBackgroundColor(myColor1);\n \n table2.addCell(cell15);\n table2.addCell(cell16);\n table2.addCell(cell17);\n table2.addCell(cell18);\n table2.addCell(cell19);\n table2.addCell(cell20);\n \n \n PdfPCell cell21 = new PdfPCell(new Paragraph(\"Total Travelling Allowance\",font3));\n //cell21.setLeading(10f, 0f);\n cell21.setPadding(3);\n cell21.setBorderWidth(1f);\n cell21.setBackgroundColor(myColor1);\n PdfPCell cell22 = new PdfPCell(new Paragraph(Float.toString(val[3]),font4));\n // cell22.setLeading(10f, 0f);\n cell22.setPadding(3);\n cell22.setBorderWidth(1f);\n cell22.setBackgroundColor(myColor1);\n PdfPCell cell23 = new PdfPCell(new Paragraph(\"Total Personal Allowance\",font3));\n //cell23.setLeading(10f, 0f);\n cell23.setPadding(3);\n cell23.setBorderWidth(1f);\n cell23.setBackgroundColor(myColor1);\n \n \n PdfPCell cell24 = new PdfPCell(new Paragraph(Float.toString(val[4]),font4));\n //cell24.setLeading(10f, 0f);\n cell24.setPadding(3);\n cell24.setBorderWidth(1f);\n cell24.setBackgroundColor(myColor1);\n PdfPCell cell25 = new PdfPCell(new Paragraph(\"Total City Allowance\",font3));\n //cell25.setLeading(10f, 0f);\n cell25.setPadding(3);\n cell25.setBorderWidth(1f);\n cell25.setBackgroundColor(myColor1);\n PdfPCell cell26 = new PdfPCell(new Paragraph(Float.toString(val[5]),font4));\n //cell26.setLeading(10f, 0f);\n cell26.setPadding(3);\n cell26.setBorderWidth(1f);\n cell26.setBackgroundColor(myColor1);\n \n table2.addCell(cell21);\n table2.addCell(cell22);\n table2.addCell(cell23);\n table2.addCell(cell24);\n table2.addCell(cell25);\n table2.addCell(cell26);\n \n \n PdfPCell cell27 = new PdfPCell(new Paragraph(\"Total Performance Pay\",font3));\n //cell27.setLeading(10f, 0f);\n cell27.setPadding(3);\n cell27.setBorderWidth(1f);\n cell27.setBackgroundColor(myColor1);\n PdfPCell cell28 = new PdfPCell(new Paragraph(Float.toString(val[6]),font4));\n // cell28.setLeading(10f, 0f);\n cell28.setPadding(3);\n cell28.setBorderWidth(1f);\n cell28.setBackgroundColor(myColor1);\n \n table2.addCell(cell27);\n table2.addCell(cell28);\n \n table2.setSpacingAfter(12f);\n \n document.add(table2); \n \n PdfPTable table3 = new PdfPTable(2); // 3 columns.\n table3.setWidthPercentage(100);\n \n PdfPCell cell271 = new PdfPCell(new Paragraph(\"Final Total amount paid by company\",font3));\n //cell27.setLeading(10f, 0f);\n cell271.setPadding(3);\n cell271.setBorderWidth(1f);\n cell271.setBackgroundColor(myColor1);\n PdfPCell cell281 = new PdfPCell(new Paragraph(Float.toString(val[6]),font4));\n // cell28.setLeading(10f, 0f);\n cell281.setPadding(3);\n cell281.setBorderWidth(1f);\n cell281.setBackgroundColor(myColor1);\n \n PdfPCell cell29 = new PdfPCell(new Paragraph(\"Total Provident Fund Collected\",font3));\n //cell29.setLeading(10f, 0f);\n cell29.setPadding(3);\n cell29.setBorderWidth(1f);\n cell29.setBackgroundColor(myColor1);\n PdfPCell cell30 = new PdfPCell(new Paragraph(Float.toString(val[7]),font4));\n //cell30.setLeading(10f, 0f);\n cell30.setPadding(3);\n cell30.setBorderWidth(1f);\n cell30.setBackgroundColor(myColor1);\n PdfPCell cell31 = new PdfPCell(new Paragraph(\"Total Professional Tax Collected\",font3));\n //cell31.setLeading(10f, 0f);\n cell31.setPadding(3);\n cell31.setBorderWidth(1f);\n cell31.setBackgroundColor(myColor1);\n PdfPCell cell32 = new PdfPCell(new Paragraph(Float.toString(val[8]),font4));\n //cell32.setLeading(10f, 0f);\n cell32.setPadding(3);\n cell32.setBorderWidth(1f);\n cell32.setBackgroundColor(myColor1);\n \n \n table3.addCell(cell271);\n table3.addCell(cell281);\n table3.addCell(cell29);\n table3.addCell(cell30);\n table3.addCell(cell31);\n table3.addCell(cell32);\n \n table3.setSpacingAfter(12f);\n \n document.add(table3);\n /* PdfPCell cell33 = new PdfPCell(new Paragraph(\"PAN\",font3));\n //cell33.setLeading(10f, 0f);\n cell33.setPadding(3);\n cell33.setBorderWidth(1f);\n cell33.setBackgroundColor(myColor1);\n PdfPCell cell34 = new PdfPCell(new Paragraph(\"XXXXXXX792E\",font4));\n // cell34.setLeading(10f, 0f);\n cell34.setPadding(3);\n cell34.setBorderWidth(1f);\n cell34.setBackgroundColor(myColor1);\n PdfPCell cell35 = new PdfPCell(new Paragraph(\"Leave Balance\",font3));\n //cell35.setLeading(10f, 0f);\n cell35.setPadding(3);\n cell35.setBorderWidth(1f);\n cell35.setBackgroundColor(myColor1);\n PdfPCell cell36 = new PdfPCell(new Paragraph(\"EL X SL X CL X\",font4));\n //cell36.setLeading(10f, 0f);\n cell36.setPadding(3);\n cell36.setBorderWidth(1f);\n cell36.setBackgroundColor(myColor1);\n PdfPCell cell37 = new PdfPCell(new Paragraph(\" WON/SWON\",font3));\n //cell37.setLeading(10f, 0f);\n cell37.setPadding(3);\n cell37.setBorderWidth(1f);\n cell37.setBackgroundColor(myColor1);\n PdfPCell cell38 = new PdfPCell(new Paragraph(\"2616141\",font4));\n //cell38.setLeading(10f, 0f);\n cell38.setPadding(3);\n cell38.setBorderWidth(1f);\n cell38.setBackgroundColor(myColor1);\n \n table2.addCell(cell33);\n table2.addCell(cell34);\n table2.addCell(cell35);\n table2.addCell(cell36);\n table2.addCell(cell37);\n table2.addCell(cell38);\n */ \n \n /* \n PdfPTable table3 = new PdfPTable(5); // 5 columns.\n table3.setWidthPercentage(100);\n \n PdfPCell cell39 = new PdfPCell(new Paragraph(\"Earnings\",font1));\n cell39.setLeading(10f, 0f);\n cell39.setPadding(4);\n cell39.setBorderWidth(1f);\n cell39.setBackgroundColor(myColor);\n PdfPCell cell40 = new PdfPCell(new Paragraph(\"Arrears (INR)\",font1));\n cell40.setLeading(10f, 0f);\n cell40.setPadding(4);\n cell40.setBorderWidth(1f);\n cell40.setBackgroundColor(myColor);\n PdfPCell cell41 = new PdfPCell(new Paragraph(\"Current (INR)\",font1));\n cell41.setLeading(10f, 0f);\n cell41.setPadding(4);\n cell41.setBorderWidth(1f);\n cell41.setBackgroundColor(myColor);\n PdfPCell cell42 = new PdfPCell(new Paragraph(\"Deductions\",font1));\n cell42.setLeading(10f, 0f);\n cell42.setPadding(4);\n cell42.setBorderWidth(1f);\n cell42.setBackgroundColor(myColor);\n PdfPCell cell43 = new PdfPCell(new Paragraph(\"Amount (INR)\",font1));\n cell43.setLeading(10f, 0f);\n cell43.setPadding(4);\n cell43.setBorderWidth(1f);\n cell43.setBackgroundColor(myColor);\n \n table3.addCell(cell39);\n table3.addCell(cell40);\n table3.addCell(cell41);\n table3.addCell(cell42);\n table3.addCell(cell43);\n \n String[] sal = new String[9];\n sal[0]=\"Basic Salary\";\n sal[1]=\"House Rent Allowance\";\n sal[2]=\"Medical Allowance\";\n sal[3]=\"Travelling Allowance\";\n sal[4]=\"Personal Allowance\";\n sal[5]=\"City Allowance\";\n sal[6]=\"Performance Pay\";\n sal[7]=\"Provident Fund\";\n sal[8]=\"Professional Tax\";\n \n Float[] val = new Float[9];\n val[0]=rs1.getFloat(4);\n val[1]=6000.00f;\n val[2]=1000.00f;\n val[3]=1000.00f;\n val[4]=val[0]/2;\n val[5]=1000.00f;\n val[6]=val[4];\n val[7]=val[0]*12/100;\n val[8]=0.00f;\n if((val[0]+val[4]+val[6])*12>250000.00f)\n {\n val[8]=(val[0]+val[4]+val[6])/10;\n }\n \n \n \n for(int i=0;i<7;i++)\n {\n PdfPCell cell44 = new PdfPCell(new Paragraph(sal[i],font3));\n //cell27.setLeading(10f, 0f);\n cell44.setPadding(3);\n cell44.setBorderWidth(1f);\n cell44.setBackgroundColor(myColor1);\n PdfPCell cell45 = new PdfPCell(new Paragraph(\"\",font4));\n // cell45.setLeading(10f, 0f);\n cell45.setPadding(3);\n cell45.setBorderWidth(1f);\n cell45.setBackgroundColor(myColor1);\n PdfPCell cell46 = new PdfPCell(new Paragraph(val[i].toString(),font3));\n //cell46.setLeading(10f, 0f);\n cell46.setHorizontalAlignment(Element.ALIGN_RIGHT);\n cell46.setPadding(3);\n cell46.setBorderWidth(1f);\n cell46.setBackgroundColor(myColor1);\n \n table3.addCell(cell44);\n table3.addCell(cell45);\n table3.addCell(cell46);\n \n \n if(i==0 || i==1) { \n PdfPCell cell47 = new PdfPCell(new Paragraph(sal[7+i],font4));\n //cell47.setLeading(10f, 0f);\n cell47.setPadding(3);\n cell47.setBorderWidth(1f);\n cell47.setBackgroundColor(myColor1);\n table3.addCell(cell47);\n PdfPCell cell48 = new PdfPCell(new Paragraph(val[i+7].toString(),font3));\n //cell48.setLeading(10f, 0f);\n cell48.setHorizontalAlignment(Element.ALIGN_RIGHT);\n cell48.setPadding(3);\n cell48.setBorderWidth(1f);\n cell48.setBackgroundColor(myColor1);\n table3.addCell(cell48);\n }\n else\n {\n PdfPCell cell47 = new PdfPCell(new Paragraph(\"\",font4));\n cell47.setBorder(PdfPCell.NO_BORDER);\n cell47.setBorderWidthRight (1f);\n cell47.setColspan(2);\n table3.addCell(cell47);\n }\n \n }\n \n PdfPCell cell48 = new PdfPCell(new Paragraph(\"\",font4));\n //cell48.setBorder(PdfPCell.NO_BORDER);\n cell48.setColspan(3);\n table3.addCell(cell48);\n \n PdfPCell cell49 = new PdfPCell(new Paragraph(\"\",font4));\n //cell49.setBorder(PdfPCell.NO_BORDER);\n cell49.setColspan(2);\n table3.addCell(cell49);\n table3.addCell(cell48);\n table3.addCell(cell49);\n table3.addCell(cell48);\n table3.addCell(cell49);\n table3.addCell(cell48);\n table3.addCell(cell49);\n\n \n PdfPCell cell50 = new PdfPCell(new Paragraph(\"Total Earnings (Current + Arrears)\",font3));\n //cell27.setLeading(10f, 0f);\n cell50.setColspan(2);\n cell50.setPadding(3);\n cell50.setBorderWidth(1f);\n cell50.setBackgroundColor(myColor1);\n table3.addCell(cell50);\n \n float a = 0.0f;\n for(int i=0;i<7;i++)\n {a+=val[i];}\n PdfPCell cell55 = new PdfPCell(new Paragraph(Float.toString(a),font3));\n //cell27.setLeading(10f, 0f);\n cell55.setPadding(3);\n cell55.setHorizontalAlignment(Element.ALIGN_RIGHT);\n cell55.setBorderWidth(1f);\n cell55.setBackgroundColor(myColor1);\n table3.addCell(cell55);\n \n \n PdfPCell cell51 = new PdfPCell(new Paragraph(\"Total Deductions\",font3));\n //cell27.setLeading(10f, 0f);\n //cell51.setColspan(3);\n cell51.setPadding(3);\n cell51.setBorderWidth(1f);\n cell51.setBackgroundColor(myColor1);\n table3.addCell(cell51);\n \n float b = val[7]+val[8];\n\n PdfPCell cell56 = new PdfPCell(new Paragraph(Float.toString(b),font3));\n //cell27.setLeading(10f, 0f);\n //cell56.setColspan(3);\n cell56.setPadding(3);\n cell56.setHorizontalAlignment(Element.ALIGN_RIGHT);\n cell56.setBorderWidth(1f);\n cell56.setBackgroundColor(myColor1);\n table3.addCell(cell56);\n \n table3.setSpacingAfter(12f);\n \n document.add(table3);\n \n PdfPTable table4 = new PdfPTable(5); // 2 columns.\n table4.setWidthPercentage(100);\n \n PdfPCell cell54 = new PdfPCell(new Paragraph(\"\",font3));\n cell54.setBorder(PdfPCell.NO_BORDER);\n cell54.setColspan(3);\n table4.addCell(cell54);\n \n PdfPCell cell52 = new PdfPCell(new Paragraph(\"Net Pay\",font5));\n cell52.setLeading(10f, 0f);\n // cell52.setBorder(PdfPCell.ALIGN_CENTER);\n cell52.setHorizontalAlignment(Element.ALIGN_LEFT);\n cell52.setVerticalAlignment(Element.ALIGN_CENTER);\n \n cell52.setPadding(6f);\n cell52.setBorderWidth(1f);\n cell52.setBackgroundColor(myColor);\n table4.addCell(cell52);\n \n PdfPCell cell53 = new PdfPCell(new Paragraph(\"\"+(a-b),font6));\n cell53.setLeading(10f, 0f);\n cell53.setPadding(6f);\n cell53.setHorizontalAlignment(Element.ALIGN_CENTER);\n cell53.setVerticalAlignment(Element.ALIGN_CENTER);\ncell53.setBorderWidth(1f);\n \n table4.addCell(cell53);\n \n document.add(table4);\n \n */\n \n // step 4\n // document.add(new Paragraph(String.format(\n // \"You have submitted the following text using the %s method:%s\",\n // request.getMethod(),uname)));\n // document.add(new Paragraph(text));\n // step 5\n document.close();\n \n // setting some response headers\n response.setHeader(\"Expires\", \"0\");\n response.setHeader(\"Cache-Control\",\"must-revalidate, post-check=0, pre-check=0\");\n response.setHeader(\"Pragma\", \"public\");\n \n // the contentlength\n response.setContentLength(baos.size());\n // write ByteArrayOutputStream to the ServletOutputStream\n OutputStream os = response.getOutputStream();\n baos.writeTo(os);\n os.flush();\n os.close();\n }\n else\n {\n response.sendRedirect(\"index.jsp?id=Your session may be expired. You have to login first\");\n\n }\n }\n catch(Exception e) {\n // throw new IOException(e.getMessage());\n System.out.println(e);\n System.out.println(\"sssssssssssssssssss\");\n \n }\n }", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException, SQLException {\r\n response.setContentType(\"text/html;charset=UTF-8\");\r\n //PrintWriter out = response.getWriter();\r\n RequestDispatcher rd = null;\r\n\r\n String dataInicial = request.getParameter(\"dataI\");\r\n String dataFinal = request.getParameter(\"dataF\");\r\n String conCodigo = request.getParameter(\"concodigo\");\r\n String conSaldo = request.getParameter(\"consaldo\");\r\n\r\n ExtratoDAO extratoDAO = new ExtratoDAO();\r\n ContaDAO contaDAO = new ContaDAO();\r\n\r\n List<ExtratoTransiente> extrato;\r\n Contas conta = null;\r\n try {\r\n extrato = extratoDAO.exibeExtrato(dataInicial, dataFinal, conCodigo, conSaldo);\r\n conta = contaDAO.buscarConta(Integer.parseInt(conCodigo));\r\n } catch (ParseException ex) {\r\n throw new ServletException(ex);\r\n }\r\n\r\n JasperReport report;\r\n byte[] byteStream = null;\r\n try {\r\n URL resourceUrl = request.getSession().getServletContext().getResource(\"/WEB-INF/report/extrato.jasper\");\r\n report = (JasperReport) JRLoader.loadObject(resourceUrl);\r\n HashMap<String, Object> parametros = new HashMap<String, Object>();\r\n parametros.put(\"conta\", conta.getConDescricao());\r\n parametros.put(\"saldo\", conta.getConSaldo());\r\n\r\n byteStream = JasperRunManager.runReportToPdf(report, parametros, new JRBeanCollectionDataSource(extrato));\r\n } catch (JRException ex) {\r\n Logger.getLogger(Extrato.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n\r\n OutputStream outStream = response.getOutputStream();\r\n response.setHeader(\"Content-Disposition\", \"inline, filename=extrato.pdf\");\r\n response.setContentType(\"application/pdf\");\r\n response.setContentLength(byteStream.length);\r\n outStream.write(byteStream, 0, byteStream.length);\r\n }", "void selectPDF()\n {\n Intent intent=new Intent();\n intent.setType(\"application/pdf\");\n intent.setAction(Intent.ACTION_GET_CONTENT);\n startActivityForResult(intent,9);\n }" ]
[ "0.68602663", "0.68318695", "0.659634", "0.6563669", "0.65130645", "0.6405056", "0.6314029", "0.6266708", "0.6231286", "0.621652", "0.6188034", "0.61562604", "0.61513263", "0.60417986", "0.6036513", "0.60226953", "0.5937788", "0.5932197", "0.5924207", "0.58990306", "0.58484066", "0.58481926", "0.5824213", "0.5822786", "0.57931966", "0.57808745", "0.5734474", "0.57105476", "0.5663461", "0.5656422", "0.5656037", "0.5648817", "0.563623", "0.56141335", "0.56060123", "0.558979", "0.5539402", "0.55242795", "0.5519261", "0.5515566", "0.55084187", "0.5505797", "0.5504375", "0.5501478", "0.5501205", "0.5475108", "0.5474016", "0.54266566", "0.54249305", "0.54226243", "0.5403518", "0.53978294", "0.5387607", "0.53813505", "0.53811365", "0.5378958", "0.5374932", "0.5367201", "0.53559244", "0.5355603", "0.53529", "0.5346807", "0.533691", "0.53341824", "0.5316564", "0.5307498", "0.52984923", "0.5295184", "0.52917117", "0.5281268", "0.5278444", "0.5276408", "0.52747315", "0.52704877", "0.5266927", "0.52615136", "0.5246906", "0.52377135", "0.52119035", "0.5199443", "0.5175536", "0.5173013", "0.51669866", "0.51610833", "0.5149222", "0.51478314", "0.51399964", "0.5136163", "0.51323056", "0.5127055", "0.5125961", "0.51052946", "0.51015353", "0.5094722", "0.5089243", "0.5082727", "0.5077549", "0.5064789", "0.50510854", "0.5041825" ]
0.5600316
35
bac dau click chuot
@Override public void mousePressed(MouseEvent e) { clickPoint = e.getPoint(); selectionBounds = null; // System.out.println("Bac dau" + e.getPoint().toString()); bacdauX = (int) e.getPoint().getX(); bacdauY = (int) e.getPoint().getY(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\tSystem.out.println(\"vai ficar clikando ai a toa? PATETA\");\n\t\t\t\t\n\t\t\t}", "@Override\n public void mousePressed(MouseEvent e){\n String boton = W.detClick( e.getButton() );\n \n //System.out.println(\"->Mouse: Presionando Click \" + boton );\n }", "@Override\n public void mouseClicked(MouseEvent e){\n String boton = W.detClick( e.getButton() );\n \n System.out.println(\" Mouse: Click \" + boton ); \n }", "@Override\n public void mouseClicked(MouseEvent e) {\n System.out.println(\"MouseClicked\");\n //kwadrat.clicked();\n trojkat.clicked();\n //kolo.clicked();\n //square.clicked();\n }", "private void cs1() {\n\t\t\tctx.mouse.click(675,481,true);\n\t\t\t\n\t\t}", "public void mouseClicked() {\n\t\tswitch(screen) {\n\t\t\n\t\t// Pantalla Home\n\t\tcase 0:\n\t\t\tif((mouseX > 529 && mouseY > 691) && (mouseX < 966 & mouseY < 867)) {\n\t\t\t\t//si hace click adentro del boton de jugar\n\t\t\t\tscreen = 1;\n\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t// Pantalla Instrucciones\n\t\tcase 1:\n\t\t\t//si hace click adentro de la pantalla\n\t\t\tscreen = 2;\n\t\t\tbreak;\n\t\t}\n\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\tSystem.out.println(\"clicko no butão\");\n\t\t\t}", "protected void dopositiveClick2() {\n\n }", "@Override\n\tprotected void OnClick() {\n\t\t\n\t}", "private void u_c_estadoMouseClicked(java.awt.event.MouseEvent evt) {\n }", "@Override\n public void mouseClicked(MouseEvent e) {\n System.out.println(\"Evento click ratón\");\n }", "public void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\t\t\tpublic void mousePressed(MouseEvent e) {\n\t\t\t\t\t\tif (unekoa != null) {\n\t\t\t\t\t\t\tunekoa.desaukeratu();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// JComponent p = (JComponent) e.getSource();\n\t\t\t\t\t\tk.aukeratu();\n\t\t\t\t\t\tunekoa = k;\n\t\t\t\t\t\tHautagaiakText.setText(k.getHautagaiak());\n\t\t\t\t\t\tif (k.getBalioa() == 0) {\n\t\t\t\t\t\t\tBalioaText.setText(\"\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBalioaText.setText(String.valueOf(k.getBalioa()));\n\t\t\t\t\t\t}\n\t\t\t\t\t}", "@Override\r\n public void mouseClicked(MouseEvent e) {\n System.out.println(e.getButton());\r\n\r\n // MouseEvent.BUTTON3 es el boton derecho\r\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n if(e.getSource().equals(btnQuayLai)){\n btnquaylaiclick();}\n }", "@Override\n\tpublic void onClick(ClickEvent arg0) {\n\t\t\n\t}", "void clickAmFromMenu();", "@Override\n\tpublic void actionPerformed(ActionEvent ae) {\n\t\tif(ae.getActionCommand().equals(\"Ação 3\"));\n\t\tSystem.out.println(\"Clicke no botão 3\");\n\t\t\n\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\toptc=btnoptc.getText().toString();\n\t\t\t\tCheckAns(optc,currentPosition);\n\t\t\t\t//Log.e(\"ans\", optc);\n\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n public void onClick(View view) {\n kurangIsi();\n }", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\tif(e.getButton()==MouseEvent.BUTTON1)\n\t\t\t\t{\n\t\t\t\t\tif(Conf.isbegin==1)\n\t\t\t\t\t{\n\t\t\t\t\t\tConf.isbegin=0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tConf.isbegin=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(e.getButton()==MouseEvent.BUTTON3)\n\t\t\t\t{\n\t\t\t\t\tif(Conf.isreplay==1)\t\n\t\t\t\t\t{\n\t\t\t\t\t\tConf.isreplay=0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tConf.isreplay=1;\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}", "@Override\n\t\t\tpublic void mousePressed(MouseEvent e) {\n\t\t\t\tSystem.out.println(\"aperto o butão\");\n\t\t\t}", "@Override\n public void onBoomButtonClick(int index) {\n }", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\t\n\t\t\t\t\n\t\t\t}", "public void mouseClicked(int ex, int ey, int button) {\r\n\t}", "public void mouseClicked(MouseEvent e) {\n\t\t\t\t\t\n\t\t\t\t}", "public void mouseClicked(MouseEvent e) \t{\n\t\t\t\t\r\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\t\n\t\t\t}", "protected void mouseClicked(int par1, int par2, int par3)\n {\n if (this.buttonId >= 0)\n {\n \t// no setting minimap keybinds to mouse button. Can do so if wanted if I change ZanMinimap to not send every input to Keyboard for processing. Check if it's mouse first\n // this.options.setKeyBinding(this.buttonId, -100 + par3);\n // ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId);\n this.buttonId = -1;\n // KeyBinding.resetKeyBindingArrayAndHash();\n }\n else\n {\n super.mouseClicked(par1, par2, par3);\n }\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n\t\t\t}", "@Override\n public void onClick(View v) {\n onClickTwitt();\n }", "public void mouseClicked(MouseEvent e) {\n\t\t\t\t\t\t\n\t\t\t\t\t}", "public void mouseClicked(MouseEvent e) {\n\t\t\t\t\t\t\n\t\t\t\t\t}", "public void mouseClicked(MouseEvent e) {\n\t\t\t\t\t\t\n\t\t\t\t\t}", "@Override\n\t\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\t\n\t\t\t\t}", "@Override\n\t\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\t\n\t\t\t\t}", "@Override\n\tpublic void onClick() {\n\t\t\n\t}", "@Override\n\t\t\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\t}", "@Override\n\tpublic void onClick() {\n\t\tSystem.out.println(\"전화를 겁니다\");\n\t}", "public void mouseClicked(MouseEvent e) {\n \t\t\r\n \t}", "@Override\r\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\r\n\t\t\t}", "private void btnModificarMouseClicked(java.awt.event.MouseEvent evt) {\n }", "@Override\r\n\t\tpublic void mouseClicked(MouseEvent arg0) {\n\t\t\t\r\n\t\t\t\r\n\t\t}", "@Override\r\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\t\t\r\n\t\t\t\t\t}", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\n\t\t\t\topta=btnopta.getText().toString();\n\t\t\t\tCheckAns(opta,currentPosition);\n\t\t\t\t \n\n\t\t\t}", "public void situerClick() {\n\n\tSystem.out.println(\"Allez-y, cliquez donc.\") ;\n\t\n\tif (dessin.waitClick()) {\n\t float lon = dessin.getClickLon() ;\n\t float lat = dessin.getClickLat() ;\n\t \n\t System.out.println(\"Clic aux coordonnees lon = \" + lon + \" lat = \" + lat) ;\n\n\t // On cherche le noeud le plus proche. O(n)\n\t float minDist = Float.MAX_VALUE ;\n\t Noeud noeud = null ;\n\t \n\t for(Map.Entry<Integer, Noeud> entry : noeuds.entrySet())\t{\r\n\t \tNoeud n = entry.getValue();\r\n\t \tfloat londiff = n.getLongitude() - lon;\r\n\t \tfloat latdiff = n.getLatitude() - lat;\r\n\t \tfloat dist = londiff*londiff + latdiff*latdiff ;\r\n\t \tif(dist < minDist)\t{\r\n\t \t\tnoeud = n;\r\n\t \t\tminDist = dist;\r\n\t \t}\r\n\t }\n\n\t System.out.println(\"Noeud le plus proche : \" + noeud) ;\n\t System.out.println() ;\n\t dessin.setColor(java.awt.Color.red) ;\n\t dessin.drawPoint(noeud.getLongitude(), noeud.getLatitude(), 5) ;\n\t}\n }", "public void click_on(){\n float x = mouseX;\n float y = mouseY;\n //if(dela>0)dela--;\n if(overRect(x, y, 570, 50, btn_ext.width, btn_ext.height)){sfx(4);\n clicked(btn_ext.get(), 570, 50, btn_ext.width, btn_ext.height, INVERT);\n qq = -1;\n }else if(overRect(x, y, 190, 50, btn_tip.width, btn_tip.height)&&!level_pick){sfx(4);\n sm = k;\n sp = 5;\n qq = 6;\n qqTmp = 2;\n }else if(level_pick){\n if(overRect(x, y, 190, 50, btn_back.width, btn_back.height)){sfx(4);\n clicked(btn_back.get(), 190, 50, btn_back.width, btn_back.height, INVERT);\n level_pick = false;\n }else{\n for(int i=0;i<7;i++){\n float xx = 252.5f;\n float yy = 130;\n if(i>3){\n xx = -45;\n yy = 215;\n }\n if(User.getInt((char)('A'+k)+str(i+1))!=-1){\n if(overRect(x, y, xx+85*i, yy, level_on.width, level_on.height)){sfx(4);\n sl = i;\n _1.setLevel();\n _1.initGame();\n pp = 1;qq = -1;\n }\n }\n }\n }\n }else{\n if(overRect(x, y, 540, height/2, btn_next.width, btn_next.height)){sfx(4);\n clicked(btn_next.get(), 540, height/2, btn_next.width, btn_next.height, INVERT);\n k=(k+1)%3;\n }\n else if(overRect(x, y, 220, height/2, btn_prev.width, btn_prev.height)){sfx(4);\n clicked(btn_prev.get(), 220, height/2, btn_prev.width, btn_prev.height, INVERT);\n k--;\n if(k<0)k=2;\n }else if(overRect(x, y, width/2, height/2, latar[k].width, latar[k].height)){sfx(4);\n level_pick = true;\n sm = k;\n }\n }\n }", "@Override\r\n\t\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t\t\r\n\t\t\t\t}", "@Override\n\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\n\t\t\t\t}", "public void mouseClicked(MouseEvent e) {\n\t\t\t\n\t\t}", "public void mouseClicked(MouseEvent e) {\n\t\t\t\n\t\t}", "@Override\n\t\t\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\n\t\t\t}", "@Override\n public void clicked(InputEvent e, float x, float y) {\n }", "void click(int x, int y, Keys... modifiers);", "@Override\n\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\n\t\t}" ]
[ "0.75907266", "0.7413925", "0.7345301", "0.7080261", "0.70433927", "0.70017457", "0.699334", "0.6983913", "0.68977547", "0.6896616", "0.68527496", "0.67580104", "0.67283183", "0.6716966", "0.6715257", "0.6700448", "0.6692496", "0.6692249", "0.6689596", "0.6689596", "0.66819066", "0.668009", "0.668009", "0.668009", "0.668009", "0.668009", "0.668009", "0.668009", "0.668009", "0.668009", "0.668009", "0.668009", "0.66788715", "0.6670521", "0.66663194", "0.6656351", "0.665236", "0.6635229", "0.66346955", "0.66319406", "0.66280943", "0.66280943", "0.66280943", "0.66280556", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.6609217", "0.65911835", "0.658803", "0.658803", "0.658803", "0.6582435", "0.6582435", "0.65791035", "0.65783024", "0.657488", "0.6573272", "0.6568714", "0.6568714", "0.6568714", "0.65500695", "0.65448904", "0.6544176", "0.65368897", "0.6534941", "0.65269244", "0.65232867", "0.6522446", "0.6515547", "0.651351", "0.65125716", "0.65125716", "0.65118873", "0.6509631", "0.6509631", "0.6509631", "0.6509631", "0.6509631", "0.6509631", "0.6509631", "0.65091634", "0.6501897", "0.65015024" ]
0.0
-1
get call from postman
public void GetCall(String url) throws ClientProtocolException, IOException { CloseableHttpClient httpclient=HttpClients.createDefault(); HttpGet httpget=new HttpGet(url); //lohith CloseableHttpResponse closeablehttpresponse=httpclient.execute(httpget); int responsestatuscode=closeablehttpresponse.getStatusLine().getStatusCode(); System.out.println("responsestatuscode: "+responsestatuscode); String response=EntityUtils.toString(closeablehttpresponse.getEntity(),"UTF-8"); System.out.println("ClientResponse: "+response); JSONObject jsonobject= new JSONObject(response); System.out.println("jsonobject: "+jsonobject); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@GET(\"posts/1\")\n public Call<Post> getPost();", "GetToken.Req getGetTokenReq();", "public Response getRequestForGetAPI(String endpoint) {\n response = given().contentType(ContentType.JSON)\n .when()\n .get(endpoint)\n .then()\n .extract().response();\n\n System.out.println(\"Response of API :\"+response.getBody().asString());\n\n String body = response.getBody().asString();\n JSONArray responseArray= new JSONArray(body);\n comment.setBody(responseArray);\n return response;\n\n }", "@GET(\"posts/1\")\n Call<Post> getPostOne();", "@Override\n\tprotected Method getMethod() {\n\t\treturn Method.GET;\n\t}", "java.lang.String getResponse();", "String getResponse();", "String getRequest();", "@Test(enabled=true)\npublic void getRequest() {\n\t\tString url = \"https://reqres.in/api/users?page=2\";\n\t\t\n\t\t//create an object of response class\n\t\t\n\t\t//Restassured will send get request to the url and store response in response object\n\t\tResponse response = RestAssured.get(url);\n\t\t\n\t\t//We have to put assertion in response code and response data\n\t\tAssert.assertEquals(response.getStatusCode(), 200 , \"Response code Mismatch\");\n\t\t\n\t\tint total_pages = response.jsonPath().get(\"total_pages\");\n\t\tAssert.assertEquals(total_pages, 2 , \"Total Pages value Mismatch\");\n \n}", "@GET(\"random.php\")\n Call<MealData> getRandomMeal();", "public String getAPI()\n {\n ResponseEntity<String> person;\n\n /*\n\t\t * Headers for the response type if we want to return JSON response then we\n\t\t * require to add.\n */\n HttpHeaders headers = new HttpHeaders();\n\n /*\n\t\t * Adding of the response header with application/json type\n */\n headers.add(\"Accept\", \"application/json\");\n\n /*\n\t\t * Creation of the Entity object for the adding the headers into request.\n */\n entity = new HttpEntity<>(headers);\n\n /*\n\t\t * Creation of REST TEMPLET object for the executing of the REST calls.\n */\n restTemplate = new RestTemplate();\n\n /*\n\t\t * Adding the basic type of authentication on the REST TEMPLETE.\n */\n restTemplate.getInterceptors()\n .add(new BasicAuthorizationInterceptor(\"Administrator\", \"Oneeight@admin18\"));\n\n /*\n\t\t * Execution of the REST call with basic authentication and JSON response type\n */\n person = restTemplate.exchange(\"http://52.172.222.197:8080/versa/login?username=Administrator&password=Oneeight@admin18\", HttpMethod.POST, entity, String.class);\n System.out.println(\"\"+person.toString());\n //headers.add(\"Cookie\", \"JSESSIONID=0FC37952D64B545C46969EFEC0E4FD12\");\n headers.add(\"Cookie\", person.getHeaders().getFirst(HttpHeaders.SET_COOKIE));\n entity = new HttpEntity<>(headers);\n person = restTemplate.exchange(\"http://52.172.222.197:8080/versa/analytics/v1.0.0/data/provider/tenants/OneEight/features/SDWAN/?qt=summary&start-date=1daysAgo&end-date=today&q=linkusage(site)&metrics=volume-rx&metrics=volume-tx&metrics=volume-rx&metrics=volume-tx&metrics=bandwidth&ds=aggregate&count=10\", HttpMethod.GET, entity, String.class);\n\n /*\n\t\t * Returning the response body with string format that easily readable.\n */\n return person.getBody();\n }", "@RequestMapping(\"/get\")\n\tpublic void get(String id) throws Exception {\n\n\t\tList<ServiceInstance> list = this.discoveryClient.getInstances(\"FEIGN-API\");\n String uri = \"\";\n for (ServiceInstance instance : list) {\n if (instance.getUri() != null && !\"\".equals(instance.getUri())) {\n uri = instance.getUri().toString();\n\t\t\t\tSystem.out.println(uri);\n //break;\n }\n }\n\t\tSystem.out.println(uri+\"/provide/user/get?id=2\" + \"===>\");\n // return uri+\"/provide/user/getInfo\";\n\n//\t\tString baStr = restTemplate.getForObject(uri+\"/provide/user/get?id=2\", String.class );\n//\t\tSystem.out.println(baStr+\"===>\");\n\t\treturn (String) this.userFeignService.get(id);\n\t\t//return \"sss\";\n\t}", "public interface QMApi {\n @GET(\"10001/getProvinceCityAreaList\")\n Call<BaseResModel<AddressEntity>> getProvinceCityAreaList(@Query(\"localVersion\") String localVersion);\n\n @POST(\"10001/qmLogin\")\n Call<BaseResModel<UserInfoEntity>> login(@Body RequestBody jsonBody);\n}", "@Test\n\t \n\t public void getApi() {\n\t\t \n\t\t Response getIt=get(\"https://reqres.in/api/users?page=2\");\n\t\t getIt.prettyPrint();\n\t\t System.out.println(getIt.getStatusCode());\n\t\t System.out.println(getIt.getTime());\n\t\t \n\t\t //to validate\n\t\t int validGstatus=getIt.getStatusCode();\n\t\t Assert.assertEquals(validGstatus,200);\n\t\t \n\t }", "@GET\n Call<Post> getByDirectUrlRequest(@Url String url);", "@Test\n public void printResponse(){\n when().get(\"http:://34.223.219.142:1212/ords/hr/countries\")\n .body().prettyPrint();\n\n }", "public void postRequest() {\n apiUtil = new APIUtil();\n // As this is an API call , we are not setting up any base url but defining the individual calls\n apiUtil.setBaseURI(configurationReader.get(\"BaseURL\"));\n //This is used to validate the get call protected with basic authentication mechanism\n basicAuthValidation();\n scenario.write(\"Request body parameters are :-\");\n SamplePOJO samplePOJO = new SamplePOJO();\n samplePOJO.setFirstName(scenarioContext.getContext(\"firstName\"));\n samplePOJO.setLastName(scenarioContext.getContext(\"lastName\"));\n\n ObjectMapper objectMapper = new ObjectMapper();\n try {\n apiUtil.setRequestBody(objectMapper.writeValueAsString(samplePOJO));\n } catch (JsonProcessingException e) {\n e.printStackTrace();\n }\n }", "@GET(\"user\")\n Call<User> getUser();", "@ApiOperation(value=\"get方法測式\", notes=\"取得會員資料\")\n @RequestMapping(value=\"getMethod\",method=RequestMethod.GET)\n @ApiResponses(value = {\n @ApiResponse(code = 200, message = \"Success\", response = String.class),\n @ApiResponse(code = 401, message = \"Unauthorized\"),\n @ApiResponse(code = 403, message = \"Forbidden\"),\n @ApiResponse(code = 404, message = \"Not Found\"),\n @ApiResponse(code = 500, message = \"Failure\")})\n public String getMember(@ApiParam(value = \"name that need to be updated\", required = true) @RequestParam String memberId) {\n System.out.println(\"==memberId===>\"+memberId);\n return memberId;\n }", "@Test\n @ApiOperation(\"表单扩展--查询流程变量\")\n public void getVariable(){\n }", "@Test\n public void simpleGet(){\n when()\n .get(\"http:://34.223.219.142:1212/ords/hr/employees\")\n .then().statusCode(200);\n\n }", "public interface PaymentMethods {\n @GET(\"paymentmethods\")\n Call<PaymentMethod[]> get(@Query(\"api_token\") String api_token);\n}", "@GET(\"rest/emprego\")\n Call<List<Posto>> callListPostoSINE();", "public interface GateWay {\n @GET(\"retrofit-demo.php?company_no=123\")\n Call<EmployeeList> getEmployee();\n}", "@GetMapping(value = \"/console/test\")\n public String test() {\n return \"Test Success\";\n }", "@GET\n\n\t@Produces(MediaType.TEXT_PLAIN)\n\n\t//@Path(\"test\")\n\tpublic String getIt() {\n\n\t\treturn \"Got it!\";\n\t}", "public void doGet( )\n {\n \n }", "@GET(\"get_invoice\")\n Call<ResponseBody> getInvoice(@Query(\"token\") String token,@Query(\"trip_id\") String TripId,@Query(\"user_type\") String userType);", "public interface PokeApiService {\n\n @GET(\"qvqk-dtmf.json\")\n Call<ArrayList<ViasRespuesta>> obtenerListaPokemon();\n}", "com.czht.face.recognition.Czhtdev.Request getRequest();", "private static Response callAPI(VERB verb, String url, Workflow mo) throws Exception {\n\n Response result;\n Entity<Workflow> wfEntity = Entity.entity(mo, MediaType.APPLICATION_JSON_TYPE);\n switch (verb) {\n case POST:\n result = RequestSender.sendPOSTRequest(getAPIURL() + url, wfEntity);\n break;\n case GET:\n result = RequestSender.sendGETRequest(getAPIURL() + url);\n break;\n case PUT:\n result = RequestSender.sendPUTRequest(getAPIURL() + url, wfEntity);\n break;\n case DELETE:\n result = RequestSender.sendDELETERequest(getAPIURL() + url);\n break;\n default:\n throw new Exception(\"Bad VERB\");\n }\n\n return result;\n }", "public static void main(String[] args) {\n\t\t\n\t\t RestAssured.baseURI = \"https://rahulshettyacademy.com\";\n\t\t String response = given().queryParam(\"key\", \"qaclick123\")\n\t .header(\"Content-Type\",\"application/json\")\n\t\t.body(PayLoad.addPlace())\n\t\t.when().post(\"maps/api/place/add/json\")\n\t\t.then().assertThat().statusCode(200)\n\t\t.body(\"scope\",equalTo(\"APP\")).header(\"server\",\"Apache/2.4.18 (Ubuntu)\")\n\t\t.extract().response().asString();\n\t\tSystem.out.println(response);\n\t \n\t //For parsing JSON we have JsonPath(class)\n\t\tJsonPath json = new JsonPath(response);\n\t\tString placeId = json.getString(\"place_id\");\n\t System.out.println(placeId);\n\t \n \n \n\t}", "public interface RequestService {\n @GET(\"index?type=yule&key=d7e184978722fe31928061a05ac7980c\")\n Call<ResponseBody> getString();\n}", "@GET\r\n @Produces(MediaType.APPLICATION_JSON)\r\n public String getIt() {\r\n // return \"Got it!\";\r\n \treturn appObj.readAppointment();\r\n }", "com.uzak.inter.bean.test.TestRequest.TestBeanRequest getRequest();", "@GET(\"current\")\n Call<String> getCurrentUser();", "@Test\n public void GETProductService_ProductCall() {\n givenHeaders().\n when().\n get(_url_prodservice).//.body().prettyPrint();\n then().\n using().defaultParser(Parser.JSON).\n log().ifError().\n statusCode(200).\n body(\"response\", not(isEmptyString()));\n System.out.print(\"GETProductService_ProductCall Test Run Result\");\n }", "@GET\n @Produces(MediaType.TEXT_PLAIN)\n public String getIt() {\n return \"Got it!\";\n }", "GetResponse() {\n\t}", "R request();", "@GET(\"device\")\n Call<DevicesResponse> getDevice();", "public interface RestDetalle {\n\n @GET(\"RS_Consulta/consulta/pedido/{numPedido}\")\n Call<ObResponse> getDetalle(@Path(\"numPedido\") String numPedido);\n}", "@GET(\"posts/{id}\")\n public Call<Post> getPost(@Path(\"id\") int postId);", "@Override\n\tprotected void executeGet(GetRequest request, OperationResponse response) {\n\t}", "@GET(\"iss-now.json/\")\n Call<ISStatus> GetLocation();", "public String post();", "@GetMapping(\"/info\")\n public String info(){\n return \"info\";\n }", "@GET(\"posts/\")\n Call<List<Post>>getPosts();", "@GetMapping\n public String echo(String name) {\n String path = String.format(\"http://%s/discovery?name=%s\", SERVER_NAME, name);\n return restTemplate.getForObject(path, String.class);\n }", "public interface LooksoftMainApi {\n @GET(\"main\")\n Call<Data> loadData();\n}", "public interface HttpService {\n//banner/query?type=1\n // public static final String BASE_URL=\"http://112.124.22.238:8081/course_api/\";\n @GET(\"banner/query\")\n Call<List<HeaderBean>> getHeaderData(@Query(\"type\") String type);\n @GET(\"campaign/recommend\")\n Call<List<RecommendBean>> getRecommendData();\n}", "public Result get(Get get) throws IOException;", "public interface TwilioService {\n @GET(\"PhoneNumbers/{phoneNumber}?Type=carrier\")\n Call<TwilioLookupResponse> lookup(@Path(\"phoneNumber\") String phoneNumber);\n}", "public void getRequest_withHeader_QueryParms() {\n apiUtil = new APIUtil();\n // As this is an API call , we are not setting up any base url but defining the individual calls\n apiUtil.setBaseURI(configurationReader.get(\"BaseURL\"));\n //This is used to validate the get call protected with basic authentication mechanism\n basicAuthValidation();\n scenario.write(\"Request query parameters are :-\");\n String[] queryParameters = {\"grant_type\"};\n setQueryParameters(queryParameters);\n String[] headerParameters = {\"content-type\"};\n setHeaderParameters(headerParameters);\n }", "public static void main(String[] args) {\n\t\tRestAssured.baseURI = \"https://dev54285.service-now.com/api/now/table/change_request\";\r\n\r\n//\t\tS2: Authentication (basic)\r\n\t\tRestAssured.authentication = RestAssured.basic(\"admin\", \"EnterPwd123!\");\r\n\t\t\r\n//\t\tS3: request type (get) { ctrl+2 , l }\r\n\t\tResponse response = RestAssured.given().queryParam(\"sysparm_fields\", \"sys_id,type,number\")\r\n\t\t\t\t.accept(ContentType.JSON).get();\r\n\t\t\r\n//\t\tS4: print response body\r\n\t\tresponse.prettyPrint();\r\n\t\t\r\n//\t\tS5: print status code\r\n\t\tSystem.out.println(response.statusCode());\r\n\t\t\r\n//\t\tResponse Body Parse\r\n\t\tJsonPath jsonPath = response.jsonPath();\r\n\t\t\r\n// \t\tGet Customized values\r\n\t\tList<String> responseList = jsonPath.getList(\"response.result.number\");\r\n\t\t\r\n\t\t/*\r\n\t\t * System.out.println(responseList.size());\r\n\t\t * System.out.println(responseList.get(responseList.size()-1));\r\n\t\t * \r\n\t\t * for (String result : responseList) { System.out.println(result); }\r\n\t\t */\r\n\t\t\r\n\t}", "com.indosat.eai.catalist.standardInputOutput.RequestType getRequest();", "public GrizzletRequest getRequest();", "private String callHandlerResponse(String tail, String requestMethod) throws IOException {\n String baseEndpoint = \"https://kax95zucj1.execute-api.us-west-2.amazonaws.com/dev/deckocards\";\n URL url = new URL(baseEndpoint + tail);\n HttpURLConnection con = (HttpURLConnection) url.openConnection();\n con.setRequestMethod(requestMethod);\n con.setRequestProperty(\"Content-Type\", \"application/json\");\n con.setConnectTimeout(5000);\n con.setReadTimeout(7000);\n int status = con.getResponseCode();\n InputStreamReader reader;\n if (status > 299) {\n reader = new InputStreamReader(con.getErrorStream());\n } else {\n reader = new InputStreamReader(con.getInputStream());\n }\n BufferedReader in = new BufferedReader(reader);\n String inputLine;\n StringBuilder content = new StringBuilder();\n while ((inputLine = in.readLine()) != null) {\n content.append(inputLine);\n }\n in.close();\n con.disconnect();\n return content.toString();\n }", "private static String get_request(String uri, boolean isChecking, String token) throws IOException {\r\n URL url = new URL(uri);\r\n HttpURLConnection connection = (HttpURLConnection) url.openConnection();\r\n connection.setRequestProperty(\"Content-Type\", \"application/json\");\r\n connection.setRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74\");\r\n if (isChecking) {\r\n connection.setRequestProperty(\"Authorization\", token);\r\n }\r\n connection.setRequestMethod(\"GET\");\r\n InputStream responseStream = connection.getInputStream();\r\n if (debug) {\r\n System.out.println(\"GET - \"+connection.getResponseCode());\r\n }\r\n try (Scanner scanner = new Scanner(responseStream)) {\r\n String responseBody = scanner.useDelimiter(\"\\\\A\").next();\r\n if (debug) {\r\n System.out.println(responseBody);\r\n }\r\n return responseBody;\r\n } catch (Exception e) {\r\n return \"ERROR\";\r\n }\r\n }", "public static void main(String[] args) {\n\r\n\t\tRestAssured.baseURI=\"https://www.boredapi.com/api/activity\";\r\n\t\tString getUserResponse=given()\r\n\t\t\t\t.when().get()\r\n\t\t\t\t.then().assertThat().log().all().statusCode(200).extract().response().asString();\r\n\t\tSystem.out.println(getUserResponse);\r\n\t\t\r\n\t\r\n\r\n}", "@GET(\"match\")\n Call<Matches> getMatches();", "public interface ApiService {\n\n @GET(\"/tools/mockapi/2793/kdd_config\")\n Call<JsonObject> getConfig();\n}", "public interface WayMapAPI {\n @GET(\"maps/api/directions/json?\")\n Call<WayPoints> getWayFromCoordinate(@Query(\"origin\")String from, @Query(\"destination\") String to, @Query(\"key\") String api_key);\n\n\n}", "public interface ServiceApi\n{\n @GET(\"{list}\")\n Call<ResponseBody> request(@Path(\"list\") String postfix, @QueryMap HashMap<String, Object> params);\n}", "public interface PIService {\n @POST(\"learningrace1/rest/participante\")\n Call<List<Participante>> getParticipante(@Body Participante participante);\n\n @GET(\"learningrace1/rest/evento/{identificador}\")\n Call<List<Evento>> getEvento(@Path(\"identificador\") String identificador);\n\n}", "@Test\n void testGetRequest() {\n String OAUTH_BASE = \"https://api-sandbox.rabobank.nl/openapi/sandbox/oauth2\";\n raboUtilUnderTest.get(OAUTH_BASE, \"/token\", \"payload\");\n\n // Verify the results\n verify(webClient).get(anyString(),any());\n }", "public interface TokenApi {\n @GET(TouTiaoServerManager.TOKEN_URL)\n Call<TokenBean> getToken(@QueryMap Map<String, String> map);\n}", "public interface UserMgrService {\n\n @GET(\"login\")\n Call<UserInfoModel> login(@Query(\"username\") String username,@Query(\"pwd\") String pwd);\n\n\n}", "public static void getMethodTest()\n\t{\n String content = restTemplate.getForObject(baseURL+\"/hello\", String.class);\n System.out.println(\"-------------\");\n \n ResponseEntity<String > s = restTemplate.getForEntity(baseURL+\"/hello\", String.class);\n System.out.println(s.getBody());\n System.out.println(s.getStatusCodeValue());\n System.out.println(s.getHeaders());\n System.out.println(s.getStatusCode());\n\n\t}", "@Test\n public void authentication2() \n {\n\t Response resp = RestAssured.given().auth().oauth2(\"accessTokenToPass\").post(\"URL/URL\");\n\t resp.getStatusCode();\n\t \n\t //Getting entire data value\n\t System.out.println(\"Content is :\" +resp.getBody().asString());\n\t \n\t //Converting in to Json path value\n\t JsonPath json = resp.getBody().jsonPath();\n\t \n\t //Printing in JSON value\n\t System.out.println(\"Json Value are :\" +json);\n }", "public interface RuntService {\n @Headers({\n \"Accept: application/json\"\n })\n @GET(\"runt/co.com.runt.local.domain.persona/{id}/{placa}\")\n Call<List<RuntVO>> consultaRunt(@Path(\"id\") Integer numeroCedula, @Path(\"placa\") String placa);\n}", "@Test\n public void Task6() {\n Body body= given()\n .when()\n .get(\"https://jsonplaceholder.typicode.com/todos/2\")\n .then()\n .statusCode(200)\n .log().body()\n .extract().as(Body.class)\n \n\n ;\n System.out.println(\"body = \" + body);\n\n }", "@RequestMapping(path=\"/initPaymentGet\", method = RequestMethod.GET)//, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\n\tpublic ResponseEntity<Object> test() {\n\t\tlogger.info(\"Init payment\");\n\t\t//System.out.println(\"DTO: \" + btcDTO.getPrice_currency());\n\t\tString pom = \"\";\n\t\tRestTemplate restTemplate = new RestTemplate();\n\t\t\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\theaders.add(\"Authorization\", \"ab7fzPdN49-xBVoY_LdSifCZiVrqCbdcfjWdweJS\");\n\t\tResponseEntity<String> responseEntity = new RestTemplate().exchange(CREATE_ORDER_API, HttpMethod.GET,\n\t\t\t\tnew HttpEntity<String>(pom, headers), String.class);\n\n\t\t//restTemplate.getForEntity(\"https://google.rs\", String.class);\n\t\t//ResponseEntity<String> response = restTemplate.getForEntity(\"https://api-sandbox.coingate.com/v2/orders\", String.class);\n\t\t//ResponseEntity<String> response = restTemplate.postForEntity(\"https://api.coingate.com/v2/orders\", btcDTO, String.class);\n\t\t\n\t\treturn new ResponseEntity<Object>(responseEntity,HttpStatus.OK);\n\t}", "public interface DataKPU {\n @GET(\"open/v1/api.php?cmd=wilayah_browse&\")\n Call<RWilayah> wilayah_browse(@Query(\"wilayah_id\") String idWil);\n}", "public interface ApiInterface {\n\n @GET(\"status.txt\")\n Call<Integer> getStatus();\n\n @GET(\"login.php\")\n Call<LoginModel> login(@Query(\"phone\") String phone);\n\n @GET(\"verify.php\")\n Call<LoginModel> verify(@Query(\"phone\") String phone, @Query(\"code\") String code);\n}", "@GET\n Call<String> getLogin(@Url String URL);", "@GET\r\n @Produces(MediaType.TEXT_PLAIN)\r\n public String getText() {\n return \"hai\";\r\n }", "@GetMapping(\"\")\r\n @ResponseStatus(code = HttpStatus.OK)\r\n public void main() {\r\n LOGGER.info(\"GET /\");\r\n }", "public interface RestInterface {\n\n @GET(\"{currency}/\")\n Call<List<ResponseModel>> geCurrency(@Path(\"currency\") String currency);\n}", "void getRequests();", "com.bingo.server.msg.REQ.LoginRequest getLogin();", "Call mo35727a(Request request);", "public interface ServiceClient {\n @GET(\"exec\")\n Call<ListWisata> getWisata(@Query(\"sheet\") String namaSheet);\n}", "public GrizzletResponse getResponse();", "GetToken.Res getGetTokenRes();", "public interface IPokeapiService {\n\n\n\n// @GET(\"lp_iem/result.json\")\n// Call<PokemonWs> listPokemon();\n\n @GET(\"?action=cardlist&\")\n Call<List<Pokemon>> listPokemon(@Query(\"user\")int user);\n //@Query(\"user\")int user\n\n @GET(\"?action=details&\")\n Call<Pokemon> getPokemon(@Query(\"card\")int id_card);\n\n @GET(\"?action=pokedex\")\n Call<List<Pokemon>> getPokedex();\n\n}", "@Test\n public void getEndpoint() throws IOException {\n CloseableHttpClient httpclient = HttpClients.createDefault();\n\n //Creating a HttpGet object\n HttpPost httppost = new HttpPost(\"https://api.github.com/user/repos\");\n String auth=Credentials.getEmail()+\":\"+Credentials.getPassWard();\n byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName(\"ISO-8859-1\")));\n String authHeader=\"Basic \"+new String(encodedAuth);\n httppost.setHeader(HttpHeaders.AUTHORIZATION,authHeader);\n String json=\"{\\\"name\\\": \\\"ploiko\\\"}\";\n httppost.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));\n HttpResponse httpresponse = httpclient.execute(httppost);\n System.out.println(httpresponse.getStatusLine());\n int actual=httpresponse.getStatusLine().getStatusCode();\n Assert.assertEquals(actual,201);\n //System.out.println(getHeaders(httpresponse,\"Access-Control-Allow-Methods\"));\n //System.out.println(httpresponse.getAllHeaders().toString());\n\n }", "private void callHandler(String method, HttpServletRequest request, HttpServletResponse response) throws IOException {\n JsonElement payload = getPayload(request, response);\n RequestContext context = new RequestContext(\n request, response, urlVariables, request.getParameterMap(), payload);\n PathNode apiStructure = getApiStructure(method);\n\n if (request.getPathInfo() == null) {\n logger.warn(\"Received \" + method + \" request with empty path.\");\n return;\n }\n\n PathNode.PathNodeResult result = apiStructure.getBindingForSubPath(request.getPathInfo());\n if (result != null) {\n urlVariables.putAll(result.getArgValues());\n result.getApiSpec().apiInterface.call(context);\n }\n }", "@Test\n public void getWitheaders(){\n with().accept(ContentType.JSON)\n .when().get(\"http://34.223.219.142:1212/ords/hr/countries/US\")\n .then().statusCode(200);\n }", "@Property\n public native String getClientRequest ();", "@GET(\"montaje/proyectos/ver/\")\n Call<List<clsProyecto>> getProyectos();", "public interface RestApi {\n\n @GET(\"/ride.asp\")\n Call<List<Model>> getData (@Query(\"userid\") int userId,\n @Query(\"from_name\") String fromName,\n @Query(\"from_lat\") double lat,\n @Query(\"from_lng\") double lng,\n @Query(\"to_name\") String toName,\n @Query(\"to_lat\") double toLat,\n @Query(\"to_lng\") double toLng,\n @Query(\"time\") long time);\n}", "io.envoyproxy.envoy.type.metadata.v3.MetadataKind.Request getRequest();", "public void request() {\n }", "public interface GetProductionDataApi {\n @GET(\"/api/Production/GetProductionData\")\n public void getProductionData(@Query(NetWorkConstant.stid) String stid,@Query(NetWorkConstant.apikey)String apikey,NetCallback<NetWorkResultBean<ProductionDataPackge>> NetCallback);\n\n @GET(\"/api/Production/GetProductionState/\")\n public void getProductionState(@Query(NetWorkConstant.stid) String stid, @Query(NetWorkConstant.apikey) String apikey, NetCallback<NetWorkResultBean<ProductionStatePackge>> callback);\n\n}", "public interface Service {\n @GET(\"/orama-media/json/fund_detail_full.json?limit=1000&offset=0&serializer=fund_detail_full\")\n Call<List<Example>> getExample();\n\n}", "public interface ApiService {\n @GET(\"questcms/floorplan\")\n Call<List<FloorPlan>> listFloorPlan();\n}", "@Test\n\tpublic void postExample() {\n\t\tString APIUrl = \"http://34.210.101.131:8081/topics\";\n\t\tString APIBody=\"{\\\"topicComplexity\\\":\\\"5\\\",\\\"topicName\\\":\\\"MCQ\\\"}\";\n\t\t// Building request using requestSpecBuilder\n\t\tRequestSpecBuilder builder = new RequestSpecBuilder();\n\t\t \n\t\tbuilder.setBody(APIBody);\n\t\tbuilder.setContentType(\"application/json\");\n\t\t//RequestSpecification requestSpec = (RequestSpecification) builder.build();\n\t\tRequestSpecification request = RestAssured.given();\n\t\tRestAssured.given().auth().preemptive().basic(\"[email protected]\",\"testdata@123\");\n\t\t//com.jayway.restassured.specification.RequestSpecification requestSpec = builder.build();\t \n\t\t \n\t\n\t\t\t\t\n\t\tResponse response = request.post(\"http://34.210.101.131:8081/topics\");\n\t\tfloat code = response.getStatusCode();\n\t\tSystem.out.println(\"status code is\"+code);\n\t\tString data =response.asString();\n\t\tSystem.out.println(\"Data is\"+data);\n\t\t\n\n\t\t\n\t\t\n\t}", "org.naru.park.ParkModel.UIParkRequest getRequest();", "@GET(\"movie/{id}\")\n Call<PersonagemResponse> getMovieDetails(@Path(\"id\") int id, @Query(\"api_key\") String apiKey);", "public interface RequestService {\n //http://gank.io/api/data/Android/10/1\n /*@GET(\"api/data/Android/10/1\")\n Call<ResponseBody> getAndroidInfo();*/\n @GET(\"api/data/Android/10/1\")\n Call<GankBean> getAndroidInfo();\n @GET(\"api/data/Android/10/{page}\")\n Call<GankBean> getAndroidInfo(@Path(\"page\") int page);\n @GET(\"api/data/query?cityname=深圳\")\n Call<ResponseBody> getWeather(@Query(\"key\") String key,@Query(\"area\") String area);\n @GET(\"group/{id}/users\")\n Call<List<User2>> groupList(@Field(\"id\") int groupId, @QueryMap Map<String,String> options);\n @GET\n Call<GankBean> getAndroid2Info(@Url String url);\n\n}" ]
[ "0.6263997", "0.62188107", "0.6088139", "0.6082206", "0.6056833", "0.6048018", "0.60454744", "0.601123", "0.6008812", "0.600551", "0.59710205", "0.5947548", "0.5873121", "0.5866739", "0.5864043", "0.58601", "0.5844936", "0.58405274", "0.5826089", "0.58245707", "0.5818347", "0.5815773", "0.57999486", "0.57989687", "0.57847214", "0.5767234", "0.5762296", "0.57286024", "0.57098955", "0.56907535", "0.56843466", "0.5683094", "0.56825995", "0.5679131", "0.5677384", "0.5674352", "0.56734526", "0.5664893", "0.5655697", "0.5654305", "0.5652025", "0.56440425", "0.56397593", "0.56323737", "0.562719", "0.56258017", "0.5622646", "0.56211185", "0.5619139", "0.5611691", "0.55996364", "0.5595456", "0.55937225", "0.55928534", "0.55881995", "0.55870104", "0.5584948", "0.5578941", "0.5567373", "0.55597997", "0.5557307", "0.55562776", "0.5554948", "0.5546377", "0.55359805", "0.5530435", "0.5530071", "0.5528333", "0.5523583", "0.5521303", "0.5520342", "0.5515984", "0.5512719", "0.55100626", "0.5509519", "0.55070627", "0.55049556", "0.55020696", "0.549262", "0.54879296", "0.54848176", "0.5483158", "0.5480886", "0.5478791", "0.54682595", "0.54617953", "0.54585016", "0.5445284", "0.54452795", "0.5445139", "0.5442974", "0.5441399", "0.5440895", "0.54406095", "0.54399616", "0.5436386", "0.54362047", "0.5436078", "0.54330534", "0.5426994", "0.5425171" ]
0.0
-1
Read the content of this InputStream and return it as a String. The stream is closed before this method returns.
public static String getText(InputStream is) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); return getText(reader); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private String read() {\n\n String s = \"\";\n\n try {\n // Check if there are bytes available\n if (inStream.available() > 0) {\n\n // Read bytes into a buffer\n byte[] inBuffer = new byte[1024];\n int bytesRead = inStream.read(inBuffer);\n\n // Convert read bytes into a string\n s = new String(inBuffer, \"ASCII\");\n s = s.substring(0, bytesRead);\n }\n\n } catch (Exception e) {\n Log.e(TAG, \"Read failed!\", e);\n }\n\n return s;\n }", "private String readStream(InputStream in) {\n try {\n ByteArrayOutputStream bo = new ByteArrayOutputStream();\n int i = in.read();\n while(i != -1) {\n bo.write(i);\n i = in.read();\n }\n return bo.toString();\n } catch (IOException e) {\n return \"\";\n }\n }", "private String readStream(InputStream is) {\n try {\n ByteArrayOutputStream bo = new ByteArrayOutputStream();\n int i = is.read();\n while(i != -1) {\n bo.write(i);\n i = is.read();\n }\n return bo.toString();\n } catch (IOException e) {\n return \"\";\n }\n }", "public String readString() throws IOException {\n return WritableUtils.readString(in);\n }", "public static String readString(InputStream is) throws IOException {\n return readString(is, DEFAULT_ENCODING);\n }", "public static String read(InputStream in) throws IOException {\n\t\tStringBuilder result = new StringBuilder();\n\t try {\n\t byte[] buf = new byte[1024]; int r = 0;\n\t while ((r = in.read(buf)) != -1) {result.append(new String(buf, 0, r));}\n\t } finally { in.close();}\n\t\tString text=result.toString();\n\t\treturn text;\n\t}", "public static String GetStringFromInputStream(InputStream is) {\n\t\tString line;\n\t\tStringBuilder total = new StringBuilder();\n\n\t\t// Wrap a BufferedReader around the InputStream\n\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(is));\n\n\t\t// Read response until the end\n\t\ttry {\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t\ttotal.append(line);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tis.close();\n\t\t\t} catch (Exception e) {\n\t\t\t\tUtilities\n\t\t\t\t\t\t.LogWarning(\"GetStringFromInputStream - could not close stream\");\n\t\t\t}\n\t\t}\n\n\t\t// Return full string\n\t\treturn total.toString();\n\t}", "public String readString() {\n byte[] byteForStream = new byte[1024];\n String message = \"\";\n\n mListener.onCarRunning();\n\n\n int bytes;\n\n while (true) {\n try {\n bytes = mInputStream.read(byteForStream);\n message = new String(byteForStream, 0, bytes);\n Log.d(TAG, \" Read from inputstream \" + message);\n\n } catch (IOException e) {\n Log.e(TAG, \" error reading from inputstream \" + e.getMessage());\n break;\n }\n }\n return message;\n }", "public String readString() throws IOException {\n checkOpened();\n return dis.readUTF();\n }", "public String getStringContent() throws IOException;", "public String read() throws IOException {\n return reader.readLine();\n }", "public String getStringFromInputStream(InputStream is) {\n\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(is));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n } catch (Exception e) {\n } finally {\n try {\n br.close();\n } catch (Exception e) {\n }\n br = null;\n return sb.toString();\n }\n }", "private String readStream(InputStream in) throws IOException {\n BufferedReader r = new BufferedReader(new InputStreamReader(in));\n\n StringBuilder sb = new StringBuilder();\n String line;\n\n // Reads every line and stores them in sb.\n while((line = r.readLine()) != null) {\n sb.append(line);\n }\n\n // Closes the input stream.\n in.close();\n\n return sb.toString();\n }", "private String streamToString(InputStream is) throws IOException {\n String str = \"\";\n \n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n \n try {\n BufferedReader reader = new BufferedReader(\n new InputStreamReader(is));\n \n while ((line = reader.readLine()) != null) {\n sb.append(line);\n }\n \n reader.close();\n } finally {\n is.close();\n }\n \n str = sb.toString();\n }\n \n return str;\n }", "public static String loadStream(InputStream in) throws IOException {\r\n\t\tInputStream is = in;\r\n\t\tint ptr = 0;\r\n\t\tis = new BufferedInputStream(is);\r\n\t\tStringBuffer buffer = new StringBuffer();\r\n\t\ttry {\r\n\t\t\twhile ((ptr = is.read()) != -1) {\r\n\t\t\t\tbuffer.append((char) ptr);\r\n\t\t\t}\r\n\t\t} finally {\r\n\t\t\tis.close();\r\n\t\t}\r\n\t\treturn buffer.toString();\r\n\t}", "static String loadStream(InputStream in) throws IOException {\n int ptr = 0;\n in = new BufferedInputStream(in);\n StringBuffer buffer = new StringBuffer();\n while( (ptr = in.read()) != -1 ) {\n buffer.append((char)ptr);\n }\n return buffer.toString();\n }", "public String getContent() {\n String s = null;\n try {\n s = new String(Files.readAllBytes(Paths.get(filename)), StandardCharsets.UTF_8);\n }\n catch (IOException e) {\n message = \"Problem reading a file: \" + filename;\n }\n return s;\n }", "public static String read(InputStream input) throws Exception {\r\n\t\treader.setInput(input);\r\n\t\treader.setCharset(\"UTF-8\");\r\n\t\treturn reader.read();\r\n\t}", "protected String readFullyAsString(InputStream inputStream)\n\t\t\tthrows IOException {\n\t\tByteArrayOutputStream baos = new ByteArrayOutputStream();\n\t\tbyte[] buffer = new byte[1024];\n\t\tint length;\n\t\twhile ((length = inputStream.read(buffer)) != -1) {\n\t\t\tbaos.write(buffer, 0, length);\n\t\t}\n\t\treturn baos.toString(StandardCharsets.UTF_8.name());\n\t}", "@NonNull\n public static String getStringFrom(InputStream inputStream) {\n StringBuffer dataStringBuffer = new StringBuffer(\"\");\n try {\n InputStreamReader isr = new InputStreamReader(inputStream);\n BufferedReader bufferedReader = new BufferedReader(isr);\n String readString = bufferedReader.readLine();\n while (readString != null) {\n dataStringBuffer.append(readString);\n readString = bufferedReader.readLine();\n }\n isr.close();\n } catch (IOException ioe) {\n ioe.printStackTrace();\n }\n return dataStringBuffer.toString();\n }", "static String loadStream(InputStream in) throws IOException { \n\t\tint ptr = 0; \n\t\tin = new BufferedInputStream(in); \n\t\tStringBuffer buffer = new StringBuffer(); \n\t\twhile( (ptr = in.read()) != -1 ) { \n\t\t\tbuffer.append((char)ptr); \n\t\t} \n\t\treturn buffer.toString(); \n\t}", "public String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException {\n Reader reader = null;\n reader = new InputStreamReader(stream, \"UTF-8\");\n char[] buffer = new char[len];\n reader.read(buffer);\n return new String(buffer);\n }", "private static String readIt(InputStream stream) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(stream));\n StringBuilder sb = new StringBuilder();\n String line;\n while ((line = br.readLine()) != null) {\n sb.append(line+\"\\n\");\n }\n br.close();\n return sb.toString();\n\t}", "private static String getStringFromInputStream(InputStream is) {\r\n\r\n BufferedReader br = null;\r\n StringBuilder sb = new StringBuilder();\r\n\r\n String line;\r\n try {\r\n\r\n br = new BufferedReader(new InputStreamReader(is));\r\n while ((line = br.readLine()) != null) {\r\n sb.append(line);\r\n }\r\n\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n finally {\r\n if (br != null) {\r\n try {\r\n br.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n }\r\n\r\n return sb.toString();\r\n\r\n }", "private String readStream(InputStream is) throws IOException {\n StringBuilder sb = new StringBuilder();\n BufferedReader r = new BufferedReader(new InputStreamReader(is),1000);\n for (String line = r.readLine(); line != null; line =r.readLine()){\n sb.append(line);\n }\n is.close();\n return sb.toString();\n }", "public static String streamToString(InputStream is) throws IOException {\n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n\n try {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n while ((line = reader.readLine()) != null) {\n sb.append(line).append(\"\\n\");\n }\n } finally {\n is.close();\n }\n return sb.toString();\n } else {\n return \"\";\n }\n\t}", "public static String readIt(InputStream is) throws IOException {\n BufferedReader reader = null;\n reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n StringBuilder responseStrBuilder = new StringBuilder();\n String inputStr;\n while ((inputStr = reader.readLine()) != null) {\n responseStrBuilder.append(inputStr);\n }\n return responseStrBuilder.toString();\n }", "private String convertStreamToString(InputStream is) throws IOException {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder builder = new StringBuilder();\n String line;\n while ((line = reader.readLine()) != null) {\n builder.append(line);\n }\n return builder.toString();\n }", "public String convertStreamToString(InputStream is) {\n try {\n if (is != null) {\n Writer writer = new StringWriter();\n\n char[] buffer = new char[1024];\n try {\n Reader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n int n;\n while ((n = reader.read(buffer)) != -1) {\n writer.write(buffer, 0, n);\n }\n } finally {\n is.close();\n }\n return writer.toString();\n } else {\n return \"\";\n }\n } catch (IOException e) {\n throw new RuntimeException(\"Did not expect this one...\", e);\n }\n }", "public String readStream(InputStream in) {\n BufferedReader reader = null;\n StringBuffer data = new StringBuffer(\"\");\n try {\n reader = new BufferedReader(new InputStreamReader(in));\n String line = \"\";\n while ((line = reader.readLine()) != null) {\n data.append(line);\n }\n } catch (IOException e) {\n Log.e(\"Log\", \"IOException\");\n } finally {\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return data.toString();\n }", "public static String getStringFromInputStream(InputStream is) {\n\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(is));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return sb.toString();\n }", "public String read() throws Exception {\r\n\t\tBufferedReader reader = null;\r\n\t\tStringBuffer sb = new StringBuffer();\r\n\t\ttry {\r\n\t\t\tif (input==null) input = new FileInputStream(file);\r\n\t\t\treader = new BufferedReader(new InputStreamReader(input,charset));\r\n\t\t\tchar[] c= null;\r\n\t\t\twhile (reader.read(c=new char[8192])!=-1) {\r\n\t\t\t\tsb.append(c);\r\n\t\t\t}\r\n\t\t\tc=null;\r\n\t\t} catch (Exception e) {\r\n\t\t\tthrow e;\r\n\t\t} finally {\r\n\t\t\treader.close();\r\n\t\t}\r\n\t\treturn sb.toString().trim();\r\n\t}", "private StringBuilder inputStreamToString(InputStream is) {\n \t String line = \"\";\n \t StringBuilder total = new StringBuilder();\n \t \n \t // Wrap a BufferedReader around the InputStream\n \t BufferedReader rd = new BufferedReader(new InputStreamReader(is));\n \n \t // Read response until the end\n \t try {\n \t\t\twhile ((line = rd.readLine()) != null) { \n \t\t\t total.append(line); \n \t\t\t}\n \t\t} catch (IOException e) {\n \t\t\te.printStackTrace();\n \t\t}\n \t \n \t // Return full string\n \t return total;\n \t}", "private String read(InputStream in) throws IOException {\n StringBuilder sb = new StringBuilder();\n BufferedReader r = new BufferedReader(new InputStreamReader(in), 1000);\n for (String line = r.readLine(); line != null; line = r.readLine()) {\n sb.append(line);\n }\n in.close();\n return sb.toString();\n }", "public static String getContent(InputStream stream) throws Exception {\n return getContent(new InputStreamReader(stream));\n }", "private String convertStreamToString(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n while ((line = reader.readLine()) != null) {\n sb.append(line).append('\\n');\n }\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n try {\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return sb.toString();\n }", "public static String getAsString(InputStream is) {\n\t\treturn head(is, null);\n\t}", "private static String read(InputStream in) throws IOException {\n StringBuilder builder = new StringBuilder();\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\n String line = null;\n while ((line = reader.readLine()) != null)\n builder.append(line);\n\n return builder.toString();\n }", "private String convertStreamToString(InputStream is) throws IOException {\r\n\t\tint bufSize = 8 * 1024;\r\n\t\tif (is != null) {\r\n\t\t\tWriter writer = new StringWriter();\r\n\r\n\t\t\tchar[] buffer = new char[bufSize];\r\n\t\t\ttry {\r\n\t\t\t\tInputStreamReader ireader = new InputStreamReader(is, \"UTF-8\");\r\n\t\t\t\tReader reader = new BufferedReader(ireader, bufSize);\r\n\t\t\t\tint n;\r\n\t\t\t\twhile ((n = reader.read(buffer)) != -1) {\r\n\t\t\t\t\twriter.write(buffer, 0, n);\r\n\t\t\t\t}\r\n\t\t\t\treader.close();\r\n\t\t\t\tireader.close();\r\n\t\t\t\treturn writer.toString();\r\n\t\t\t} catch (OutOfMemoryError ex) {\r\n\t\t\t\tLog.e(\"b2evo_android\", \"Convert Stream: (out of memory)\");\r\n\t\t\t\twriter.close();\r\n\t\t\t\twriter = null;\r\n\t\t\t\tSystem.gc();\r\n\t\t\t\treturn \"\";\r\n\t\t\t} finally {\r\n\t\t\t\tis.close();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\treturn \"\";\r\n\t\t}\r\n\t}", "public String convertStreamToString(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n\n String line = null;\n try {\n while ((line = reader.readLine()) != null) {\n sb.append(line + \"\\n\");\n }\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n try {\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return sb.toString();\n }", "public static String read(Reader in) throws IOException {\n\t\tStringBuilder result = new StringBuilder();\n\t try {\n\t \tchar[] buf = new char[1024]; int r = 0;\n\t while ((r = in.read(buf)) != -1) {result.append(new String(buf, 0, r));}\n\t } finally { in.close();}\n\t\tString text=result.toString();\n\t\treturn text;\n\t}", "private String convertStreamToString(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n String line;\n try {\n // building the string\n while ((line = reader.readLine()) != null) {\n sb.append(line).append('\\n');\n }\n } catch (IOException e) {\n // error occurred in the inputstream\n Log.e(TAG, \"IOException: \" + e.getMessage());\n } finally {\n try {\n is.close();\n } catch (IOException e) {\n // error occurred closing input stream\n Log.e(TAG, \"IOException: \" + e.getMessage());\n }\n }\n return sb.toString();\n }", "public String readUTF() throws IOException {\n\n\t\t// Punt on this one and use DataInputStream routines.\n\t\tDataInputStream d = new DataInputStream(this);\n\t\treturn d.readUTF();\n\n\t}", "private static String readFromStream(InputStream inputStream) throws IOException {\n StringBuilder output = new StringBuilder();\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName(\"UTF-8\"));\n BufferedReader reader = new BufferedReader(inputStreamReader);\n String line = reader.readLine();\n while (line != null) {\n output.append(line);\n line = reader.readLine();\n }\n }\n return output.toString();\n }", "public String readString() {\n final int BUF_SIZE = 100;\n byte[] byteDest = new byte[BUF_SIZE];\n String ret = \"\";\n int num = BUF_SIZE;\n try {\n while (!ret.contains(\"\\r\")) {\n if ((num = in.read(byteDest)) > 0) {\n ret += new String(byteDest, 0, num);\n }\n }\n } catch (IOException e) {\n print(\"Error reading String from \" + portName);\n }\n print(\"Read :\" + ret + \":\");\n return ret;\n }", "public static String convertStreamToString(InputStream is) throws IOException {\r\n\t\tif (is != null) {\r\n\t\t\tStringBuilder sb = new StringBuilder();\r\n\t\t\tString line;\r\n\r\n\t\t\ttry {\r\n\t\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\r\n\t\t\t\twhile ((line = reader.readLine()) != null) {\r\n\t\t\t\t\tsb.append(line).append(\"\\n\");\r\n\t\t\t\t}\r\n\t\t\t} finally {\r\n\t\t\t\tis.close();\r\n\t\t\t}\r\n\t\t\treturn sb.toString();\r\n\t\t} else {\r\n\t\t\treturn \"\";\r\n\t\t}\r\n\t}", "private static String convertStreamToString(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is), 8192);\n StringBuilder sb = new StringBuilder();\n\n String line = null;\n try {\n while ((line = reader.readLine()) != null) {\n sb.append(line + \"\\n\");\n }\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n try {\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return sb.toString();\n }", "private String readString(InputStream in) throws IOException {\r\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(in, \"iso-8859-1\"));\r\n\t\tString inputLine;\r\n\t\tStringBuffer response = new StringBuffer();\r\n\t\twhile ((inputLine = reader.readLine()) != null) {\r\n\t\t\tresponse.append(inputLine);\r\n\t\t}\r\n\t\tin.close();\r\n\t\treturn response.toString();\r\n\t}", "public static String inputStreamToString(InputStream is) {\n\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(is));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n\n } catch (IOException e) {\n\n return null;\n\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n\n return sb.toString();\n\n }", "public static String readString(InputStream is) {\r\n \t\tif (is == null)\r\n \t\t\treturn null;\r\n \t\tBufferedReader reader= null;\r\n \t\ttry {\r\n \t\t\tStringBuffer buffer= new StringBuffer();\r\n \t\t\tchar[] part= new char[2048];\r\n \t\t\tint read= 0;\r\n \t\t\treader= new BufferedReader(new InputStreamReader(is));\r\n \r\n \t\t\twhile ((read= reader.read(part)) != -1)\r\n \t\t\t\tbuffer.append(part, 0, read);\r\n \t\t\t\r\n \t\t\treturn buffer.toString();\r\n \t\t\t\r\n \t\t} catch (IOException ex) {\r\n \t\t} finally {\r\n \t\t\tif (reader != null) {\r\n \t\t\t\ttry {\r\n \t\t\t\t\treader.close();\r\n \t\t\t\t} catch (IOException ex) {\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\treturn null;\r\n \t}", "private String InputStreamToString(InputStream in) {\n BufferedReader reader = null;\n try {\n reader = new BufferedReader(new InputStreamReader(in, IConstants.UTF8_ENCODING));\n } catch (UnsupportedEncodingException e1) {\n LogUtil.logError(EntropyPlugin.PLUGIN_ID, e1);\n }\n\n StringBuffer myStrBuf = new StringBuffer();\n int charOut = 0;\n String output = \"\"; //$NON-NLS-1$\n try {\n while ((charOut = reader.read()) != -1) {\n myStrBuf.append(String.valueOf((char) charOut));\n }\n } catch (IOException e) {\n LogUtil.logError(EntropyPlugin.PLUGIN_ID, e);\n }\n output = myStrBuf.toString();\n return output;\n }", "private String readIt(InputStream stream) throws IOException {\n BufferedReader reader = new BufferedReader(new InputStreamReader(stream, \"iso-8859-1\"), 128);\n StringBuilder sb = new StringBuilder();\n String line;\n while ((line = reader.readLine()) != null) {\n sb.append(line);\n }\n return sb.toString();\n }", "public synchronized String read() {\n\t\tString message = \"\";\n\n\t\tif(content.size() > 0 )\n\t\t\tmessage = content.get(0);\n\t\tnotify();\n\n\t\treturn message;\n }", "public String convertStreamToString(InputStream is) throws IOException {\r\n /*\r\n * To convert the InputStream to String we use the Reader.read(char[]\r\n * buffer) method. We iterate until the Reader return -1 which means\r\n * there's no more data to read. We use the StringWriter class to\r\n * produce the string.\r\n */\r\n if (is != null) {\r\n Writer writer = new StringWriter();\r\n char[] buffer = new char[1024];\r\n try {\r\n Reader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\r\n int n;\r\n while ((n = reader.read(buffer)) != -1) {\r\n writer.write(buffer, 0, n);\r\n }\r\n } finally {\r\n is.close();\r\n }\r\n return writer.toString();\r\n } else {\r\n return \"\";\r\n }\r\n }", "public String StreamToString(InputStream is) {\r\n //Creamos el Buffer\r\n BufferedReader reader =\r\n new BufferedReader(new InputStreamReader(is));\r\n StringBuilder sb = new StringBuilder();\r\n String line = null;\r\n try {\r\n //Bucle para leer todas las líneas\r\n //En este ejemplo al ser solo 1 la respuesta\r\n //Pues no haría falta\r\n while((line = reader.readLine())!=null){\r\n sb.append(line);\r\n }\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n } finally {\r\n try {\r\n is.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n //retornamos el codigo límpio\r\n return sb.toString();\r\n }", "public static String readString(InputStream is, String encoding) throws IOException {\n StringWriter sw = new StringWriter();\n try {\n copy(is, sw, encoding);\n return sw.toString();\n } finally {\n close(is);\n close(sw);\n }\n }", "public String getContent() throws IOException {\n ContentType type = getContentType();\n \n if(type == null) {\n return body.getContent(\"UTF-8\");\n } \n return getContent(type);\n }", "private static String readFromStream(InputStream inputStream) throws IOException {\n\n // Create a new empty string builder\n StringBuilder stringBuilder = new StringBuilder();\n\n // Create a bufferedReader that reads from the inputStream param\n BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream,\n Charset.forName(\"UTF-8\")));\n\n // Create a string that is one line of the buffered reader\n String line = bufferedReader.readLine();\n\n while (line != null) {\n // Add line to stringBuilder\n stringBuilder.append(line);\n\n // Set line to the next line in buffered reader\n line = bufferedReader.readLine();\n }\n\n // Return string builder as a string\n return stringBuilder.toString();\n }", "private static String readFromStream(InputStream inputStream) {\n StringBuilder outputString = new StringBuilder();\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName(\"UTF-8\"));\n BufferedReader reader = new BufferedReader(inputStreamReader);\n try {\n String line = reader.readLine();\n while (line != null) {\n outputString.append(line);\n line = reader.readLine();\n }\n } catch (IOException e) {\n Log.e(LOG_TAG, \"Error reading line from reader, readFromStream() block\", e);\n }\n }\n return outputString.toString();\n }", "public static String convertStreamToString(InputStream is) {\n String line = \"\";\n StringBuilder total = new StringBuilder();\n BufferedReader rd = new BufferedReader(new InputStreamReader(is));\n try {\n while ((line = rd.readLine()) != null) {\n total.append(line);\n }\n } catch (Exception e) {\n\n }\n return total.toString();\n }", "static String slurp(InputStream stream) throws IOException {\n StringBuilder sb = new StringBuilder();\n BufferedReader br = new BufferedReader(new InputStreamReader(stream));\n String line;\n while ((line = br.readLine()) != null) {\n sb.append(line).append(System.lineSeparator());\n }\n br.close();\n return sb.toString();\n }", "public static String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException {\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(stream));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n\n return sb.toString();\n }", "public String read() {\n\t\tStringBuffer text = new StringBuffer((int)file.length());\n\t\ttry {\n\t\t\tFileReader fr = new FileReader(file);\n\t\t\tBufferedReader b = new BufferedReader(fr);\n\t\t\tboolean eof = false;\n\t\t\tString line;\n\t\t\tString ret = \"\\n\";\n\t\t\twhile (!eof) {\n\t\t\t\tline = b.readLine();\n\t\t\t\tif (line == null) {\n\t\t\t\t\teof = true;\n\t\t\t\t} else {\n\t\t\t\t\ttext.append(line);\n\t\t\t\t\ttext.append(ret);\n\t\t\t\t}\n\t\t\t}\n\t\t\tb.close();\n\t\t} catch (IOException e) {\n\t\t\tthrow new IllegalArgumentException(\"File \" + file.getName() +\n\t\t\t\t\" is unreadable : \" + e.toString());\n\t\t}\n\t\treturn text.toString();\n\t}", "public String responsetoString(InputStream in) throws IOException{\n\t\tBufferedReader br = new BufferedReader( new InputStreamReader(in));\n\t\tStringBuilder sb = new StringBuilder();\n\t\tString line = null;\n\t\twhile((line = br.readLine())!= null){\n\t\t\tsb.append(line);\t\t\t\n\t\t}\n\t\tin.close();\n\t\treturn sb.toString();\n\t}", "private String inputStreamToString(InputStream is) {\n Scanner scanner = new Scanner(is);\n Scanner tokenizer = scanner.useDelimiter(\"\\\\A\");\n String str = tokenizer.hasNext() ? tokenizer.next() : \"\";\n scanner.close();\n return str;\n }", "public static String readFileFromInputStream(final InputStream is) throws IOException\n\t{\n\t\tfinal BufferedReader input = new BufferedReader(new InputStreamReader(\n\t\t\t\tis, FILE_CHARSET_NAME));\n\t\ttry\n\t\t{\n\t\t\tfinal StringBuilder contents = new StringBuilder(BUFFER_SIZE);\n\n\t\t\t// copy from input stream\n\t\t\tfinal char[] charBuffer = new char[BUFFER_SIZE];\n\t\t\tint len;\n\t\t\twhile ((len = input.read(charBuffer)) > 0)\n\t\t\t{\n\t\t\t\tcontents.append(charBuffer, 0, len);\n\t\t\t}\n\n\t\t\treturn contents.toString().replaceAll(\"\\r\\n\", \"\\n\");\n\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tinput.close();\n\t\t}\n\t}", "public static String InputStreamToString(InputStream is) throws IOException {\r\n\t\treturn InputStreamToString(is, false, true);\r\n\t}", "public String readString() {\n return readNextLine();\n }", "private static String convertStreamToString(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n while ((line = reader.readLine()) != null) {\n sb.append(line + \"\\n\");\n }\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n try {\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return sb.toString();\n }", "private static String convertStreamToString(InputStream is) {\r\n\r\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(is));\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\r\n\t\tString line = null;\r\n\t\ttry {\r\n\t\t\twhile ((line = reader.readLine()) != null) {\r\n\t\t\t\tsb.append(line + \"\\n\");\r\n\t\t\t}\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} finally {\r\n\t\t\ttry {\r\n\t\t\t\tis.close();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn sb.toString();\r\n\t}", "protected static String convertStreamToString(InputStream is) {\r\n /*\r\n * To convert the InputStream to String we use the BufferedReader.readLine()\r\n * method. We iterate until the BufferedReader return null which means\r\n * there's no more data to read. Each line will appended to a StringBuilder\r\n * and returned as String.\r\n */\r\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\r\n StringBuilder sb = new StringBuilder();\r\n \r\n String line = null;\r\n try {\r\n while ((line = reader.readLine()) != null) {\r\n sb.append(line + \"\\n\");\r\n }\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n } finally {\r\n try {\r\n is.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n \r\n return sb.toString();\r\n }", "@Override\n public String getContent() throws FileNotFound, CannotReadFile\n {\n Reader input = null;\n try\n {\n input = new InputStreamReader(resource.openStream());\n String content = IOUtils.toString(input).replace(\"\\r\\n\", \"\\n\");\n\n return content;\n } catch (FileNotFoundException ex)\n {\n throw new FileNotFound();\n } catch (IOException ex)\n {\n throw new CannotReadFile();\n } finally\n {\n InternalUtils.close(input);\n }\n }", "public static String convertStreamToString(InputStream is) throws Exception {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n String line = null;\n while ((line = reader.readLine()) != null) {\n sb.append(line).append(\"\\n\");\n }\n reader.close();\n return sb.toString();\n }", "private static String convertStreamToString(InputStream is) {\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n\n String line = null;\n try {\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t sb.append(line + \"\\n\");\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n try {\n\t\t\tis.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n return sb.toString();\n \n }", "private static String readStream(InputStream is, String charsetName) throws UnsupportedEncodingException, IOException {\r\n StringBuffer sb = new StringBuffer();\r\n byte[] buffer = new byte[1024];\r\n int length = 0;\r\n while ((length = is.read(buffer)) != -1) {\r\n sb.append(new String(buffer, 0, length, charsetName));\r\n }\r\n return sb.toString();\r\n }", "public static String convertStreamToString(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n \n String line = null;\n try {\n while ((line = reader.readLine()) != null) {\n sb.append(line + \"\\n\");\n }\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n try {\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return sb.toString();\n }", "public static String inputStreamToString(InputStream in) {\r\n StringBuffer buffer = new StringBuffer();\r\n try {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(in,\r\n \"UTF-8\"), 1024);\r\n String line;\r\n while ((line = br.readLine()) != null) {\r\n buffer.append(line);\r\n }\r\n } catch (IOException iox) {\r\n LOGR.warning(iox.getMessage());\r\n }\r\n return buffer.toString();\r\n }", "private static String convertStreamToString(InputStream is)\n {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n\n String line = null;\n try\n {\n while ((line = reader.readLine()) != null)\n {\n sb.append(line + \"\\n\");\n }\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n finally\n {\n try\n {\n is.close();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n System.out.println(sb.toString());\n return sb.toString();\n }", "private static String convertStreamToString(InputStream is) {\n\t\tInputStreamReader isr = new InputStreamReader(is);\n BufferedReader reader = new BufferedReader(isr);\n StringBuilder sb = new StringBuilder();\n \n String line = null;\n try {\n while ((line = reader.readLine()) != null) {\n sb.append(line + \"\\n\");\n }\n } catch (IOException e) {\n \tLog.e(TAG, e.getMessage(), e);\n } finally {\n try {\n reader.close();\n } catch (IOException e) {\n \tLog.w(TAG, e.getMessage(), e);\n }\n \n try {\n isr.close();\n } catch (IOException e) {\n \tLog.w(TAG, e.getMessage(), e);\n }\n }\n \n return sb.toString();\n }", "public static String convertStreamToString(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n while ((line = reader.readLine()) != null) {\n sb.append(line + \"\\n\");\n }\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n finally {\n try {\n is.close();\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n }\n return sb.toString();\n }", "public static String convertStreamToString(InputStream is) {\n if (is == null) return null;\n Scanner s = new Scanner(is, \"UTF-8\").useDelimiter(\"\\\\A\");\n return s.hasNext() ? s.next() : \"\";\n }", "private static final String convertStreamToString(InputStream is) {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(is));\n\t\tStringBuilder sb = new StringBuilder();\n\n\t\tString line = null;\n\t\ttry {\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tsb.append(line + \"\\n\");\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tis.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\treturn sb.toString();\n\t}", "public String getContentAsString() {\n \tif (getContent()!=null && isText()) {\n \t\treturn new String(getContent());\n \t}\n \treturn \"\";\n }", "private StringBuilder inputStreamToString(InputStream is) {\n String rLine = \"\";\n StringBuilder answer = new StringBuilder();\n BufferedReader br = new BufferedReader(new InputStreamReader(is));\n try {\n while ((rLine = br.readLine()) != null) {\n answer.append(rLine);\n }\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n return answer;\n }", "public static String convertInputStreamToString(InputStream is)\n throws IOException {\n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n try {\n BufferedReader reader = new BufferedReader(\n new InputStreamReader(is, UtilsConstants.UTF_8));\n while ((line = reader.readLine()) != null) {\n sb.append(line).append(UtilsConstants.LINE_SEPARATOR);\n }\n } finally {\n is.close();\n }\n return sb.toString();\n } else {\n return \"\";\n }\n }", "java.lang.String getContents();", "java.lang.String getContents();", "private String stringFromInputStream(InputStream instream) throws IOException {\n StringBuilder sb = new StringBuilder(\"\");\n if (instream == null) {\n logger.warn(\"Input stream is null.\");\n return sb.toString();\n }\n BufferedReader bufreader = new BufferedReader(new InputStreamReader(instream));\n String line = \"\";\n while ((line = bufreader.readLine()) != null) {\n sb.append(line);\n sb.append(LINE_SEPARATOR);\n }\n return sb.toString();\n }", "public static String convertStreamToString(InputStream is) {\n java.util.Scanner s = new java.util.Scanner(is).useDelimiter(\"\\\\A\");\n return s.hasNext() ? s.next() : \"\";\n }", "public java.lang.String getContents() {\n java.lang.Object ref = contents_;\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 if (bs.isValidUtf8()) {\n contents_ = s;\n }\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "@Override\n\tpublic String readBlob() throws PersistBlobException {\n\t\tlog.debug(\"readString: \");\n\t\ttry {\n\t\t\tString contents = FileUtils.readFileToString(new File(full_file_name), \"UTF-8\");\n\t\t\tlog.debug(\"returned string: \"+contents);\n\t\t\treturn contents;\n\t\t} catch (IOException e) {\n\t\t\tthrow new PersistBlobException(\"can not read string\",e);\n\t\t}\n\n\t}", "static String readString() throws IOException{\n return bufferedReader.readLine();\n }", "private static String convertInputStreamToString(InputStream inputStream) throws IOException{\t\t\t\t\t\t\t\t\t\n\n\t\tBufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));\t\t\t\t\t\t\t\t\t\n\t\tString line = \"\";\t\t\t\t\t\t\t\t\t\n\t\tString result = \"\";\t\t\t\t\t\t\t\t\t\n\t\twhile((line = bufferedReader.readLine()) != null)\t{\t\t\t\t\t\t\t\t\n\t\t\tresult += line;\t\t\t\t\t\t\t\t\n\t\t}\t\t\t\t\t\t\t\t\t\n\n\t\tinputStream.close();\t\t\t\t\t\t\t\t\t\n\t\treturn result;\t\t\t\t\t\t\t\t\t\n\t}", "private String getTextLineFromStream( InputStream is ) throws IOException {\n StringBuffer buffer = new StringBuffer();\n int b;\n\n \twhile( (b = is.read()) != -1 && b != (int) '\\n' ) {\n \t\tbuffer.append( (char) b );\n \t}\n \treturn buffer.toString().trim();\n }", "public String read();", "private static String convertStreamToString(InputStream is) {\r\n\t\t/*\r\n\t\t * To convert the InputStream to String we use the\r\n\t\t * BufferedReader.readLine() method. We iterate until the BufferedReader\r\n\t\t * return null which means there's no more data to read. Each line will\r\n\t\t * appended to a StringBuilder and returned as String.\r\n\t\t */\r\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(is));\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\r\n\t\tString line = null;\r\n\t\ttry {\r\n\t\t\twhile ((line = reader.readLine()) != null) {\r\n\t\t\t\tsb.append(line + \"\\n\");\r\n\t\t\t}\r\n\t\t} catch (IOException e) {\r\n//\t\t\tLog.e(\"HTTP\", \"HTTP::convertStreamToString IOEX\",e);\r\n\t\t} finally {\r\n\t\t\ttry {\r\n\t\t\t\tis.close();\r\n\t\t\t} catch (IOException e) {\r\n//\t\t\t\tLog.e(Constants.TAG, \"HTTP::convertStreamToString, finally catch IOEX\", e);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn sb.toString();\r\n\t}", "public static String readFile(InputStream in) throws IOException {\n final StringBuffer sBuffer = new StringBuffer();\n final BufferedReader br = new BufferedReader(new InputStreamReader(in));\n final char[] buffer = new char[1024];\n\n int cnt;\n while ((cnt = br.read(buffer, 0, buffer.length)) > -1) {\n sBuffer.append(buffer, 0, cnt);\n }\n br.close();\n in.close();\n return sBuffer.toString();\n }", "String getContent() throws IOException;", "public static String convertStreamToString(InputStream is) throws IOException {\n\tif (is != null) {\n\t\tWriter writer = new StringWriter();\n\n\t\tchar[] buffer = new char[1024];\n\t\ttry {\n\t\t\tReader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n\t\t\tint n;\n\t\t\twhile ((n = reader.read(buffer)) != -1) {\n\t\t\t\twriter.write(buffer, 0, n);\n\t\t\t}\n\t\t} finally {\n\t\t\tis.close();\n\t\t}\n\t\treturn writer.toString();\n\t} else {\n\t\treturn \"\";\n\t}\n}", "private String getContent(InputStream inputStream) throws AspireException{\n\n BufferedReader bufferReader = null;\n StringBuilder stringBuilder = new StringBuilder();\n String line;\n \n try {\n \n bufferReader = new BufferedReader(new InputStreamReader(inputStream));\n \n while ((line = bufferReader.readLine()) != null) {\n stringBuilder.append(line);\n stringBuilder.append(\"\\n\");\n }\n \n } catch (IOException e) {\n throw new AspireException(\"SubversionJavaParser.getContent\", e);\n } finally {\n if (bufferReader != null) {\n try {\n bufferReader.close();\n } catch (IOException e) {\n throw new AspireException(\"SubversionJavaParser.getContent\", e);\n }\n }\n }\n \n return stringBuilder.toString();\n }" ]
[ "0.750401", "0.71766174", "0.71658283", "0.71614", "0.703968", "0.6957307", "0.6951378", "0.6943325", "0.68958026", "0.68387455", "0.68240273", "0.6815508", "0.681406", "0.6791604", "0.6769644", "0.67581195", "0.675076", "0.6674198", "0.6642366", "0.66232073", "0.66109115", "0.65943503", "0.659355", "0.65809244", "0.65779406", "0.6559019", "0.6555324", "0.6519561", "0.65108174", "0.65033", "0.64972323", "0.64937574", "0.64794916", "0.6467185", "0.64632493", "0.64523464", "0.6449309", "0.64474255", "0.64375883", "0.64220953", "0.63995427", "0.6393472", "0.6388774", "0.63809144", "0.6379516", "0.63741666", "0.63684595", "0.6357481", "0.63544506", "0.6354406", "0.6352023", "0.63396627", "0.63354135", "0.6334831", "0.6333478", "0.6329143", "0.6326979", "0.63173795", "0.6316649", "0.63129115", "0.631143", "0.63032687", "0.6294832", "0.62860894", "0.6284448", "0.6282627", "0.6261638", "0.6251039", "0.6249356", "0.6248164", "0.623234", "0.6229757", "0.62213856", "0.6209716", "0.6206186", "0.6198423", "0.6192881", "0.6179178", "0.61753106", "0.61736125", "0.6170592", "0.6169511", "0.61592525", "0.61530906", "0.61443394", "0.61343914", "0.61343914", "0.6131031", "0.6129664", "0.61282915", "0.61224955", "0.6108008", "0.6106172", "0.6101411", "0.6094228", "0.6081375", "0.6076388", "0.6076039", "0.60704076", "0.60687745" ]
0.64269257
39
Read the content of this InputStream using specified charset and return it as a String. The stream is closed before this method returns.
public static String getText(InputStream is, String charset) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(is, charset)); return getText(reader); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static String readStream(InputStream is, String charsetName) throws UnsupportedEncodingException, IOException {\r\n StringBuffer sb = new StringBuffer();\r\n byte[] buffer = new byte[1024];\r\n int length = 0;\r\n while ((length = is.read(buffer)) != -1) {\r\n sb.append(new String(buffer, 0, length, charsetName));\r\n }\r\n return sb.toString();\r\n }", "public static String readString(InputStream is) throws IOException {\n return readString(is, DEFAULT_ENCODING);\n }", "public static String readString(InputStream is, String encoding) throws IOException {\n StringWriter sw = new StringWriter();\n try {\n copy(is, sw, encoding);\n return sw.toString();\n } finally {\n close(is);\n close(sw);\n }\n }", "protected String convertStreamToString(InputStream is, String charset) {\n\t\tScanner s = new Scanner(is, charset);\n\t\ttry {\n\t\t\ts.useDelimiter(\"\\\\A\");\n\t\t\treturn s.hasNext() ? s.next() : \"\";\n\t\t} finally {\n\t\t\ts.close();\n\t\t}\n\t}", "private String readString(InputStream in) throws IOException {\r\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(in, \"iso-8859-1\"));\r\n\t\tString inputLine;\r\n\t\tStringBuffer response = new StringBuffer();\r\n\t\twhile ((inputLine = reader.readLine()) != null) {\r\n\t\t\tresponse.append(inputLine);\r\n\t\t}\r\n\t\tin.close();\r\n\t\treturn response.toString();\r\n\t}", "public String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException {\n Reader reader = null;\n reader = new InputStreamReader(stream, \"UTF-8\");\n char[] buffer = new char[len];\n reader.read(buffer);\n return new String(buffer);\n }", "public static String copyToString(InputStream in, Charset charset) throws IOException {\n if (in == null) throw new IllegalArgumentException(\"No InputStream specified\");\n if (charset == null) throw new IllegalArgumentException(\"No Charset specified\");\n StringBuilder out = new StringBuilder();\n InputStreamReader reader = new InputStreamReader(in, charset);\n char[] buffer = new char[BUFFER_SIZE];\n int bytesRead;\n while ((bytesRead = reader.read(buffer)) != -1) {\n out.append(buffer, 0, bytesRead);\n }\n return out.toString();\n }", "public static String readString(InputStream is, String encoding) {\n \t\tif (is == null)\n \t\t\treturn null;\n \t\tBufferedReader reader= null;\n \t\ttry {\n \t\t\tStringBuffer buffer= new StringBuffer();\n \t\t\tchar[] part= new char[2048];\n \t\t\tint read= 0;\n \t\t\treader= new BufferedReader(new InputStreamReader(is, encoding));\n \n \t\t\twhile ((read= reader.read(part)) != -1)\n \t\t\t\tbuffer.append(part, 0, read);\n \t\t\t\n \t\t\treturn buffer.toString();\n \t\t\t\n \t\t} catch (IOException ex) {\n \t\t\tCompareUIPlugin.log(ex);\n \t\t} finally {\n \t\t\tif (reader != null) {\n \t\t\t\ttry {\n \t\t\t\t\treader.close();\n \t\t\t\t} catch (IOException ex) {\n \t\t\t\t\t// silently ignored\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn null;\n \t}", "public static String read(InputStream input) throws Exception {\r\n\t\treader.setInput(input);\r\n\t\treader.setCharset(\"UTF-8\");\r\n\t\treturn reader.read();\r\n\t}", "private String readIt(InputStream stream) throws IOException {\n BufferedReader reader = new BufferedReader(new InputStreamReader(stream, \"iso-8859-1\"), 128);\n StringBuilder sb = new StringBuilder();\n String line;\n while ((line = reader.readLine()) != null) {\n sb.append(line);\n }\n return sb.toString();\n }", "public String readString() throws IOException {\n checkOpened();\n return dis.readUTF();\n }", "private String read() {\n\n String s = \"\";\n\n try {\n // Check if there are bytes available\n if (inStream.available() > 0) {\n\n // Read bytes into a buffer\n byte[] inBuffer = new byte[1024];\n int bytesRead = inStream.read(inBuffer);\n\n // Convert read bytes into a string\n s = new String(inBuffer, \"ASCII\");\n s = s.substring(0, bytesRead);\n }\n\n } catch (Exception e) {\n Log.e(TAG, \"Read failed!\", e);\n }\n\n return s;\n }", "public String read() throws Exception {\r\n\t\tBufferedReader reader = null;\r\n\t\tStringBuffer sb = new StringBuffer();\r\n\t\ttry {\r\n\t\t\tif (input==null) input = new FileInputStream(file);\r\n\t\t\treader = new BufferedReader(new InputStreamReader(input,charset));\r\n\t\t\tchar[] c= null;\r\n\t\t\twhile (reader.read(c=new char[8192])!=-1) {\r\n\t\t\t\tsb.append(c);\r\n\t\t\t}\r\n\t\t\tc=null;\r\n\t\t} catch (Exception e) {\r\n\t\t\tthrow e;\r\n\t\t} finally {\r\n\t\t\treader.close();\r\n\t\t}\r\n\t\treturn sb.toString().trim();\r\n\t}", "public static String readIt(InputStream is) throws IOException {\n BufferedReader reader = null;\n reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n StringBuilder responseStrBuilder = new StringBuilder();\n String inputStr;\n while ((inputStr = reader.readLine()) != null) {\n responseStrBuilder.append(inputStr);\n }\n return responseStrBuilder.toString();\n }", "public static String read(InputStream in) throws IOException {\n\t\tStringBuilder result = new StringBuilder();\n\t try {\n\t byte[] buf = new byte[1024]; int r = 0;\n\t while ((r = in.read(buf)) != -1) {result.append(new String(buf, 0, r));}\n\t } finally { in.close();}\n\t\tString text=result.toString();\n\t\treturn text;\n\t}", "private static String decode(final InputStream input, final String charset) throws XHTMLTidyException {\n\t\ttry {\n\t\t\tfinal CharsetDecoder charsetDecoder = Charset.forName(charset).newDecoder();\n\t\t\tcharsetDecoder.onMalformedInput(CodingErrorAction.REPLACE);\n\t\t\tcharsetDecoder.onUnmappableCharacter(CodingErrorAction.REPORT);\n\t\t\tfinal Reader reader = new InputStreamReader(input, charsetDecoder);\n\t\t\tfinal CharBuffer buffer = CharBuffer.allocate(input.available());\n\t\t\treader.read(buffer);\n\t\t\tbuffer.compact();\n\t\t\tfinal String text = new String(buffer.array());\n\t\t\tbuffer.clear();\n\t\t\treturn text;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tthrow new XHTMLTidyException(e);\n\t\t}\n\t}", "public String getStringFromInputStream(InputStream is) {\n\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(is));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n } catch (Exception e) {\n } finally {\n try {\n br.close();\n } catch (Exception e) {\n }\n br = null;\n return sb.toString();\n }\n }", "public String peekString(Charset charset) {\n if (charset == null)\n charset = Charsets.UTF_8;\n StringBuilder builder = new StringBuilder();\n for (ByteBuffer bb : mBuffers) {\n byte[] bytes;\n int offset;\n int length;\n if (bb.isDirect()) {\n bytes = new byte[bb.remaining()];\n offset = 0;\n length = bb.remaining();\n bb.get(bytes);\n } else {\n bytes = bb.array();\n offset = bb.arrayOffset() + bb.position();\n length = bb.remaining();\n }\n builder.append(new String(bytes, offset, length, charset));\n }\n return builder.toString();\n }", "public static String convertStreamToString(InputStream is) throws IOException {\n\n String encoding = \"UTF-8\"; //default\n\n\n // cerca se il documento specifica un altro encoding\n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));//\"UTF-8\"));\n while ((line = reader.readLine()) != null) { //CRASHA\n sb.append(line).append(\"\\n\");\n if ((sb.toString().contains(\"<?\") && sb.toString().contains(\"?>\")) && sb.toString().contains(\"encoding=\")) {\n\n Pattern p = Pattern.compile(\".*<\\\\?.*encoding=.(.*).\\\\?>.*\", Pattern.DOTALL);\n\n Matcher matcher = p.matcher(sb.toString());\n\n if (matcher.matches()) {\n encoding = matcher.group(1);\n }\n\n break;\n }\n }\n\n\n\n }\n\n // converte\n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n\n try {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is, encoding));//\"UTF-8\"));\n while ((line = reader.readLine()) != null) {\n sb.append(line).append(\"\\n\");\n System.out.println(line);\n }\n } finally {\n is.close();\n }\n return sb.toString();\n } else {\n return \"error\";\n }\n }", "public static String readFileAsString(String path, String charsetName) throws IOException {\n ByteBuffer content = internalReadFileAsByteArray(path);\n CharBuffer result = Charset.forName(charsetName).decode(content);\n char[] charContent = null;\n if (result.hasArray()) {\n charContent = result.array();\n } else {\n charContent = new char[result.limit()];\n result.get(charContent);\n }\n return new String(charContent);\n\n }", "public static String GetStringFromInputStream(InputStream is) {\n\t\tString line;\n\t\tStringBuilder total = new StringBuilder();\n\n\t\t// Wrap a BufferedReader around the InputStream\n\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(is));\n\n\t\t// Read response until the end\n\t\ttry {\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t\ttotal.append(line);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tis.close();\n\t\t\t} catch (Exception e) {\n\t\t\t\tUtilities\n\t\t\t\t\t\t.LogWarning(\"GetStringFromInputStream - could not close stream\");\n\t\t\t}\n\t\t}\n\n\t\t// Return full string\n\t\treturn total.toString();\n\t}", "private String readStream(InputStream is) {\n try {\n ByteArrayOutputStream bo = new ByteArrayOutputStream();\n int i = is.read();\n while(i != -1) {\n bo.write(i);\n i = is.read();\n }\n return bo.toString();\n } catch (IOException e) {\n return \"\";\n }\n }", "public String readString() {\n byte[] byteForStream = new byte[1024];\n String message = \"\";\n\n mListener.onCarRunning();\n\n\n int bytes;\n\n while (true) {\n try {\n bytes = mInputStream.read(byteForStream);\n message = new String(byteForStream, 0, bytes);\n Log.d(TAG, \" Read from inputstream \" + message);\n\n } catch (IOException e) {\n Log.e(TAG, \" error reading from inputstream \" + e.getMessage());\n break;\n }\n }\n return message;\n }", "static String loadStream(InputStream in) throws IOException {\n int ptr = 0;\n in = new BufferedInputStream(in);\n StringBuffer buffer = new StringBuffer();\n while( (ptr = in.read()) != -1 ) {\n buffer.append((char)ptr);\n }\n return buffer.toString();\n }", "public static String loadString(@NonNull InputStream inputStream, Charset encoding) throws IOException {\n if(encoding == null){\n encoding = StandardCharsets.UTF_8;\n }\n int nRead;\n byte[] data = new byte[8];\n StringBuilder sb = new StringBuilder();\n while ((nRead = inputStream.read(data, 0, data.length)) != -1) {\n sb.append(new String(data, 0, nRead, encoding));\n }\n return sb.toString();\n }", "public static String readString(InputStream is) {\r\n \t\tif (is == null)\r\n \t\t\treturn null;\r\n \t\tBufferedReader reader= null;\r\n \t\ttry {\r\n \t\t\tStringBuffer buffer= new StringBuffer();\r\n \t\t\tchar[] part= new char[2048];\r\n \t\t\tint read= 0;\r\n \t\t\treader= new BufferedReader(new InputStreamReader(is));\r\n \r\n \t\t\twhile ((read= reader.read(part)) != -1)\r\n \t\t\t\tbuffer.append(part, 0, read);\r\n \t\t\t\r\n \t\t\treturn buffer.toString();\r\n \t\t\t\r\n \t\t} catch (IOException ex) {\r\n \t\t} finally {\r\n \t\t\tif (reader != null) {\r\n \t\t\t\ttry {\r\n \t\t\t\t\treader.close();\r\n \t\t\t\t} catch (IOException ex) {\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\treturn null;\r\n \t}", "@NonNull\n public static String getStringFrom(InputStream inputStream) {\n StringBuffer dataStringBuffer = new StringBuffer(\"\");\n try {\n InputStreamReader isr = new InputStreamReader(inputStream);\n BufferedReader bufferedReader = new BufferedReader(isr);\n String readString = bufferedReader.readLine();\n while (readString != null) {\n dataStringBuffer.append(readString);\n readString = bufferedReader.readLine();\n }\n isr.close();\n } catch (IOException ioe) {\n ioe.printStackTrace();\n }\n return dataStringBuffer.toString();\n }", "private String readStream(InputStream in) {\n try {\n ByteArrayOutputStream bo = new ByteArrayOutputStream();\n int i = in.read();\n while(i != -1) {\n bo.write(i);\n i = in.read();\n }\n return bo.toString();\n } catch (IOException e) {\n return \"\";\n }\n }", "private static String readFromStream(InputStream inputStream) throws IOException {\n StringBuilder output = new StringBuilder();\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName(\"UTF-8\"));\n BufferedReader reader = new BufferedReader(inputStreamReader);\n String line = reader.readLine();\n while (line != null) {\n output.append(line);\n line = reader.readLine();\n }\n }\n return output.toString();\n }", "public String readString() throws IOException {\n return WritableUtils.readString(in);\n }", "public static String getContentString( String url, String charset ) throws URISyntaxException, IOException {\n\t\treturn getContentString( false, url, charset );\n\t}", "public String readUTF() throws IOException {\n\n\t\t// Punt on this one and use DataInputStream routines.\n\t\tDataInputStream d = new DataInputStream(this);\n\t\treturn d.readUTF();\n\n\t}", "public String readUTF() throws IOException;", "public String getContent() {\n String s = null;\n try {\n s = new String(Files.readAllBytes(Paths.get(filename)), StandardCharsets.UTF_8);\n }\n catch (IOException e) {\n message = \"Problem reading a file: \" + filename;\n }\n return s;\n }", "public static String loadStream(InputStream in) throws IOException {\r\n\t\tInputStream is = in;\r\n\t\tint ptr = 0;\r\n\t\tis = new BufferedInputStream(is);\r\n\t\tStringBuffer buffer = new StringBuffer();\r\n\t\ttry {\r\n\t\t\twhile ((ptr = is.read()) != -1) {\r\n\t\t\t\tbuffer.append((char) ptr);\r\n\t\t\t}\r\n\t\t} finally {\r\n\t\t\tis.close();\r\n\t\t}\r\n\t\treturn buffer.toString();\r\n\t}", "public static String readFileFromInputStream(final InputStream is) throws IOException\n\t{\n\t\tfinal BufferedReader input = new BufferedReader(new InputStreamReader(\n\t\t\t\tis, FILE_CHARSET_NAME));\n\t\ttry\n\t\t{\n\t\t\tfinal StringBuilder contents = new StringBuilder(BUFFER_SIZE);\n\n\t\t\t// copy from input stream\n\t\t\tfinal char[] charBuffer = new char[BUFFER_SIZE];\n\t\t\tint len;\n\t\t\twhile ((len = input.read(charBuffer)) > 0)\n\t\t\t{\n\t\t\t\tcontents.append(charBuffer, 0, len);\n\t\t\t}\n\n\t\t\treturn contents.toString().replaceAll(\"\\r\\n\", \"\\n\");\n\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tinput.close();\n\t\t}\n\t}", "public String getStringContent() throws IOException;", "public String convertStreamToString(InputStream is) {\n try {\n if (is != null) {\n Writer writer = new StringWriter();\n\n char[] buffer = new char[1024];\n try {\n Reader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n int n;\n while ((n = reader.read(buffer)) != -1) {\n writer.write(buffer, 0, n);\n }\n } finally {\n is.close();\n }\n return writer.toString();\n } else {\n return \"\";\n }\n } catch (IOException e) {\n throw new RuntimeException(\"Did not expect this one...\", e);\n }\n }", "protected String readUnicodeInputStream(InputStream in) throws IOException {\n\t\tUnicodeReader reader = new UnicodeReader(in, null);\n\t\tString data = FileCopyUtils.copyToString(reader);\n\t\treader.close();\n\t\treturn data;\n\t}", "private String _read(InputStream in, String enc) throws IOException\n {\n int ptr = 0;\n int count;\n \n while ((count = in.read(_readBuffer, ptr, _readBuffer.length - ptr)) > 0) {\n ptr += count;\n // buffer full? Need to realloc\n if (ptr == _readBuffer.length) {\n _readBuffer = Arrays.copyOf(_readBuffer, ptr + ptr);\n }\n }\n \n return new String(_readBuffer, 0, ptr, enc);\n }", "protected String readFullyAsString(InputStream inputStream)\n\t\t\tthrows IOException {\n\t\tByteArrayOutputStream baos = new ByteArrayOutputStream();\n\t\tbyte[] buffer = new byte[1024];\n\t\tint length;\n\t\twhile ((length = inputStream.read(buffer)) != -1) {\n\t\t\tbaos.write(buffer, 0, length);\n\t\t}\n\t\treturn baos.toString(StandardCharsets.UTF_8.name());\n\t}", "static String loadStream(InputStream in) throws IOException { \n\t\tint ptr = 0; \n\t\tin = new BufferedInputStream(in); \n\t\tStringBuffer buffer = new StringBuffer(); \n\t\twhile( (ptr = in.read()) != -1 ) { \n\t\t\tbuffer.append((char)ptr); \n\t\t} \n\t\treturn buffer.toString(); \n\t}", "private static String getStringFromInputStream(InputStream is) {\r\n\r\n BufferedReader br = null;\r\n StringBuilder sb = new StringBuilder();\r\n\r\n String line;\r\n try {\r\n\r\n br = new BufferedReader(new InputStreamReader(is));\r\n while ((line = br.readLine()) != null) {\r\n sb.append(line);\r\n }\r\n\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n finally {\r\n if (br != null) {\r\n try {\r\n br.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n }\r\n\r\n return sb.toString();\r\n\r\n }", "public static String readString(final InputStream stream)\n throws IOException\n {\n ByteArrayOutputStream bytes;\n byte[] buffer;\n int read;\n\n buffer = new byte[8192];\n bytes = new ByteArrayOutputStream();\n while ((read = stream.read(buffer)) != -1)\n {\n bytes.write(buffer, 0, read);\n }\n return new String(bytes.toByteArray(), \"ISO-8859-1\");\n }", "public static String getText(InputStream is) throws IOException {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n return getText(reader);\n }", "public static String convertStreamToString(InputStream is) {\n if (is == null) return null;\n Scanner s = new Scanner(is, \"UTF-8\").useDelimiter(\"\\\\A\");\n return s.hasNext() ? s.next() : \"\";\n }", "public String parserResultFromContent(InputStream is) throws IOException {\n String result = \"\";\n BufferedReader reader = new BufferedReader(\n new InputStreamReader(is, Constants.CHARSET_NAME_UTF8));\n String line = \"\";\n while ((line = reader.readLine()) != null) {\n result += line;\n }\n is.close();\n return result;\n }", "public static String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException {\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(stream));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n\n return sb.toString();\n }", "private String convertStreamToString(InputStream is) throws IOException {\r\n\t\tint bufSize = 8 * 1024;\r\n\t\tif (is != null) {\r\n\t\t\tWriter writer = new StringWriter();\r\n\r\n\t\t\tchar[] buffer = new char[bufSize];\r\n\t\t\ttry {\r\n\t\t\t\tInputStreamReader ireader = new InputStreamReader(is, \"UTF-8\");\r\n\t\t\t\tReader reader = new BufferedReader(ireader, bufSize);\r\n\t\t\t\tint n;\r\n\t\t\t\twhile ((n = reader.read(buffer)) != -1) {\r\n\t\t\t\t\twriter.write(buffer, 0, n);\r\n\t\t\t\t}\r\n\t\t\t\treader.close();\r\n\t\t\t\tireader.close();\r\n\t\t\t\treturn writer.toString();\r\n\t\t\t} catch (OutOfMemoryError ex) {\r\n\t\t\t\tLog.e(\"b2evo_android\", \"Convert Stream: (out of memory)\");\r\n\t\t\t\twriter.close();\r\n\t\t\t\twriter = null;\r\n\t\t\t\tSystem.gc();\r\n\t\t\t\treturn \"\";\r\n\t\t\t} finally {\r\n\t\t\t\tis.close();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\treturn \"\";\r\n\t\t}\r\n\t}", "public static String streamToString(InputStream is) throws IOException {\n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n\n try {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n while ((line = reader.readLine()) != null) {\n sb.append(line).append(\"\\n\");\n }\n } finally {\n is.close();\n }\n return sb.toString();\n } else {\n return \"\";\n }\n\t}", "public static String getStringFromInputStream(InputStream is) {\n\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(is));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return sb.toString();\n }", "public String getContentsAsString(String charSet) throws VlException\n {\n byte contents[] = getContents();\n\n String str;\n\n try\n {\n if (charSet==null)\n str = new String(contents); // use default charSet\n else\n str = new String(contents, charSet);\n }\n catch (UnsupportedEncodingException e)\n {\n Global.errorPrintf(this,\"Exception:%s\\n\",e);\n Global.debugPrintStacktrace(e); \n\n throw (new VlException(\"charSet enconding:'\"+charSet+\"' not supported\", e));\n }\n\n return str;\n }", "public static String readLine(InputStream inputStream, String charset,\n boolean includeCR) throws IOException {\n byte[] line = readLine(inputStream, includeCR);\n return (null == line) ? null : new String(line, charset);\n }", "public static String read(Reader in) throws IOException {\n\t\tStringBuilder result = new StringBuilder();\n\t try {\n\t \tchar[] buf = new char[1024]; int r = 0;\n\t while ((r = in.read(buf)) != -1) {result.append(new String(buf, 0, r));}\n\t } finally { in.close();}\n\t\tString text=result.toString();\n\t\treturn text;\n\t}", "public static String convertStreamToString(InputStream is) throws IOException {\r\n\t\tif (is != null) {\r\n\t\t\tStringBuilder sb = new StringBuilder();\r\n\t\t\tString line;\r\n\r\n\t\t\ttry {\r\n\t\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\r\n\t\t\t\twhile ((line = reader.readLine()) != null) {\r\n\t\t\t\t\tsb.append(line).append(\"\\n\");\r\n\t\t\t\t}\r\n\t\t\t} finally {\r\n\t\t\t\tis.close();\r\n\t\t\t}\r\n\t\t\treturn sb.toString();\r\n\t\t} else {\r\n\t\t\treturn \"\";\r\n\t\t}\r\n\t}", "public String readString() {\n final int BUF_SIZE = 100;\n byte[] byteDest = new byte[BUF_SIZE];\n String ret = \"\";\n int num = BUF_SIZE;\n try {\n while (!ret.contains(\"\\r\")) {\n if ((num = in.read(byteDest)) > 0) {\n ret += new String(byteDest, 0, num);\n }\n }\n } catch (IOException e) {\n print(\"Error reading String from \" + portName);\n }\n print(\"Read :\" + ret + \":\");\n return ret;\n }", "public static String readString(String resource, Charset charset) {\n byte[]\tbytes;\n\n bytes = readBytes(resource);\n if (bytes == null)\n return null;\n\n try {\n return new String(bytes, charset);\n }\n catch (Exception e) {\n LOGGER.log(Level.SEVERE, \"Failed to read string (\" + charset + \") from resource file: \" + resource, e);\n return null;\n }\n }", "private String readStream(InputStream in) throws IOException {\n BufferedReader r = new BufferedReader(new InputStreamReader(in));\n\n StringBuilder sb = new StringBuilder();\n String line;\n\n // Reads every line and stores them in sb.\n while((line = r.readLine()) != null) {\n sb.append(line);\n }\n\n // Closes the input stream.\n in.close();\n\n return sb.toString();\n }", "public String convertStreamToString(InputStream is) throws IOException {\r\n /*\r\n * To convert the InputStream to String we use the Reader.read(char[]\r\n * buffer) method. We iterate until the Reader return -1 which means\r\n * there's no more data to read. We use the StringWriter class to\r\n * produce the string.\r\n */\r\n if (is != null) {\r\n Writer writer = new StringWriter();\r\n char[] buffer = new char[1024];\r\n try {\r\n Reader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\r\n int n;\r\n while ((n = reader.read(buffer)) != -1) {\r\n writer.write(buffer, 0, n);\r\n }\r\n } finally {\r\n is.close();\r\n }\r\n return writer.toString();\r\n } else {\r\n return \"\";\r\n }\r\n }", "public static String readFromInputStream(InputStream inputStream) throws IOException {\n StringBuilder streamOutput = new StringBuilder();\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset\n .forName(\"UTF-8\"));\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n String line = bufferedReader.readLine();\n while (line != null) {\n streamOutput.append(line);\n line = bufferedReader.readLine();\n }\n }\n return streamOutput.toString();\n }", "public static String toString(final InputStream input, final String encoding)\n throws IOException {\n return toString(input, Charset.forName(encoding));\n }", "public static String toString(final InputStream input, final Charset encoding) throws IOException {\n final StringWriter sw = new StringWriter();\n copy(input, sw, encoding);\n return sw.toString();\n }", "private static String readFromStream(InputStream inputStream) {\n StringBuilder outputString = new StringBuilder();\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName(\"UTF-8\"));\n BufferedReader reader = new BufferedReader(inputStreamReader);\n try {\n String line = reader.readLine();\n while (line != null) {\n outputString.append(line);\n line = reader.readLine();\n }\n } catch (IOException e) {\n Log.e(LOG_TAG, \"Error reading line from reader, readFromStream() block\", e);\n }\n }\n return outputString.toString();\n }", "private String readStream(InputStream is) throws IOException {\n StringBuilder sb = new StringBuilder();\n BufferedReader r = new BufferedReader(new InputStreamReader(is),1000);\n for (String line = r.readLine(); line != null; line =r.readLine()){\n sb.append(line);\n }\n is.close();\n return sb.toString();\n }", "private static String readFromStream(InputStream inputStream) throws IOException {\n\n // Create a new empty string builder\n StringBuilder stringBuilder = new StringBuilder();\n\n // Create a bufferedReader that reads from the inputStream param\n BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream,\n Charset.forName(\"UTF-8\")));\n\n // Create a string that is one line of the buffered reader\n String line = bufferedReader.readLine();\n\n while (line != null) {\n // Add line to stringBuilder\n stringBuilder.append(line);\n\n // Set line to the next line in buffered reader\n line = bufferedReader.readLine();\n }\n\n // Return string builder as a string\n return stringBuilder.toString();\n }", "private String InputStreamToString(InputStream in) {\n BufferedReader reader = null;\n try {\n reader = new BufferedReader(new InputStreamReader(in, IConstants.UTF8_ENCODING));\n } catch (UnsupportedEncodingException e1) {\n LogUtil.logError(EntropyPlugin.PLUGIN_ID, e1);\n }\n\n StringBuffer myStrBuf = new StringBuffer();\n int charOut = 0;\n String output = \"\"; //$NON-NLS-1$\n try {\n while ((charOut = reader.read()) != -1) {\n myStrBuf.append(String.valueOf((char) charOut));\n }\n } catch (IOException e) {\n LogUtil.logError(EntropyPlugin.PLUGIN_ID, e);\n }\n output = myStrBuf.toString();\n return output;\n }", "private String inputStreamToString(InputStream is) {\n Scanner scanner = new Scanner(is);\n Scanner tokenizer = scanner.useDelimiter(\"\\\\A\");\n String str = tokenizer.hasNext() ? tokenizer.next() : \"\";\n scanner.close();\n return str;\n }", "public static String getContentString( HttpRequestHeaderInfo header, String url, String charset ) throws URISyntaxException, IOException {\n\t\treturn new String( getContentBytes( header, url ), charset );\n\t}", "public static String inputStreamToString(InputStream in) {\r\n StringBuffer buffer = new StringBuffer();\r\n try {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(in,\r\n \"UTF-8\"), 1024);\r\n String line;\r\n while ((line = br.readLine()) != null) {\r\n buffer.append(line);\r\n }\r\n } catch (IOException iox) {\r\n LOGR.warning(iox.getMessage());\r\n }\r\n return buffer.toString();\r\n }", "public static String getContent(InputStream stream) throws Exception {\n return getContent(new InputStreamReader(stream));\n }", "public static String convertStreamToString(InputStream inputStream) {\n\n String result = \"\";\n try {\n\n Scanner scanner = new Scanner(inputStream, \"UTF-8\").useDelimiter(\"\\\\A\");\n if (scanner.hasNext()) {\n result = scanner.next();\n }\n inputStream.close();\n } catch (IOException e) {\n\n e.printStackTrace();\n }\n return result;\n }", "private String streamToString(InputStream is) throws IOException {\n String str = \"\";\n \n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n \n try {\n BufferedReader reader = new BufferedReader(\n new InputStreamReader(is));\n \n while ((line = reader.readLine()) != null) {\n sb.append(line);\n }\n \n reader.close();\n } finally {\n is.close();\n }\n \n str = sb.toString();\n }\n \n return str;\n }", "public static char[] readInputStreamContents(InputStream is, String encoding) throws CoreException {\r\n\t\tCheck.checkArg(is);\r\n\r\n\t\tReader reader;\r\n\t\ttry {\r\n\t \tif (encoding != null)\r\n\t \t\treader = new InputStreamReader(is, encoding);\r\n\t \telse\r\n\t \t\treader = new InputStreamReader(is);\r\n\t\r\n\t return readReaderContents(reader);\r\n\t\t} catch (UnsupportedEncodingException e) {\r\n throw new CoreException(createErrorStatus(e));\r\n }\r\n\t}", "public synchronized String getBodyString(String charsetName)\r\n\t{\r\n\t\tif (this.bodyString == null)\r\n\t\t{\r\n\t\t\ttry {\r\n\t\t\t\tthis.bodyString = new String(this.bodyBytes, charsetName);\r\n\t\t\t} catch (UnsupportedEncodingException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn this.bodyString;\r\n\t}", "public String readStream(InputStream in) {\n BufferedReader reader = null;\n StringBuffer data = new StringBuffer(\"\");\n try {\n reader = new BufferedReader(new InputStreamReader(in));\n String line = \"\";\n while ((line = reader.readLine()) != null) {\n data.append(line);\n }\n } catch (IOException e) {\n Log.e(\"Log\", \"IOException\");\n } finally {\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return data.toString();\n }", "private String read(InputStream in) throws IOException {\n StringBuilder sb = new StringBuilder();\n BufferedReader r = new BufferedReader(new InputStreamReader(in), 1000);\n for (String line = r.readLine(); line != null; line = r.readLine()) {\n sb.append(line);\n }\n in.close();\n return sb.toString();\n }", "public String getContent() throws IOException {\n ContentType type = getContentType();\n \n if(type == null) {\n return body.getContent(\"UTF-8\");\n } \n return getContent(type);\n }", "private static String read(InputStream in) throws IOException {\n StringBuilder builder = new StringBuilder();\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\n String line = null;\n while ((line = reader.readLine()) != null)\n builder.append(line);\n\n return builder.toString();\n }", "public static String convertStreamToString(InputStream is) throws IOException {\n\tif (is != null) {\n\t\tWriter writer = new StringWriter();\n\n\t\tchar[] buffer = new char[1024];\n\t\ttry {\n\t\t\tReader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n\t\t\tint n;\n\t\t\twhile ((n = reader.read(buffer)) != -1) {\n\t\t\t\twriter.write(buffer, 0, n);\n\t\t\t}\n\t\t} finally {\n\t\t\tis.close();\n\t\t}\n\t\treturn writer.toString();\n\t} else {\n\t\treturn \"\";\n\t}\n}", "public static String convertInputStreamToString(InputStream is)\n throws IOException {\n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n try {\n BufferedReader reader = new BufferedReader(\n new InputStreamReader(is, UtilsConstants.UTF_8));\n while ((line = reader.readLine()) != null) {\n sb.append(line).append(UtilsConstants.LINE_SEPARATOR);\n }\n } finally {\n is.close();\n }\n return sb.toString();\n } else {\n return \"\";\n }\n }", "private String convertStreamToString(InputStream is) throws IOException {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder builder = new StringBuilder();\n String line;\n while ((line = reader.readLine()) != null) {\n builder.append(line);\n }\n return builder.toString();\n }", "public static String decodeToString(InputStream in) throws IOException {\n\t\treturn new String(decodeToBytes(in));\n\t}", "@Override\n\tpublic String readBlob() throws PersistBlobException {\n\t\tlog.debug(\"readString: \");\n\t\ttry {\n\t\t\tString contents = FileUtils.readFileToString(new File(full_file_name), \"UTF-8\");\n\t\t\tlog.debug(\"returned string: \"+contents);\n\t\t\treturn contents;\n\t\t} catch (IOException e) {\n\t\t\tthrow new PersistBlobException(\"can not read string\",e);\n\t\t}\n\n\t}", "public String readString(){\n\t\tif(sc.hasNext()){\n\t\t\treturn sc.next();\n\t\t}\n\t\tsc.nextLine();\n\t\treturn null;\n\t}", "private static String getString(Reader reader) {\n StringBuffer buf = new StringBuffer();\n char[] buffer = new char[1024];\n int count;\n try {\n while ((count = reader.read(buffer)) != -1) {\n buf.append(buffer, 0, count);\n }\n } catch (IOException e) {\n return null;\n }\n return buf.toString();\n }", "String getString() throws IOException {\n\n\t\t\tString encoding;\n\n\t\t\tswitch (this.type) {\n\n\t\t\t// Not all are ISO-8859-1 but it's the closest thing\n\t\t\tcase DerParser.NUMERIC_STRING:\n\t\t\tcase DerParser.PRINTABLE_STRING:\n\t\t\tcase DerParser.VIDEOTEX_STRING:\n\t\t\tcase DerParser.IA5_STRING:\n\t\t\tcase DerParser.GRAPHIC_STRING:\n\t\t\tcase DerParser.ISO646_STRING:\n\t\t\tcase DerParser.GENERAL_STRING:\n\t\t\t\tencoding = \"ISO-8859-1\";\n\t\t\t\tbreak;\n\n\t\t\tcase DerParser.BMP_STRING:\n\t\t\t\tencoding = \"UTF-16BE\";\n\t\t\t\tbreak;\n\n\t\t\tcase DerParser.UTF8_STRING:\n\t\t\t\tencoding = \"UTF-8\";\n\t\t\t\tbreak;\n\n\t\t\tcase DerParser.UNIVERSAL_STRING:\n\t\t\t\tthrow new IOException(\"Invalid DER: can't handle UCS-4 string\");\n\n\t\t\tcase DerParser.OID:\n\t\t\t\treturn getObjectIdentifier(this.value);\n\t\t\tdefault:\n\t\t\t\tthrow new IOException(String.format(\"Invalid DER: object (%d) is not a string\", this.type));\n\t\t\t}\n\n\t\t\treturn new String(this.value, encoding);\n\t\t}", "public static String inputStreamToString(InputStream is) {\n\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(is));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n\n } catch (IOException e) {\n\n return null;\n\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n\n return sb.toString();\n\n }", "public String responsetoString(InputStream in) throws IOException{\n\t\tBufferedReader br = new BufferedReader( new InputStreamReader(in));\n\t\tStringBuilder sb = new StringBuilder();\n\t\tString line = null;\n\t\twhile((line = br.readLine())!= null){\n\t\t\tsb.append(line);\t\t\t\n\t\t}\n\t\tin.close();\n\t\treturn sb.toString();\n\t}", "private String readAll(Reader rd) throws IOException {\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\tint cp;\r\n\t\twhile ((cp = rd.read()) != -1) {\r\n\t\t\tsb.append((char) cp);\r\n\t\t}\r\n\t\treturn sb.toString();\r\n\t}", "private String convertStreamToString(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n while ((line = reader.readLine()) != null) {\n sb.append(line).append('\\n');\n }\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n try {\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return sb.toString();\n }", "private static String readIt(InputStream stream) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(stream));\n StringBuilder sb = new StringBuilder();\n String line;\n while ((line = br.readLine()) != null) {\n sb.append(line+\"\\n\");\n }\n br.close();\n return sb.toString();\n\t}", "private String readString( InputStream stream ) throws IOException {\n char delimiter = (char) stream.read();\n buffer = new StringBuffer();\n while ( true ) {\n int c = stream.read();\n if ( c == delimiter ) {\n break;\n }\n else {\n switch ( (char) c ) {\n case '\\r':\n case '\\n':\n throw new TableFormatException(\n \"End of line within a string literal\" );\n case '\\\\':\n buffer.append( (char) stream.read() );\n break;\n case END:\n throw new TableFormatException(\n \"End of file within a string literal\" );\n default:\n buffer.append( (char) c );\n }\n }\n }\n return buffer.toString();\n }", "public static String readFile(InputStream in) throws IOException {\n final StringBuffer sBuffer = new StringBuffer();\n final BufferedReader br = new BufferedReader(new InputStreamReader(in));\n final char[] buffer = new char[1024];\n\n int cnt;\n while ((cnt = br.read(buffer, 0, buffer.length)) > -1) {\n sBuffer.append(buffer, 0, cnt);\n }\n br.close();\n in.close();\n return sBuffer.toString();\n }", "public static String getContent(InputStreamReader inputReader)\n throws Exception {\n StringBuilder buffer = new StringBuilder();\n BufferedReader reader = new BufferedReader(inputReader);\n try {\n int read = reader.read();\n while (read != -1) {\n buffer.append((char) read);\n read = reader.read();\n }\n } finally {\n reader.close();\n }\n return buffer.toString();\n }", "public String read() throws IOException {\n return reader.readLine();\n }", "private synchronized String readString(int len) throws IOException {\n\t\tread(bytes, len);\n\t\treturn readString(bytes, 0, len);\n\t}", "public String convertStreamToString(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n StringBuilder sb = new StringBuilder();\n\n String line = null;\n try {\n while ((line = reader.readLine()) != null) {\n sb.append(line + \"\\n\");\n }\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n try {\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return sb.toString();\n }", "private static String convertStreamToString(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is), 8192);\n StringBuilder sb = new StringBuilder();\n\n String line = null;\n try {\n while ((line = reader.readLine()) != null) {\n sb.append(line + \"\\n\");\n }\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n try {\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return sb.toString();\n }", "public static String getString(ByteBuffer buffer,String charsetName) throws UnsupportedEncodingException {\n\t\tString retString = new String(buffer.array());\n\t\tretString = retString.trim();\n\t\treturn retString;\n\t}", "String getContent() throws IOException;" ]
[ "0.7268685", "0.6915386", "0.68700117", "0.6850134", "0.6723728", "0.66768605", "0.6676599", "0.6672888", "0.6605543", "0.6510115", "0.6463359", "0.64496857", "0.63550323", "0.63310724", "0.631648", "0.6261696", "0.62365407", "0.62315214", "0.6212349", "0.6196451", "0.6195188", "0.618481", "0.6177276", "0.61568326", "0.6155444", "0.6153155", "0.6143151", "0.6131556", "0.6124795", "0.61229366", "0.6122209", "0.6113411", "0.6112037", "0.60883945", "0.6081535", "0.6075084", "0.606855", "0.6042342", "0.60373443", "0.6029518", "0.59970826", "0.5987135", "0.59783465", "0.5977654", "0.5975129", "0.59713644", "0.59544444", "0.5949662", "0.5946522", "0.5943222", "0.5939212", "0.59172547", "0.59144896", "0.5905929", "0.5892896", "0.5884843", "0.58660316", "0.5828008", "0.58229965", "0.58088845", "0.580298", "0.57900184", "0.5781528", "0.5761298", "0.57558995", "0.57382566", "0.5736104", "0.57269144", "0.57246375", "0.57026714", "0.56931484", "0.5693039", "0.5682561", "0.5682222", "0.5678737", "0.56688213", "0.5659109", "0.5651761", "0.56495386", "0.5647914", "0.56381565", "0.56342196", "0.56191295", "0.56000364", "0.55935925", "0.5582568", "0.55765915", "0.55719805", "0.55670315", "0.55602014", "0.55501485", "0.5545112", "0.553969", "0.55369747", "0.5531998", "0.5528495", "0.5526456", "0.5521443", "0.5498118", "0.5496456" ]
0.7226666
1
Read the content of the Reader and return it as a String. The reader is closed before this method returns.
public static String getText(Reader reader) throws IOException { BufferedReader bufferedReader = new BufferedReader(reader); return getText(bufferedReader); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static String getString(Reader reader) {\n StringBuffer buf = new StringBuffer();\n char[] buffer = new char[1024];\n int count;\n try {\n while ((count = reader.read(buffer)) != -1) {\n buf.append(buffer, 0, count);\n }\n } catch (IOException e) {\n return null;\n }\n return buf.toString();\n }", "public String read() throws IOException {\n return reader.readLine();\n }", "public static String read(Reader in) throws IOException {\n\t\tStringBuilder result = new StringBuilder();\n\t try {\n\t \tchar[] buf = new char[1024]; int r = 0;\n\t while ((r = in.read(buf)) != -1) {result.append(new String(buf, 0, r));}\n\t } finally { in.close();}\n\t\tString text=result.toString();\n\t\treturn text;\n\t}", "public static String readFully(Reader reader) throws IOException {\n\t\ttry {\n\t\t\tStringWriter writer = new StringWriter();\n\t\t\tchar[] buffer = new char[1024];\n\t\t\tint count;\n\t\t\twhile ((count = reader.read(buffer)) != -1) {\n\t\t\t\twriter.write(buffer, 0, count);\n\t\t\t}\n\t\t\treturn writer.toString();\n\t\t} finally {\n\t\t\treader.close();\n\t\t}\n\t}", "private String read() {\n\n String s = \"\";\n\n try {\n // Check if there are bytes available\n if (inStream.available() > 0) {\n\n // Read bytes into a buffer\n byte[] inBuffer = new byte[1024];\n int bytesRead = inStream.read(inBuffer);\n\n // Convert read bytes into a string\n s = new String(inBuffer, \"ASCII\");\n s = s.substring(0, bytesRead);\n }\n\n } catch (Exception e) {\n Log.e(TAG, \"Read failed!\", e);\n }\n\n return s;\n }", "public String readString() throws IOException {\n return WritableUtils.readString(in);\n }", "public String read() throws Exception {\r\n\t\tBufferedReader reader = null;\r\n\t\tStringBuffer sb = new StringBuffer();\r\n\t\ttry {\r\n\t\t\tif (input==null) input = new FileInputStream(file);\r\n\t\t\treader = new BufferedReader(new InputStreamReader(input,charset));\r\n\t\t\tchar[] c= null;\r\n\t\t\twhile (reader.read(c=new char[8192])!=-1) {\r\n\t\t\t\tsb.append(c);\r\n\t\t\t}\r\n\t\t\tc=null;\r\n\t\t} catch (Exception e) {\r\n\t\t\tthrow e;\r\n\t\t} finally {\r\n\t\t\treader.close();\r\n\t\t}\r\n\t\treturn sb.toString().trim();\r\n\t}", "public String readString() throws IOException {\n checkOpened();\n return dis.readUTF();\n }", "public static String getContent(InputStreamReader inputReader)\n throws Exception {\n StringBuilder buffer = new StringBuilder();\n BufferedReader reader = new BufferedReader(inputReader);\n try {\n int read = reader.read();\n while (read != -1) {\n buffer.append((char) read);\n read = reader.read();\n }\n } finally {\n reader.close();\n }\n return buffer.toString();\n }", "static String readString() throws IOException{\n return bufferedReader.readLine();\n }", "private static String getString(BufferedReader reader) throws IOException{\n String result=null;\n while(result==null) {\n result = reader.readLine();\n }\n return result.trim();\n }", "private String readAll(Reader rd) throws IOException {\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\tint cp;\r\n\t\twhile ((cp = rd.read()) != -1) {\r\n\t\t\tsb.append((char) cp);\r\n\t\t}\r\n\t\treturn sb.toString();\r\n\t}", "public String read() {\n\t\tStringBuffer text = new StringBuffer((int)file.length());\n\t\ttry {\n\t\t\tFileReader fr = new FileReader(file);\n\t\t\tBufferedReader b = new BufferedReader(fr);\n\t\t\tboolean eof = false;\n\t\t\tString line;\n\t\t\tString ret = \"\\n\";\n\t\t\twhile (!eof) {\n\t\t\t\tline = b.readLine();\n\t\t\t\tif (line == null) {\n\t\t\t\t\teof = true;\n\t\t\t\t} else {\n\t\t\t\t\ttext.append(line);\n\t\t\t\t\ttext.append(ret);\n\t\t\t\t}\n\t\t\t}\n\t\t\tb.close();\n\t\t} catch (IOException e) {\n\t\t\tthrow new IllegalArgumentException(\"File \" + file.getName() +\n\t\t\t\t\" is unreadable : \" + e.toString());\n\t\t}\n\t\treturn text.toString();\n\t}", "public String getStringContent() throws IOException;", "public static String getText(BufferedReader reader) throws IOException {\n StringBuilder answer = new StringBuilder();\n // reading the content of the file within a char buffer\n // allow to keep the correct line endings\n char[] charBuffer = new char[8192];\n int nbCharRead /* = 0*/;\n try {\n while ((nbCharRead = reader.read(charBuffer)) != -1) {\n // appends buffer\n answer.append(charBuffer, 0, nbCharRead);\n }\n Reader temp = reader;\n reader = null;\n temp.close();\n } finally {\n closeWithWarning(reader);\n }\n return answer.toString();\n }", "public String readString() {\n byte[] byteForStream = new byte[1024];\n String message = \"\";\n\n mListener.onCarRunning();\n\n\n int bytes;\n\n while (true) {\n try {\n bytes = mInputStream.read(byteForStream);\n message = new String(byteForStream, 0, bytes);\n Log.d(TAG, \" Read from inputstream \" + message);\n\n } catch (IOException e) {\n Log.e(TAG, \" error reading from inputstream \" + e.getMessage());\n break;\n }\n }\n return message;\n }", "public String readString() {\n return readNextLine();\n }", "private static String readAll(Reader rd) throws IOException {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint cp;\n\t\twhile ((cp = rd.read()) != -1) {\n\t\t\tsb.append((char) cp);\n\t\t}\n\t\treturn sb.toString();\n\t}", "private static String readAll(Reader rd) throws IOException {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint cp;\n\t\twhile ((cp = rd.read()) != -1) {\n\t\t\tsb.append((char) cp);\n\t\t}\n\t\treturn sb.toString();\n\t}", "public static String toString(final Reader input) throws IOException {\n final StringWriter sw = new StringWriter();\n copy(input, sw);\n return sw.toString();\n }", "private static String readAll(Reader rd) throws IOException {\n\t\t StringBuilder sb = new StringBuilder();\n\t\t int cp;\n\t\t while ((cp = rd.read()) != -1) {\n\t\t sb.append((char) cp);\n\t\t }\n\t\t return sb.toString();\n\t\t }", "public String readString() {\n final int BUF_SIZE = 100;\n byte[] byteDest = new byte[BUF_SIZE];\n String ret = \"\";\n int num = BUF_SIZE;\n try {\n while (!ret.contains(\"\\r\")) {\n if ((num = in.read(byteDest)) > 0) {\n ret += new String(byteDest, 0, num);\n }\n }\n } catch (IOException e) {\n print(\"Error reading String from \" + portName);\n }\n print(\"Read :\" + ret + \":\");\n return ret;\n }", "private String readResult() throws IOException {\n return reader.readLine();\n }", "public static String readString() {\n return in.nextLine();\n }", "public String readString(){\n\t\tif(sc.hasNext()){\n\t\t\treturn sc.next();\n\t\t}\n\t\tsc.nextLine();\n\t\treturn null;\n\t}", "public static String readerToText(Reader reader) {\n\t\tStringBuilder sbf = new StringBuilder();\n\t\ttry (BufferedReader br = new BufferedReader(reader)) {\n\t\t\tString str = null;\n\t\t\twhile ((str = br.readLine()) != null) {\n\t\t\t\tsbf.append(str).append('\\n');\n\t\t\t}\n\t\t\treturn sbf.toString();\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(\"Error while reading from reader. {}\", e.getMessage());\n\t\t\treturn \"\";\n\t\t}\n\t}", "@Override\n\tpublic String readBlob() throws PersistBlobException {\n\t\tlog.debug(\"readString: \");\n\t\ttry {\n\t\t\tString contents = FileUtils.readFileToString(new File(full_file_name), \"UTF-8\");\n\t\t\tlog.debug(\"returned string: \"+contents);\n\t\t\treturn contents;\n\t\t} catch (IOException e) {\n\t\t\tthrow new PersistBlobException(\"can not read string\",e);\n\t\t}\n\n\t}", "private String readStream(InputStream in) throws IOException {\n BufferedReader r = new BufferedReader(new InputStreamReader(in));\n\n StringBuilder sb = new StringBuilder();\n String line;\n\n // Reads every line and stores them in sb.\n while((line = r.readLine()) != null) {\n sb.append(line);\n }\n\n // Closes the input stream.\n in.close();\n\n return sb.toString();\n }", "public synchronized String read() {\n\t\tString message = \"\";\n\n\t\tif(content.size() > 0 )\n\t\t\tmessage = content.get(0);\n\t\tnotify();\n\n\t\treturn message;\n }", "public static String read(InputStream in) throws IOException {\n\t\tStringBuilder result = new StringBuilder();\n\t try {\n\t byte[] buf = new byte[1024]; int r = 0;\n\t while ((r = in.read(buf)) != -1) {result.append(new String(buf, 0, r));}\n\t } finally { in.close();}\n\t\tString text=result.toString();\n\t\treturn text;\n\t}", "public static String readFile() {\n\t\tFileReader file;\n\t\tString textFile = \"\";\n\n\t\ttry {\n\t\t\tfile = new FileReader(path);\n\n\t\t\t// Output string.\n\t\t\ttextFile = new String();\n\n\t\t\tBufferedReader bfr = new BufferedReader(file);\n\n\t\t\ttextFile= bfr.readLine();\n\t\t\t\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(\"Error reading the file\");\n\t\t}\n\t\treturn textFile;\n\n\t}", "@Override\n public String readLine() {\n try {\n return this.bufferedReader.readLine();\n } catch (IOException e) {\n return \"\";\n }\n }", "public String read();", "private String readStream(InputStream in) {\n try {\n ByteArrayOutputStream bo = new ByteArrayOutputStream();\n int i = in.read();\n while(i != -1) {\n bo.write(i);\n i = in.read();\n }\n return bo.toString();\n } catch (IOException e) {\n return \"\";\n }\n }", "public String getContent() {\n String s = null;\n try {\n s = new String(Files.readAllBytes(Paths.get(filename)), StandardCharsets.UTF_8);\n }\n catch (IOException e) {\n message = \"Problem reading a file: \" + filename;\n }\n return s;\n }", "public static String readString(InputStream is) throws IOException {\n return readString(is, DEFAULT_ENCODING);\n }", "public String readLine() throws IOException {\n\t\t// Punt on this and use BufferedReader routines.\n\t\tBufferedReader d = new BufferedReader(new InputStreamReader(this));\n\t\treturn d.readLine();\n\t}", "private static String read(InputStream in) throws IOException {\n StringBuilder builder = new StringBuilder();\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\n String line = null;\n while ((line = reader.readLine()) != null)\n builder.append(line);\n\n return builder.toString();\n }", "public String getStringFromInputStream(InputStream is) {\n\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(is));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n } catch (Exception e) {\n } finally {\n try {\n br.close();\n } catch (Exception e) {\n }\n br = null;\n return sb.toString();\n }\n }", "public String readUTF() throws IOException {\n\n\t\t// Punt on this one and use DataInputStream routines.\n\t\tDataInputStream d = new DataInputStream(this);\n\t\treturn d.readUTF();\n\n\t}", "private String read(InputStream in) throws IOException {\n StringBuilder sb = new StringBuilder();\n BufferedReader r = new BufferedReader(new InputStreamReader(in), 1000);\n for (String line = r.readLine(); line != null; line = r.readLine()) {\n sb.append(line);\n }\n in.close();\n return sb.toString();\n }", "private static String readFromStream(InputStream inputStream) {\n StringBuilder outputString = new StringBuilder();\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName(\"UTF-8\"));\n BufferedReader reader = new BufferedReader(inputStreamReader);\n try {\n String line = reader.readLine();\n while (line != null) {\n outputString.append(line);\n line = reader.readLine();\n }\n } catch (IOException e) {\n Log.e(LOG_TAG, \"Error reading line from reader, readFromStream() block\", e);\n }\n }\n return outputString.toString();\n }", "java.lang.String getContents();", "java.lang.String getContents();", "private static String getStringFromInputStream(InputStream is) {\r\n\r\n BufferedReader br = null;\r\n StringBuilder sb = new StringBuilder();\r\n\r\n String line;\r\n try {\r\n\r\n br = new BufferedReader(new InputStreamReader(is));\r\n while ((line = br.readLine()) != null) {\r\n sb.append(line);\r\n }\r\n\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n finally {\r\n if (br != null) {\r\n try {\r\n br.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n }\r\n\r\n return sb.toString();\r\n\r\n }", "public String getText() {\n getLock().getReadLock();\n try {\n return getTextBuffer().toString();\n } finally {\n getLock().relinquishReadLock();\n }\n }", "private static String readAllBytes(Reader rd) throws IOException {\n\t\tStringBuilder stringBuilder = new StringBuilder();\n\t\tint cp;\n\t\twhile ((cp = rd.read()) != -1) {\n\t\t\tstringBuilder.append((char) cp);\n\t\t}\n\t\treturn stringBuilder.toString();\n\t}", "private synchronized String readString(int len) throws IOException {\n\t\tread(bytes, len);\n\t\treturn readString(bytes, 0, len);\n\t}", "@NonNull\n public static String getStringFrom(InputStream inputStream) {\n StringBuffer dataStringBuffer = new StringBuffer(\"\");\n try {\n InputStreamReader isr = new InputStreamReader(inputStream);\n BufferedReader bufferedReader = new BufferedReader(isr);\n String readString = bufferedReader.readLine();\n while (readString != null) {\n dataStringBuffer.append(readString);\n readString = bufferedReader.readLine();\n }\n isr.close();\n } catch (IOException ioe) {\n ioe.printStackTrace();\n }\n return dataStringBuffer.toString();\n }", "private String readStream(InputStream is) {\n try {\n ByteArrayOutputStream bo = new ByteArrayOutputStream();\n int i = is.read();\n while(i != -1) {\n bo.write(i);\n i = is.read();\n }\n return bo.toString();\n } catch (IOException e) {\n return \"\";\n }\n }", "private String getXMLText(final XMLStreamReader reader)\n throws XMLStreamException {\n String text = null;\n if (reader.hasNext()) {\n reader.next();\n text = reader.getText();\n }\n return text;\n }", "public String readString(){\r\n byte[] pLen = new byte[1];\r\n byte[] pTAG = new byte[1];\r\n byte[] pSN = new byte[10];\r\n byte[] pNumTagFound = new byte[1];\r\n short tag = cardReader.select(handle,pTAG, pLen, pSN);\r\n if (tag < 0 ){\r\n message = \"No card found\";\r\n System.err.println(message);\r\n }\r\n if (!login()) return \"No card found\";\r\n String s;\r\n byte[] bdata = new byte[16];\r\n cardReader.read(handle,blocknr,bdata);\r\n s = new String(bdata);\r\n System.err.println(\"Read block: \" + s); \r\n return s;\r\n }", "protected String readAscii(BinaryDataReader dataReader) throws IOException\n\t{\n\t\tbyte[] data = new byte[this.count];\n\n\t\t// read string buffer\n\t\tif (this.count <= 4)\n\t\t{\n\t\t\t// unpack integer\n\t\t\tint value = this.value;\n\t\t\tfor (int i = 0; i < this.count; i++)\n\t\t\t{\n\t\t\t\tdata[i] = (byte) (value & 0x00FF);\n\t\t\t\tvalue = value >> 8;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// convert state to long offset for reading large buffer\n\t\t\tlong offset = ((long) this.value) & 0xffffffffL;\n\n\t\t\tlong pos0 = dataReader.getFilePointer();\n\t\t\tdataReader.seek(offset);\n\t\t\tdataReader.readByteArray(data);\n\t\t\tdataReader.seek(pos0);\n\t\t}\n\n\t\treturn new String(data);\n\t}", "String readString();", "public static String read(InputStream input) throws Exception {\r\n\t\treader.setInput(input);\r\n\t\treader.setCharset(\"UTF-8\");\r\n\t\treturn reader.read();\r\n\t}", "public String read()\n\t{\n\t\ttry\n\t\t{\n\t\t\tint startAt = 0;\n\t\t\tString tempRead = inFromClient.readLine();\n\t\t\t\n\t\t\t// Clear out any nonalphabetic characters from the input buffer if\n\t\t\t// the user has just connected.\n\t\t\tif (!hasReadOnce)\n\t\t\t{\n\t\t\t\tfor (int ctr = 0; ctr < tempRead.length(); ctr++)\n\t\t\t\t{\n\t\t\t\t\tif ((tempRead.charAt(ctr) >= 'a' && tempRead.charAt(ctr) <= 'z')\n\t\t\t\t\t\t|| (tempRead.charAt(ctr) >= 'A' && tempRead.charAt(ctr) <= 'Z'))\n\t\t\t\t\t{\n\t\t\t\t\t\tstartAt = ctr;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thasReadOnce = true;\n\t\t\t}\n\n\t\t\thasPrinted = true;\n\t\t\ttempRead = tempRead.substring(startAt, tempRead.length());\n\t\t\t\n\t\t\t// Never return nonprintable characters. To support windows telnet, go back one\n\t\t\t// character for each backspace (chr #8) encountered.\n\t\t\tString newRead = \"\";\n\t\t\tfor (int ctr = 0; ctr < tempRead.length(); ctr++)\n\t\t\t{\n\t\t\t\tif (tempRead.charAt(ctr) > 31)\n\t\t\t\t\tnewRead = newRead+tempRead.charAt(ctr);\n\t\t\t\tif (tempRead.charAt(ctr) == 8 && newRead.length() > 0)\n\t\t\t\t\tnewRead = newRead.substring(0, newRead.length()-1);\n\t\t\t}\n\n\t\t\treturn newRead;\n\n\t\t} catch (NullPointerException e) {\n\t\t\tthis.closeSocket();\n\t\t\tif (ch.shortName.length() > 0)\n\t\t\t\tsysLog(\"connections\", \"Socket closed unexpectedly: \"+ch.shortName);\n\t\t\telse\n\t\t\t\tsysLog(\"connections\", \"Socket closed unexpectedly: No character.\");\n\t\t\treturn \"\";\n\t\t} catch (SocketException e) {\n\t\t\treturn \"\";\n\t\t} catch (Exception e) {\n\t\t\tif (ch.shortName.length() > 0)\n\t\t\t\tsysLog(\"connections\", \"Socket closed unexpectedly: \"+ch.shortName);\n\t\t\telse\n\t\t\t\tsysLog(\"connections\", \"Socket closed unexpectedly: No character.\");\n\t\t\treturn \"\";\n\t\t}\n\t}", "public static String readString(){\n\t\tstringInput = readInput();\n\t\treturn stringInput; \n\t}", "private String streamToString(InputStream is) throws IOException {\n String str = \"\";\n \n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n \n try {\n BufferedReader reader = new BufferedReader(\n new InputStreamReader(is));\n \n while ((line = reader.readLine()) != null) {\n sb.append(line);\n }\n \n reader.close();\n } finally {\n is.close();\n }\n \n str = sb.toString();\n }\n \n return str;\n }", "public String readMessage() throws IOException {\n\t\treturn reader.readLine();\n\t}", "@Override\n public String getContent() throws FileNotFound, CannotReadFile\n {\n Reader input = null;\n try\n {\n input = new InputStreamReader(resource.openStream());\n String content = IOUtils.toString(input).replace(\"\\r\\n\", \"\\n\");\n\n return content;\n } catch (FileNotFoundException ex)\n {\n throw new FileNotFound();\n } catch (IOException ex)\n {\n throw new CannotReadFile();\n } finally\n {\n InternalUtils.close(input);\n }\n }", "String getString() throws IOException {\n\n\t\t\tString encoding;\n\n\t\t\tswitch (this.type) {\n\n\t\t\t// Not all are ISO-8859-1 but it's the closest thing\n\t\t\tcase DerParser.NUMERIC_STRING:\n\t\t\tcase DerParser.PRINTABLE_STRING:\n\t\t\tcase DerParser.VIDEOTEX_STRING:\n\t\t\tcase DerParser.IA5_STRING:\n\t\t\tcase DerParser.GRAPHIC_STRING:\n\t\t\tcase DerParser.ISO646_STRING:\n\t\t\tcase DerParser.GENERAL_STRING:\n\t\t\t\tencoding = \"ISO-8859-1\";\n\t\t\t\tbreak;\n\n\t\t\tcase DerParser.BMP_STRING:\n\t\t\t\tencoding = \"UTF-16BE\";\n\t\t\t\tbreak;\n\n\t\t\tcase DerParser.UTF8_STRING:\n\t\t\t\tencoding = \"UTF-8\";\n\t\t\t\tbreak;\n\n\t\t\tcase DerParser.UNIVERSAL_STRING:\n\t\t\t\tthrow new IOException(\"Invalid DER: can't handle UCS-4 string\");\n\n\t\t\tcase DerParser.OID:\n\t\t\t\treturn getObjectIdentifier(this.value);\n\t\t\tdefault:\n\t\t\t\tthrow new IOException(String.format(\"Invalid DER: object (%d) is not a string\", this.type));\n\t\t\t}\n\n\t\t\treturn new String(this.value, encoding);\n\t\t}", "public String readStream(InputStream in) {\n BufferedReader reader = null;\n StringBuffer data = new StringBuffer(\"\");\n try {\n reader = new BufferedReader(new InputStreamReader(in));\n String line = \"\";\n while ((line = reader.readLine()) != null) {\n data.append(line);\n }\n } catch (IOException e) {\n Log.e(\"Log\", \"IOException\");\n } finally {\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return data.toString();\n }", "public static String GetStringFromInputStream(InputStream is) {\n\t\tString line;\n\t\tStringBuilder total = new StringBuilder();\n\n\t\t// Wrap a BufferedReader around the InputStream\n\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(is));\n\n\t\t// Read response until the end\n\t\ttry {\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t\ttotal.append(line);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tis.close();\n\t\t\t} catch (Exception e) {\n\t\t\t\tUtilities\n\t\t\t\t\t\t.LogWarning(\"GetStringFromInputStream - could not close stream\");\n\t\t\t}\n\t\t}\n\n\t\t// Return full string\n\t\treturn total.toString();\n\t}", "public static String readString(InputStream is, String encoding) throws IOException {\n StringWriter sw = new StringWriter();\n try {\n copy(is, sw, encoding);\n return sw.toString();\n } finally {\n close(is);\n close(sw);\n }\n }", "private static String readIt(InputStream stream) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(stream));\n StringBuilder sb = new StringBuilder();\n String line;\n while ((line = br.readLine()) != null) {\n sb.append(line+\"\\n\");\n }\n br.close();\n return sb.toString();\n\t}", "private static String readFromStream(InputStream inputStream) throws IOException {\n\n // Create a new empty string builder\n StringBuilder stringBuilder = new StringBuilder();\n\n // Create a bufferedReader that reads from the inputStream param\n BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream,\n Charset.forName(\"UTF-8\")));\n\n // Create a string that is one line of the buffered reader\n String line = bufferedReader.readLine();\n\n while (line != null) {\n // Add line to stringBuilder\n stringBuilder.append(line);\n\n // Set line to the next line in buffered reader\n line = bufferedReader.readLine();\n }\n\n // Return string builder as a string\n return stringBuilder.toString();\n }", "protected String readFullyAsString(InputStream inputStream)\n\t\t\tthrows IOException {\n\t\tByteArrayOutputStream baos = new ByteArrayOutputStream();\n\t\tbyte[] buffer = new byte[1024];\n\t\tint length;\n\t\twhile ((length = inputStream.read(buffer)) != -1) {\n\t\t\tbaos.write(buffer, 0, length);\n\t\t}\n\t\treturn baos.toString(StandardCharsets.UTF_8.name());\n\t}", "public String readLine() throws IOException\r\n\t{\r\n\t\treturn file.readLine();\r\n\t}", "private String readToString(URLConnection connection) throws IOException {\n\tBufferedReader reader = null;\n\ttry {\n\t\tInputStream inStream = connection.getInputStream();\n\t\tif (connection instanceof java.net.HttpURLConnection) {\n\t\t\tHttpURLConnection httpConnection = (HttpURLConnection) connection;\n\t\t\tif (httpConnection.getResponseCode() == 403) {\n\t\t\t\tthrow new IOException(\"Service does not accept the authentication credentials: \"\n\t\t\t\t\t+ httpConnection.getResponseCode() + httpConnection.getResponseMessage());\n\t\t\t} else if (httpConnection.getResponseCode() >= 400) {\n\t\t\t\tthrow new IOException(\"Service responded with a failure code: \"\n\t\t\t\t\t+ httpConnection.getResponseCode() + httpConnection.getResponseMessage());\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new IOException(\"Unexpected URI type encountered\");\n\t\t}\n\t\treader = new BufferedReader(new InputStreamReader(inStream));\n\t\tString str;\n\t\tStringBuilder buffer = new StringBuilder();\n\t\twhile ((str = reader.readLine()) != null) {\n\t\t\tbuffer.append(str);\n\t\t}\n\t\treturn buffer.toString();\n\t } finally {\n\t \tif (reader != null) {\n\t \t\treader.close();\n\t \t}\n\t}\n }", "String read();", "String read();", "public static String getStringFromInputStream(InputStream is) {\n\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(is));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return sb.toString();\n }", "public static String readString(InputStream is) {\r\n \t\tif (is == null)\r\n \t\t\treturn null;\r\n \t\tBufferedReader reader= null;\r\n \t\ttry {\r\n \t\t\tStringBuffer buffer= new StringBuffer();\r\n \t\t\tchar[] part= new char[2048];\r\n \t\t\tint read= 0;\r\n \t\t\treader= new BufferedReader(new InputStreamReader(is));\r\n \r\n \t\t\twhile ((read= reader.read(part)) != -1)\r\n \t\t\t\tbuffer.append(part, 0, read);\r\n \t\t\t\r\n \t\t\treturn buffer.toString();\r\n \t\t\t\r\n \t\t} catch (IOException ex) {\r\n \t\t} finally {\r\n \t\t\tif (reader != null) {\r\n \t\t\t\ttry {\r\n \t\t\t\t\treader.close();\r\n \t\t\t\t} catch (IOException ex) {\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\treturn null;\r\n \t}", "public static String readString()\n \n {\n String wort=\"xxxx\";\n try {\n wort=eingabe.readLine();\n \n } catch(IOException e1) {\n System.out.println(\"Eingabefehler,\");\n \n }\n return wort;\n }", "public String readFromFile() throws IOException {\n return br.readLine();\n }", "public synchronized String read() {\n\n /* RULE: empty, eligible for WRITE only; !empty, eligible for READ only :\n for read process to proceed, need message tray to be full, so while empty,\n make this thread sleep (the READER thread) so the other thread will run\n and write/fill in the message tray */\n\n while(empty) { // loop til we got a msg to read (cant read without msg)\n // DEADLOCK FIX\n try {\n wait(); // an Object method, not Thread's\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n\n empty = true; // i read the msg, will be sending this to Reader afterwards so message tray is now empty\n notifyAll(); // executed only after we have updated 'empty'\n return message;\n }", "public String getString() {\n return this.scanner.nextLine();\n }", "private static String readFromStream(InputStream inputStream) throws IOException {\n StringBuilder output = new StringBuilder();\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName(\"UTF-8\"));\n BufferedReader reader = new BufferedReader(inputStreamReader);\n String line = reader.readLine();\n while (line != null) {\n output.append(line);\n line = reader.readLine();\n }\n }\n return output.toString();\n }", "String getContents();", "public String ReadFile() throws IOException {\n File file = context.getFilesDir();\n File textfile = new File(file + \"/\" + this.fileName);\n\n FileInputStream input = context.openFileInput(this.fileName);\n byte[] buffer = new byte[(int)textfile.length()];\n\n input.read(buffer);\n\n return new String(buffer);\n }", "public String read(String filePath) throws IOException {\r\n\t\t//read file into stream\r\n\t\t\treturn new String(Files.readAllBytes(Paths.get(filePath)));\r\n\t}", "public static String read(String path) {\r\n\t\t\r\n\t\t// open the file\r\n\t\tFile file = new File(path);\r\n\t\t\r\n\t\t\r\n\t\t// if the file does not exist return null\r\n\t\tif (!file.exists())\r\n\t\t\treturn null;\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tString content = \"\";\r\n\t\t\r\n\t\t// write to the file\r\n\t\ttry {\r\n\t\t\t// open stream\r\n\t\t\tFileReader fReader = new FileReader(file);\r\n\t\t\tBufferedReader bufferedReader = new BufferedReader(fReader);\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t// read all the content of the file\r\n\t\t\tString current = bufferedReader.readLine();\r\n\t\t\twhile (current != null) {\r\n\t\t\t\tcontent = content.concat(current + \"\\n\");\r\n\t\t\t\tcurrent = bufferedReader.readLine();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// close anything was opened\r\n\t\t\tbufferedReader.close();\r\n\t\t\tfReader.close();\r\n\r\n\t\t} catch (Exception e) {\r\n\r\n\t\t}\r\n\t\t\r\n\t\treturn content;\r\n\t}", "public String readString(){\n\t\ttry{\n\t\t\treturn scanner.next();\n\t\t}catch (NoSuchElementException e){\n\t\t\tthrow new NoSuchElementException(\"NoSuchEle\");\n\t\t}\n\t}", "private String readStream(InputStream is) throws IOException {\n StringBuilder sb = new StringBuilder();\n BufferedReader r = new BufferedReader(new InputStreamReader(is),1000);\n for (String line = r.readLine(); line != null; line =r.readLine()){\n sb.append(line);\n }\n is.close();\n return sb.toString();\n }", "private String readString(InputStream in) throws IOException {\r\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(in, \"iso-8859-1\"));\r\n\t\tString inputLine;\r\n\t\tStringBuffer response = new StringBuffer();\r\n\t\twhile ((inputLine = reader.readLine()) != null) {\r\n\t\t\tresponse.append(inputLine);\r\n\t\t}\r\n\t\tin.close();\r\n\t\treturn response.toString();\r\n\t}", "public String getString() {\n\t\treturn getString(\"\\n\");\n\t}", "private String getStringFromFile() throws FileNotFoundException {\n String contents;\n FileInputStream fis = new FileInputStream(f);\n StringBuilder stringBuilder = new StringBuilder();\n try {\n InputStreamReader inputStreamReader = new InputStreamReader(fis, \"UTF-8\");\n BufferedReader reader = new BufferedReader(inputStreamReader);\n String line = reader.readLine();\n while (line != null) {\n stringBuilder.append(line).append('\\n');\n line = reader.readLine();\n }\n } catch (IOException e) {\n // Error occurred when opening raw file for reading.\n } finally {\n contents = stringBuilder.toString();\n }\n return contents;\n }", "public static String readString(InputStream is, String encoding) {\n \t\tif (is == null)\n \t\t\treturn null;\n \t\tBufferedReader reader= null;\n \t\ttry {\n \t\t\tStringBuffer buffer= new StringBuffer();\n \t\t\tchar[] part= new char[2048];\n \t\t\tint read= 0;\n \t\t\treader= new BufferedReader(new InputStreamReader(is, encoding));\n \n \t\t\twhile ((read= reader.read(part)) != -1)\n \t\t\t\tbuffer.append(part, 0, read);\n \t\t\t\n \t\t\treturn buffer.toString();\n \t\t\t\n \t\t} catch (IOException ex) {\n \t\t\tCompareUIPlugin.log(ex);\n \t\t} finally {\n \t\t\tif (reader != null) {\n \t\t\t\ttry {\n \t\t\t\t\treader.close();\n \t\t\t\t} catch (IOException ex) {\n \t\t\t\t\t// silently ignored\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn null;\n \t}", "public static String getLine(InputStreamReader reader) {\n StringBuffer b = new StringBuffer();\n int c;\n try {\n while ((c = reader.read()) != -1 && c != '\\n') {\n if (c != '\\r')\n b.append((char)c);\n }\n } catch (IOException ioe) {\n c = -1;\n }\n\n if (c == -1 && b.length() == 0)\n return null;\n else\n return b.toString();\n }", "private static String readStream(InputStream is, String charsetName) throws UnsupportedEncodingException, IOException {\r\n StringBuffer sb = new StringBuffer();\r\n byte[] buffer = new byte[1024];\r\n int length = 0;\r\n while ((length = is.read(buffer)) != -1) {\r\n sb.append(new String(buffer, 0, length, charsetName));\r\n }\r\n return sb.toString();\r\n }", "private String readLine() {\n\t\ttry {\n\t\t\treturn reader.nextLine();\t\n\t\t} catch (NoSuchElementException e) {\n\t\t\treturn null;\n\t\t}\n\t}", "private String readNextLine() {\n StringBuilder sb = new StringBuilder();\n\n try {\n BufferedReader br = new BufferedReader(new InputStreamReader(stream));\n sb.append(br.readLine());\n } catch (IOException e) {\n e.fillInStackTrace();\n }\n\n return sb.toString();\n }", "public static String getText(InputStream is) throws IOException {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\n return getText(reader);\n }", "public String getString() {\n\t\treturn renderResult(this._result).trim();\n\t}", "public String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException {\n Reader reader = null;\n reader = new InputStreamReader(stream, \"UTF-8\");\n char[] buffer = new char[len];\n reader.read(buffer);\n return new String(buffer);\n }", "public static String readIt(InputStream is) throws IOException {\n BufferedReader reader = null;\n reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n StringBuilder responseStrBuilder = new StringBuilder();\n String inputStr;\n while ((inputStr = reader.readLine()) != null) {\n responseStrBuilder.append(inputStr);\n }\n return responseStrBuilder.toString();\n }", "private String _read(InputStream in, String enc) throws IOException\n {\n int ptr = 0;\n int count;\n \n while ((count = in.read(_readBuffer, ptr, _readBuffer.length - ptr)) > 0) {\n ptr += count;\n // buffer full? Need to realloc\n if (ptr == _readBuffer.length) {\n _readBuffer = Arrays.copyOf(_readBuffer, ptr + ptr);\n }\n }\n \n return new String(_readBuffer, 0, ptr, enc);\n }", "private String inputStreamToString(InputStream is) {\n Scanner scanner = new Scanner(is);\n Scanner tokenizer = scanner.useDelimiter(\"\\\\A\");\n String str = tokenizer.hasNext() ? tokenizer.next() : \"\";\n scanner.close();\n return str;\n }", "private static String readLine() {\r\n String input=\"\";\r\n try {\r\n input = in.readLine();\r\n } catch (IOException e) {\r\n System.out.println(e.getMessage());\r\n }\r\n return input;\r\n }", "static String loadStream(InputStream in) throws IOException {\n int ptr = 0;\n in = new BufferedInputStream(in);\n StringBuffer buffer = new StringBuffer();\n while( (ptr = in.read()) != -1 ) {\n buffer.append((char)ptr);\n }\n return buffer.toString();\n }" ]
[ "0.7497638", "0.72253704", "0.7205618", "0.7200244", "0.7139847", "0.7127019", "0.7004908", "0.6994871", "0.685931", "0.6858148", "0.6811185", "0.67172444", "0.6709463", "0.6701768", "0.6690161", "0.66522455", "0.6612697", "0.66035664", "0.66035664", "0.65090364", "0.6494985", "0.64757735", "0.6408924", "0.64003646", "0.63670224", "0.63617235", "0.63553137", "0.63418627", "0.6337139", "0.6333018", "0.6321697", "0.6315514", "0.6250186", "0.6238538", "0.62362516", "0.6229663", "0.622424", "0.6222243", "0.6171105", "0.6157796", "0.6147771", "0.61400914", "0.61137444", "0.61137444", "0.610372", "0.6100744", "0.6099439", "0.60920674", "0.60849416", "0.6081729", "0.6064737", "0.60451025", "0.60293084", "0.60291165", "0.602703", "0.60243374", "0.602294", "0.6020327", "0.6017818", "0.60130334", "0.60043037", "0.5998483", "0.59942716", "0.5992093", "0.5977034", "0.59736717", "0.5966123", "0.59562856", "0.5948628", "0.59370315", "0.59370315", "0.5932162", "0.5930923", "0.5925289", "0.59107304", "0.5905149", "0.58869946", "0.58838683", "0.58807266", "0.5879338", "0.5877439", "0.5857105", "0.5843367", "0.5841201", "0.5834311", "0.58244014", "0.58157855", "0.58088523", "0.5806026", "0.57957166", "0.57919306", "0.5783109", "0.5776151", "0.576875", "0.57661986", "0.57658774", "0.5757455", "0.5755071", "0.575283", "0.57495403" ]
0.67393017
11
Read the content of the BufferedReader and return it as a String. The BufferedReader is closed afterwards.
public static String getText(BufferedReader reader) throws IOException { StringBuilder answer = new StringBuilder(); // reading the content of the file within a char buffer // allow to keep the correct line endings char[] charBuffer = new char[8192]; int nbCharRead /* = 0*/; try { while ((nbCharRead = reader.read(charBuffer)) != -1) { // appends buffer answer.append(charBuffer, 0, nbCharRead); } Reader temp = reader; reader = null; temp.close(); } finally { closeWithWarning(reader); } return answer.toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static String readString() throws IOException{\n return bufferedReader.readLine();\n }", "private static String getString(BufferedReader reader) throws IOException{\n String result=null;\n while(result==null) {\n result = reader.readLine();\n }\n return result.trim();\n }", "private static String getString(Reader reader) {\n StringBuffer buf = new StringBuffer();\n char[] buffer = new char[1024];\n int count;\n try {\n while ((count = reader.read(buffer)) != -1) {\n buf.append(buffer, 0, count);\n }\n } catch (IOException e) {\n return null;\n }\n return buf.toString();\n }", "public String read() throws IOException {\n return reader.readLine();\n }", "public static String read(Reader in) throws IOException {\n\t\tStringBuilder result = new StringBuilder();\n\t try {\n\t \tchar[] buf = new char[1024]; int r = 0;\n\t while ((r = in.read(buf)) != -1) {result.append(new String(buf, 0, r));}\n\t } finally { in.close();}\n\t\tString text=result.toString();\n\t\treturn text;\n\t}", "public String readString() throws IOException {\n return WritableUtils.readString(in);\n }", "public String readLine() throws IOException {\n\t\t// Punt on this and use BufferedReader routines.\n\t\tBufferedReader d = new BufferedReader(new InputStreamReader(this));\n\t\treturn d.readLine();\n\t}", "public String readString() throws IOException {\n checkOpened();\n return dis.readUTF();\n }", "public static String readFully(Reader reader) throws IOException {\n\t\ttry {\n\t\t\tStringWriter writer = new StringWriter();\n\t\t\tchar[] buffer = new char[1024];\n\t\t\tint count;\n\t\t\twhile ((count = reader.read(buffer)) != -1) {\n\t\t\t\twriter.write(buffer, 0, count);\n\t\t\t}\n\t\t\treturn writer.toString();\n\t\t} finally {\n\t\t\treader.close();\n\t\t}\n\t}", "public String read() throws Exception {\r\n\t\tBufferedReader reader = null;\r\n\t\tStringBuffer sb = new StringBuffer();\r\n\t\ttry {\r\n\t\t\tif (input==null) input = new FileInputStream(file);\r\n\t\t\treader = new BufferedReader(new InputStreamReader(input,charset));\r\n\t\t\tchar[] c= null;\r\n\t\t\twhile (reader.read(c=new char[8192])!=-1) {\r\n\t\t\t\tsb.append(c);\r\n\t\t\t}\r\n\t\t\tc=null;\r\n\t\t} catch (Exception e) {\r\n\t\t\tthrow e;\r\n\t\t} finally {\r\n\t\t\treader.close();\r\n\t\t}\r\n\t\treturn sb.toString().trim();\r\n\t}", "@Override\n public String readLine() {\n try {\n return this.bufferedReader.readLine();\n } catch (IOException e) {\n return \"\";\n }\n }", "public String readString() {\n final int BUF_SIZE = 100;\n byte[] byteDest = new byte[BUF_SIZE];\n String ret = \"\";\n int num = BUF_SIZE;\n try {\n while (!ret.contains(\"\\r\")) {\n if ((num = in.read(byteDest)) > 0) {\n ret += new String(byteDest, 0, num);\n }\n }\n } catch (IOException e) {\n print(\"Error reading String from \" + portName);\n }\n print(\"Read :\" + ret + \":\");\n return ret;\n }", "public static String readLine(BufferedReader bufferedReader) {\r\n\r\n try {\r\n return bufferedReader.readLine();\r\n } catch (IOException ex) {\r\n Logger.getLogger(FileUtility.class.getName()).log(Level.SEVERE, \"Error in readLine\", ex);\r\n return null;\r\n }\r\n }", "private String readLine(BufferedReader br) throws IOException {\n StringBuffer sb = new StringBuffer();\n boolean haveCR = false;\n boolean done = false;\n int i;\n char c;\n \n while((i = br.read()) != -1) {\n c = (char)i;\n \n if(haveCR) {\n switch(c) {\n case '\\n':\n sb.append(c);\n done = true;\n break;\n default:\n br.reset();\n done = true;\n break;\n }\n }\n else {\n sb.append(c);\n switch(c) {\n case '\\n':\n done = true;\n break;\n case '\\r':\n br.mark(1);\n haveCR = true;\n }\n }\n \n if(done) {\n break;\n }\n }\n\n return sb.length() > 0 ? sb.toString() : null;\n }", "private static String read(InputStream in) throws IOException {\n StringBuilder builder = new StringBuilder();\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\n String line = null;\n while ((line = reader.readLine()) != null)\n builder.append(line);\n\n return builder.toString();\n }", "public static String getLine(InputStreamReader reader) {\n StringBuffer b = new StringBuffer();\n int c;\n try {\n while ((c = reader.read()) != -1 && c != '\\n') {\n if (c != '\\r')\n b.append((char)c);\n }\n } catch (IOException ioe) {\n c = -1;\n }\n\n if (c == -1 && b.length() == 0)\n return null;\n else\n return b.toString();\n }", "public String read() {\n\t\tStringBuffer text = new StringBuffer((int)file.length());\n\t\ttry {\n\t\t\tFileReader fr = new FileReader(file);\n\t\t\tBufferedReader b = new BufferedReader(fr);\n\t\t\tboolean eof = false;\n\t\t\tString line;\n\t\t\tString ret = \"\\n\";\n\t\t\twhile (!eof) {\n\t\t\t\tline = b.readLine();\n\t\t\t\tif (line == null) {\n\t\t\t\t\teof = true;\n\t\t\t\t} else {\n\t\t\t\t\ttext.append(line);\n\t\t\t\t\ttext.append(ret);\n\t\t\t\t}\n\t\t\t}\n\t\t\tb.close();\n\t\t} catch (IOException e) {\n\t\t\tthrow new IllegalArgumentException(\"File \" + file.getName() +\n\t\t\t\t\" is unreadable : \" + e.toString());\n\t\t}\n\t\treturn text.toString();\n\t}", "private String read(InputStream in) throws IOException {\n StringBuilder sb = new StringBuilder();\n BufferedReader r = new BufferedReader(new InputStreamReader(in), 1000);\n for (String line = r.readLine(); line != null; line = r.readLine()) {\n sb.append(line);\n }\n in.close();\n return sb.toString();\n }", "private String read() {\n\n String s = \"\";\n\n try {\n // Check if there are bytes available\n if (inStream.available() > 0) {\n\n // Read bytes into a buffer\n byte[] inBuffer = new byte[1024];\n int bytesRead = inStream.read(inBuffer);\n\n // Convert read bytes into a string\n s = new String(inBuffer, \"ASCII\");\n s = s.substring(0, bytesRead);\n }\n\n } catch (Exception e) {\n Log.e(TAG, \"Read failed!\", e);\n }\n\n return s;\n }", "public String readLine() throws IOException\r\n\t{\r\n\t\treturn file.readLine();\r\n\t}", "public static String getContent(InputStreamReader inputReader)\n throws Exception {\n StringBuilder buffer = new StringBuilder();\n BufferedReader reader = new BufferedReader(inputReader);\n try {\n int read = reader.read();\n while (read != -1) {\n buffer.append((char) read);\n read = reader.read();\n }\n } finally {\n reader.close();\n }\n return buffer.toString();\n }", "public static String readLine(InputStream inputStream, String charset,\n boolean includeCR) throws IOException {\n byte[] line = readLine(inputStream, includeCR);\n return (null == line) ? null : new String(line, charset);\n }", "public final String readNextLine() throws IOException {\r\n String str;\r\n if (buf_end-buf_pos <= 0) {\r\n if (fillBuffer() < 0) {\r\n throw new IOException(\"Error filling buffer!\");\r\n }\r\n }\r\n int lineEnd = -1;\r\n for (int i = buf_pos; i < buf_end; i++) {\r\n if (buffer[i] == '\\n') {\r\n lineEnd = i;\r\n break;\r\n }\r\n }\r\n if (lineEnd < 0) {\r\n StringBuilder input = new StringBuilder(256);\r\n int c;\r\n while (((c = read()) != -1) && (c != '\\n')) {\r\n input.append((char)c);\r\n }\r\n if ((c == -1) && (input.length() == 0)) {\r\n return null;\r\n }\r\n return input.toString();\r\n }\r\n\r\n if (lineEnd > 0 && buffer[lineEnd-1] == '\\r') {\r\n str = new String(buffer, buf_pos, lineEnd - buf_pos -1);\r\n }\r\n else {\r\n str = new String(buffer, buf_pos, lineEnd - buf_pos);\r\n }\r\n buf_pos = lineEnd +1;\r\n return str;\r\n }", "public static String read(InputStream in) throws IOException {\n\t\tStringBuilder result = new StringBuilder();\n\t try {\n\t byte[] buf = new byte[1024]; int r = 0;\n\t while ((r = in.read(buf)) != -1) {result.append(new String(buf, 0, r));}\n\t } finally { in.close();}\n\t\tString text=result.toString();\n\t\treturn text;\n\t}", "public String readFileBufferedReader() {\n String result = \"\";\n BufferedReader in = null;\n try {\n in = new BufferedReader(new FileReader(new File(ALICE_PATH)));\n\n for (String x = in.readLine(); x != null; x = in.readLine()) {\n result = result + x + '\\n';\n }\n\n } catch (IOException e) {\n }\n\n if(in != null)try {\n in.close();\n } catch (IOException e) {\n }\n\n return result;\n }", "public String readFromFile() throws IOException {\n return br.readLine();\n }", "private String readResult() throws IOException {\n return reader.readLine();\n }", "public String readString() {\n return readNextLine();\n }", "private String readFromClient() throws IOException {\n final String request = inFromClient.readLine();\n return request;\n }", "public static String readString() {\n return in.nextLine();\n }", "@NonNull\n public static String getStringFrom(InputStream inputStream) {\n StringBuffer dataStringBuffer = new StringBuffer(\"\");\n try {\n InputStreamReader isr = new InputStreamReader(inputStream);\n BufferedReader bufferedReader = new BufferedReader(isr);\n String readString = bufferedReader.readLine();\n while (readString != null) {\n dataStringBuffer.append(readString);\n readString = bufferedReader.readLine();\n }\n isr.close();\n } catch (IOException ioe) {\n ioe.printStackTrace();\n }\n return dataStringBuffer.toString();\n }", "private static String readIt(InputStream stream) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(stream));\n StringBuilder sb = new StringBuilder();\n String line;\n while ((line = br.readLine()) != null) {\n sb.append(line+\"\\n\");\n }\n br.close();\n return sb.toString();\n\t}", "public String getStringFromInputStream(InputStream is) {\n\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(is));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n } catch (Exception e) {\n } finally {\n try {\n br.close();\n } catch (Exception e) {\n }\n br = null;\n return sb.toString();\n }\n }", "private String readStream(InputStream in) throws IOException {\n BufferedReader r = new BufferedReader(new InputStreamReader(in));\n\n StringBuilder sb = new StringBuilder();\n String line;\n\n // Reads every line and stores them in sb.\n while((line = r.readLine()) != null) {\n sb.append(line);\n }\n\n // Closes the input stream.\n in.close();\n\n return sb.toString();\n }", "private static String readFromStream(InputStream inputStream) throws IOException {\n\n // Create a new empty string builder\n StringBuilder stringBuilder = new StringBuilder();\n\n // Create a bufferedReader that reads from the inputStream param\n BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream,\n Charset.forName(\"UTF-8\")));\n\n // Create a string that is one line of the buffered reader\n String line = bufferedReader.readLine();\n\n while (line != null) {\n // Add line to stringBuilder\n stringBuilder.append(line);\n\n // Set line to the next line in buffered reader\n line = bufferedReader.readLine();\n }\n\n // Return string builder as a string\n return stringBuilder.toString();\n }", "private static String getStringFromInputStream(InputStream is) {\r\n\r\n BufferedReader br = null;\r\n StringBuilder sb = new StringBuilder();\r\n\r\n String line;\r\n try {\r\n\r\n br = new BufferedReader(new InputStreamReader(is));\r\n while ((line = br.readLine()) != null) {\r\n sb.append(line);\r\n }\r\n\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n finally {\r\n if (br != null) {\r\n try {\r\n br.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n }\r\n\r\n return sb.toString();\r\n\r\n }", "private static String readFromStream(InputStream inputStream) {\n StringBuilder outputString = new StringBuilder();\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName(\"UTF-8\"));\n BufferedReader reader = new BufferedReader(inputStreamReader);\n try {\n String line = reader.readLine();\n while (line != null) {\n outputString.append(line);\n line = reader.readLine();\n }\n } catch (IOException e) {\n Log.e(LOG_TAG, \"Error reading line from reader, readFromStream() block\", e);\n }\n }\n return outputString.toString();\n }", "public String getStringContent() throws IOException;", "private String readAll(Reader rd) throws IOException {\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\tint cp;\r\n\t\twhile ((cp = rd.read()) != -1) {\r\n\t\t\tsb.append((char) cp);\r\n\t\t}\r\n\t\treturn sb.toString();\r\n\t}", "public String readString() {\n byte[] byteForStream = new byte[1024];\n String message = \"\";\n\n mListener.onCarRunning();\n\n\n int bytes;\n\n while (true) {\n try {\n bytes = mInputStream.read(byteForStream);\n message = new String(byteForStream, 0, bytes);\n Log.d(TAG, \" Read from inputstream \" + message);\n\n } catch (IOException e) {\n Log.e(TAG, \" error reading from inputstream \" + e.getMessage());\n break;\n }\n }\n return message;\n }", "private static String readLine() {\r\n String input=\"\";\r\n try {\r\n input = in.readLine();\r\n } catch (IOException e) {\r\n System.out.println(e.getMessage());\r\n }\r\n return input;\r\n }", "private String readLine() {\r\n\t\ttry {\r\n\t\t\treturn input.readLine();\r\n\t\t} catch (IOException e) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}", "public static String bufferScanner() throws IOException\n\t{\n\treturn br.readLine();\n\t}", "public String read()\n\t{\n\t\ttry\n\t\t{\n\t\t\tint startAt = 0;\n\t\t\tString tempRead = inFromClient.readLine();\n\t\t\t\n\t\t\t// Clear out any nonalphabetic characters from the input buffer if\n\t\t\t// the user has just connected.\n\t\t\tif (!hasReadOnce)\n\t\t\t{\n\t\t\t\tfor (int ctr = 0; ctr < tempRead.length(); ctr++)\n\t\t\t\t{\n\t\t\t\t\tif ((tempRead.charAt(ctr) >= 'a' && tempRead.charAt(ctr) <= 'z')\n\t\t\t\t\t\t|| (tempRead.charAt(ctr) >= 'A' && tempRead.charAt(ctr) <= 'Z'))\n\t\t\t\t\t{\n\t\t\t\t\t\tstartAt = ctr;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thasReadOnce = true;\n\t\t\t}\n\n\t\t\thasPrinted = true;\n\t\t\ttempRead = tempRead.substring(startAt, tempRead.length());\n\t\t\t\n\t\t\t// Never return nonprintable characters. To support windows telnet, go back one\n\t\t\t// character for each backspace (chr #8) encountered.\n\t\t\tString newRead = \"\";\n\t\t\tfor (int ctr = 0; ctr < tempRead.length(); ctr++)\n\t\t\t{\n\t\t\t\tif (tempRead.charAt(ctr) > 31)\n\t\t\t\t\tnewRead = newRead+tempRead.charAt(ctr);\n\t\t\t\tif (tempRead.charAt(ctr) == 8 && newRead.length() > 0)\n\t\t\t\t\tnewRead = newRead.substring(0, newRead.length()-1);\n\t\t\t}\n\n\t\t\treturn newRead;\n\n\t\t} catch (NullPointerException e) {\n\t\t\tthis.closeSocket();\n\t\t\tif (ch.shortName.length() > 0)\n\t\t\t\tsysLog(\"connections\", \"Socket closed unexpectedly: \"+ch.shortName);\n\t\t\telse\n\t\t\t\tsysLog(\"connections\", \"Socket closed unexpectedly: No character.\");\n\t\t\treturn \"\";\n\t\t} catch (SocketException e) {\n\t\t\treturn \"\";\n\t\t} catch (Exception e) {\n\t\t\tif (ch.shortName.length() > 0)\n\t\t\t\tsysLog(\"connections\", \"Socket closed unexpectedly: \"+ch.shortName);\n\t\t\telse\n\t\t\t\tsysLog(\"connections\", \"Socket closed unexpectedly: No character.\");\n\t\t\treturn \"\";\n\t\t}\n\t}", "public static String readFile() {\n\t\tFileReader file;\n\t\tString textFile = \"\";\n\n\t\ttry {\n\t\t\tfile = new FileReader(path);\n\n\t\t\t// Output string.\n\t\t\ttextFile = new String();\n\n\t\t\tBufferedReader bfr = new BufferedReader(file);\n\n\t\t\ttextFile= bfr.readLine();\n\t\t\t\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(\"Error reading the file\");\n\t\t}\n\t\treturn textFile;\n\n\t}", "private static String readAll(Reader rd) throws IOException {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint cp;\n\t\twhile ((cp = rd.read()) != -1) {\n\t\t\tsb.append((char) cp);\n\t\t}\n\t\treturn sb.toString();\n\t}", "private static String readAll(Reader rd) throws IOException {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint cp;\n\t\twhile ((cp = rd.read()) != -1) {\n\t\t\tsb.append((char) cp);\n\t\t}\n\t\treturn sb.toString();\n\t}", "public String readLine() throws IOException, ReadTimeoutException {\n\t\ttry {\n\t\t\twaitForAvailable();\n\t\t\tlineBuffer[0] = (byte) inputStream.read();\n\t\t\twaitForAvailable();\n\t\t\tlineBuffer[1] = (byte) inputStream.read();\n\t\t\tlineLength = 2;\n\t\t\twhile (lineBuffer[lineLength - 2] != (byte) 13\n\t\t\t\t|| lineBuffer[lineLength - 1] != (byte) 10) {\n\t\t\t\twaitForAvailable();\n\t\t\t\tlineBuffer[lineLength] = (byte) inputStream.read();\n\t\t\t\tlineLength++;\n\t\t\t}\n\t\t\treturn new String(lineBuffer, 0, lineLength - 2);\n\t\t} catch (ArrayIndexOutOfBoundsException aioobe) {\n\t\t\tthrow new IOException(\"Line too long.\");\n\t\t}\n\t}", "public static String readString(InputStream is) throws IOException {\n return readString(is, DEFAULT_ENCODING);\n }", "String readString();", "private static String readFromStream(InputStream inputStream) throws IOException {\n StringBuilder output = new StringBuilder();\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName(\"UTF-8\"));\n BufferedReader reader = new BufferedReader(inputStreamReader);\n String line = reader.readLine();\n while (line != null) {\n output.append(line);\n line = reader.readLine();\n }\n }\n return output.toString();\n }", "public static String getText(Reader reader) throws IOException {\n BufferedReader bufferedReader = new BufferedReader(reader);\n return getText(bufferedReader);\n }", "public static String readFile(InputStream in) throws IOException {\n final StringBuffer sBuffer = new StringBuffer();\n final BufferedReader br = new BufferedReader(new InputStreamReader(in));\n final char[] buffer = new char[1024];\n\n int cnt;\n while ((cnt = br.read(buffer, 0, buffer.length)) > -1) {\n sBuffer.append(buffer, 0, cnt);\n }\n br.close();\n in.close();\n return sBuffer.toString();\n }", "public static String readString(InputStream is) {\r\n \t\tif (is == null)\r\n \t\t\treturn null;\r\n \t\tBufferedReader reader= null;\r\n \t\ttry {\r\n \t\t\tStringBuffer buffer= new StringBuffer();\r\n \t\t\tchar[] part= new char[2048];\r\n \t\t\tint read= 0;\r\n \t\t\treader= new BufferedReader(new InputStreamReader(is));\r\n \r\n \t\t\twhile ((read= reader.read(part)) != -1)\r\n \t\t\t\tbuffer.append(part, 0, read);\r\n \t\t\t\r\n \t\t\treturn buffer.toString();\r\n \t\t\t\r\n \t\t} catch (IOException ex) {\r\n \t\t} finally {\r\n \t\t\tif (reader != null) {\r\n \t\t\t\ttry {\r\n \t\t\t\t\treader.close();\r\n \t\t\t\t} catch (IOException ex) {\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\treturn null;\r\n \t}", "public String readFile(){\r\n StringBuffer str = new StringBuffer(); //StringBuffer is a mutable string\r\n Charset charset = Charset.forName(\"UTF-8\"); //UTF-8 character encoding\r\n Path file = Paths.get(filename + \".txt\");\r\n try (BufferedReader reader = Files.newBufferedReader(file, charset)) { // Buffer: a memory area that buffered streams read\r\n String line = null;\r\n while ((line = reader.readLine()) != null) { //Readers and writers are on top of streams and converts bytes to characters and back, using a character encoding\r\n str.append(line + \"\\n\");\r\n }\r\n }\r\n catch (IOException x) {\r\n System.err.format(\"IOException: %s%n\", x);\r\n }\r\n return str.toString();\r\n }", "public static String readIt(InputStream is) throws IOException {\n BufferedReader reader = null;\n reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n StringBuilder responseStrBuilder = new StringBuilder();\n String inputStr;\n while ((inputStr = reader.readLine()) != null) {\n responseStrBuilder.append(inputStr);\n }\n return responseStrBuilder.toString();\n }", "private synchronized String readString(int len) throws IOException {\n\t\tread(bytes, len);\n\t\treturn readString(bytes, 0, len);\n\t}", "public static String read(String filename) throws IOException {\n // Reading input by lines:\n BufferedReader in = new BufferedReader(new FileReader(filename));\n// BufferedInputStream in2 = new BufferedInputStream(new FileInputStream(filename));\n String s;\n int s2;\n StringBuilder sb = new StringBuilder();\n while((s = in.readLine())!= null)\n sb.append( s + \"\\n\");\n// sb.append((char) s2);\n in.close();\n return sb.toString();\n }", "public static String GetStringFromInputStream(InputStream is) {\n\t\tString line;\n\t\tStringBuilder total = new StringBuilder();\n\n\t\t// Wrap a BufferedReader around the InputStream\n\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(is));\n\n\t\t// Read response until the end\n\t\ttry {\n\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t\ttotal.append(line);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tis.close();\n\t\t\t} catch (Exception e) {\n\t\t\t\tUtilities\n\t\t\t\t\t\t.LogWarning(\"GetStringFromInputStream - could not close stream\");\n\t\t\t}\n\t\t}\n\n\t\t// Return full string\n\t\treturn total.toString();\n\t}", "private String readContents(final URL url) throws IOException {\n \t\tfinal BufferedReader in =\n \t\t\tnew BufferedReader(new InputStreamReader(url.openStream()));\n \t\tfinal StringBuilder sb = new StringBuilder();\n \t\twhile (true) {\n \t\t\tfinal String line = in.readLine();\n \t\t\tif (line == null) break; // eof\n \t\t\tsb.append(line);\n \t\t}\n \t\tin.close();\n \t\treturn sb.toString();\n \t}", "public static String getStringFromInputStream(InputStream is) {\n\n BufferedReader br = null;\n StringBuilder sb = new StringBuilder();\n\n String line;\n try {\n\n br = new BufferedReader(new InputStreamReader(is));\n while ((line = br.readLine()) != null) {\n sb.append(line);\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return sb.toString();\n }", "public String readLine() {\n\n String temp = null;\n\n try\n {\n assert this.isValid();\t\t\t//Test that we can read the file\n temp = br.readLine();\t\t\t//Read the next line and store it as temp\n }\n\n\t\t//Catch possible exceptions\n catch(java.io.IOException e) {\n System.out.println(\"Error reading file: \" + e );\n }\n\n return temp;\n }", "private String readNextLine() {\n StringBuilder sb = new StringBuilder();\n\n try {\n BufferedReader br = new BufferedReader(new InputStreamReader(stream));\n sb.append(br.readLine());\n } catch (IOException e) {\n e.fillInStackTrace();\n }\n\n return sb.toString();\n }", "private String readString(InputStream in) throws IOException {\r\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(in, \"iso-8859-1\"));\r\n\t\tString inputLine;\r\n\t\tStringBuffer response = new StringBuffer();\r\n\t\twhile ((inputLine = reader.readLine()) != null) {\r\n\t\t\tresponse.append(inputLine);\r\n\t\t}\r\n\t\tin.close();\r\n\t\treturn response.toString();\r\n\t}", "public String readLine() {\n if(in.hasNextLine()) {\n return in.nextLine();\n } else {\n // remote host closed connection!\n cleanup();\n return null;\n }\n }", "private static String readAll(Reader rd) throws IOException {\n\t\t StringBuilder sb = new StringBuilder();\n\t\t int cp;\n\t\t while ((cp = rd.read()) != -1) {\n\t\t sb.append((char) cp);\n\t\t }\n\t\t return sb.toString();\n\t\t }", "String read();", "String read();", "private static String readAllBytes(Reader rd) throws IOException {\n\t\tStringBuilder stringBuilder = new StringBuilder();\n\t\tint cp;\n\t\twhile ((cp = rd.read()) != -1) {\n\t\t\tstringBuilder.append((char) cp);\n\t\t}\n\t\treturn stringBuilder.toString();\n\t}", "public String read();", "private String readStream(InputStream is) throws IOException {\n StringBuilder sb = new StringBuilder();\n BufferedReader r = new BufferedReader(new InputStreamReader(is),1000);\n for (String line = r.readLine(); line != null; line =r.readLine()){\n sb.append(line);\n }\n is.close();\n return sb.toString();\n }", "public String readString(){\n\t\tif(sc.hasNext()){\n\t\t\treturn sc.next();\n\t\t}\n\t\tsc.nextLine();\n\t\treturn null;\n\t}", "public String readFile(){\n\t\tString res = \"\";\n\t\t\n\t\tFile log = new File(filePath);\n\t\tBufferedReader bf = null;\n\t\t\n\t\ttry{\n\t\t\tbf = new BufferedReader(new FileReader(log));\n\t\t\tString line = bf.readLine();\n\t\t\n\t\t\n\t\t\twhile (line != null){\n\t\t\t\tres += line+\"\\n\";\n\t\t\t\tline = bf.readLine();\n\t\t\t}\n\t\t\n\t\t\treturn res;\n\t\t}\n\t\tcatch(Exception oops){\n\t\t\tSystem.err.println(\"There was an error reading the file \"+oops.getStackTrace());\n\t\t\treturn \"\";\n\t\t}\n\t\tfinally{\n\t\t\ttry {\n\t\t\t\tbf.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.err.println(\"There was an error closing the read Buffer \"+e.getStackTrace());\n\t\t\t}\n\t\t}\n\t}", "protected String readFullyAsString(InputStream inputStream)\n\t\t\tthrows IOException {\n\t\tByteArrayOutputStream baos = new ByteArrayOutputStream();\n\t\tbyte[] buffer = new byte[1024];\n\t\tint length;\n\t\twhile ((length = inputStream.read(buffer)) != -1) {\n\t\t\tbaos.write(buffer, 0, length);\n\t\t}\n\t\treturn baos.toString(StandardCharsets.UTF_8.name());\n\t}", "static String loadStream(InputStream in) throws IOException {\n int ptr = 0;\n in = new BufferedInputStream(in);\n StringBuffer buffer = new StringBuffer();\n while( (ptr = in.read()) != -1 ) {\n buffer.append((char)ptr);\n }\n return buffer.toString();\n }", "static String slurp(InputStream stream) throws IOException {\n StringBuilder sb = new StringBuilder();\n BufferedReader br = new BufferedReader(new InputStreamReader(stream));\n String line;\n while ((line = br.readLine()) != null) {\n sb.append(line).append(System.lineSeparator());\n }\n br.close();\n return sb.toString();\n }", "private static void bufferedReading2(String str) throws IOException {\n try (BufferedReader reader = new BufferedReader(new StringReader(str))) {\n String result = reader.lines().collect(Collectors.joining(System.lineSeparator()));\n System.out.println(result);\n }\n }", "public static String readString()\n \n {\n String wort=\"xxxx\";\n try {\n wort=eingabe.readLine();\n \n } catch(IOException e1) {\n System.out.println(\"Eingabefehler,\");\n \n }\n return wort;\n }", "private String readLine() {\n\t\ttry {\n\t\t\treturn reader.nextLine();\t\n\t\t} catch (NoSuchElementException e) {\n\t\t\treturn null;\n\t\t}\n\t}", "public String inputStreamToString(InputStream inputStreamFromServer) throws IOException{\r\n //create bufferedReader from inputStream\r\n BufferedReader bufferedReader = new BufferedReader(\r\n new InputStreamReader(inputStreamFromServer));\r\n\r\n //hold variables\r\n String inputLine;\r\n StringBuffer responseAsString = new StringBuffer();\r\n\r\n //reading with buffer\r\n while((inputLine = bufferedReader.readLine()) != null){\r\n responseAsString.append(inputLine);\r\n }\r\n\r\n return responseAsString.toString();\r\n\r\n }", "String readLine() throws IOException\n\t{\n\t\tString line = null;\n\t\tif (haveStreams())\n\t\t\tline = m_in.readLine();\n\t\telse\n\t\t\tline = keyboardReadLine();\n\n\t\tsetCurrentLine(line);\n\t\treturn line;\n\t}", "private static String readNextLine(BufferedReader reader) {\n\t\t\n\t\ttry {\n\t\t\tString line = reader.readLine();\n\t\t\treturn line;\n\t\t} catch(IOException e) {\n\t\t\tGdx.app.error(TAG, \"Failed to read the file\", e);\n\t\t\ttry {\n\t\t\t\treader.close();\n\t\t\t} catch(IOException ex) {\n\t\t\t\tGdx.app.error(TAG, \"Failed to close file\");\n\t\t\t\tGdx.app.exit();\n\t\t\t}\n\t\t\tGdx.app.exit();\n\t\t\treturn null;\n\t\t}\n\t}", "private static String ioStr(InputStream in) throws IOException {\n\t\t// Read input\n\t\tString str = new String();\n\t\tString next = null;\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\t\twhile ((next = reader.readLine()) != null) {\n\t\t\tstr += next + \"\\n\";\n\t\t}\n\t\tin.close();\n\n\t\t// Convert result accordingly\n\t\tif (str.length() > 1) {\n\t\t\treturn str.substring(0, str.length() - 1);\n\t\t}\n\t\treturn str;\n\t}", "public static String loadStream(InputStream in) throws IOException {\r\n\t\tInputStream is = in;\r\n\t\tint ptr = 0;\r\n\t\tis = new BufferedInputStream(is);\r\n\t\tStringBuffer buffer = new StringBuffer();\r\n\t\ttry {\r\n\t\t\twhile ((ptr = is.read()) != -1) {\r\n\t\t\t\tbuffer.append((char) ptr);\r\n\t\t\t}\r\n\t\t} finally {\r\n\t\t\tis.close();\r\n\t\t}\r\n\t\treturn buffer.toString();\r\n\t}", "public String recvRaw() throws IOException\n\t{\n\t\ttry\n\t\t{\n\t\t\treturn _reader.readLine();\n\t\t} catch (IOException e)\n\t\t{\n\t\t\tthrow new IOException(\"We have been killed: \" + e.getMessage(), e);\n\t\t}\n\t}", "private String readStream(InputStream in) {\n try {\n ByteArrayOutputStream bo = new ByteArrayOutputStream();\n int i = in.read();\n while(i != -1) {\n bo.write(i);\n i = in.read();\n }\n return bo.toString();\n } catch (IOException e) {\n return \"\";\n }\n }", "public static String getString() throws IOException {\n InputStreamReader isr = new InputStreamReader(System.in);\n BufferedReader br = new BufferedReader(isr);\n String s = br.readLine();\n return s;\n }", "private String getTextLineFromStream( InputStream is ) throws IOException {\n StringBuffer buffer = new StringBuffer();\n int b;\n\n \twhile( (b = is.read()) != -1 && b != (int) '\\n' ) {\n \t\tbuffer.append( (char) b );\n \t}\n \treturn buffer.toString().trim();\n }", "private StringBuilder inputStreamToString(InputStream is) {\n \t String line = \"\";\n \t StringBuilder total = new StringBuilder();\n \t \n \t // Wrap a BufferedReader around the InputStream\n \t BufferedReader rd = new BufferedReader(new InputStreamReader(is));\n \n \t // Read response until the end\n \t try {\n \t\t\twhile ((line = rd.readLine()) != null) { \n \t\t\t total.append(line); \n \t\t\t}\n \t\t} catch (IOException e) {\n \t\t\te.printStackTrace();\n \t\t}\n \t \n \t // Return full string\n \t return total;\n \t}", "static String loadStream(InputStream in) throws IOException { \n\t\tint ptr = 0; \n\t\tin = new BufferedInputStream(in); \n\t\tStringBuffer buffer = new StringBuffer(); \n\t\twhile( (ptr = in.read()) != -1 ) { \n\t\t\tbuffer.append((char)ptr); \n\t\t} \n\t\treturn buffer.toString(); \n\t}", "public String readMessage() throws IOException {\n\t\treturn reader.readLine();\n\t}", "public static String readString(){\n\t\tstringInput = readInput();\n\t\treturn stringInput; \n\t}", "public String readUTF() throws IOException {\n\n\t\t// Punt on this one and use DataInputStream routines.\n\t\tDataInputStream d = new DataInputStream(this);\n\t\treturn d.readUTF();\n\n\t}", "public static String readFromInputStream(InputStream inputStream) throws IOException {\n StringBuilder streamOutput = new StringBuilder();\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset\n .forName(\"UTF-8\"));\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n String line = bufferedReader.readLine();\n while (line != null) {\n streamOutput.append(line);\n line = bufferedReader.readLine();\n }\n }\n return streamOutput.toString();\n }", "public String read(String filePath) throws IOException {\r\n\t\t//read file into stream\r\n\t\t\treturn new String(Files.readAllBytes(Paths.get(filePath)));\r\n\t}", "public String readStream(InputStream in) {\n BufferedReader reader = null;\n StringBuffer data = new StringBuffer(\"\");\n try {\n reader = new BufferedReader(new InputStreamReader(in));\n String line = \"\";\n while ((line = reader.readLine()) != null) {\n data.append(line);\n }\n } catch (IOException e) {\n Log.e(\"Log\", \"IOException\");\n } finally {\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return data.toString();\n }", "public static String getString() throws IOException {\r\n InputStreamReader isr = new InputStreamReader(System.in);\r\n BufferedReader br = new BufferedReader(isr);\r\n String s = br.readLine();\r\n return s;\r\n }", "public static String readString(String file) throws IOException\n {\n try(InputStream in = getInputStream(file); BufferedReader reader = new BufferedReader(new InputStreamReader(in)))\n {\n StringBuilder builder = new StringBuilder();\n String line;\n while((line = reader.readLine()) != null)\n builder.append(line).append(\"\\n\");\n\n return builder.toString();\n }\n }", "private String _read(InputStream in, String enc) throws IOException\n {\n int ptr = 0;\n int count;\n \n while ((count = in.read(_readBuffer, ptr, _readBuffer.length - ptr)) > 0) {\n ptr += count;\n // buffer full? Need to realloc\n if (ptr == _readBuffer.length) {\n _readBuffer = Arrays.copyOf(_readBuffer, ptr + ptr);\n }\n }\n \n return new String(_readBuffer, 0, ptr, enc);\n }", "private String streamToString(InputStream is) throws IOException {\n String str = \"\";\n \n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n \n try {\n BufferedReader reader = new BufferedReader(\n new InputStreamReader(is));\n \n while ((line = reader.readLine()) != null) {\n sb.append(line);\n }\n \n reader.close();\n } finally {\n is.close();\n }\n \n str = sb.toString();\n }\n \n return str;\n }" ]
[ "0.76448953", "0.75239164", "0.7336122", "0.729221", "0.71942973", "0.70569927", "0.70181453", "0.7011259", "0.69880927", "0.6958488", "0.6946416", "0.69348365", "0.68314135", "0.6807702", "0.6772812", "0.67634046", "0.6731396", "0.6716449", "0.6701995", "0.667455", "0.66669095", "0.6664812", "0.6663795", "0.6635941", "0.6635876", "0.6609332", "0.660838", "0.65891623", "0.6551523", "0.65486145", "0.65401286", "0.6534455", "0.6532829", "0.6528755", "0.6515844", "0.65020484", "0.64968115", "0.64955115", "0.6484922", "0.6475762", "0.6471627", "0.6466081", "0.64483255", "0.6440537", "0.64241326", "0.64141023", "0.64141023", "0.6401212", "0.6400395", "0.63889", "0.6376971", "0.63748354", "0.6372241", "0.63679564", "0.6346218", "0.63421494", "0.63339186", "0.6331488", "0.63018054", "0.6295737", "0.62863433", "0.6285384", "0.62823725", "0.628196", "0.6277799", "0.6261427", "0.6243123", "0.6243123", "0.62291116", "0.622482", "0.620799", "0.61877143", "0.6177609", "0.6176058", "0.6175463", "0.6170895", "0.61629915", "0.61525834", "0.61521256", "0.61471814", "0.6136756", "0.6129189", "0.61215943", "0.61189556", "0.61154616", "0.6111334", "0.61068577", "0.6104295", "0.6096458", "0.60916203", "0.60889095", "0.6088899", "0.6083673", "0.60820305", "0.60806876", "0.6080168", "0.60769475", "0.6076442", "0.60689014", "0.6063223" ]
0.7458489
2
Close the Closeable. Logging a warning if any problems occur.
public static void closeWithWarning(Closeable c) { if (c != null) { try { c.close(); } catch (IOException e) { LOG.warning("Caught exception during close(): " + e); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void close() {\n if (cleanup != null) {\n cleanup.disable();\n }\n if (isOpen()) {\n forceClose();\n }\n }", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "private void close() {\n try {\n if (reader != null) {\n this.reader.close();\n }\n if (writer != null) {\n this.writer.close();\n }\n }\n catch (IOException e) {\n log.error(e);\n log.debug(Constants.STREAM_IS_CLOSED);\n }\n }", "public void close() {\n if (closed) {\n return;\n }\n try {\n disconnect();\n } catch (Exception e) {\n throw new IOError(e);\n }\n closed = true;\n }", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "public void close() throws DukeException {\n try {\n this.writer.close();\n } catch (IOException e) {\n throw Ui.ioException(e);\n }\n }", "public synchronized void close() {}", "protected void close() {\n\t\tif(sOutput != null) {\n\t\t\ttry {\n\t\t\t\tsOutput.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.err.println(\"error closing output stream\");\n\t\t\t}\n\t\t\t\n\t\t\tsOutput = null;\n\t\t}\n\t}", "public void close() {}", "public void close() throws IOException {\n\t}", "public void close() throws IOException {\n\t}", "@Override\n public void close() throws IOException {\n isClosed = true;\n }", "public void shutdown() {\n try {\n this.writer.close();\n } catch (IOException e) {\n log.warn(i18n.getString(\"problemCloseOutput\", e), e);\n }\n }", "public void close() {\r\n helper.close();\r\n }", "public void close() throws IOException {\n\n\t}", "public void close() {\n helper.close();\n }", "void close() throws Exception;", "void close() throws Exception;", "public void close() throws IOException {\n this.snapLog.close();\n }", "@Override\n void close() throws IOException{\n System.out.print(\"Close\");\n \n }", "public void close() {\n\t\t}", "public void close() {\n }", "public void close() {\n }", "public void close() {\n }", "void close()\n {\n DisconnectInfo disconnectInfo = connection.getDisconnectInfo();\n if (disconnectInfo == null)\n {\n disconnectInfo = connection.setDisconnectInfo(\n new DisconnectInfo(connection, DisconnectType.UNKNOWN, null, null));\n }\n\n // Determine if this connection was closed by a finalizer.\n final boolean closedByFinalizer =\n ((disconnectInfo.getType() == DisconnectType.CLOSED_BY_FINALIZER) &&\n socket.isConnected());\n\n\n // Make sure that the connection reader is no longer running.\n try\n {\n connectionReader.close(false);\n }\n catch (final Exception e)\n {\n debugException(e);\n }\n\n try\n {\n outputStream.close();\n }\n catch (final Exception e)\n {\n debugException(e);\n }\n\n try\n {\n socket.close();\n }\n catch (final Exception e)\n {\n debugException(e);\n }\n\n if (saslClient != null)\n {\n try\n {\n saslClient.dispose();\n }\n catch (final Exception e)\n {\n debugException(e);\n }\n finally\n {\n saslClient = null;\n }\n }\n\n debugDisconnect(host, port, connection, disconnectInfo.getType(),\n disconnectInfo.getMessage(), disconnectInfo.getCause());\n if (closedByFinalizer && debugEnabled(DebugType.LDAP))\n {\n debug(Level.WARNING, DebugType.LDAP,\n \"Connection closed by LDAP SDK finalizer: \" + toString());\n }\n disconnectInfo.notifyDisconnectHandler();\n }", "public void close()\n\t\t{\n\t\t}", "public void close()\n {\n try\n {\n stop();\n }\n catch (IOException ioex)\n {\n logger.error(\"Failed to stop \" + getClass().getSimpleName(), ioex);\n }\n }", "public void close() {\n }", "public void close() {\n }", "public void close() {\n }", "public void close() {\n try { out.flush(); } catch (Exception e) {}; // just to be sure\n \n cleanup();\n }", "public void close()\r\n {\r\n }", "@Override\n public void close() throws IOException {\n }", "@Override\n public void close() throws IOException {\n }", "public void close() {\r\n\t}", "@Override\n public void close() {\n //no-op\n }", "public void close() {\n\t}", "@Override\n void close() throws IOException;", "@Override public void closed() {\n\t\t}", "public void close() throws IOException {\n open = false;\n stream.close();\n }", "protected final void close()\n {\n try {\n _reader.close();\n _reader = null;\n } catch ( IOException except ) { }\n }", "@Override\n public void close() {\n }", "@Override\n public void close() {\n }", "public void close()\r\n\t{\r\n\t if (isOpen()) try {\r\n\t \tfd.close();\r\n\t } catch (IOException ex) {\r\n\t \t/* do nothing */\r\n\t } finally {\r\n\t\t thisc = EOF;\r\n\t\t holdc = EOF;\r\n\t\t fd = null;\r\n\t }\r\n\t}", "@Override\n public void close() throws IOException {\n\n }", "public static void close(final Closeable stream) {\n if (stream != null) {\n try {\n stream.close();\n } catch (final IOException ex) {\n ex.printStackTrace();\n }\n }\n }", "@Override\n void close() throws IOException;", "protected void close() {\n\t\tthis.writer.stop();\n\t\tsynchronized (this.writer.writer) {\n\t\t\twhile (!this.writer.isFinished()) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.writer.writer.wait();\n\t\t\t\t}\n\t\t\t\tcatch (InterruptedException e) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\tthis.btc.close();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t}\n\n\t\tthis.closed = true;\n\t}", "public void close(){\r\n\t\tif (this.fileWriter != null){\r\n\t\t\ttry {\r\n\t\t\t\tthis.fileWriter.flush();\r\n\t\t\t\tthis.fileWriter.close();\r\n\t\t\t\tthis.fileWriter = null;\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tlogger.error(\"Cannot close the file handle \"+this.myfilename+\". Your results might be lost. Cause: \"+e.getMessage());\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\r\n\t\t}\r\n\t}", "@Override\r\n\tpublic final void close() throws IOException {\r\n\t\tf.close();\r\n\t\tf = null;\r\n\t}", "protected void close() {\r\n\t\ttry {\r\n\t\t\t_asciiIn.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\tSystem.out.println(\r\n\t\t\t\t\t\"Error ocurred while closing file \" + _directory + _filename + _filetype + \":\" + e.getMessage());\r\n\t\t} // catch\r\n\t}", "@Override\n public void close() throws IOException {\n }", "public void close()\n {\n }", "@Override\n void close() throws IOException;", "public void close() {\n\t\t\n\t}", "public void close() {\n\t\t\n\t}", "public void close() {\n\t\t\n\t}", "public void close() {\n\t\tourHelper.close();\n\t}", "public void close() throws IOException\n {\n try\n {\n flush();\n }\n catch (IOException ignored)\n {\n // ignore\n }\n getStream().close();\n }", "@Override\n\tpublic void close() throws IOException {\n\t\t\n\t}", "@Override\n\tpublic void close() throws IOException {\n\t\t\n\t}", "public void close() {\n\n\t}", "public void close() {\n\n\t}", "@Override\r\n\tpublic void close() throws Exception {\r\n\t\tSystem.out.println(\"Cerrado\");\r\n\t}", "@Override\n public void closing() {\n }", "@Override\n\t\tpublic void close() throws IOException {\n\t\t\t\n\t\t}", "public void close() {\n this.output = null;\n }", "@Override\n public void close() throws IOException {\n\n }", "public void close(){\n\t\ttry {\n\t\t\tout.close();\n\t\t\tout = null;\n\t\t}\n\t\tcatch (IOException e){\n\t\t\tSystem.out.println(\"Problem closing file.\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "public void close() {\n finalize0();\n }", "public void close(){\n\t\ttry{\n\t\t\tflush();\n\t\t\tse.close();\n\t\t}catch(IOException ioex){\n\t\t\tfailures = true;\n\t\t}\n\t}", "public void close() throws IOException {\n if (dataFile != null)\n dataFile.close();\n dataFile = null;\n super.close();\n }", "public void close() throws IOException {\r\n\r\n // System.out.println(\"FileDICOM.close\");\r\n this.finalize();\r\n }", "void close() throws Exception;", "@Override\r\n\tpublic synchronized void close() {\n\t\tsuper.close();\r\n\t}", "@Override\n public void cleanup() throws Exception {\n outputStream.close();\n }", "public void close() throws IOException {\n Closeables.close(api, true);\n }", "@Override\n public void close() {\n backingIterator.close();\n outputBuffer.close();\n isClosed = true;\n }", "public void close()\n throws IOException\n {\n outstream.close();\n }", "public void close() {\n dispose();\n }", "public void close() {\n\t\tSystem.out.println(\"Scraper terminated\");\n\t}", "@Override\n void close() throws Exception;", "@Override\n public void close() {\n }" ]
[ "0.72817063", "0.69601697", "0.69601697", "0.69601697", "0.69601697", "0.69601697", "0.69601697", "0.69601697", "0.69601697", "0.6954965", "0.69540954", "0.6936791", "0.6936791", "0.6936791", "0.6936791", "0.6936791", "0.6936791", "0.6936791", "0.6936791", "0.6936791", "0.6936791", "0.6936791", "0.68827254", "0.6877094", "0.6828881", "0.6822825", "0.68131405", "0.68131405", "0.680397", "0.6772344", "0.6768685", "0.6755316", "0.6750684", "0.6741385", "0.6741385", "0.67315984", "0.67195636", "0.6706838", "0.6693044", "0.6693044", "0.6693044", "0.667773", "0.6674323", "0.6666461", "0.66566926", "0.66566926", "0.66566926", "0.66526365", "0.6644393", "0.6633888", "0.6633888", "0.6623047", "0.66174966", "0.65976787", "0.6594553", "0.6590201", "0.65857077", "0.65820915", "0.6569236", "0.6569236", "0.65690625", "0.6533124", "0.653088", "0.6521936", "0.6511817", "0.6507782", "0.6504602", "0.65028715", "0.6498433", "0.6494524", "0.64913803", "0.6489216", "0.6489216", "0.6489216", "0.64861256", "0.6483069", "0.6481871", "0.6481871", "0.64747447", "0.64747447", "0.64743626", "0.64727116", "0.64705557", "0.64682555", "0.64680517", "0.64669335", "0.6462366", "0.6458856", "0.6456994", "0.6456841", "0.6456302", "0.64516073", "0.6445997", "0.64434963", "0.6431657", "0.6430633", "0.6428565", "0.64252293", "0.642414", "0.6414844" ]
0.70042974
1
Close the Closeable. Ignore any problems that might occur.
public static void closeQuietly(Closeable c) { if (c != null) { try { c.close(); } catch (IOException e) { /* ignore */ } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected final void close()\n {\n try {\n _reader.close();\n _reader = null;\n } catch ( IOException except ) { }\n }", "public void close() {\n if (cleanup != null) {\n cleanup.disable();\n }\n if (isOpen()) {\n forceClose();\n }\n }", "private void close() {\n try {\n if (reader != null) {\n this.reader.close();\n }\n if (writer != null) {\n this.writer.close();\n }\n }\n catch (IOException e) {\n log.error(e);\n log.debug(Constants.STREAM_IS_CLOSED);\n }\n }", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "public void close() throws IOException {\n open = false;\n stream.close();\n }", "public void close() throws IOException {\r\n reader.close();\r\n reader = null;\r\n }", "@Override\n public void close() throws IOException {\n isClosed = true;\n }", "public void close() throws IOException {\n\t}", "public void close() throws IOException {\n\t}", "protected void close() {\r\n\t\ttry {\r\n\t\t\t_asciiIn.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\tSystem.out.println(\r\n\t\t\t\t\t\"Error ocurred while closing file \" + _directory + _filename + _filetype + \":\" + e.getMessage());\r\n\t\t} // catch\r\n\t}", "@Override\n void close() throws IOException;", "public void close() throws IOException {\n\n\t}", "public void close() {\n if (closed) {\n return;\n }\n try {\n disconnect();\n } catch (Exception e) {\n throw new IOError(e);\n }\n closed = true;\n }", "@Override\n public void close() throws IOException {\n }", "@Override\n public void close() throws IOException {\n }", "protected void close() {\n\t\tif(sOutput != null) {\n\t\t\ttry {\n\t\t\t\tsOutput.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.err.println(\"error closing output stream\");\n\t\t\t}\n\t\t\t\n\t\t\tsOutput = null;\n\t\t}\n\t}", "@Override\n public void close() throws IOException\n {\n\n // do nothing\n }", "@Override\r\n\tpublic final void close() throws IOException {\r\n\t\tf.close();\r\n\t\tf = null;\r\n\t}", "public void close() throws DukeException {\n try {\n this.writer.close();\n } catch (IOException e) {\n throw Ui.ioException(e);\n }\n }", "@Override\n public void close() throws IOException {\n\n }", "@Override\n void close() throws IOException;", "public void close()\r\n\t{\r\n\t if (isOpen()) try {\r\n\t \tfd.close();\r\n\t } catch (IOException ex) {\r\n\t \t/* do nothing */\r\n\t } finally {\r\n\t\t thisc = EOF;\r\n\t\t holdc = EOF;\r\n\t\t fd = null;\r\n\t }\r\n\t}", "public synchronized void close() {}", "@Override\n void close() throws IOException;", "public void close() throws IOException {\n if (dataFile != null)\n dataFile.close();\n dataFile = null;\n super.close();\n }", "@Override\n public void close() {\n backingIterator.close();\n outputBuffer.close();\n isClosed = true;\n }", "public void close(){\n\t\ttry {\n\t\t\tout.close();\n\t\t\tout = null;\n\t\t}\n\t\tcatch (IOException e){\n\t\t\tSystem.out.println(\"Problem closing file.\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "public void close() {}", "public void close() throws IOException {\n reader.close();\n }", "@Override\n public void close() throws IOException {\n }", "@Override\n protected void doClose() {\n FileUtil.closeSilent(this.in);\n this.recordFactory = null;\n this.geometryFactory = null;\n this.in = null;\n this.recordDefinition = null;\n this.resource = null;\n }", "@Override\n public void close() throws IOException {\n input.close();\n }", "public void close() {\n try { out.flush(); } catch (Exception e) {}; // just to be sure\n \n cleanup();\n }", "@Override\n public void close() {\n //no-op\n }", "@Override\n\t\tpublic void close() throws IOException {\n\t\t\t\n\t\t}", "@Override\n public void close() throws IOException {\n\n }", "@Override\n\tpublic void close() throws IOException {\n\t\t\n\t}", "@Override\n\tpublic void close() throws IOException {\n\t\t\n\t}", "public void close() throws IOException {\r\n\r\n // System.out.println(\"FileDICOM.close\");\r\n this.finalize();\r\n }", "public void close() {\n\t\t}", "public void close() throws IOException {\n reset();\n _reader.close();\n }", "void close(boolean evictOnClose) throws IOException;", "public void close() throws IOException {\n source.close();\n }", "public synchronized void close() throws IOException {\n\t\tm_reader.close();\n\t}", "@Override\n public void close() {\n }", "@Override\n public void close() {\n }", "void close() throws Exception;", "void close() throws Exception;", "public void close() throws IOException\n {\n try\n {\n flush();\n }\n catch (IOException ignored)\n {\n // ignore\n }\n getStream().close();\n }", "public void close()\n\t\t{\n\t\t}", "public abstract void close() throws IOException;", "public abstract void close() throws IOException;", "public void close() {\n wrapped.close();\n }", "@Override\n public void close() throws IOException\n {\n try {\n mergingIterator.close();\n }\n finally {\n cleanup.run();\n }\n }", "@Override public abstract void close();", "@Override\n\tpublic void close() throws IOException {\n\n\t}", "@Override\n\tpublic void close() throws IOException {\n\n\t}", "@Override\n\tpublic void close() throws IOException {\n\n\t}", "@Override\n\tpublic void close() throws IOException {\n\n\t}", "public void close() {\n }", "public void close() {\n }", "public void close() {\n }", "public void close(){\r\n\t\tif (this.fileWriter != null){\r\n\t\t\ttry {\r\n\t\t\t\tthis.fileWriter.flush();\r\n\t\t\t\tthis.fileWriter.close();\r\n\t\t\t\tthis.fileWriter = null;\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tlogger.error(\"Cannot close the file handle \"+this.myfilename+\". Your results might be lost. Cause: \"+e.getMessage());\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\r\n\t\t}\r\n\t}", "@Override\r\n\tpublic synchronized void close() {\n\t\tsuper.close();\r\n\t}", "@Override public void closed() {\n\t\t}", "private void close() {\r\n try {\r\n if (m_in != null) {\r\n m_in.close();\r\n }\r\n if (m_out != null) {\r\n m_out.close();\r\n }\r\n if (m_socket != null) {\r\n m_socket.close();\r\n }\r\n } catch (IOException e) {\r\n throw new WrappedRuntimeException(e);\r\n }\r\n }", "public void close() throws IOException {\n if (!closed) {\n // Android-changed: Unconditionally close external inflaters (b/26462400)\n //if (usesDefaultInflater)\n inf.end();\n in.close();\n closed = true;\n }\n }", "public void close() {\n finalize0();\n }", "public void close()\n throws IOException\n {\n outstream.close();\n }", "public void close() throws java.io.IOException {\n\t\tbr.close(); \t\t\t//Closes the file\n\t}", "public void close() {\n }", "public void close() {\n }", "public void close() {\n }", "public void close() throws IOException {\r\n \taf.close();\r\n \taf = null;\r\n }", "public void close() {\r\n\t}", "public void close() {\n try {\n out.close();\n } catch (java.io.IOException ioe) {\n }\n ;\n }", "public void close() {\n\t}", "public void close() {\r\n helper.close();\r\n }", "public void close() {\n\t\ttry {\n\t\t\tin.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void close()\r\n {\r\n }", "public void close() {\n dispose();\n }", "protected void close() {\n\t\tthis.writer.stop();\n\t\tsynchronized (this.writer.writer) {\n\t\t\twhile (!this.writer.isFinished()) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.writer.writer.wait();\n\t\t\t\t}\n\t\t\t\tcatch (InterruptedException e) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\tthis.btc.close();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t}\n\n\t\tthis.closed = true;\n\t}", "public void close() {\n helper.close();\n }" ]
[ "0.74980307", "0.7465323", "0.74081224", "0.73563737", "0.73563737", "0.73563737", "0.73563737", "0.73563737", "0.73563737", "0.73563737", "0.73563737", "0.7293001", "0.7293001", "0.7293001", "0.7293001", "0.7293001", "0.7293001", "0.7293001", "0.7293001", "0.7293001", "0.7293001", "0.7293001", "0.7207144", "0.72043186", "0.7203827", "0.71697325", "0.71697325", "0.7144865", "0.7132479", "0.71269655", "0.7092348", "0.7067855", "0.7067855", "0.70666826", "0.7059248", "0.70553106", "0.70467603", "0.70413816", "0.703463", "0.7029697", "0.70256656", "0.7009709", "0.70070946", "0.7000784", "0.6988612", "0.69791126", "0.69767904", "0.6976185", "0.6969164", "0.6958315", "0.6951187", "0.69413024", "0.69292325", "0.6928587", "0.69244695", "0.69244695", "0.691268", "0.6904825", "0.6904073", "0.6901951", "0.68990403", "0.6886257", "0.6879609", "0.6879609", "0.68695885", "0.68695885", "0.6867378", "0.6867089", "0.68665653", "0.68665653", "0.68493676", "0.68420404", "0.68385386", "0.68363106", "0.68363106", "0.68363106", "0.68363106", "0.6834352", "0.6834352", "0.6834352", "0.68317235", "0.68211913", "0.681724", "0.68162113", "0.6815477", "0.6809558", "0.6806598", "0.6805846", "0.6797992", "0.6797992", "0.6797992", "0.67937344", "0.6790442", "0.6787782", "0.6782457", "0.6781649", "0.6779176", "0.67663693", "0.67634773", "0.6761427", "0.6757032" ]
0.0
-1
Created by feng on 2015/8/8.
public interface Component { public void operation(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "private static void cajas() {\n\t\t\n\t}", "private stendhal() {\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "public void mo4359a() {\n }", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "private void kk12() {\n\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private void poetries() {\n\n\t}", "public void mo38117a() {\n }", "private void strin() {\n\n\t}", "@Override\n public void init() {\n\n }", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void interr() {\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 einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\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\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 init() {\n\n\n\n }", "private void init() {\n\n\t}", "@Override\n public void memoria() {\n \n }", "private void m50366E() {\n }", "protected boolean func_70814_o() { return true; }", "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 }", "Constructor() {\r\n\t\t \r\n\t }", "@Override\n public void settings() {\n // TODO Auto-generated method stub\n \n }", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "public void skystonePos4() {\n }", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "public void mo6081a() {\n }", "public void skystonePos6() {\n }", "public final void mo51373a() {\n }", "public void Tyre() {\n\t\t\r\n\t}", "public void mo55254a() {\n }", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}", "static void feladat9() {\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}", "public void Exterior() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void doF8() {\n\t\t\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n public void init() {\n }", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\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\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tvoid func04() {\n\t\t\r\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "void berechneFlaeche() {\n\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\n void init() {\n }", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\n\tpublic int mettreAJour() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic void init()\n\t{\n\n\t}", "public void init()\n { \t\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public void mo21877s() {\n }", "static void feladat4() {\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "public void skystonePos5() {\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "public void skystonePos3() {\n }" ]
[ "0.62235576", "0.61594087", "0.61099446", "0.60991067", "0.60991067", "0.60908985", "0.6067942", "0.60315406", "0.6003369", "0.60017365", "0.59879375", "0.5978093", "0.59375924", "0.59196997", "0.5906573", "0.5895621", "0.5891126", "0.5864742", "0.5847863", "0.5831558", "0.5809269", "0.58068126", "0.58041215", "0.58031017", "0.58024365", "0.57922375", "0.5785707", "0.5784842", "0.57619214", "0.57619214", "0.57619214", "0.57619214", "0.57619214", "0.5741137", "0.5723781", "0.5709611", "0.5699053", "0.5699053", "0.5697127", "0.5697127", "0.5697127", "0.5686774", "0.56722665", "0.5670113", "0.566294", "0.56557137", "0.565179", "0.565179", "0.565179", "0.565179", "0.565179", "0.565179", "0.565179", "0.5651507", "0.5651391", "0.56495774", "0.56495774", "0.5648089", "0.56316614", "0.56287646", "0.5622209", "0.5613945", "0.5609445", "0.5604362", "0.56016326", "0.5593035", "0.55855256", "0.55848485", "0.55848485", "0.55848485", "0.5581557", "0.55807656", "0.55796957", "0.55702144", "0.5569373", "0.55671304", "0.5564904", "0.55644757", "0.55644757", "0.55644757", "0.5564386", "0.55635047", "0.5560373", "0.555412", "0.55538285", "0.5551919", "0.5546284", "0.55435586", "0.5541213", "0.5540896", "0.55379546", "0.553457", "0.552094", "0.55174255", "0.5517205", "0.5512979", "0.5508654", "0.55039364", "0.55039364", "0.55024534", "0.5501087" ]
0.0
-1
Game View Controller is instantiated with inputs generated by the menu controller, indicating number of players and decks.
public GameViewController(int[] input) { inputs = input; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public GameController() {\n \t\t// Fill the table empty positions.\n \t\tfor (int i = 0; i < MAX_NUMBER_OF_PILES; i++) {\n \t\t\tmTable.add(i, null);\n \t\t}\n \t\tcreateDeck();\n \t\tgs = new GameState(mTable, pileNames, pileNo);\n \t\tnew Listener(this);\n \t}", "public GameController() {\r\n\t\tsuper();\r\n\t\tthis.model = Main.getModel();\r\n\t\tthis.player = this.model.getPlayer();\r\n\t\tthis.timeline = this.model.getIndefiniteTimeline();\r\n\t}", "public MainMenuController()\n {\n ArrayList<JButton> menuList = new ArrayList();\n \n //Setup default colors\n player1Color = Color.RED;\n player2Color = Color.BLUE;\n \n //Setup the start button\n startButton = new JButton(\"Start\");\n startButton.setBackground(Color.GREEN);\n menuList.add(startButton);\n \n startButton.addActionListener((ActionEvent ae) -> {\n uControll = new UltimateController();\n uControll.start(player1Color, player2Color);\n this.setupGameWindow();\n menuPanel.close();\n });\n \n //Setup multiplayer button\n JButton multiButton = new JButton(\"Network Play\");\n multiButton.setBackground(new Color(0,255,200));\n menuList.add(multiButton);\n multiButton.addActionListener((ActionEvent ae) -> {\n View.Multiplayer mp = new View.Multiplayer();\n mp.setParentWindow(menuPanel);\n mp.launchWindow();\n menuPanel.close();\n });\n \n //Setup the settings button\n JButton settingButton = new JButton(\"Settings\");\n settingButton.setBackground(Color.orange);\n menuList.add(settingButton);\n settingButton.addActionListener((ActionEvent ae) -> {\n setGUI = new View.SettingGUI(player1Color, player2Color);\n setupSettingWindow();\n });\n \n //Setup the how to play button\n howToButton = new JButton(\"How to Play\");\n howToButton.setBackground(Color.LIGHT_GRAY);\n menuList.add(howToButton);\n howToButton.addActionListener((ActionEvent ae) -> {\n //Create a frame\n JFrame newWindow = new JFrame(\"How to Play\"); \n View.HowToPlayPanel hPlay = new View.HowToPlayPanel();\n newWindow.add(hPlay);\n newWindow.setSize(1200,550);\n \n //Make the return button work\n hPlay.getReturnBtn().addActionListener((ActionEvent ae2) -> {\n newWindow.dispose();\n });\n \n newWindow.setVisible(true);\n newWindow.requestFocus();\n });\n \n //Setup the Quit button\n quitButton = new JButton(\"Quit\");\n quitButton.setBackground(Color.RED);\n menuList.add(quitButton);\n \n quitButton.addActionListener((ActionEvent ae) -> {\n System.out.println(\"Quit the program\");\n System.exit(0);\n });\n \n startButton.setBounds(570, 300, 120, 45);\n howToButton.setBounds(570, 375, 120, 45);\n quitButton.setBounds(570, 450, 120, 45);\n \n menuPanel = new MenuPanel(menuList);\n }", "private RockGameController() {\n points = 0; opponentPoints = 0;\n update1 = false; update2 = false; update3 = false; update4 = false; update5 = false;\n rockBodyOne = new RockGameBody(RockGameModel.getInstance().getRockOne());\n rockBodyTwo = new RockGameBody(RockGameModel.getInstance().getRockTwo());\n rockBodyThree = new RockGameBody(RockGameModel.getInstance().getRockThree());\n rockBodyFour = new RockGameBody(RockGameModel.getInstance().getRockFour());\n rockBodyFive = new RockGameBody(RockGameModel.getInstance().getRockFive());\n rocks = new ArrayList<RockGameBody>() {{add(rockBodyOne); add(rockBodyTwo); add(rockBodyThree); add(rockBodyFour); add(rockBodyFive);}};\n }", "public GameView() {\n initComponents();\n gameView(30, 30);\n }", "public SinglePlayerGameController() {\n player1 = new Player(\"Player 1\");\n computer = new Player(\"Computer\");\n game = new Game(new Dice(), player1, computer);\n player1.setColor(\"blue\");\n computer.setColor(\"red\");\n diceImage = new DiceImage();\n }", "public SudokuGameApp(String name) {\n super(name);\n this.model = new SudokuGame();\n this.view = new SudokuGamePanel();\n\n getContentPane().add(this.view);\n setSize(1000, 550);\n setResizable(false);\n\n // Fill Difficulty Selector\n for (Difficulty diff : Difficulty.values()) {\n view.getHomePanel().getLevelSelectionModel().addElement(diff);\n }\n\n // Window Action Listeners\n this.addWindowListener(new WindowAdapter() {\n @Override\n public void windowClosing(WindowEvent e) {\n Object[] options = {\"Exit Sudoku\", \"Cancel\"};\n int result = JOptionPane.showOptionDialog(getParent(), \"Are you sure you want to exit the application?\\nActive games will not be saved.\", \"Exit?\", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);\n if (result == JOptionPane.YES_OPTION) {\n setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n } else {\n setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);\n }\n }\n });\n\n // Action Listeners on Welcome Panel\n this.view.getWelcomePanel().getSignUpPanel().getSigninButton().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n view.getWelcomePanel().getCardLayoutManager().next(view.getWelcomePanel().getSlider());\n }\n });\n this.view.getWelcomePanel().getSignUpPanel().getSignupButton().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n signUpEvt();\n }\n });\n this.view.getWelcomePanel().getSignInPanel().getSignupButton().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n view.getWelcomePanel().getCardLayoutManager().next(view.getWelcomePanel().getSlider());\n }\n });\n this.view.getWelcomePanel().getSignInPanel().getSigninButton().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n signInEvt();\n }\n });\n\n // Action Listeners on Home Panel\n this.view.getHomePanel().getNewGameBtn().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n // Get Level for the Game\n Difficulty level = Difficulty.valueOf(view.getHomePanel().getLevelSelector().getSelectedItem().toString().toUpperCase());\n\n // Generate New Game\n Generator puzzle = new Generator();\n puzzle.generateGrid(level);\n model.setPuzzle(puzzle.getGrid());\n\n // Configure View\n view.getGamePanel().setViewCellList(model.getPuzzle().getCellList());\n view.getGamePanel().getLevelTitle().setText(String.valueOf(level));\n update();\n\n // Switch to Game Panel\n view.getCardLayoutManager().show(view.getContent(), \"game\");\n\n // Set up Game Timer & Start\n long start = Calendar.getInstance().getTimeInMillis() / 1000;\n model.setTimer(new Timer(1000, new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n long secondsSinceInit = ((Calendar.getInstance().getTimeInMillis() / 1000) - start);\n view.getGamePanel().getTimeLabel().setText(String.format(\"%02d:%02d\", secondsSinceInit / 60 % 60, secondsSinceInit % 60));\n }\n }));\n model.getTimer().setInitialDelay(0);\n model.getTimer().start();\n }\n });\n this.view.getHomePanel().getViewRulesBtn().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n rulesCaller = \"home\"; // -> Rules was called from the 'home' panel, so return to it when done\n view.getCardLayoutManager().show(view.getContent(), \"rules\");\n }\n });\n this.view.getHomePanel().getSignoutBtn().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n Object[] options = {\"Yes, sign out\", \"No way!\"};\n int result = JOptionPane.showOptionDialog(getParent(), \"Are you sure you want to sign out?\", \"Leaving Already?\", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);\n if (result == 0) {\n view.getCardLayoutManager().show(view.getContent(), \"welcome\");\n model.setPlayer(null);\n model.setPuzzle(null);\n model.setHintsUsed(0);\n model.setTimer(null);\n view.getGamePanel().getHintBtn().setEnabled(true);\n view.getHomePanel().getLevelSelector().setSelectedIndex(0);\n }\n }\n });\n\n // Actions Listeners on Game & Rules Panel\n this.view.getGamePanel().getHintBtn().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n // User wants a hint, check if game has unused hints\n if (model.getHintsUsed() < model.getPuzzle().getDifficulty().getMaxHints()) {\n model.getPuzzle().hint(false);\n model.setHintsUsed(model.getHintsUsed() + 1);\n update();\n System.err.println(\"HINT USED: \" + model.getStringHintsUsed());\n if (model.getHintsUsed() == model.getPuzzle().getDifficulty().getMaxHints()) {\n view.getGamePanel().getHintBtn().setEnabled(false);\n JOptionPane.showOptionDialog(getParent(), \"Let's not make it too easy!\\nThat was the last hint for this game.\\n\\nDid you Know?\\nSudokus can likely prevent Alzheimer's disease\\nand Dementia, so don't make it too easy.\", \"Out of Hints\", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);\n }\n checkGridCompletion();\n }\n }\n });\n this.view.getGamePanel().getViewRulesBtn().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n // Show Rules Panel\n rulesCaller = \"game\"; // -> Rules was called from the 'game' panel, so return to it when done\n view.getCardLayoutManager().show(view.getContent(), \"rules\");\n }\n });\n this.view.getRulesPanel().getBackBtn().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n view.getCardLayoutManager().show(view.getContent(), rulesCaller); // -> Return to caller panel\n }\n });\n this.view.getGamePanel().getEndGameBtn().addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n Object[] options = {\"That's it\", \"Cancel\"};\n int result = JOptionPane.showOptionDialog(getParent(), \"Are you sure you want to end the game?\\n\\nThis Sudoku is best played in one sitting,\\nand can't be continued later.\", \"Exit?\", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);\n if (result == 0) {\n view.getCardLayoutManager().show(view.getContent(), \"home\");\n destroyGameInstance();\n }\n }\n });\n\n // Cell Listener Adapters\n this.cellKeyListener = new KeyAdapter() {\n /**\n * Validates the user input for the cell\n *\n * @param evt the key event trigger\n */\n @Override\n public void keyTyped(KeyEvent evt) {\n Cell cell = (Cell) evt.getSource();\n // Disregard entry if not 1-9 or text already exists\n if (!String.valueOf(evt.getKeyChar()).matches(\"^[1-9]$\") || cell.getText().length() == 1) {\n System.out.println(\"Input: \" + evt.getKeyChar() + \" was rejected.\");\n evt.consume();\n } else {\n // Check if input meets contraints\n if (!model.getPuzzle().meetsConstraints(cell, Integer.valueOf(String.valueOf(evt.getKeyChar()).trim()))) {\n System.err.println(\"VALUE \" + evt.getKeyChar() + \" AT \" + cell.getPosition() + \" DOES NOT MEET SUDOKU CONTRAINTS\");\n cell.setText(\"\");\n cell.setUserValue(0);\n evt.consume();\n } else {\n cell.setUserValue(Integer.valueOf(String.valueOf(evt.getKeyChar()).trim()));\n }\n checkGridCompletion();\n }\n }\n\n };\n this.cellMouseListener = new MouseAdapter() {\n // Cell Hover Attribute\n private Color preActionColor;\n\n /**\n * Event Handler for mouse button press\n *\n * @param evt the event trigger\n */\n @Override\n public void mousePressed(MouseEvent evt) {\n Cell cell = (Cell) evt.getSource();\n\n // On Right-Click, clear cell\n if (evt.getButton() == MouseEvent.BUTTON3) {\n cell.setText(\"\");\n cell.setUserValue(0);\n }\n\n cell.selectAll();\n }\n\n /**\n * Highlights game constraints for the hovered cell\n *\n * @param evt the cell being hovered\n */\n @Override\n public void mouseEntered(MouseEvent evt) {\n Cell cell = (Cell) evt.getSource();\n preActionColor = cell.getBackground();\n\n // Highlight Valid Cells\n for (Cell aCell : view.getGamePanel().getViewCellList()) {\n if (cell.getPosition().getRow() == aCell.getPosition().getRow()) {\n aCell.setBackground(APP_GREEN.darker().darker());\n }\n if (cell.getPosition().getColumn() == aCell.getPosition().getColumn()) {\n aCell.setBackground(APP_GREEN.darker().darker());\n }\n if (cell.getPosition().getSubgrid() == aCell.getPosition().getSubgrid()) {\n aCell.setBackground(APP_GREEN.darker().darker());\n }\n }\n\n cell.setBackground(APP_GREEN);\n }\n\n /**\n * Restores hover colors from hover event\n *\n * @param evt the hovered cell being exited from\n */\n @Override\n public void mouseExited(MouseEvent evt) {\n Cell cell = (Cell) evt.getSource();\n\n // Restore Color\n for (Cell aCell : view.getGamePanel().getViewCellList()) {\n if (aCell.isLocked()) {\n aCell.setBackground(BKGD_DARK_GRAY);\n } else {\n aCell.setBackground(BKGD_LIGHT_GRAY);\n }\n }\n\n cell.setBackground(preActionColor);\n }\n\n };\n }", "public void init(){\n\t\t//Makes the view\n\t\tsetUpView();\n\n\t\t//Make the controller. Links the action listeners to the view\n\t\tnew Controller(this);\n\t\t\n\t\t//Initilize the array list\n\t\tgameInput = new ArrayList<Integer>();\n\t\tuserInput = new ArrayList<Integer>();\n\t\thighScore = new HighScoreArrayList();\n\t}", "public Controller()\r\n {\r\n fillBombs();\r\n fillBoard();\r\n scoreBoard = new ScoreBoard();\r\n }", "public MainController() {\n initializeControllers();\n initializeGui();\n runGameLoop();\n }", "public GameController(VirtualView client, int num, String gameName) {\n running = new AtomicBoolean(true);\n setup = new AtomicBoolean(true);\n playerControllers = new ArrayList<PlayerController>();\n colors = new ArrayList<String>();\n colors.add(\"r\");\n colors.add(\"g\");\n colors.add(\"b\");\n Player p1 = new Player(client.getId(), colors.get(0));\n PlayerController p1Controller = new PlayerController(p1, client, this);\n game = new Game(gameName, p1, num);\n playerControllers.add(p1Controller);\n client.setPlayerController(p1Controller);\n }", "public void startNewGame()\n {\n // Display the Banner Page.\n \n System.out.println(\"\\nWelcome to the city of Aaron.\");\n \n // Prompt for and get the user’s name.\n String name;\n System.out.println(\"\\nPlease type in your first name: \");\n name = keyboard.next();\n\n // Call the createNewGame() method in the GameControl class\n \n GameControl.createNewGame(name);\n\n // Display a welcome message\n System.out.println(\"Welcome \" + name + \" have fun!!!\");\n \n //Call the GameMenuView\n GameMenuView gmv = new GameMenuView();\n gmv.displayMenu();\n }", "GameGUI() {\r\n _randomSource = new Random();\r\n _players = new Player[2];\r\n _input = new BufferedReader(new InputStreamReader(System.in));\r\n _players[0] = new HumanPlayer(BP, this);\r\n _players[1] = new MachinePlayer(WP, this);\r\n _playing = false;\r\n }", "private void createGameController() {\n\t\tLog.i(LOG_TAG, \"createGameController\");\n\n\t\tBundle intent = this.getIntent().getExtras();\n\t\t\n\t\tthis.punchMode = intent.getString(\"punchMode\");\n\t\t\n\t\tthis.gameController = new TimeTrialGameController( this.timerTextView,\n\t\t\t\tthis.numberOfPunchesCounterTextView, this.punchMode);\n\t\t\n\t\tthis.gameController.addObserver(this);\n\t}", "public static void populate() {\n HomeView homeView = new HomeView();\n homeView.setOnKeyPressed(keyEvent -> {\n WorldView worldView = WorldController.getWorld();\n worldView.getChildren().add(new Player(homeView.getNameText()));\n scene = new Scene(worldView,600,900);\n primaryStage.setTitle(\"Frogger Arcade\");\n primaryStage.setScene(scene);\n });\n primaryStage.setTitle(\"Frogger Home\");\n primaryStage.setScene(new Scene(homeView));\n primaryStage.show();\n }", "public MatchController()\n {\n // Here from Game_Constants interface constants such as number of players, black coins count\n // and red coins count are fetched.\n this.playerControllerList = new PriorityQueue<PlayerController>(new Comparator<PlayerController>(){\n @Override\n public int compare(PlayerController p1, PlayerController p2) \n {\n return (p1.getPoints() > p2.getPoints() ) ? -1: (p1.getPoints() < p2.getPoints()) ? 1:0 ;\n }\n });\n for(int i=0; i<GameConfiguration.NUMBER_OF_PLAYERS; i++)\n {\n this.playerControllerList.add(new PlayerController(i));\n }\n this.gameController = new GameController(GameConfiguration.BLACK_COINS_COUNT, GameConfiguration.RED_COINS_COUNT);\n this.turn = 0;\n }", "private void newGame()\r\n {\r\n //close the current screen\r\n screen.dispose();\r\n //start back at the set up menu\r\n SetupView screen = new SetupView();\r\n SetupController controller = new SetupController(screen);\r\n screen.registerObserver(controller);\r\n }", "public void startGame() {\n int numberOFPlayers = view.askForNumberOfPlayers();\n\n // adding dealer...\n players.add(dealer);\n //...and players to 'players' ArrayList\n for (int i = 1; i < numberOFPlayers; i++) {\n players.add(new RegularPlayer(i + 1));\n }\n\n // dealing cards to players\n dealer.dealCardsToPlayers(players);\n // Game\n while (!(players.size() == 1)) {\n\n for (int i = 0; i < players.size(); i++) {\n\n // printowanie ilości kart kazdego z graczy dla testów\n if (checkGameStatus()) {\n try {\n // display no of cards for each player\n for (Player player : players) {\n view.print(\"Player \" + player.getPlayerId() + \" no of cards: \" + player.getCardsCount());\n }\n\n round(players.get(i), players);\n } catch (IndexOutOfBoundsException e) {\n continue;\n }\n } else {\n break;\n }\n }\n }\n }", "public GameController(int width, int height) {\n\n // YOUR CODE HERE\n }", "@Override\r\n public boolean doAction(String[] inputs) {\n String playersName = inputs[0];\r\n //player = savePlayer(playersName)\r\n Player player = GameControl.savePlayer(playersName);\r\n //IF player == null\r\n if (player == null) {\r\n System.out.println(\"Could not create the player.\"\r\n + \"Enter a different name.\");\r\n //RETURN false // Repeats the StartProgramView\r\n return false;\r\n } else {\r\n System.out.println(\"****************************************\"\r\n + \" Hello\" + playersName + \",\"\r\n + \" Welcome to Delirium. Good luck!\"\r\n + \"****************************************\");\r\n }\r\n //mainMenuView = Create a new MainMenuView object\r\n MainMenuView mainMenuView = new MainMenuView();\r\n mainMenuView.display();\r\n return true;\r\n }", "public ViewMain()\n\t{\n\t\tview = new View();\n\t\t\n\t\tcolors = new Color[20][10];\n\t\tfor(int i=0; i < 20; ++i)\n\t\t\tfor(int j=0; j < 10; ++j)\n\t\t\t\tcolors[i][j] = Color.DARK_GRAY;\n\t\t\n\t\tpanel = new BoardGamePanel(colors);\n\t\tpanel.setVisible(true);\n\t\t\n\t\tgameInfo = new GameInfo();\n\t\t\n\t\tactionListenner();\n\t\t\n\t}", "public GameController(Match match)\n {\n this.match = match;\n gameMode = GameMode.NORMAL;\n\n MatchSettings settings = MatchSettings.getInstance();\n\n remainingSkulls = new AtomicInteger(settings.getSkullNumber());\n startTimerSeconds = settings.getStartTimerSeconds();\n deaths = Collections.synchronizedList(new ArrayList<>());\n map = Map.createMap(settings.getMapNumber());\n\n createDecks();\n }", "public GameView(ClientWindow window) {\n super(\"game\", window);\n initComponents();\n \n \n this.gamePanel = new GamePanel(this);\n add(gamePanel, BorderLayout.CENTER);\n \n this.chatPanel = new ChatPanel(this);\n add(chatPanel, BorderLayout.SOUTH);\n \n this.scoreboardPanel = new ScoreboardPanel();\n add(scoreboardPanel, BorderLayout.WEST);\n }", "View(Stage stage, Model model,Player player) {\n this.model = model;\n this.stage = stage;\n battleRoot = new BattleRoot(SCREEN_SIZE_X, SCREEN_SIZE_Y,player);\n playingScene = new Scene(battleRoot);\n this.stage.setScene(this.playingScene);\n// battleRoot.getChildren().addAll(textFieldRoot, enemysPlayFieldRoot, playFieldRoot, handCommand);\n }", "private void initViews() {\n TextView textViewPlayer1 = (TextView) findViewById(R.id.textView_player1);\n TextView textViewScorePlayer1 = (TextView) findViewById(R.id.textView_player1_score);\n ProgressBar progressBarPlayer1 = (ProgressBar) findViewById(R.id.progressBar_player1);\n\n TextView textViewPlayer2 = (TextView) findViewById(R.id.textView_player2);\n TextView textViewScorePlayer2 = (TextView) findViewById(R.id.textView_player2_score);\n ProgressBar progressBarPlayer2 = (ProgressBar) findViewById(R.id.progressBar_player2);\n\n ImageView imageViewDie = (ImageView) findViewById(R.id.imageView_die);\n\n TextView textViewAccumulated = (TextView) findViewById(R.id.textView_accumulated);\n TextView textViewPlayerTurn = (TextView) findViewById(R.id.textView_player_turn);\n TextView textViewStartTurn = (TextView) findViewById(R.id.textView_start_turn);\n\n Button buttonCollect = (Button) findViewById(R.id.button_collect);\n Button buttonThrow = (Button) findViewById(R.id.button_throw);\n\n // The views are stored in objects which handle its behaviour //\n BarScore barScorePlayer1 =\n new BarScore(textViewPlayer1, textViewScorePlayer1, progressBarPlayer1);\n BarScore barScorePlayer2 =\n new BarScore(textViewPlayer2, textViewScorePlayer2, progressBarPlayer2);\n ScoreBoard scoreBoard = new ScoreBoard(barScorePlayer1, barScorePlayer2);\n DieView dieView = new DieView(imageViewDie);\n GameInfo gameInfo =\n new GameInfo(textViewAccumulated, textViewPlayerTurn, textViewStartTurn);\n ButtonsToPlay buttons = new ButtonsToPlay(buttonThrow, buttonCollect);\n\n // These objects with views are GameObjects, so they are stored in a global array //\n gameObjects = new GameObject[]{scoreBoard, dieView, gameInfo, buttons};\n\n // The AlertDialog to show the winner message or exit message -> onBackPressed() //\n gameAlertDialog = new GameAlertDialog(this, game, gameObjects);\n\n // Listeners //\n buttonThrow.setOnClickListener(new ThrowListener(game, gameAlertDialog, gameObjects));\n buttonCollect.setOnClickListener(new CollectListener(game, gameObjects));\n textViewStartTurn.setOnClickListener(new StartTurnListener(game, gameObjects));\n }", "private ActionManager initModel(){ \n System.out.println(\"Welcome to Deadwood!\"); \n ArrayList<Player> players = new ArrayList<Player>();\n\n if(numOfPlayers == null){\n System.out.println(\"How many players?\");\n numOfPlayers = sc.nextInt();\n }\n if(numOfPlayers < 2 || numOfPlayers > 8){\n sc.close();\n throw new IllegalArgumentException(\"Invalid number of players.\");\n }\n sc.nextLine();\n for(int i = 1; i <= numOfPlayers; i++){\n System.out.println(\"What is your name?\");\n String playerName = sc.nextLine();\n if(!players.stream().anyMatch(p -> p.getName().equals(playerName))) { \n players.add(new Player(playerName));\n } else {\n System.out.println(\"Choose another name!\");\n i--;\n }\n }\n return new ActionManager(players);\n }", "GameResult start(Player uno , Player due , Model model ,Controller controller , ViewInterface view , gestioneInput io) throws IOException;", "public Game() {\r\n \r\n level = 1;\r\n \r\n enemyCount = 15;\r\n \r\n // world\r\n world = new Level1();\r\n \r\n world.populate(this);\r\n \r\n // view\r\n view = new MyView(world, this, 1000, 650);\r\n\r\n view.setGridResolution(1);\r\n\r\n // mouse controls\r\n view.addMouseListener(new MouseHandler(view, world.getPlayer()));\r\n \r\n\r\n // display the view in a frame\r\n JFrame frame = new JFrame(\"Multi-Level game\");\r\n\r\n // quit the application when the game window is closed\r\n frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n frame.setLocationByPlatform(true);\r\n // display the world in the window\r\n frame.add(view);\r\n controlPanel = new ControlPanel(world, this);\r\n frame.add(controlPanel, BorderLayout.WEST);\r\n // don't let the game window be resized\r\n frame.setResizable(false);\r\n // size the game window to fit the world view\r\n frame.pack();\r\n // make the window visible\r\n frame.setVisible(true);\r\n \r\n keyHandler = new KeyHandler(world.getPlayer());\r\n // key controls\r\n frame.addKeyListener(keyHandler);\r\n \r\n // give keyboard focus to the frame whenever the mouse enters the view\r\n view.addMouseListener(new GiveFocus(frame));\r\n \r\n // Invincibility\r\n if(world.getPlayer().getInivincibility() == true) {\r\n world.getPlayer().removeAllCollisionListeners();\r\n } \r\n\r\n // Debugging view\r\n // JFrame debugView = new DebugViewer(gameWorld, 1000, 650);\r\n \r\n // background sound\r\n audioManager = new AudioManager();\r\n levelMusic = audioManager.getLevel1Sound();\r\n levelMusic.loop();\r\n \r\n // start!\r\n world.start();\r\n \r\n }", "public void constructGameView(int num){\r\n\t\t\r\n\t\t//Create pawn panel\r\n\t\tgameView.getGamePiecesPanel().createPawnPanel(num);\r\n\t\t\r\n\t\t//Add action listeners to pawn buttons\r\n\t\tgameView.getGamePiecesPanel().setGamePieceButtonListener(new ActionListener(){\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\tif( pawnListener != null ){\r\n\r\n\t\t\t\t\tObject source = e.getSource();\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(source instanceof PawnButton){\r\n\t\t\t\t\t\tint index = ((PawnButton) source).getIndex();\r\n\t\t\t\t\t\tVari vari = ((PawnButton) source).getColor(); \r\n\t\t\t\t\t\r\n\t\t\t\t\t\tpawnListener.pawnPressPerformed(new PawnButtonEvent(index, vari));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}", "public void newGame() {\n // this.dungeonGenerator = new TowerDungeonGenerator();\n this.dungeonGenerator = cfg.getGenerator();\n\n Dungeon d = dungeonGenerator.generateDungeon(cfg.getDepth());\n Room[] rooms = d.getRooms();\n\n String playername = JOptionPane.showInputDialog(null, \"What's your name ?\");\n if (playername == null) playername = \"anon\";\n System.out.println(playername);\n\n this.player = new Player(playername, rooms[0], 0, 0);\n player.getCurrentCell().setVisible(true);\n rooms[0].getCell(0, 0).setEntity(player);\n\n frame.showGame();\n frame.refresh(player.getCurrentRoom().toString());\n frame.setHUD(player.getGold(), player.getStrength(), player.getCurrentRoom().getLevel());\n }", "public void startProgram() {\n this.displayBanner();\n// prompt the player to enter their name Retrieve the name of the player\n String playersName = this.getPlayersName();\n// create and save the player object\n User user = ProgramControl.createPlayer(playersName);\n// Display a personalized welcome message\n this.displayWelcomeMessage(user);\n// Display the Main menu.\n MainMenuView mainMenu = new MainMenuView();\n mainMenu.display();\n }", "public GameView(GameModel model, GameController controller) {\n\t\tsuper(\"Puzzler\");\n\t\tSystem.out.println(\"view\");\n\t\t\n \tthis.model = model;\n \tthis.controller = controller;\n\t\t\n\t\tsize = model.getSize();\n\t\t\n\t\t// 1 is small icons and 2 is medium\n\t\tif (size > 25)\n\t\t\tdotSize = 1;\n\t\telse\n\t\t\tdotSize = 2;\n\t\t\n\t\tsetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\tsetBackground(Color.WHITE);\n\n\n\t\t// Updates and Shows The Number of Steps \n\t\tnumberofsteps= new JLabel(\" Number of steps: \" + 0);//model.getNumberOfSteps());\n\n\t\t// Reset Button\n\t\tJButton reset = new JButton(\"reset\");\n\t\treset.setFocusPainted(false);\n\t\treset.addActionListener(controller);\n\n\t\tJButton quit= new JButton(\"quit\");\n\t\tquit.setFocusPainted(false);\n\t\tquit.addActionListener(controller);\n\n\t\t// Create Dot Panel\n\t\tJPanel dotPanel = new JPanel();\n\t\tdotPanel.setBackground(Color.WHITE);\n\t\tdotPanel.setLayout(new GridLayout(size+1, size));\n\t\tdotPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 0, 20));\n\t\t\n\t\t// Create Dot Selection Panel\n\t\tJPanel selectPanel = new JPanel();\n\t\tselectPanel.setBackground(Color.WHITE);\n\t\tselectPanel.setLayout(new GridLayout(1, 3));\n\t\t\n\t\t// Create Dot options Panel\n\t\tJPanel optionsPanel = new JPanel();\n\t\toptionsPanel.setBackground(Color.WHITE);\n\t\toptionsPanel.setLayout(new GridLayout(1, 3));\n\t\t\n\t\t// Create Selection Dots\n\t\tDotButton d0 = new DotButton(0, 0, 0, 3);\n\t\tDotButton d1 = new DotButton(0, 1, 1, 3);\n\t\tDotButton d2 = new DotButton(0, 2, 2, 3);\n\t\tDotButton d3 = new DotButton(0, 3, 3, 3);\n\t\tDotButton d4 = new DotButton(0, 4, 4, 3);\n\t\tDotButton d5 = new DotButton(0, 5, 5, 3);\n\t\t\n\t\t// Add action listeners\n\t\td0.addActionListener(controller);\n\t\td1.addActionListener(controller);\n\t\td2.addActionListener(controller);\n\t\td3.addActionListener(controller);\n\t\td4.addActionListener(controller);\n\t\td5.addActionListener(controller);\n\t\t\n\t\t// Add selection buttons to panel\n\t\tselectPanel.add(d0);\n\t\tselectPanel.add(d1);\n\t\tselectPanel.add(d2);\n\t\tselectPanel.add(d3);\n\t\tselectPanel.add(d4);\n\t\tselectPanel.add(d5);\n\t\t\n\t\t// Add options buttons\n\t\toptionsPanel.add(numberofsteps);\n\t\toptionsPanel.add(reset);\n\t\toptionsPanel.add(quit);\n\t\t\n\t\t\n\t\t// Add buttons\n\t\tdots = new DotButton[size][size];\n\t\taddDots(dotPanel);\n\t\t\n\t\t// Add panels to frame\n\t\tadd(dotPanel);\n\n\t\t//adding two south panels to frame \n\t\tJPanel southPanel=new JPanel();\n\t\tsouthPanel.setLayout(new GridLayout(2, 6));\n\t\tsouthPanel.add(selectPanel,BorderLayout.NORTH);\n\t\tsouthPanel.add(optionsPanel,BorderLayout.SOUTH);\n\t\tadd(southPanel,BorderLayout.SOUTH);\n\n\t\tpack();\n\t\tsetResizable(false);\n\t\tsetVisible(true);\t\n }", "public KiwiCountUI(Game game) \n {\n assert game != null : \"Make sure game object is created before UI\";\n this.game = game;\n setAsGameListener();\n initComponents();\n initIslandGrid();\n update();\n \n }", "private GameController() {\n\n }", "@FXML\n void startGame(ActionEvent event) {\n logic.viewUpdated();\n }", "public NetGameView() {\n\t\tnet = new Net(0, 0);\n\t\tt = new Text(\"\" + score);\n\t\tFont font = Font.font(\"Verdana\", FontWeight.EXTRA_BOLD, 50);\n\t\tt.setFont(font);\n\t\tButton mapButton = new Button(\"Return\");\n\t\tButton tutorial = new Button(\"Show Tutorial\");\n\t\tGroup root = new Group();\n\t\tgameThree = new Scene(root);\n\t\tfishAlert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n\t\tenemyAlert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n\t\ttrashAlert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n\t\tcontrolAlert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n\t\tfishAlert.setGraphic(new ImageView(new Image(\"Game_Sprites/fish_bass_left.png\")));\n\t\tenemyAlert.setGraphic(new ImageView(new Image(\"Game_Sprites/fish_catfish_left_0.png\")));\n\t\ttrashAlert.setGraphic(new ImageView(new Image(\"Game_Sprites/trashbag.png\")));\n\t\t\n\t\t\n\t\troot.addEventFilter(MouseEvent.MOUSE_MOVED, e -> {\n\t\t\t// System.out.println(e.getSceneX() + \" \" + e.getSceneY());\n\t\t\tnet.setX(e.getSceneX() - 140);\n\t\t\tnet.setY(e.getSceneY() - 140);\n\n\t\t});\n\n\t\tCanvas canvas = new Canvas(canvasWidth, canvasHeight);\n\t\troot.getChildren().add(canvas);\n\n\t\tmapButton.setOnAction(new EventHandler<ActionEvent>() {\n\t\t\tpublic void handle(ActionEvent e) {\n\t\t\t\tgameLevel = Level.MAP;\n\n\t\t\t}\n\t\t});\n\t\ttutorial.setOnAction(new EventHandler<ActionEvent>() {\n\t\t\tpublic void handle(ActionEvent e) {\n\t\t\t\tcontrolAlert.showAndWait();\n\t\t\t\talert4 = false;\n\t\t\t\tfishAlert.showAndWait();\n\t\t\t\talert1 = false;\n\t\t\t\tenemyAlert.showAndWait();\n\t\t\t\talert2 = false;\n\t\t\t\ttrashAlert.showAndWait();\n\t\t\t\talert3 = false;\n\t\t\t\tscore = 0;\n\t\t\t}\n\t\t});\n\t\tcontrolAlert.initOwner(gameThree.getWindow());\n\t\t\n\t\tfishAlert.setContentText(\"Avoid removing Bass from their natural habitat through irresponsible fishing. Picking up these will lose you points.\");\n\t\tenemyAlert.setContentText(\"Catfish are a known invasive species in the estuary, remove them by using the net! Picking up these will gain you points.\");\n\t\ttrashAlert.setContentText(\"Trash and other pollutants litter the esturary, do your part and help clean it up! Picking up these will gain you points.\");\n\t\tcontrolAlert.setContentText(\"Remove fish and trash by moving the net over the item you want to pick up\");\n\t\t\n\t\troot.getChildren().add(mapButton);\n\t\troot.getChildren().add(tutorial);\n\t\ttutorial.setTranslateX(50);\n\t\ttutorial.setTranslateY(50);\n\t\tmapButton.setTranslateX(50);\n\t\tmapButton.setTranslateY(80);\n\t\tmapButton.setVisible(true);\n\n\t\tgc = canvas.getGraphicsContext2D();\n\n\t\tfor (int i = 0; i < 5; i++) {\n\t\t\tcollectables.add(new NormalFishCollect());\n\t\t}\n\t\tfor (int i = 0; i < 5; i++) {\n\t\t\tenemies.add(new EnemyFishCollect());\n\t\t}\n\t\tfor (int i = 0; i < 5; i++) {\n\t\t\ttrashList.add(new TrashCollect());\n\t\t}\n\n\t\timportImages();\n\t\troot.getChildren().add(t);\n\t\tt.setTranslateX(20);\n\t\tt.setTranslateY(40);\n\n\t}", "public void singlePlayerChosen(){\n DifficultyViewController dif = new DifficultyViewController(this);\n dif.showView();\n this.hideView();\n }", "public void InitGame(){\n System.out.format(\"New game initiated ...\");\n Game game = new Game(client_List);\n SetGame(game);\n }", "public GameContainer(int s, int m) {\r\n\t\tfinal int INPUT_HEIGHT = 100;\r\n \r\n setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);\r\n\t\tsetResizable(false);\r\n\t\tsetTitle(\"Kablewie!\");\r\n Game g = new Game(s,m);\r\n String playerName = JOptionPane.showInputDialog(\"Enter your name: \",\r\n\t\t\t\t\t\t\t\"New Challenger\");\r\n if (playerName != null) {\r\n \tif(playerName.length() > NAME_CHAR_LIM) {\r\n \tplayerName = JOptionPane.showInputDialog(\"Sorry character \"+\r\n\t\t\t\t \"limit is 20.\\n Enter your name: \", \"New Challenger\");\r\n }\r\n } else {playerName = \"N/A\";}\r\n g.newPlayer(playerName);\r\n JPanel input = new JPanel(); input.setSize(g.getWidth(), INPUT_HEIGHT);\r\n input.setLayout(new GridLayout(CONTROL_PANEL_Y, CONTROL_PANEL_X));\r\n JLabel lblSize = new JLabel(\"Size: \");\r\n input.add(lblSize);\r\n JTextField tfSize = new JTextField(TEXT_FIELD_SIZE);input.add(tfSize);\r\n JLabel lblMines = new JLabel(\"Number of mines: \");input.add(lblMines);\r\n JTextField tfMines = new JTextField(TEXT_FIELD_SIZE);input.add(tfMines);\r\n JButton btnNewGame = new JButton(\"New Game\");input.add(btnNewGame);\r\n JButton btnExit = new JButton(\"Exit\");input.add(btnExit);\r\n \r\n class InputHandler implements ActionListener {\r\n\t\t\t/**\r\n\t\t\t * Implementation of abstract method inherited from ActionListener\r\n\t\t\t * This method adds functionality to the buttons at the footer\r\n\t\t\t * of game container\r\n\t\t\t * @param e An ActionEvent \r\n\t\t\t */\r\n \tpublic void actionPerformed(ActionEvent e) {\r\n \t\tint size = 10;\r\n \t\tint mines = -1;\r\n \t\tboolean valid = true;\r\n \t\tboolean defaultValue = false;\r\n \t\tint sizeInput = 10;\r\n \t\tint mineInput = -1;\r\n \t\t\r\n \t\tif (e.getSource() == btnNewGame) {\r\n \t \t\tif (tfSize.getText().equals(\"\") || \r\n\t\t\t\t\t\t!isNumeric(tfSize.getText())) {\r\n \t \t\t\tsize = 10; defaultValue = true;\r\n \t \t\t} else {sizeInput = Integer.parseInt(tfSize.getText());}\r\n \t \t\tif ((sizeInput <= 30) && (sizeInput > 0) && \r\n\t\t\t\t\t (isNumeric(tfSize.getText()) || defaultValue)){\r\n \t \t\t\tsize = sizeInput; } else {valid = false;}\r\n\t\t\t\t\tif (tfMines.getText().equals(\"\") || \r\n\t\t\t\t\t !isNumeric(tfSize.getText())){\r\n \t \t\t\tmines = size; mineInput = size;\r\n \t \t\t} else {mineInput = Integer.parseInt(tfMines.getText()); }\r\n \t \t\tif ((mineInput <= 150) && \r\n\t\t\t\t\t (mineInput < (sizeInput*sizeInput)) && \r\n\t\t\t\t\t (isNumeric(tfSize.getText()) || defaultValue)){\r\n \t \t\t\tmines = mineInput;\r\n \t \t\t} else {valid = false;}\r\n \t \t\tif (valid){new GameContainer(size, mines); dispose();}else{\r\n \t \t\t\tJOptionPane.showMessageDialog(getGameContainer(),\r\n \t\t\t\t\t\"The size must be a number between 1 and 30. \"+\r\n\t\t\t\t\t\t\t\"\\n\\nThe number of mines must be between 0 \\n\"\r\n \t \t\t\t\t+ \"and the size squared and must not exceed 150.\",\r\n \t \t\t\t\t\"Incorrect value(s) entered\",\r\n\t\t\t\t\t\t\tJOptionPane.WARNING_MESSAGE);\r\n \t \t\t}\r\n \t \t\ttfSize.setText(\"\"); tfMines.setText(\"\");\r\n } else if (e.getSource() == btnExit) { dispose();}\r\n \t}\t\r\n }\r\n InputHandler handler = new InputHandler();\r\n btnNewGame.addActionListener(handler);\r\n btnExit.addActionListener(handler);\r\n getContentPane().add(g, BorderLayout.NORTH);\r\n getContentPane().add(input, BorderLayout.CENTER);\r\n g.getScoreboard().updateTime(); setResizable(false); \r\n\t\tpack(); setLocationRelativeTo(null); setVisible(true);\r\n\t}", "public Controller(ViewIF view) {\n\t\tthis.view = view;\n\t\tthis.dao = new DAO();\n\t\tthis.stats = new Statistics(this.dao);\n\t\tthis.gameStarted = false;\n\t}", "public void loadNewGameView()\n\t{\n\t\ttry {\n\t\t\tprimaryStage.setTitle(\"Neues Spiel\");\n\t\t\tGridPane root = new GridPane();\n\t\t\tFXMLLoader loader = new FXMLLoader(getClass().getResource(\"/view/NewGame.fxml\"));\n\t\t\troot = loader.load();\n\t\t\tNewGameViewController viewController = (NewGameViewController) loader.getController();\n\t\t\tviewController.setOnitamaController(onitamaController);\n\t\t\tviewController.init();\n\n\t\t\tScene scene = new Scene(root);\n\t\t\t//((Stage) outerPane.getScene().getWindow()).setScene(scene);\n\t\t\tPlatform.runLater(() -> { LoadViewController.primaryStage.setScene(scene); });\n\t\t\t//LoadViewController.primaryStage.setScene(scene);\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@FXML\n private void startGame(){\n AnchorPane anchorPane = new AnchorPane();\n Scene gameScene = new Scene(anchorPane, 800, 600);\n Stage gameStage = new Stage();\n GameView gameView = new GameView(anchorPane, gameScene, gameStage);\n gameView.gameStart();\n }", "private Scene createMainMenuScene() {\n VBox root = new VBox();\n root.setId(\"pane\");\n root.setAlignment(Pos.CENTER);\n root.setSpacing(BUTTON_DISTANCE);\n\n Label lTitle = new Label(\"2048 Fx\");\n lTitle.setId(\"title-label\");\n root.getChildren().add(lTitle);\n\n Button bNewGame = new Button(\"New game\");\n bNewGame.setOnAction(new EventHandler<ActionEvent>() {\n @Override\n public void handle(ActionEvent event) {\n Game.board.init();\n }\n });\n bNewGame.setId(\"c16\");\n root.getChildren().add(bNewGame);\n\n Button bLoadGame = new Button(\"Load game\");\n bLoadGame.setId(\"c256\");\n bLoadGame.setOnAction(new EventHandler<ActionEvent>() {\n @Override\n public void handle(ActionEvent event) {\n FileChooser fileChooser = new FileChooser();\n fileChooser.setTitle(\"Load saving\");\n File directory = new File(\"./savegames\");\n if (!directory.exists()) {\n directory = new File(\"./\");\n }\n fileChooser.setInitialDirectory(directory);\n FileChooser.ExtensionFilter extFilter =\n new FileChooser.ExtensionFilter(\"Saved 2048 games\", \"*.saving\");\n fileChooser.getExtensionFilters().add(extFilter);\n File file = fileChooser.showOpenDialog(Game.stage);\n if (file != null) {\n Game.board.replay(file);\n }\n }\n });\n root.getChildren().add(bLoadGame);\n\n Button bSettings = new Button(\"Settings\");\n bSettings.setId(\"c4096\");\n bSettings.setOnAction(new EventHandler<ActionEvent>() {\n @Override\n public void handle(ActionEvent event) {\n settingsMenu();\n }\n });\n root.getChildren().add(bSettings);\n\n Button bGenerate = new Button(\"Also\");\n bGenerate.setOnAction(new EventHandler<ActionEvent>() {\n @Override\n public void handle(ActionEvent event) {\n\tGame.statBoard.statMenu();\n }\n });\n bGenerate.setId(\"c1024\");\n root.getChildren().add(bGenerate);\n\n Button bQuit = new Button(\"Quit\");\n bQuit.setId(\"c65536\");\n bQuit.setOnAction(new EventHandler<ActionEvent>() {\n @Override\n public void handle(ActionEvent event) {\n FileHandler.saveSettings(Game.settings);\n Game.stage.close();\n }\n });\n root.getChildren().add(bQuit);\n Scene menuScene = new Scene(root, Game.WINDOW_SIZE_X, Game.WINDOW_SIZE_Y);\n menuScene.getStylesheets().\n addAll(this.getClass().getResource(\"menu.css\").toExternalForm());\n return menuScene;\n }", "public void loadGameView() {\n\t\ttry {\n\t\t\tprimaryStage.setTitle(\"Spiel Laden\");\n\t\t\tBorderPane root = new BorderPane();\n\t\t\tFXMLLoader loader = new FXMLLoader(getClass().getResource(\"/view/LoadGame.fxml\"));\n\t\t\troot = loader.load();\n\t\t\tLoadGameViewController loadGameViewController = (LoadGameViewController) loader.getController();\n\t\t\tloadGameViewController.setOnitamaController(onitamaController);\n\t\t\tloadGameViewController.init();\n\t\t\tScene scene = new Scene(root);\n\t\t\t//((Stage) outerPane.getScene().getWindow()).setScene(scene);\n\t\t\t//LoadViewController.primaryStage.setScene(scene);\n\t\t\tPlatform.runLater(() -> { LoadViewController.primaryStage.setScene(scene); });\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@FXML\n public void handleKeyPress(KeyEvent event) {\n // TODO = handle additional key presses, e.g. for consuming a health potion\n switch (event.getCode()) {\n case SPACE:\n if (isPaused) {\n startTimer();\n } else {\n pause();\n }\n break;\n case H: // try to use health potion\n world.useHealthPotion();\n break;\n case M:\n world.showGameMode();\n break;\n // case R: // restart game\n // LoopManiaApplication a = new LoopManiaApplication();\n // Stage s = new Stage();\n // try {\n // a.start(s);\n // } catch (IOException e) {\n // // TODO Auto-generated catch block\n // e.printStackTrace();\n // }\n // break;\n case P: // generate potion for player (test usage)\n System.out.println(\"Lot of items & cards generated for Player......\");\n loadItem(\"Potion\");\n loadItem(\"Helmet\");\n loadItem(\"Armour\");\n loadItem(\"Shield\");\n loadItem(\"Sword\");\n loadItem(\"Stake\");\n loadItem(\"Staff\");\n loadCard(\"Tower\");\n loadCard(\"Barracks\");\n loadCard(\"Campfire\");\n loadCard(\"Trap\");\n loadCard(\"VampireCastle\");\n loadCard(\"ZombiePit\");\n loadCard(\"Village\");\n break;\n // case L: \n // System.out.println(\"++++++++++++++++++++++++++++++++++\");\n // System.out.println(\"Showing equiped items:\");\n // for (int i = 0; i < 4; i++) {\n // for (int j = 0; i < 4; i++) {\n // Boolean b = world.getEquippedInventoryItemEntityByCoordinates(i, j) != null;\n // System.out.print(\" \" + b + \" \");\n // }\n // System.out.println(\"\");\n // }\n // System.out.println(\"++++++++++++++++++++++++++++++++++\");\n // break;\n default:\n break;\n }\n }", "@Override\n public void start(Stage primaryStage) {\n// if (screenWidth >= 414) {\n// screenWidth = 414;\n// }\n// if (screenHeight >= 736) {\n// screenHeight = 736;\n// }//preset stage/scene size\n\n //System.out.println(Integer.toString(screenWidth) + Integer.toString(screenHeight));\n System.out.print(\"Default:\");\n gameController = new GameController(1, 4);//default player and map size\n// gameController.newMapPane();//preload a Map Pane\n\n ScreenController mainContainer = new ScreenController();\n mainContainer.loadScreen(GroupGame.homeScreenID, GroupGame.homeScreenFile);\n mainContainer.loadScreen(GroupGame.newOptionID, GroupGame.newOptionFile);\n mainContainer.loadScreen(GroupGame.createPlayerID, GroupGame.createPlayerFile);\n mainContainer.loadScreen(GroupGame.MapScreenID, GroupGame.MapScreenFile);\n mainContainer.setScreen(GroupGame.homeScreenID);\n\n Group root = new Group();\n root.getChildren().addAll(mainContainer);\n Scene scene = new Scene(root);\n primaryStage.setScene(scene);\n primaryStage.show();\n }", "public abstract void init(int myIndex, GameView view);", "public void startProgram()\r\n\t{\r\n\t\tview.displayPlayerNames();\r\n\t\tview.loadGameData();\r\n\t\tview.displayGame();\r\n\t}", "public PlayerView2() {\n initComponents();\n }", "public GameController(){\n\t\t\n\t\tupdaterRunnable = new Updater();\n\t\tgameLoopThread = new Thread(updaterRunnable);\n\t\trunning = false;\n\t\tgameFinished = false;\n\t}", "public Controller(Game game, View consoleView, View graphicalView){\n\t\tthis.game = game;\n\t\tthis.consoleView = consoleView;\n\t\tthis.graphicalView = graphicalView;\t\n\t\t\n\t\tstart();\n\t}", "GameController makeGameController(LobbyController lobbyController);", "public Controller() {\n\t\tplaylist = new ArrayList<>();\n\t\tshowingMore = false;\n\t\tstage = Main.getStage();\n\t}", "public void loadGameCanvasView()\n\t{\n\t\ttry {\n\t\t\tprimaryStage.setTitle(\"Onitama\");\n\t\t\tGridPane root = new GridPane();\n\t\t\tFXMLLoader loader = new FXMLLoader(getClass().getResource(\"/view/GameCanvas.fxml\"));\n\t\t\troot = loader.load();\n\t\t\tGameCanvasViewController viewController = (GameCanvasViewController) loader.getController();\n\t\t\tviewController.setOnitamaController(onitamaController);\n\t\t\tviewController.init();\n\n\t\t\tScene scene = new Scene(root);\n\t \t// this fixes java bug when change scnene after dialog\n\t\t\t// javafx bug https://bugs.openjdk.java.net/browse/JDK-8140491\n\t\t\tPlatform.runLater(() -> { \n\t\t\t\tLoadViewController.primaryStage.setScene(scene);\n\t\t\t});\n\t\t\t//LoadViewController.primaryStage.setScene(scene);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public GameView(GameModel model, DiceModel diceModel) {\n this.model = model;\n this.controller = new GameController(model, diceModel);\n this.diceModel = diceModel;\n\n initComponents();\n\n model.addObserver(this);\n\n createComponents();\n updateScores();\n\n pack();\n }", "private void initializeGUIComponents() {\n\t\tmyScene = new Scene(myRoot);\n ButtonConditionManager.getInstance().beginListeningToScene(myScene);\n\t\tmyStage.setTitle(\"MY PLAYER VIEW\");\n\t\tmyStage.setScene(myScene);\n\t\tmyStage.show();\n\t\tmyCanvas = new GameCanvas();\n\t\tmyRoot.getChildren().add(myCanvas.getNode());\n\t\tmyCanvas.getNode().toBack();\n\t}", "public Controller (Game game) {\n fsm = new FiniteStateMachine();\n this.game = game;\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n Difficulty level = Difficulty.valueOf(view.getHomePanel().getLevelSelector().getSelectedItem().toString().toUpperCase());\n\n // Generate New Game\n Generator puzzle = new Generator();\n puzzle.generateGrid(level);\n model.setPuzzle(puzzle.getGrid());\n\n // Configure View\n view.getGamePanel().setViewCellList(model.getPuzzle().getCellList());\n view.getGamePanel().getLevelTitle().setText(String.valueOf(level));\n update();\n\n // Switch to Game Panel\n view.getCardLayoutManager().show(view.getContent(), \"game\");\n\n // Set up Game Timer & Start\n long start = Calendar.getInstance().getTimeInMillis() / 1000;\n model.setTimer(new Timer(1000, new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n long secondsSinceInit = ((Calendar.getInstance().getTimeInMillis() / 1000) - start);\n view.getGamePanel().getTimeLabel().setText(String.format(\"%02d:%02d\", secondsSinceInit / 60 % 60, secondsSinceInit % 60));\n }\n }));\n model.getTimer().setInitialDelay(0);\n model.getTimer().start();\n }", "private Game (String[] args) {\n numTotalPlayers = Integer.valueOf(args[2]); \n try {\n numComputerPlayers = Integer.parseInt(args[3]);\n } catch (ArrayIndexOutOfBoundsException e) {\n numComputerPlayers = 0;\n System.out.println(\"No computer players enabled.\");\n }\n numHumanPlayers = numTotalPlayers - numComputerPlayers;\n board = Board.getInstance(args[0], args[1]);\n view = View.getInstance();\n }", "private void startGame() {\n hideView(R.id.title);\n hideView(R.id.score);\n gameView.setVisibility(View.VISIBLE);\n level=0;\n totalPoints =0;\n gameView.setTotalPoints(totalPoints);\n startLevel();\n }", "public void createNewGame(Stage menuStage) {\n\t\t\n\t\tthis.menuStage = menuStage;\n\t\tthis.menuStage.hide();\n\t\tview = new GameView(inputs[1]);\n\t\ttry {\n\t\tview.show();\n\t\tgame = new Game(getNames(), inputs[0]);\n\t\tturned = false;\n\t\tview.initialisePlayerViews(nameList);\n\t\tcreateKeyListeners();\n\t\tcreateGameLoop();\n\t\t}catch (IndexOutOfBoundsException ex){\n\t\t\tthrow new GameException(\"User cancelled game\");\n\t\t}\n\t}", "public GameController(int width, int height) {\n\n this.width=width;\n this.height=height;\n model = new GameModel(width,height);\n view = new GameView(model,this);\n }", "@Override\n public void run(){\n Settings.setGameSettings(new Player(0,Color.RED,1800, \"Player 1\",true),\n new Player(1,Color.BLUE,1800, \"Player 2\",false),1800,25);\n MenuFrame menuFrame = new MenuFrame();\n }", "@Override\r\n public void show() {\r\n Gdx.input.setInputProcessor(combatController);\r\n }", "public void startMenu() {\n textAlign(CENTER);\n textFont(f);\n background(20, 20, 20);\n PImage img = loadImage (\"TRON.png\");\n image (img, 10, 100, width-20, 180);\n //text(\"TRON\", width/2, height/2);\n fill(color(109, 236, 255));\n textSize(34);\n text(\"Press [2-4] to Select a Game Size\", width/2, height/2 + 50);\n\n int playerSize = -1;\n\n // Below code is from: https://stackoverflow.com/questions/628761/convert-a-character-digit-to-the-corresponding-integer-in-c\n if (keyPressed) {\n playerSize = key - '0';\n\n if (playerSize >= 2 && playerSize <= 4) {\n // Later on player 1 and player 2 will be taken from text box input (same for color)\n this.players = new ArrayList();\n ArrayList<String> controls = new ArrayList();\n controls.add(\"wasd\"); // player 1\n controls.add(\"arrows\"); // player 2\n controls.add(\"ijkl\"); // player 3\n controls.add(\"gvbn\"); // player 4\n\n for (int i=0; i<playerSize; i++) {\n String controlString = controls.get(i);\n char[] controlArray = new char[4];\n if (controlString.equals(\"arrows\")) {\n controlArray[0] = UP;\n controlArray[1] = LEFT;\n controlArray[2] = DOWN;\n controlArray[3] = RIGHT;\n } else {\n for (int j=0; j<4; j++) { // Add each direction to the array using charAt\n controlArray[j] = controlString.charAt(j);\n }\n }\n this.players.add(new Player(controlArray[0], controlArray[1], controlArray[2], controlArray[3]).setControlKeys(controlString)); // One player mode breaks game\n }\n\n this.state = GameState.CREATE_PLAYER;\n }\n }\n}", "public GameController() {\n GameLoop.getInstance();\n }", "public SnakeGameView(Context context) {\n\t\tsuper(context);\n\t\tthis.context = context;\n\t\tmanager = new SnakeGameManager(context);\n\t}", "public LevelPackagesController(Croggle game) {\n\t\tthis.game = game;\n\t\tthis.initialiseLevelPackages();\n\t}", "public Game(){\n new Window(800, 800, \"Survival Game\", this);\n handler = new Handler();\n camera = new Camera(0,0);\n this.addKeyListener(new KeyInput(handler));\n\n //create the map\n map = new Map(handler);\n map.generateMap();\n map.drawWorld();\n\n player = new Player(100, 100, ID.Player, handler);\n handler.addObject(player);\n handler.addObject(new Bear(600, 600, ID.Bear, player));\n handler.addObject(new Deer(400, 400, ID.Deer, player));\n\n start();\n }", "public SimCardsMenu(Game game) {\n super(\"SimCardsMenu\", game);\n\n mDefaultLayerViewport.set(getScreenWidth() / 2, getScreenHeight() / 2, getScreenWidth() / 2, getScreenHeight() / 2);\n mDefaultScreenViewport.set(0, 0, (int) mDefaultLayerViewport.halfWidth * 2, (int) mDefaultLayerViewport.halfHeight * 2);\n\n // Load in the bitmaps used on the main menu screen\n AssetManager assetManager = mGame.getAssetManager();\n assetManager.loadAndAddBitmap(\"PlayGameButton\", \"img/PlayGame.png\");\n assetManager.loadAndAddBitmap(\"ViewDeckButton\", \"img/ViewDeck.png\");\n assetManager.loadAndAddBitmap(\"QuitGameButton\", \"img/QuitGame.png\");\n\n assetManager.loadAndAddBitmap(\"PlayGameButtonPushed\", \"img/PlayGamePushed.png\");\n assetManager.loadAndAddBitmap(\"ViewDeckButtonPushed\", \"img/ViewDeckPushed.png\");\n assetManager.loadAndAddBitmap(\"QuitGameButtonPushed\", \"img/QuitGamePushed.png\");\n\n assetManager.loadAndAddBitmap(\"GameLogo\", \"img/GameLogo.png\");\n assetManager.loadAndAddBitmap(\"SimCardsMenuBackground2\", \"img/SimCardsMenuBackground2.png\");\n\n // Define the spacing that will be used to position the buttons\n float offS = (mDefaultScreenViewport.bottom / 8) + 20.0f;\n\n //Define buttons\n\n mPlayButton = new PushButton(mDefaultScreenViewport.right / 2, mDefaultScreenViewport.bottom / 2 - 100.0f,\n mDefaultScreenViewport.right / 3.5F, mDefaultScreenViewport.bottom / 8, \"PlayGameButton\", \"PlayGameButtonPushed\",this);\n mPlayButton.setPlaySounds(true, true);\n\n mDeckButton = new PushButton(mDefaultScreenViewport.right / 2, mDefaultScreenViewport.bottom / 2 - 100.0f - offS,\n mDefaultScreenViewport.right / 3.5F, mDefaultScreenViewport.bottom / 8, \"ViewDeckButton\", \"ViewDeckButtonPushed\", this);\n mDeckButton.setPlaySounds(true, true);\n\n mQuitButton = new PushButton(mDefaultScreenViewport.right / 2, mDefaultScreenViewport.bottom / 2 - 100.0f - (2 * offS),\n mDefaultScreenViewport.right / 3.5F, mDefaultScreenViewport.bottom / 8, \"QuitGameButton\", \"QuitGameButtonPushed\", this);\n mQuitButton.setPlaySounds(true, true);\n\n //Define logo\n mLogo = new GameObject(mDefaultScreenViewport.width / 2, mDefaultScreenViewport.bottom - 270.0f,\n mDefaultScreenViewport.right / 2.5f, mDefaultScreenViewport.bottom / 2.5f,\n getGame().getAssetManager().getBitmap(\"GameLogo\"), this);\n\n //Define Background\n mBackground = new GameObject(mDefaultLayerViewport.halfWidth,\n mDefaultLayerViewport.halfHeight, mDefaultLayerViewport.halfWidth * 2, mDefaultLayerViewport.halfHeight * 2, getGame()\n .getAssetManager().getBitmap(\"SimCardsMenuBackground2\"), this);\n }", "public void prepareTheGame(){\n Thread t=new Thread( () -> {\n System.out.println(\"Preparing the game of lobby number \" + lobbyID);\n Collections.shuffle(nicknames);\n\n Controller controller = new Controller(nicknames, view);\n\n view.setController(controller);\n view.setClientConnectionToController();\n\n controller.play();\n }\n );\n\n t.start();\n }", "public YahtzeeView(){\n setLayout(null);\n cardLayout_Action = new CardLayout();\n gameCon_Layout = new FixSizeCardLayout();\n //panel used to house the cardLayout manager.\n mainBackGroundPanel = new MainSlot_JPanel();\n mainBackGroundPanel.setLayout(null);\n \n mainActionPanel = new JPanel(cardLayout_Action); \n mainActionPanel.setBounds(100, 48, 600, 434);\n gameControlPanel = new JPanel(gameCon_Layout);\n gameControlPanel.setBounds(120, 510, 540, 50);\n \n mainBackGroundPanel.add(mainActionPanel);\n mainBackGroundPanel.add(gameControlPanel);\n\n gameControlPanel.add(emptyGameControllerView(),\n \"Player-1GameController\");\n gameControlPanel.setOpaque(false);\n \n mainBackGroundPanel.setBounds(0,0,800,600);\n \n add(mainBackGroundPanel);\n setVisible(true);\n \n currentPage_ActionPanel = \"\";\n currentPage_ControlPanel = \"\";\n }", "public static void runGame() {\n //Create instance of Datacontroller for sample data\n DataController dataController = DataController.getInstance();\n Encounter encounter;\n Scanner scan = new Scanner( System.in);\n\n int commandNum; //Variable that determines state of game\n\n while(true) {\n //TODO: Enter list of options for movement at every iteration\n System.out.println(\"Please enter your command\");\n System.out.println(\"1. Exit Game\\n2. Enter Combat\\n3. Items\");\n commandNum = scan.nextInt();\n\n switch (commandNum) {\n case 1: //Exit Game\n return;\n case 2: // Join Controller.Encounter\n encounter = new Encounter(dataController.getPlayer(),dataController.getEnemy());\n try {\n encounter.startFight();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n break;\n case 3: // View Menu TODO: create menu class\n\n }\n }\n }", "public KeyboardController(Tanks game) \n {\n \ttanksGame = game;\n }", "private void startGame() {\n\t\tmain.next_module = new Game(main, inputs, gameSelectionData);\n\t}", "public void setUpHUDPanel() {\n\n\t\t//Criando e configurando painel que apresenta botoes de acoes\n\t\tthis.playerOptionPanel = new JPanel(null);\n\t\tthis.playerOptionPanel.setBounds(730, 315, 275, 235);\n\t\tthis.playerOptionPanel.setOpaque(false);\n\n\t\t//Criando e configurando botao para jogar/manipular dado\n\t\tthis.moveButton = new JButton(\"JOGAR O DADO\");\n\t\tthis.moveButton.setBounds(45, 25, 175, 45);\n\t\tthis.moveButton.setActionCommand(\"MOVE\");\n\t\tthis.moveButton.setMnemonic(KeyEvent.VK_M);\n\t\tthis.moveButton.setToolTipText(\"Cique aqui para jogar o dado e realizar o movimento\");\n\n\t\t//Adicionando tratador de evento para clique no botao\n\t\tthis.moveButton.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent event) {\n\t\t\t\tmanipulaDice();\n\t\t\t}\n\t\t});\n\n\t\t//Criando e configurando botao para realizar palpite\n\t\tthis.suggestButton = new JButton(\"REALIZAR PALPITE\");\n\t\tthis.suggestButton.setBounds(45, 90, 175, 45);\n\t\tthis.suggestButton.setActionCommand(\"SUGGEST\");\n\t\tthis.suggestButton.setMnemonic(KeyEvent.VK_S);\n\t\tthis.suggestButton.setEnabled(false);\n\t\tthis.suggestButton.setToolTipText(\"Clique aqui para realizar sugestão\");\n\n\t\t//Criando e configurando botao para realizar acusacao\n\t\tthis.accuseButton = new JButton(\"ACUSAR\");\n\t\tthis.accuseButton.setBounds(45, 160, 175, 45);\n\t\tthis.accuseButton.setActionCommand(\"ACCUSE\");\n\t\tthis.accuseButton.setMnemonic(KeyEvent.VK_A);\n\t\tthis.accuseButton.setToolTipText(\"Clique para fazer acusacao. OBS: Acusacao incorreta poderá te eliminar do jogo.\");\n\n\t\t//Adicionando os botoes corretamente no painel\n\t\tthis.playerOptionPanel.add(this.moveButton);\n\t\tthis.playerOptionPanel.add(this.suggestButton);\n\t\tthis.playerOptionPanel.add(this.accuseButton);\n\n\t\t//Incluindo painel em painel maior\n\t\tthis.add(this.playerOptionPanel);\n\t}", "public Game() \n {\n Logger.setLogger(null);\n createInstances();\n parser = new Parser();\n player = new Player();\n userInputs = new ArrayList<String>();\n }", "public void handleInput(KeyEvent kEvent, MouseEvent mEvent, ViewController viewController) {\n Game game = Game.getInstance();\n switch (game.getGameState()) {\n case GAME_SCREEN:\n if (kEvent != null) {\n if (!game.isGameStarted() && !game.isPlayerDead()) {\n if (game.startGame()) {\n viewController.isDeathAnimPlaying = false;\n viewController.isDeathAnimFinished = true;\n }\n }\n if (kEvent.getCode().equals(inputsMap.get(Input.UP_P1)))\n game.setNextPlayerAction(Movement.UP, 0);\n if (kEvent.getCode().equals(inputsMap.get(Input.DOWN_P1)))\n game.setNextPlayerAction(Movement.DOWN, 0);\n if (kEvent.getCode().equals(inputsMap.get(Input.RIGHT_P1)))\n game.setNextPlayerAction(Movement.RIGHT, 0);\n if (kEvent.getCode().equals(inputsMap.get(Input.LEFT_P1)))\n game.setNextPlayerAction(Movement.LEFT, 0);\n\n if (kEvent.getCode().equals(inputsMap.get(Input.UP_P2)))\n game.setNextPlayerAction(Movement.UP, 1);\n if (kEvent.getCode().equals(inputsMap.get(Input.DOWN_P2)))\n game.setNextPlayerAction(Movement.DOWN, 1);\n if (kEvent.getCode().equals(inputsMap.get(Input.RIGHT_P2)))\n game.setNextPlayerAction(Movement.RIGHT, 1);\n if (kEvent.getCode().equals(inputsMap.get(Input.LEFT_P2)))\n game.setNextPlayerAction(Movement.LEFT, 1);\n\n if (kEvent.getCode().equals(inputsMap.get(Input.ENTER)))\n if (game.isGameFinished() && game.isPlayerDead() && viewController.isDeathAnimFinished) {\n viewController.initButtons();\n game.runLater(() -> game.setGameState(GameState.MENU_SCREEN));\n Menu.getInstance().setTab(MenuTab.HIGHSCORE_ENTER);\n }\n }\n break;\n case MENU_SCREEN:\n switch (Menu.getInstance().getTab()) {\n case MAIN:\n if (mEvent != null) {\n Point mouseCoords = new Point((int) (mEvent.getSceneX() / ViewController.SCALE), (int) (mEvent.getSceneY() / ViewController.SCALE));\n if (Utils.isInside(mouseCoords, MenuTab.MAIN.getButton(\"1-player\").getHitbox())) {\n game.runLater(() -> game.setGameState(GameState.GAME_SCREEN));\n game.setNbPlayer(1);\n viewController.resetSprites();\n viewController.whenToStopDeathAnim = System.currentTimeMillis() - 1;\n viewController.whenToStopScoreAnim = System.currentTimeMillis() - 1;\n viewController.audioController.canPlayIntro(true);\n }\n if (Utils.isInside(mouseCoords, MenuTab.MAIN.getButton(\"2-players\").getHitbox())) {\n game.runLater(() -> game.setGameState(GameState.GAME_SCREEN));\n game.setNbPlayer(2);\n viewController.resetSprites();\n viewController.whenToStopDeathAnim = System.currentTimeMillis() - 1;\n viewController.whenToStopScoreAnim = System.currentTimeMillis() - 1;\n viewController.audioController.canPlayIntro(true);\n }\n if (Utils.isInside(mouseCoords, MenuTab.MAIN.getButton(\"controls\").getHitbox()))\n Menu.getInstance().setTab(MenuTab.CONTROLS);\n if (Utils.isInside(mouseCoords, MenuTab.MAIN.getButton(\"highscore\").getHitbox()))\n Menu.getInstance().setTab(MenuTab.HIGHSCORE);\n if (Utils.isInside(mouseCoords, MenuTab.MAIN.getButton(\"editor\").getHitbox())) {\n game.setGameState(GameState.LEVEL_EDITOR);\n if (!editorLaunched) {\n Runnable runnable = () -> {\n try {\n EditorViewController editorController = new EditorViewController();\n editorController.setInputController(this);\n editorController.start(new Stage());\n } catch (IOException e) {\n e.printStackTrace();\n }\n };\n Platform.runLater(runnable);\n editorLaunched = true;\n }\n }\n }\n break;\n case CONTROLS:\n boolean isButtonFocused = false;\n Input selectedInput = null;\n for (String id : MenuTab.CONTROLS.getButtonList())\n if (MenuTab.CONTROLS.getButton(id).isSelected()) {\n isButtonFocused = true;\n selectedInput = Input.valueOf(id);\n }\n if (mEvent != null) {\n Point mouseCoords = new Point((int) (mEvent.getSceneX() / ViewController.SCALE), (int) (mEvent.getSceneY() / ViewController.SCALE));\n if (!isButtonFocused) {\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(\"back\").getHitbox()))\n Menu.getInstance().setTab(MenuTab.MAIN);\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.UP_P1.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.UP_P1.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.UP_P1);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.DOWN_P1.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.DOWN_P1.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.DOWN_P1);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.RIGHT_P1.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.RIGHT_P1.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.RIGHT_P1);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.LEFT_P1.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.LEFT_P1.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.LEFT_P1);\n }\n\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.UP_P2.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.UP_P2.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.UP_P2);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.DOWN_P2.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.DOWN_P2.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.DOWN_P2);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.RIGHT_P2.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.RIGHT_P2.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.RIGHT_P2);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.LEFT_P2.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.LEFT_P2.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.LEFT_P2);\n }\n }\n }\n if (kEvent != null) {\n if (isButtonFocused && selectedInput != null) {\n if (currentCode == kEvent.getCode() || !inputsMap.containsValue(kEvent.getCode())) {\n setKey(selectedInput, kEvent.getCode());\n MenuTab.CONTROLS.getButton(selectedInput.toString()).setSelected(false);\n MenuTab.CONTROLS.getButton(selectedInput.toString()).setText(kEvent.getCode().getName());\n Loader.getInstance().saveConfigs(inputsMap);\n currentCode = null;\n } else\n audioController.warning();\n }\n }\n break;\n case HIGHSCORE:\n if (mEvent != null) {\n Point mouseCoords = new Point((int) (mEvent.getSceneX() / ViewController.SCALE), (int) (mEvent.getSceneY() / ViewController.SCALE));\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(\"back\").getHitbox()))\n Menu.getInstance().setTab(MenuTab.MAIN);\n }\n break;\n case HIGHSCORE_ENTER:\n if (kEvent != null) {\n Button button = MenuTab.HIGHSCORE_ENTER.getButton(\"name\");\n if ((kEvent.getCode().isLetterKey() || kEvent.getCode().isDigitKey())&& (button.getText().length() < 5))\n button.setText(button.getText() + kEvent.getText());\n else if (kEvent.getCode() == KeyCode.BACK_SPACE && button.getText().length() >= 1)\n button.setText(button.getText().substring(0, button.getText().length() - 1));\n else if (kEvent.getCode().equals(inputsMap.get(Input.ENTER)) && button.getText().length() > 0) {\n game.runLater(() -> game.addHighscore(new Score(game.getScoreToSave(), button.getText())));\n Loader.getInstance().saveHighscore(game.getHighscores());\n Menu.getInstance().setTab(MenuTab.MAIN);\n }\n }\n }\n break;\n }\n }", "public BattleShipGame(){\n ui = new UserInterface();\n played = false;\n highestScore = 0;\n }", "public Controller(char[][] levelmap){\r\n\t\r\n\tgameRunning = true;\r\n\tthis.wind = new Window();\r\n\tthis.map=levelmap;\r\n\tthis.Gameloop(this.map);\r\n\t\r\n\t}", "@Override\n public void show() {\n batch = new SpriteBatch();\n stage = createStage();\n\n // create overlays\n hud = new GigagalHUD();\n victoryOverlay = new VictoryOverlay();\n gameoverOverlay = new GameOverOverlay();\n\n // determine input processor\n useOnScreenControl = (Gdx.app.getType() == Application.ApplicationType.Android // on mobile\n || Configs.instance.isDebugOnScreenControlEnabled() // or debugging\n );\n\n if (useOnScreenControl) {\n onscreenControl = new OnscreenControl();\n gameInputProcessor = new TouchProcessor(onscreenControl);\n } else {\n gameInputProcessor = new KeyPressProcessor();\n }\n\n Gdx.input.setInputProcessor(gameInputProcessor);\n\n // load new level\n startNewLevel();\n }", "public void run(){\n //make sure user enters valid number of players\n if((numTotalPlayers < 1) || (numTotalPlayers > 8)){\n view.showErrorPopUp(\"Invalid input, please enter a player number from 2 to 8\");\n System.out.println(\"Please enter a number from 2 to 8\");\n System.exit(0);\n }\n \n //creates the player queue with diff values according to num players\n players = initPlayers();\n\n // init and show board and currentPlayer\n board.resetBoard();\n startNewTurn();\n view.show(); // show view as last step of run()\n\n if (numTotalPlayers == numComputerPlayers) { // if all players are computers, trigger doComputerTurn()\n view.showErrorPopUp(\"The board is excited to have all computer players, so it's about to shake things up, like it's dancing! \\n\\nWARNING: do not run the program with all of the players as computer players if you have epilepsy as the colors of the game are about to flash on-screen during the whole game.\");\n doComputerTurn();\n }\n }", "public void doInitializations(JFrame menu){\n\t\tup = false;\n\t\tdown = false;\n\t\tleft = false;\n\t\tright = false; //sonst läuft Spieler nach Neustart einfach los\n\t\tattack = false;\n\t\tattack2 = false;\n\t\t\n\t\tlevel = 1;\n\t\troom = 1;\n\t\tlast = System.nanoTime();\n\t\tgameover = 0;\n\t\t\n\t\tactors = new CopyOnWriteArrayList<Sprite>();\n\t\tattacks = new CopyOnWriteArrayList<Object>();\n\t\t\n\t\tlib = SpriteLib.getInstance();\n\t\t\n\t\t\n\t\tsoundlib = new SoundLib();\n\t\tsoundlib.loadSound(\"Hintergrund\", \"sound/Greensleeves.wav\");\n\t\tsoundlib.loadSound(\"Angriff\", \"sound/Angriff.wav\");\n\t\tsoundlib.loadSound(\"Zauber\", \"sound/Zauber.wav\");\n\t\tif(sound_running == true){\n\t\tsoundlib.loopSound(\"Hintergrund\");\n\t\t}\n\t\t\t\n\t\t////1 = Coins, 2 = Mana, 3 = Shop, 4 = Rüstung, 5 = Waffe, 6 = NPC\n\t\tplayer = new Player(lib.getSprite(\"resources/pics/player.gif\", 12, 1), 50, 50, 100, this);\n\t\tenemy = new Enemy(lib.getSprite(\"resources/pics/enemy.gif\", 4, 1), 100, 500, 10, 100, this);\n\t\tenemy3 = new IceEnemy(lib.getSprite(\"resources/pics/Eisgegner.gif\", 4, 1), 500, 50, 10, 100, this);\n\t\tenemy4 = new FireEnemy(lib.getSprite(\"resources/pics/Feuergegner.gif\", 4, 1), 600, 50, 10, 100, this);\n\t\tenemy2 = new Enemy(lib.getSprite(\"resources/pics/enemy.gif\", 4, 1), 300, 200, 10, 100, this);\n\t\tcoin = new Item(lib.getSprite(\"resources/pics/coin.gif\", 1, 1), 700, 400, 1, 100, this);\n\t\tcoin2 = new Item(lib.getSprite(\"resources/pics/coin.gif\", 1, 1), 670, 400, 1, 100, this);\n\t\tcoin3 = new Item(lib.getSprite(\"resources/pics/coin.gif\", 1, 1), 640, 400, 1, 100, this);\n\t\tcoin4 = new Item(lib.getSprite(\"resources/pics/coin.gif\", 1, 1), 610, 400, 1, 100, this);\n\t\tcoin5 = new Item(lib.getSprite(\"resources/pics/coin.gif\", 1, 1), 580, 400, 1, 100, this);\n\t\tcoin6 = new Item(lib.getSprite(\"resources/pics/coin.gif\", 1, 1), 100, 50, 1, 100, this);\n\t\tcoin7 = new Item(lib.getSprite(\"resources/pics/coin.gif\", 1, 1), 140, 50, 1, 100, this);\n\t\tcoin8 = new Item(lib.getSprite(\"resources/pics/coin.gif\", 1, 1), 180, 50, 1, 100, this);\n\t\tcoin9 = new Item(lib.getSprite(\"resources/pics/coin.gif\", 1, 1), 220, 50, 1, 100, this);\n\t\tcoin10 = new Item(lib.getSprite(\"resources/pics/coin.gif\", 1, 1), 260, 50, 1, 100, this);\n\t\tmana = new Item(lib.getSprite(\"resources/pics/mana.gif\", 1, 1), 470, 500, 2, 100, this);\n\t\tshop = new Item(lib.getSprite(\"resources/pics/shop.gif\", 1, 1), 400, 500, 3, 100, this);\n\t\tnpc = new Item(lib.getSprite(\"resources/pics/npc.gif\", 1, 1), 100, 100, 6, 100, this);\n\t\tschildeis = new Item(lib.getSprite(\"resources/pics/IceArmour.gif\", 1, 1), 100, 200, 4, 100, this);\n\t\tschildfeuer = new Item(lib.getSprite(\"resources/pics/FireArmour.gif\", 1, 1), 150, 200, 9, 100, this);\n\t\tschwerteis = new Item(lib.getSprite(\"resources/pics/IceSword.gif\", 1, 1), 100, 150, 5, 100, this);\n\t\tschwertfeuer = new Item(lib.getSprite(\"resources/pics/FireSword.gif\", 1, 1), 150, 150, 10, 100, this);\n\t\thealthpack = new Item(lib.getSprite(\"resources/pics/healthpack.gif\", 1, 1), 500, 100, 7, 100, this);\n\t\tquest = new Quest(lib.getSprite(\"resources/pics/quest.gif\", 1, 1), 500, 200, 2, 100, this); //Münz-Quest\n\t\tquest2 = new Quest(lib.getSprite(\"resources/pics/quest.gif\", 1, 1), 100, 250, 1, 100, this); //Mathe-Münz-Quest\n\n\t\tactors.add(enemy); \n\t\tactors.add(enemy2); \n\t\tactors.add(enemy3);\n\t\tactors.add(enemy4); \n\t\tactors.add(coin); \n\t\tactors.add(coin2); \n\t\tactors.add(coin3); \n\t\tactors.add(coin4); \n\t\tactors.add(coin5);\n\t\tactors.add(coin6); \n\t\tactors.add(coin7); \n\t\tactors.add(coin8); \n\t\tactors.add(coin9); \n\t\tactors.add(coin10);\n\t\tactors.add(mana);\n\t\tactors.add(shop);\n\t\tactors.add(npc);\n\t\tactors.add(schwerteis);\n\t\tactors.add(schildeis);\n\t\tactors.add(schwertfeuer);\n\t\tactors.add(schildfeuer);\n\t\tactors.add(healthpack);\n\t\tactors.add(quest);\n\t\tactors.add(quest2);\n\t\tactors.add(player);\n\t\t\n\t\tcheckpointx = 50;\n\t\tcheckpointy = 50;\n\n\t\t\n\t\tplayer.setOldCoins(100);\n\t\tplayer.setOldXP(0);\n\t\tplayer.setOldMana(0);\n\t\tplayer.setOldWeapon(0);\n\t\tplayer.setOldArmour(0);\n\t\tplayer.setCoins(100);\n\t\tplayer.setXP(0);\n\t\tplayer.setOldMaxhealth(100);\n\t\t\n\t\tplayer.setSkillHealth1(false);\n\t\tplayer.setSkillHealth2(false);\n\t\tplayer.setSkillStrength1(false);\n\t\tplayer.setSkillStrength2(false);\n\t\t\n\t\tplayer.setOldSkillHealth1(false);\n\t\tplayer.setOldSkillHealth2(false);\n\t\tplayer.setOldSkillStrength1(false);\n\t\tplayer.setOldSkillStrength2(false);\n\t\t\n\t\t\n\t\tskillsOnce = false;\n\t\t\n\t\t//Erstellen der Karte, wobei die ersten 3 Parameter für die Eingabedateien stehen, die erste Zahl für die Anzahl der Spalten im TileSet, die zweite für die Anzahl der Zeilen\n\t\tmap = new MapDisplay(\"resources/level/TileMap_1_1.txt\", \"resources/pics/tiles_1.gif\", \"resources/pics/shadow.png\", 5, 1, this);\n\t\t\n\t\tinitSkills();\n\t\tmenu.dispose();\n\t\tsetStarted(true);\n\t\t\n\t}", "public GameManager(){\r\n init = new Initialisation();\r\n tower=init.getTower();\r\n courtyard=init.getCourtyard();\r\n kitchen=init.getKitchen();\r\n banquetHall=init.getBanquetHall();\r\n stock=init.getStock();\r\n throneHall=init.getThroneHall();\r\n vestibule=init.getVestibule();\r\n stables=init.getStables();\r\n\r\n this.player = new Player(tower);\r\n\r\n push(new IntroductionState());\r\n\t}", "public static void main(String[] args) {\n//\n// controller.setSoldierRank(0, \"Turai\");\n// controller.addModel(new Model(2, \"Lera\", \"RavSamal\"));\n// controller.updateViews();\n\n Controller controller = new Controller();\n controller.addModel(new Model(1, \"Gal\", \"Citizen\"));\n controller.addModel(new Model(12121, \"bubu\", \"Smar\"));\n controller.addModel(new Model(624, \"Groot\", \"Tree\"));\n controller.addModel(new Model(-10, \"Deadpool\", \"Awesome\"));\n controller.addModel(new Model(100, \"Nikita\", \"Citizen\"));\n\n controller.presentUI();\n\n controller.updateViews();\n }", "public Controller() {\n model = new Model();\n comboBox = new ChannelComboBox();\n initView();\n new ChannelWorker().execute();\n timer = new Timer();\n }", "@Override\r\n\r\n public <K> void playGame(PyramidSolitaireModel<K> model, List<K> deck, boolean shuffle,\r\n int numRows, int numDraw) throws IllegalArgumentException {\r\n try {\r\n if (model == null || deck == null) {\r\n throw new IllegalArgumentException(\"Model is null\");\r\n } else {\r\n model.startGame(deck, shuffle, numRows, numDraw);\r\n }\r\n\r\n //creates a new view so the controller can call on it\r\n this.view = new PyramidSolitaireTextualView(model, ap);\r\n\r\n //creates a new model so the controller can call on it, don't need it because model is a\r\n // param\r\n // this.model = new BasicPyramidSolitaire();\r\n //transmit game state to appendable + transmit score\r\n\r\n try {\r\n view.render();\r\n if (model.isGameOver()) {\r\n return;\r\n }\r\n this.ap.append(\"\\nScore: \").append(String.valueOf(model.getScore())).append(\"\\n\");\r\n\r\n } catch (IOException e) {\r\n throw new IllegalStateException(\"Could not render Input\");\r\n }\r\n\r\n try {\r\n\r\n //TWO CONDITIONS FOR THE Loop to continue: if the game is NOT over and if the user\r\n // has more to input\r\n while (!model.isGameOver() && scan.hasNext()) {\r\n\r\n //there are more moves + game is still in progress\r\n String nextInput = scan.next();\r\n\r\n switch (nextInput) { //always assign scan.next to a variable\r\n //case:\r\n case \"rm1\":\r\n remove1Helper(model);\r\n break;\r\n case \"rm2\":\r\n remove4Helper(model);\r\n break;\r\n case \"rmwd\":\r\n remove3DrawHelper(model);\r\n break;\r\n case \"dd\":\r\n discardDrawHelper(model);\r\n break;\r\n //case if the game is quit\r\n case \"Q\":\r\n case \"q\":\r\n quitGameString(model);\r\n return;\r\n //unrecognized input\r\n default:\r\n ap.append(\"unrecognized input:\").append(nextInput);\r\n ap.append(\"\\n\");\r\n\r\n }\r\n if (quitGameBool) {\r\n quitGameString(model);\r\n return;\r\n }\r\n\r\n view.render();\r\n this.ap.append(\"\\n\");\r\n }\r\n\r\n } catch (IOException e) {\r\n //\r\n }\r\n\r\n } catch (IllegalStateException e) {\r\n throw new IllegalStateException(\"Illegal argument here please try again !\");\r\n }\r\n\r\n }", "public GameManager(int numberOfPlayers, int numberOfPcPlayers, String[] names, Scanner scanner) {\n gameStatus = true;\n state = new State(numberOfPlayers);\n cards = new ArrayList<>();\n //call make card depend on number of player\n for (int i = 0; i <= (numberOfPlayers-1)/10; i++) {\n makeCards();\n }\n //make instances of player and control.\n players = new ArrayList<>();\n controls = new ArrayList<>();\n for (int i = 0; i < numberOfPlayers; i++) {\n ArrayList<Card> playerCards = new ArrayList<>();\n for (int j = 0; j < 7; j++) {\n playerCards.add(cards.get(0));\n cards.remove(0);\n }\n players.add(new Player(names[i], playerCards));\n if (i < numberOfPcPlayers) {\n controls.add(new PcControl(players.get(i),state));\n }\n else {\n controls.add(new HumanControl(players.get(i), scanner));\n }\n }\n //put first current card\n putCurrentCard();\n }", "public interface GameControllerInterface {\n\n /**\n * Adds a {@link solution.interfaces.GameUIInterface} to the\n * implementation of {@link solution.interfaces.GameControllerInterface}\n *\n * @param listener the listener to be added\n */\n public void addUpdateListener(GameUIInterface listener);\n\n /**\n * removes a {@link solution.interfaces.GameUIInterface} from the\n * implementation of {@link solution.interfaces.GameControllerInterface}\n *\n * @param listener the listener to be removed\n */\n public void removeUpdateListener(GameUIInterface listener);\n\n /**\n * The following are a list of convenience data methods for the views\n */\n\n /**\n *\n * @return a list of all players in the current game\n */\n public List<Colour> getPlayerList();\n\n /**\n *\n * @return the player whose turn it currently is\n */\n public Colour getCurrentPlayer();\n\n /**\n * This method is used to get the current player's real position.\n * It's useful when displaying Mr X's real location on his turn.\n *\n * @return the current player's real position\n */\n public int getCurrentPlayerRealPosition();\n\n /**\n * This method gets the specified player's visible position,\n * that is, their last known position.\n *\n * @param colour the player whose position is required\n * @return the player's last known position\n */\n public int getPlayerVisiblePosition(Colour colour);\n\n /**\n *\n * @param currentPlayer the player whose tickets are required\n * @return a list of the player's tickets\n */\n public Map<Ticket,Integer> getPlayerTickets(Colour currentPlayer);\n\n /**\n * This method gets the list of valid moves the specified player may\n * perform from their location\n *\n * @param player the player whose moves are required\n * @param location the player's current location\n * @return a list of possible moves for the player from the specified location\n */\n public List<MoveTicket> getValidSingleMovesAtLocation(Colour player, int location);\n\n /**\n * This method gets the list of valid moves the specified player may\n * perform from their location after a first move has been performed.\n * The move type is specified by firstTicket and taken into account when\n * calculating the valid moves.\n *\n * @param player the player whose moves are required\n * @param location the player's current location\n * @param firstTicket the {@link scotlandyard.Ticket} used in the first move.\n * @return a list of possible moves for the player from the specified location\n */\n public List<MoveTicket> getValidSecondMovesAtLocation(Colour player, int location, Ticket firstTicket);\n\n /**\n *\n * @return a list of Mr X's moves\n */\n public List<MoveTicket> getMrXHistory();\n\n /**\n * This method will return the list of winning players,\n * or an empty list if there are currently none.\n *\n * @return the set of winning players if there are\n */\n public Set<Colour> getWinningPlayers();\n\n /**\n *\n * @return true if the game is over\n */\n public boolean isGameOver();\n\n /**\n * This method loads a game from file\n *\n * @param fileLocation the location of the saved file\n * @param replay whether or not the game should be animated back move by move\n */\n public void loadGame(File fileLocation, boolean replay);\n\n /**\n *\n * @return true if Mr X is currently visible\n */\n public boolean isMrXVisible();\n\n\n /**\n * This method saves the current game to file\n *\n * @param fileLocation the lactation to save the file to\n */\n public void saveGame(File fileLocation);\n\n\n\n /**\n * The following are a list of notify methods which allow view components\n * to inform the implementation of {@link solution.interfaces.GameControllerInterface} of changes\n */\n\n\n\n\n /**\n * This notifies the interface implementation that all players have been added to the\n * game\n * @param count the number of players that have been added\n */\n public void notifyAllPlayersAdded(final int count);\n\n /**\n * This notifies the interface implementation that the Game Map has been loaded\n * and hence further actions relying on load can begin.\n */\n public void notifyMapLoaded();\n\n /**\n * This notifies the interface implementation that the current move animation has\n * finished.\n */\n public void notifyMoveAnimationFinished();\n\n /**\n * This notifies the interface implementation that a move has been selected\n *\n * @param move the selected move\n */\n public void notifyMoveSelected(final Move move);\n\n\n\n\n\n}", "@FXML\n void HandleGameType(ActionEvent event) throws Exception{\n MenuController.GoMenuGameType();\n \n \n }", "public Game()\r\n\t{\r\n\t\tthis.players = new Player[Config.PlayerLimit];\r\n\t\tthis.resetGame();\r\n\t}", "public GameController(int width, int height) {\r\n\t\tthis.gameMap = new GameMap(10);\r\n\t\tthis.isDebugVisible = true;\r\n\t\tthis.initializeGUI(width, height);\r\n\t\tthis.gameMap.addObserver(this.mapView);\r\n\t\tthis.gameMap.addObserver(this.debugView);\r\n\t\tthis.gameMap.addObserver(this.controlView);\r\n\t\tthis.timer = new Timer(10000, this);\r\n\t\tthis.countdown = new Timer(1000, this);\r\n\t\tthis.timer.setActionCommand(\"Timer\");\r\n\t\tthis.countdown.setActionCommand(\"Countdown\");\r\n\t}", "void newGame() {\n logger.log(\"New game starting.\");\n logger.log(divider);\n\n\n // Create the deck.\n createDeck();\n logger.log(\"Deck loaded: \" + deck.toString());\n\t logger.log(divider);\n\n\n // Shuffle the deck.\n shuffleDeck();\n logger.log(\"Deck shuffled: \" + deck.toString());\n logger.log(divider);\n\n // Create the players.\n createPlayers();\n setGameState(GameState.PLAYERS_SPAWNED);\n\n // Deal cards to players' decks.\n deal();\n for (Player player : players) {\n logger.log(\"Hand: \" + player);\n }\n \n\n // Randomly select the active player for the first round.\n selectRandomPlayer();\n\n setGameState(GameState.NEW_GAME_INITIALISED);\n }", "public MenuController() {\r\n\t \r\n\t }", "public Game()\n {\n // initialise instance variables\n playerName = \"\";\n gameTotal = 0;\n }", "private void initializePlayerController (Player player) {\n if (player1 instanceof InteractivePlayer)\n new PlayerController(\n (InteractivePlayer)player,game,in);\n }", "@FXML\n public void initialize() {\n winnerName.setText(this.match.getWinner().getName());\n tournamentName.setText(this.match.getNameTournament());\n roundNumber.setText(this.match.getNbRonde()+\"\");\n firstPlayerScoreSet1.setText(this.match.getPoints(0)+\"\");\n secondPlayerScoreSet1.setText(this.match.getPoints(1)+\"\");\n firstPlayerScoreSet2.setText(this.match.getPoints(2)+\"\");\n secondPlayerScoreSet2.setText(this.match.getPoints(3)+\"\");\n firstPlayerScoreSet3.setText(this.match.getPoints(4)+\"\");\n secondPlayerScoreSet3.setText(this.match.getPoints(5)+\"\");\n namePlayer1.setText(this.match.getPlayer1().getName());\n namePlayer2.setText(this.match.getPlayer2().getName());\n firstPlayerName.setText(this.match.getPlayer1().getName());\n secondPlayerName.setText(this.match.getPlayer2().getName());\n\n\n }", "public Menu(){\n\t\tthis.player = null;\n\t\tthis.weapon = null;\n\t\tthis.power = null;\n\t\tthis.in = new Scanner(System.in);\n\t\tthis.bdd = new Driver();\n\t\tthis.savedIndex = 0;\n\n\t}", "private void setUpController(){\n\n SessionController.getInstance().addCommand(new PartyCreateCommand(\"PARTY_CREATE\"));\n SessionController.getInstance().addCommand(new PartyDetailsRetrieveCommand(\"PARTY_DETAILS_RETRIEVE\"));\n SessionController.getInstance().addCommand(new PartyInvitesRetrieveCommand(\"PARTY_INVITES_RETRIEVE\"));\n SessionController.getInstance().addCommand(new PartyLeaveCommand(\"PARTY_LEAVE\"));\n SessionController.getInstance().addCommand(new PartyMemberRemoveCommand(\"PARTY_MEMBER_REMOVE\"));\n SessionController.getInstance().addCommand(new PlayerCreateCommand(\"PLAYER_CREATE\"));\n SessionController.getInstance().addCommand(new PlayerInvitesRetrieveCommand(\"PLAYER_INVITES_RETRIEVE\"));\n SessionController.getInstance().addCommand(new PlayerLogOutCommand(\"PLAYER_LOG_OUT\"));\n }", "private void initPlayModeController() {\n playMode.setOnMouseClicked(event -> {\n MasterMindMain mm = null;\n try { mm = new MasterMindMain(); }\n catch (Exception e) { e.printStackTrace(); }\n mm.start(SimulatorMain.stage);\n });\n playMode.setOnMouseEntered(event -> { playMode.setGraphic(new Circle(5)); });\n playMode.setOnMouseExited(event -> { playMode.setGraphic(null); });\n }" ]
[ "0.674099", "0.6567885", "0.65562254", "0.6550608", "0.64955837", "0.6450296", "0.6410479", "0.6372124", "0.63306916", "0.632725", "0.63271403", "0.6262563", "0.623108", "0.6211139", "0.61888826", "0.6185595", "0.6177841", "0.61631566", "0.6121193", "0.6109254", "0.6097843", "0.6095743", "0.60915846", "0.6085231", "0.6084462", "0.6058724", "0.60560304", "0.605297", "0.6043703", "0.60195994", "0.6015669", "0.5982921", "0.59676284", "0.59633434", "0.5947047", "0.5945227", "0.5941353", "0.5940842", "0.59397733", "0.5936793", "0.5930939", "0.5926229", "0.5896829", "0.5888658", "0.5888408", "0.5888132", "0.5884534", "0.58834404", "0.5869729", "0.5863675", "0.58480465", "0.5835954", "0.58308315", "0.5825143", "0.582437", "0.58215326", "0.58196634", "0.5813874", "0.58106047", "0.58081", "0.5807422", "0.58058465", "0.58057666", "0.57985044", "0.5789771", "0.57779163", "0.57743883", "0.5760456", "0.5755093", "0.5751678", "0.57494783", "0.57446283", "0.5744308", "0.57399064", "0.5738177", "0.573135", "0.57295156", "0.5728083", "0.57268065", "0.5725236", "0.57227105", "0.5721759", "0.57191706", "0.57178646", "0.571302", "0.57120115", "0.57070047", "0.5704248", "0.57040584", "0.5697977", "0.56970984", "0.56965196", "0.5695055", "0.56947684", "0.56893826", "0.5685854", "0.56852573", "0.5673513", "0.5672264", "0.5668675" ]
0.65975165
1
/ The NameDialog throws a game exception if the user clicks on the cancel button.
private ArrayList<String> getNames() { NameDialog n = new NameDialog(); nameList = new ArrayList<String>(); try { nameList = n.getNames(inputs[1]); }catch(GameException ex) { view.close(); menuStage.show(); } return nameList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 changeNameDialog() {\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.change_name_dialog,null);\n\n changeName = view.findViewById(R.id.change_name);\n nCancel = view.findViewById(R.id.n_cancel);\n nSave = view.findViewById(R.id.n_save);\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 nSave.setOnClickListener(v -> {\n txtName = changeName.getText().toString().trim();\n if(TextUtils.isEmpty(txtName)){\n Toast.makeText(UserActivity.this, \"Your name is empty\" , Toast.LENGTH_SHORT).show();\n dialog.dismiss();\n }\n else {\n updateUserInfo(txtName);\n dialog.dismiss();\n }\n });\n\n nCancel.setOnClickListener(v -> dialog.dismiss());\n\n }", "private String getPlayerName() {\n\t\tString[] options = {\"OK\"};\n\t\tJPanel namePanel = new JPanel(new GridLayout(0, 1));\n\t\tJLabel lbl = new JLabel(\"Next player, what is your name?\");\n\t\tJTextField txt = new JTextField(10);\n\t\tnamePanel.add(lbl);\n\t\tnamePanel.add(txt);\n\t\t\n\t\t// show dialog box\n\t\tJOptionPane.showOptionDialog(frame, namePanel, \"Player name\",\n\t\t\t\tJOptionPane.NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options , options[0]);\n\t\tString playerName = txt.getText();\n\t\twhile(playerName.length() < 1){\n\t\t\tlbl.setText(\"Name must be at least one character long.\");\n\t\t\tJOptionPane.showOptionDialog(frame, namePanel, \"Player name\",\n\t\t\t\t\tJOptionPane.NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options , options[0]);\n\t\t\tplayerName = txt.getText();\n\t\t}\n\t\treturn playerName;\n\t}", "static String getNameFromUser( Frame owner )\n\t{\n\t\treturn JOptionPane.showInputDialog( owner,\n\t\t\t\t \"You are a high scorer! Please enter your name.\",\n\t\t\t\t \"Congratulations!\",\n\t\t\t\t JOptionPane.QUESTION_MESSAGE );\n\t}", "private void showRenameDialog() {\n \t\tAlertDialog.Builder alert = new AlertDialog.Builder( this );\n \n \t\talert.setTitle( this.getString( R.string.action_edit_gpsfilter_area_rename ) );\n \n \t\tfinal EditText input = new EditText( this );\n \t\tinput.setText( this.area.getName() );\n \t\talert.setView( input );\n \n \t\talert.setPositiveButton( android.R.string.ok, new DialogInterface.OnClickListener() {\n \t\t\tpublic void onClick( DialogInterface dialog, int whichButton ) {\n \t\t\t\tarea.setName( input.getText().toString() );\n \t\t\t}\n \t\t} );\n \n \t\talert.setNegativeButton( android.R.string.cancel, new DialogInterface.OnClickListener() {\n \t\t\tpublic void onClick( DialogInterface dialog, int whichButton ) {\n \t\t\t}\n \t\t} );\n \n \t\talert.show();\n \t}", "public static JDialog createSummonerNameDialog(final ChampionSelectGUI t) {\n\t\tfinal JPanel contentPanel = new JPanel();\n\t\tJLabel request = new JLabel(\"Please enter your summoner name\");\n\t\tcontentPanel.add(request);\n\t\trequest.setAlignmentX(Component.CENTER_ALIGNMENT);\n\t\tfinal JTextField input = new JTextField(10);\n\t\tinput.setHorizontalAlignment(SwingConstants.CENTER);\n\t\tcontentPanel.add(input);\n\t\tJButton ok = new JButton(\"ok\");\n\t\tcontentPanel.add(ok);\n\t\tok.setSize(200, 150);\n\t\tok.setAlignmentX(Component.CENTER_ALIGNMENT);\n\t\tfinal JDialog d = new JDialog(t, \"Summoner Name\", true);\n\t\td.setContentPane(contentPanel);\n\t\td.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);\n\t\td.setSize(400, 100);\n\t\td.setLocationRelativeTo(t);\n\t\td.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));\n\t\td.addWindowListener(new WindowListener() {\n\t\t\tpublic void windowClosing(WindowEvent e) {\n\t\t\t\tint ret = JOptionPane.showConfirmDialog(contentPanel, \"Are you sure you want to exit?\", \"Choose an option\", JOptionPane.YES_NO_OPTION);\n\t\t\t\tif (ret == 0) {\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tpublic void windowOpened(WindowEvent e) {\n\t\t\t\tinput.requestFocus();\n\t\t\t}\n\t\t\tpublic void windowClosed(WindowEvent e) {}\n\t\t\tpublic void windowIconified(WindowEvent e) { }\n\t\t\tpublic void windowDeiconified(WindowEvent e) { }\n\t\t\tpublic void windowActivated(WindowEvent e) { }\n\t\t\tpublic void windowDeactivated(WindowEvent e) { }\n\t\t});\n\t\tok.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tif (input.getText().equals(\"\")) {\n\t\t\t\t\tJOptionPane.showMessageDialog(contentPanel, \"Please input a summoner name.\", \"Message\", JOptionPane.ERROR_MESSAGE);\n\t\t\t\t} else {\n\t\t\t\t\tt.summNameArr[0] = input.getText();\n\t\t\t\t\td.setVisible(false);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn d;\n\t}", "private static void promptName() {\n\t\tSystem.out.print(\"Please enter a name: \");\n\t}", "private void requestUserName() {\n // Show an alert to ask for the name\n AlertDialog.Builder builder = new AlertDialog.Builder(this);\n builder.setTitle(\"Enter name:\");\n\n final EditText input_field = new EditText(this);\n\n builder.setView(input_field);\n\n // If a name is provided, let the user pass after pressing Ok\n builder.setPositiveButton(\"OK\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n name = input_field.getText().toString();\n }\n });\n // If a no name is provided, prompt again\n builder.setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n dialogInterface.cancel();\n requestUserName();\n }\n });\n\n builder.show();\n }", "@Override\n\t\t\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t\t\tuserName = (String) JOptionPane.showInputDialog(frame,\"Digite o nome:\");\n\t\t\t\t\t}", "private String getName()\r\n {\r\n return JOptionPane.showInputDialog(frame, \"Choose a screen name:\", \"Screen name selection\",\r\n JOptionPane.PLAIN_MESSAGE);\r\n }", "@Override \n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (editTextName.getText().toString().equalsIgnoreCase(\"\"))\n\t\t\t\t{\t\t\t\t\n\t\t\t\t\talertDialogNameMissing.setTitle(\"Erreur\");\n\t\t\t\t\talertDialogNameMissing.setMessage(\"Veuillez entrer votre prénom\");\n\t\t\t\t\t\n\t\t\t\t\talertDialogNameMissing.setButton(RESULT_OK, \"OK\", new DialogInterface.OnClickListener() {\n\t\t\t\t\t public void onClick(DialogInterface dialog, int which) {\n\n\t\t\t\t\t }\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\talertDialogNameMissing.show();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\topenContextMenu(v);\n\t\t\t\t}\n\t\t\t}", "public void AskName(){\r\n\t\tSystem.out.println(\"Player 2, please enter your name: \\nPredictable Computer\");\r\n\t\tplayerName = \"Predictable Computer\";\r\n\t}", "private void editName() {\n Routine r = list.getSelectedValue();\n\n String s = (String) JOptionPane.showInputDialog(\n this,\n \"Enter the new name:\",\n \"Edit name\",\n JOptionPane.PLAIN_MESSAGE,\n null, null, r.getName());\n\n if (s != null) {\n r.setName(s);\n }\n }", "public BelowAverageComputer() {\n\n name = JOptionPane.showInputDialog(\"Enter The Name Of The Below \"\n + \"Average Computer: \") ;\n }", "public void askForName(){\r\n boolean shouldReturnMenu = false;\r\n String name;\r\n while(true){\r\n name = JOptionPane.showInputDialog (\"Please enter your name!\"); \r\n if(name == null){\r\n GameApp.returnFromMakeProfileToMainMenu();\r\n return;\r\n }\r\n else if (name.length() == 0){\r\n JOptionPane.showMessageDialog (null, \"Error! Please enter a proper name.\", \"Invalid Name\", JOptionPane.PLAIN_MESSAGE); \r\n }\r\n else if (name.length() > 14)\r\n {\r\n JOptionPane.showMessageDialog (null, \"Error! The name you have entered is too long. The name must not exceed 14 characters.\", \"Invalid Name\", JOptionPane.PLAIN_MESSAGE); \r\n }\r\n else if (fileExists(name)){\r\n int n = JOptionPane.showConfirmDialog(null,\"This profile already exists. Do you want to override the file?\",\"Do you want to override the file?\",JOptionPane.YES_NO_OPTION);\r\n System.out.println(\"HERE: \" + n);\r\n if (n == 0){\r\n //shouldReturnMenu = true;\r\n //break;\r\n makeProfile(name);\r\n }\r\n else if (n == 1){\r\n shouldReturnMenu = true;\r\n break;\r\n }\r\n else if (n == -1){\r\n shouldReturnMenu = true;\r\n break;\r\n }\r\n else{\r\n makeProfile(name);\r\n }\r\n //ASK DYKE\r\n break;\r\n }\r\n else{\r\n makeProfile(name);\r\n //shouldReturnMenu = false;\r\n break;\r\n \r\n }\r\n }\r\n if(shouldReturnMenu)\r\n GameApp.returnFromMakeProfileToMainMenu();\r\n else{\r\n System.out.println(\"Working!\");\r\n GameApp.makeToView(\"../profiles/\" + name + \".profile\");\r\n }\r\n }", "@Override\n public void actionPerformed(AnActionEvent e) {\n Project project = e.getProject();\n Messages.showInputDialog(\"what is your name?\",\"input your name\",Messages.getQuestionIcon());\n\n }", "private boolean nameEntered(String gameName) {\n if (gameName.matches(\"\")) {\n Toast.makeText(this, \"You did not enter a game name.\", Toast.LENGTH_SHORT).show();\n return false;\n }\n return true;\n }", "private String promptForAlbumName() {\n\t\treturn (String)\n\t\t JOptionPane.showInputDialog(\n\t\t\t\talbumTree, \n\t\t\t\t\"Album Name: \", \n\t\t\t\t\"Add Album\",\n\t\t\t\tJOptionPane.PLAIN_MESSAGE, \n\t\t\t\tnull, \n\t\t\t\tnull, \n\t\t\t\t\"\");\t\t\n\t}", "public String getName() {return this.name.getText();}", "public void pedirNickname() {\n\t\tTextInputDialog dialog = new TextInputDialog(\"walter\");\n\t\tdialog.setTitle(\"Usuario\");\n\t\tdialog.setHeaderText(null);\n\t\tdialog.setContentText(\"Please enter your nickname:\");\n\t\tOptional<String> result = dialog.showAndWait();\n\t\tresult.ifPresent(name -> {\n\t\t\ttry {\n\t\t\t\tMain.getPartida().agregar(dialog.getContentText());\n\t\t\t\tMain.getPartida().guardar();\n\t\t\t\n\t\t\t} catch (JugadorYaRegistradoException | JugadorNoEncontradoException e) {\n\t\t\t\t\n\t\t\t\tAlert alert = new Alert(AlertType.INFORMATION);\n\t\t\t\talert.setTitle(\"Pokemon Training\");\n\t\t\t\talert.setHeaderText(null);\n\t\t\t\talert.setContentText(e.getMessage());\n\t\t\t\tStage stage = (Stage) alert.getDialogPane().getScene().getWindow();\n\t\t\t\tstage.getIcons().add(new Image(\"data/pokeBall.png\"));\n\t\t\t\tButtonType butthole = new ButtonType(\"Suck my dick\");\n\t\t\t\talert.getButtonTypes().setAll(butthole);\n\t\t\t\tOptional<ButtonType>asshole=alert.showAndWait();\n\t\t\t\tasshole.ifPresent(f-> pedirNickname());\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t}", "public String selectName()\n {\n JOptionPane nameSelector = new JOptionPane();\n String name = nameSelector.showInputDialog(\"What is this trainer's name?\");\n return name;\n }", "public void onClick(DialogInterface dialog, int id) {\n promptName = (userInput.getText()).toString();\n if(promptName==null || promptName.equals(\"\"))\n {\n starterPrompt();\n }\n }", "public boolean nameFile(String op) throws IOException{\n\n try{\n\n m_FileName = JOptionPane.showInputDialog(\"Enter \"+ op +\" Name\");\n\n } catch (Exception e){\n e.printStackTrace();\n }\n return true;\n }", "public Human() {\n\n name = JOptionPane.showInputDialog(\"Enter The Name Of The Human: \") ;\n }", "public void alertName(){\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.setTitle(\"Error al ingresar nombre\");\n alert.setHeaderText(\"Se encontró un error en el nombre,\"\n + \"tiene mas de 12 caracteres o está repetido. Debe ingresar el nombre nuevamente.\");\n alert.showAndWait();\n }", "@Override\n\t\t\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t\t\tJOptionPane.showMessageDialog(frame,\"Nome Atual: \" + userName);\n\t\t\t\t\t}", "public void AskName(String input){\r\n\t\tplayerName = input;\r\n\t}", "public void guessName()\n\t{\n\t\tSystem.out.println(\"Who do you think it is?\");\n\t\tguessName = scan.nextLine();\n\t\tif(guessName.equals(name))\n\t\t{\n\t\t\tSystem.out.println(\"Congratulations, you are correct!\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"You are incorrect\");\n\t\t\tSystem.out.println(\"The correct answer was \" + name);\n\t\t}\n\t}", "public void setCountryName(){\n\t\tcountry_name = JOptionPane.showInputDialog(FrameHandler.main_frame, \"Enter the name of your country\");\n\t}", "private void fNameActionPerformed(java.awt.event.ActionEvent evt) {\n\t }", "@Test\n public void GIncorrectNameFormat () {\n onView(withId(R.id.username)).check(matches(isDisplayed()));\n //change name to wrong format\n onView(withId(R.id.username)).perform(replaceText(\"34&\"));\n //click the button\n onView(withId(R.id.save)).perform(click());\n // check toast visibility\n onView(withText(R.string.NotCorrectName))\n .inRoot(new ToastMatcher())\n .check(matches(withText(R.string.NotCorrectName)));\n //check activity still shown\n assertFalse(activityTestRule.getActivity().isFinishing());\n }", "public void onClick(DialogInterface dialog, int id) {\n String title = editTextTitle.getText().toString();\n if(title.length() > 15)\n {\n Toast.makeText(context, \"Naslov ne sme biti daljši od 15 znakov!\" , Toast.LENGTH_SHORT ).show();\n }else {\n if (!title.equals(\"\")) {\n CreatePlayerNamesDialog(numberOfPlayers);\n } else {\n Toast.makeText(getActivity(), \"Naslov igre ne sme biti prazen!\", Toast.LENGTH_LONG).show();\n }\n }\n }", "private void changeBtName() {\n\t\tLayoutInflater factory = LayoutInflater.from(this);\n\t\tfinal View textEntryView = factory.inflate(R.layout.alert_dialog, null);\n\t\tfinal EditText e = (EditText) textEntryView\n\t\t\t\t.findViewById(R.id.btname_edit);\n\n\t\tAlertDialog ad = new AlertDialog.Builder(this)\n\t\t\t\t.setIconAttribute(android.R.attr.alertDialogIcon)\n\t\t\t\t.setTitle(\"Set ADK Bluetooth Name\")\n\t\t\t\t.setView(textEntryView)\n\t\t\t\t.setPositiveButton(R.string.set_bt_name_ok,\n\t\t\t\t\t\tnew DialogInterface.OnClickListener() {\n\t\t\t\t\t\t\tpublic void onClick(DialogInterface dialog,\n\t\t\t\t\t\t\t\t\tint whichButton) {\n\n\t\t\t\t\t\t\t\tcurBtName = e.getText().toString();\n\t\t\t\t\t\t\t\tif (curBtName.equals(\"\"))\n\t\t\t\t\t\t\t\t\tcurBtName = \"ADK 2012\";\n\n\t\t\t\t\t\t\t\tbyte b[] = null;\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tb = curBtName.getBytes(\"UTF-8\");\n\t\t\t\t\t\t\t\t} catch (UnsupportedEncodingException e1) {\n\t\t\t\t\t\t\t\t\t// well aren't you SOL....\n\t\t\t\t\t\t\t\t\te1.printStackTrace();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbyte b2[] = new byte[b.length + 1];\n\t\t\t\t\t\t\t\tfor (int i = 0; i < b.length; i++)\n\t\t\t\t\t\t\t\t\tb2[i] = b[i];\n\t\t\t\t\t\t\t\tb2[b.length] = 0;\n\n\t\t\t\t\t\t\t\tsendCommand(CMD_BT_NAME, CMD_BT_NAME, b2);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t.setNegativeButton(R.string.set_bt_name_cancel,\n\t\t\t\t\t\tnew DialogInterface.OnClickListener() {\n\t\t\t\t\t\t\tpublic void onClick(DialogInterface dialog,\n\t\t\t\t\t\t\t\t\tint whichButton) {\n\n\t\t\t\t\t\t\t\t// user cancels\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}).create();\n\n\t\te.setText(curBtName);\n\t\tad.show();\n\t}", "public void onClick(DialogInterface dialog,int id) {\n if(!(userInput.getText()+\"\").isEmpty()){\n createDirectories.isFileRenamed(fileName,(userInput.getText()+\"\"),\"Recordings\",selectedCurrentEvent);\n }\n mEditor.putBoolean(showNamePromptKey,!showToggle.isChecked());\n mEditor.apply();\n }", "public void Sair() {\r\n\t\t\t\r\n\t\t\tnome = JOptionPane.showInputDialog(\"Informe o seu nome ou SAIR para finalizar\");\r\n }", "public String lerNome() {\n\t\treturn JOptionPane.showInputDialog(\"Digite seu Nome:\");\n\t\t// janela de entrada\n\t}", "private void onCancelButtonPressed() {\r\n disposeDialogAndCreateNewGame(); // Reset board,\r\n game.setCanPlaceMarks(false); // But don't start a new game.\r\n }", "public ReservedNameException(String message, String name){\r\n super(message);\r\n this.name = name;\r\n }", "private void validate(String name) {\r\n /*\r\n Check to make sure that name is not blank and as a size of at least three characters and does not contain any spaces\r\n constant for min username chars.\r\n */\r\n final int MIN_USERNAME_CHARS = 3;\r\n if (name.isEmpty() || name.length() < MIN_USERNAME_CHARS || name.contains(\" \")) {\r\n // if so, show error message box\r\n showError(\"You must have a name at least \" + MIN_USERNAME_CHARS + \" characters long and have no spaces.\", \"Error\");\r\n } else {\r\n // set the host name\r\n Preferences.getInstance().setHostName(name);\r\n Preferences.getInstance().save();\r\n // close the window\r\n close();\r\n }\r\n }", "@Override\r\n\tpublic void setOpponentName(String name) {\n\t\tmain.setOpponentUsername(name);\r\n\t}", "@Override\n public void onClick(View view) {\n String playerName = nameEditText.getText().toString();\n if ( playerName.matches(\"\") || TextUtils.isEmpty(playerName))\n {\n nameEditText.setError(\"Please Enter Name To play QUIZ !!!\");\n }\n else\n {\n Intent intent = new Intent(MainActivity.this, QuizActivity.class);\n intent.putExtra(\"name\", playerName);\n startActivity(intent);\n finish();\n }\n }", "@Override\n\t\t\t\t\tpublic void onCancel(DialogInterface dialog) {\n\t\t\t\t\t}", "public void initButtons() {\n\t\tcomponents.clear();\n\t\t\n\t\tImageButton rename = new ImageButton(width - 124, 0, 45, 45);\n\t\trename.setTexture(\"/graphics/textures/ui/Rename.png\");\n\t\trename.disabledColor = IGuiElement.gray;\n\t\trename.setClickEvent(new IGuiEvent() {\n\t\t\t@Override\n\t\t\tpublic void trigger() {\n\t\t\t\tfinal InputField name = new InputField(0, 0, 0, Game.client.getUsername(), Tr._(\"username\"));\n\t\t\t\tDialog dialog = new Dialog(Tr._(\"namechange\"), \"\", new Action(Tr._(\"cancel\"), Dialog.CLOSE_EVENT), new Action(Tr._(\"ok\"), new IGuiEvent() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void trigger() {\n\t\t\t\t\t\tnew Thread() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\tGame.currentGame.getActiveScene().lockScene();\n\t\t\t\t\t\t\t\tString oldUsername = Game.client.getUsername();\n\t\t\t\t\t\t\t\tGame.client.renameClient(name.getText());\n\t\t\t\t\t\t\t\twhile (Game.client.getUsername().equals(oldUsername)) {\n\t\t\t\t\t\t\t\t\tif (Game.client.isRejected()) {\n\t\t\t\t\t\t\t\t\t\tGame.currentGame.getActiveScene().unlockScene();\n\t\t\t\t\t\t\t\t\t\tGame.currentGame.addScene(new Dialog(Tr._(\"error\"), Tr._(\"mp.reject.\" + Game.client.getRejectionCause().name().toLowerCase()), new Action(Tr._(\"close\"),\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\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\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tDialog.CLOSE_EVENT)));\n\t\t\t\t\t\t\t\t\t\tGame.client.resetRejection();\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tThread.sleep(100);\n\t\t\t\t\t\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGame.currentGame.getActiveScene().unlockScene();\n\t\t\t\t\t\t\t\tGame.currentGame.removeActiveScene();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}.start();\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t\tname.setWidth(dialog.getWidth() - 50);\n\t\t\t\tdialog.addComponent(name);\n\t\t\t\tGame.currentGame.addScene(dialog);\n\t\t\t}\n\t\t});\n\t\tadd(rename);\n\t\t\n\t\tImageButton kick = new ImageButton(width - 124, 36, 45, 45);\n\t\tkick.setTexture(\"/graphics/textures/ui/Logout.png\");\n\t\tkick.disabledColor = IGuiElement.gray;\n\t\tkick.setClickEvent(new IGuiEvent() {\n\t\t\t@Override\n\t\t\tpublic void trigger() {\n\t\t\t\tDialog dialog = new Dialog(Tr._(\"kick\"), Tr._(\"kickquestion\").replace(\"%player%\", p.getUsername()), new Action(Tr._(\"cancel\"), Dialog.CLOSE_EVENT),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnew Action(Tr._(\"ok\"), new IGuiEvent() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpublic void trigger() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGame.client.sendPacket(new Packet1Disconnect(p.getUsername(), \"mp.reason.kicked\"));\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGame.currentGame.removeActiveScene();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\t\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\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}));\n\t\t\t\tGame.currentGame.addScene(dialog);\n\t\t\t}\n\t\t});\n\t\tadd(kick);\n\t\t\n\t\tint nw = 190;\n\t\tfloat ratio = TextButton.HEIGHT / (float) TextButton.WIDTH;\n\t\tfinal TextButton ready = new TextButton(width - 128 - nw / 2, 15, Tr._(\"ready\"));\n\t\tready.setWidth(nw);\n\t\tready.setHeight((int) (ratio * nw));\n\t\tready.setToggleMode(true);\n\t\tready.setClickEvent(new IGuiEvent() {\n\t\t\t@Override\n\t\t\tpublic void trigger() {\n\t\t\t\ttry {\n\t\t\t\t\tp.setReady(ready.isActive());\n\t\t\t\t\tGame.client.sendPacket(new Packet6Player(p));\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tadd(ready);\n\t\t\n\t\tColorLabel c = new ColorLabel(width - 400, 1, height - 20, p.getColor());\n\t\tc.grayOnDisable = false;\n\t\tadd(c);\n\t}", "public void cancelDialog() {dispose();}", "public void onClick(DialogInterface dialog, int whichButton) {\n\n String inputName = input.getText().toString();\n\n if (inputName.length() > 0) {\n players.add(inputName);\n StringBuilder sb = new StringBuilder(savedNames);\n sb.append(inputName + \",\");\n savedNames = sb.toString();\n editor.putString(\"savedNames\", savedNames);\n editor.commit();\n }\n }", "public void setNames() {\n\t\tPlayer1 = \"COMPUTER\";\n\t\tPlayer2 = JOptionPane.showInputDialog(null, \"Enter your Name:\");\n\t\tnames_set = true;\n\t}", "@Override\n\tpublic void onClick(View v) {\n\t\tif (v == mBtnSure) {\n\t\t\tif (onNameCListener != null) {\n\t\t\t\tonNameCListener.onClick(mInitName);\n\t\t\t}\n\t\t} else if (v == mBtnCancel) {\n\n\t\t} else if (v == mLyNameChild) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tdismiss();\n\t\t}\n\t\tdismiss();\n\t}", "@Override\n\tpublic void onCancel(DialogInterface arg0) {\n\t\t\n\t}", "public Text getByName(String name){\r\n\t\tfor (int i=0;i<thisDialog.size();i++){\r\n\t\t\tif (thisDialog.get(i).getName().equals(name)){\r\n\t\t\t\treturn thisDialog.get(i);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "String askName(boolean W,ChessGame G);", "@Override\n public void onCancel(DialogInterface arg0) {\n\n }", "public static void main(String[] args) {\n\t\r\nString Bob = \"You make great jokes!\";\r\nString Amie = \"Your art is beautiful!\";\r\nString Grace = \"You're clever!\";\r\n\r\n\t\t// 2. Ask the user to enter a name. Store their answer in a variable.\r\n\r\nString name = JOptionPane.showInputDialog(\"Enter a name.\");\r\n\r\n\t\t// 3. In a pop-up, tell the user what is remarkable about that person. \r\n\r\nif (name.equalsIgnoreCase(\"Bob\")) {\r\n\t\r\nJOptionPane.showMessageDialog(null, Bob); }\r\n\r\n\r\nelse if (name.equalsIgnoreCase(\"Amie\")) {\r\n\r\nJOptionPane.showMessageDialog(null, Amie);\r\n}\r\n\r\nelse if (name.equalsIgnoreCase(\"Grace\")) {\r\n\r\nJOptionPane.showMessageDialog(null, Grace); \r\n}\r\n}", "private String promptLoadOrNew(){\r\n Object[] options = {\"Start A New Game!\", \"Load A Previous Game.\"};\r\n String result = (String) JOptionPane.showInputDialog(\r\n null,\r\n \"What would you like to do?\",\r\n \"Welcome!\",\r\n JOptionPane.PLAIN_MESSAGE,\r\n null,\r\n options,\r\n 1);\r\n return result;\r\n \r\n }", "public void enterNameInAboutMe(String name) throws UIAutomationException{\r\n\t\r\n\t\telementController.requireElementSmart(fileName,\"Name Text Field In About Me\",GlobalVariables.configuration.getAttrSearchList(), \"User Name\");\r\n\t\tUIActions.click(fileName,\"Name Text Field In About Me\",GlobalVariables.configuration.getAttrSearchList(), \"User Name\");\r\n\t\tUIActions.clearTextBox(fileName,\"Name Text Field In About Me\",GlobalVariables.configuration.getAttrSearchList(), \"User Name\");\r\n\t\tUIActions.enterValueInTextBox(name,fileName,\"Name Text Field In About Me\",GlobalVariables.configuration.getAttrSearchList(), \"User Name\");\r\n\t\tUIActions.enterKey(Keys.TAB);\r\n\t\r\n\t}", "@Override\r\n\t\t\t\t\tpublic void onCancel(DialogInterface dialog) {\r\n\t\t\t\t\t}", "public void setPlayerName()\r\n\t{\r\n\t\tScanner in = new Scanner(System.in);\r\n\t\tSystem.out.print(\"Enter your name: \");\r\n\t\tname = in.nextLine();\r\n\t}", "public void validateUserName(String name) {\n\t\ttry {\n\t\t\tAssert.assertTrue(userName.getText().equalsIgnoreCase(\"Hi \"+name),\"Username is correctly displayed\");\n\t\t\tLog.addMessage(\"Username correctly displayed\");\n\t\t}catch(Exception e) {\n\t\t\tLog.addMessage(\"Validation of User Login is failed\");\n\t\t\tLog.addMessage(e.getMessage().toString());\n\t\t\tAssert.assertTrue(false, \"Failed to validate User Login\");\n\t\t}\n\t}", "public String getCanceledByName() {\n return this.canceledByName;\n }", "@Override\n public void onClick(DialogInterface dialog, int which) {\n NicknameDialogListener listener = (NicknameDialogListener) getActivity();\n listener.onFinishEditDialog(input.getText().toString());\n dialog.dismiss();\n }", "private String getQuestion(String name, String number)\n {\n \treturn String.format(getString(R.string.dialog_message, ((name != null && !name.equals(\"\")) ? name : getString(R.string.unknown_name)), number));\n }", "@Override\n public void onCancel(DialogInterface dialog) {\n }", "public void validateNameField() {\n\t\tif (nameField.getText().length() > 0) {\n\t\t\ttimeToPick.setEnabled(true);\n\t\t\tif (nameField.getText().length() > 24) {\n\t\t\t\tnameField.setText(nameField.getText().substring(0, 24));\n\t\t\t}\n\t\t\ttimeToPick.putClientProperty(\"playerName\", nameField.getText());\n\t\t} else {\n\t\t\ttimeToPick.setEnabled(false);\n\t\t}\n\t}", "private void getPlayerNames(){\n players[0] = JOptionPane.showInputDialog(\"Please input the name for the first player\");\n players[1] = JOptionPane.showInputDialog(\"Please input the name for the second player\");\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n if (! newGame.getText().equals(\"\")) {\n\n String gameName = newGame.getText();\n\n controller.addGame(gameName);\n\n ArrayList<String> allGames = controller.getAllGames();\n characterGUI.setGameCombo(allGames);\n\n characterGUI.setEnabled(true);\n GameGUI.this.dispose();\n\n } else {\n\n characterGUI.showMessageDialog(\"You must enter a game name.\",\n \"GAME NAME ERROR\", JOptionPane.ERROR_MESSAGE);\n }\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tetyourName.setError(null);\n\t\t\t}", "private void showErrorMessage(String errorMessage)\n {\n JOptionPane.showMessageDialog(null, ERRMSG_NAME_MISSING,\n HERO_ERROR_TITLE, JOptionPane.ERROR_MESSAGE);\n _nameField.requestFocusInWindow();\n }", "public static int confirmWithCancel (\r\n\t\tResources loader, Component frame, String name, Object args[]) {\r\n\r\n\t\tint retVal = JOptionPane.showConfirmDialog(frame,\r\n\t\t\tloader.getResourceMessage(name.concat(\".message\"), args),\r\n\t\t\tloader.getResourceMessage(name.concat(\".title\"), args),\r\n\t\t\tJOptionPane.YES_NO_CANCEL_OPTION,\r\n\t\t\tJOptionPane.WARNING_MESSAGE);\r\n\r\n\t\treturn (retVal);\r\n\t}", "private void renameFile() {\r\n // Get modeldata of the selected file to rename\r\n AlertDialog.Builder builder = new AlertDialog.Builder(this);\r\n final EditText input;\r\n builder.setTitle(R.string.rename_dialog_title);\r\n View view = View.inflate(this, R.layout.dialog_edit_text, null);\r\n\r\n input = (EditText) view.findViewById(R.id.dialog_edit_text);\r\n\r\n builder.setView(view);\r\n builder.setPositiveButton(R.string.rename_dialog_ok_button, null);\r\n builder.setNegativeButton(R.string.rename_dialog_cancel_button, null);\r\n // setting the file name into dialog text after removing the extension name of a file\r\n input.setText(FileUtils.removeExtension(dataModelArrayList.get(position).getFile().getName()));\r\n // set the cursor at the end of edit text\r\n input.setSelection(input.getText().length());\r\n final AlertDialog dialog = builder.create();\r\n // for showing the keyboard when dialog is open,must call before dialog.show to get desired result\r\n dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);\r\n dialog.show();\r\n dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n String fileName = input.getText().toString().trim();\r\n if (fileName.length() != 0) {\r\n if (fileName.length() <= 30) {\r\n if (FileUtils.getSpecialCharacterValidation(fileName)) {\r\n\r\n final File newFile = new File(dataModelArrayList.get(position).getFile().getParent(), input.getText().toString() + \".\" +\r\n FileUtils.getExtension(dataModelArrayList.get(position).getFile().getName()));\r\n if (newFile.exists()) {\r\n SDKUtils.showToast(PhotoViewActivity.this, getString(R.string.file_already_exists_error));\r\n } else {\r\n // Method to update the name of file\r\n updateFileName(dataModelArrayList.get(position), input.getText().toString());\r\n dialog.dismiss();\r\n }\r\n\r\n\r\n //Hide the keyboard after dismiss the dialog.\r\n dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);\r\n } else {\r\n SDKUtils.showToast(PhotoViewActivity.this, getString(R.string.file_name_invalid_character));\r\n }\r\n } else {\r\n SDKUtils.showToast(PhotoViewActivity.this, getString(R.string.rename_file_name_length));\r\n }\r\n } else {\r\n SDKUtils.showToast(PhotoViewActivity.this, getString(R.string.empty_dialog_message));\r\n }\r\n }\r\n });\r\n dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n dialog.dismiss();\r\n //Hide the keyboard after dismiss the dialog.\r\n dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);\r\n\r\n }\r\n });\r\n }", "@java.lang.Override\r\n public String askName() {\r\n Hello.display(\"Welcome! What is your name?\");\r\n Scanner in = new Scanner(System.in);\r\n String name = in.next();\r\n return name;\r\n }", "public void notifyTurn(String name) {\n if(name.equals(username) && !(client.getPlayer() instanceof ComputerPlayer)) {\n JOptionPane.showMessageDialog(frame, \"It's your turn!\");\n } else if(!(client.getPlayer() instanceof ComputerPlayer)) {\n JOptionPane.showMessageDialog(frame, \"It's \" + name + \"'s turn!\");\n }\n inventoryArea.append(\"\\n\\nIt's \" + name + \"'s turn\");\n }", "public void onClick(DialogInterface dialog, int which) {\n \t\t\t\t\t\t\tnames.remove(arg2);\n \t\t\t\t\t\t\tupdateList();\n \t\t\t\t\t\t}", "public String createName() {\r\n\r\n boolean donePickingName = false;\r\n String inputName =\"\";\r\n \r\n while (donePickingName == false) {\r\n System.out.println(\"\\nWHAT IS YOUR NAME?\");\r\n System.out.print(\"NAME: \");\r\n inputName = scan.next();\r\n \r\n System.out.println(\"You chose \" + \"'\" + inputName + \"'\" + \" as your name.\\n\");\r\n System.out.println(\"Hello \" + inputName + \"!\");\r\n System.out.println(\"This will be your name through the whole game, do you want to keep it?\\n\"\r\n + \"YES/NO\");\r\n System.out.print(\"ACTION: \");\r\n\r\n String actionInput;\r\n actionInput = scan.next().substring(0, 1);\r\n\r\n if (actionInput.equalsIgnoreCase(\"n\")) {\r\n donePickingName = false;\r\n }\r\n if (actionInput.equalsIgnoreCase(\"y\")) {\r\n System.out.println(\"\\nYou chose to keep your name\");\r\n donePickingName = true;\r\n } else {\r\n System.out.println(\"\\n'\" + actionInput + \"'\" + \" is not a valid option... Try again.\");\r\n }\r\n \r\n }\r\n return inputName;\r\n }", "public LobbyDialog(String ownerName) {\n\t\tthis.ownerName = ownerName;\n\n\t\tGameServer server = new GameServer(this);\n\t\tThread serverThread = new Thread(server);\n\t\tserverThread.start();\n\n\t\tJButton backBtn = new JButton(\"Zurück\");\n\t\tJButton startBtn = new JButton(\"Start\");\n\n\t\tJTextField player1Txt = new JTextField(ownerName);\n\t\tplayer2Txt = new JTextField(\"Warte auf Spieler 2\");\n\n\t\tJPanel btnPanel = new JPanel();\n\n\t\tBox playerBox = Box.createVerticalBox();\n\n\t\tplayer1Txt.setEditable(false);\n\t\tplayer2Txt.setEditable(false);\n\n\t\tplayerBox.add(player1Txt);\n\t\tplayerBox.add(player2Txt);\n\n\t\tbtnPanel.add(backBtn, BorderLayout.WEST);\n\t\tbtnPanel.add(startBtn, BorderLayout.EAST);\n\n\t\tadd(playerBox, BorderLayout.CENTER);\n\t\tadd(btnPanel, BorderLayout.SOUTH);\n\n\t\tsetSize(250, 200);\n\t\tsetLocationRelativeTo(null);\n\t\tsetVisible(true);\n\t\tsetDefaultCloseOperation(DISPOSE_ON_CLOSE);\n\t\tsetResizable(false);\n\t\tsetTitle(\"Lobby\");\n\n\t\t// Spiel wird gestartet\n\t\tstartBtn.addActionListener(new ActionListener() {\n\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tdispose();\n\t\t\t\tstartGame = true;\n\t\t\t\tnew Game(1, server.getSocket().getInetAddress(), 4447, ownerName, clientName);\n\t\t\t}\n\t\t});\n\n\t\t// Schließt den Dialog und führt zum GameSetup zurück\n\t\tbackBtn.addActionListener(new ActionListener() {\n\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tdispose();\n\t\t\t}\n\t\t});\n\n\t}", "public RandomOpponent(String name) {\n this.name = name;\n }", "public void alterarDadosCadastraisNomeInvalido(String nome) {\n\t\tAlterarDadosCadastraisPage alterarDadosCadastraisPage = new AlterarDadosCadastraisPage(driver);\n\t\talterarDadosCadastraisPage.getInputNome().clear();\n\t\talterarDadosCadastraisPage.getInputNome().sendKeys(nome);\n\t\talterarDadosCadastraisPage.getButtonSalvar().click();\n\t}", "public void decideName()\n {\n System.out.println(\"What do want your newly tamed WIND dragon to be named?\");\n String name = new String(input.nextLine());\n \n setName(name);\n }", "@Override\n\t\tpublic void onCancel(DialogInterface dialog) {\n\t\t\t\n\t\t}", "private void showMatchOverDialog(String winnerName) {\n this.computerPaquetView.showOnceHiddenCards();\n int dialogResult = JOptionPane.showConfirmDialog (null, String.format(\"%s won!\\nContinue?\", winnerName),\"\", JOptionPane.YES_NO_OPTION);\n if(dialogResult == JOptionPane.YES_OPTION){\n this.startGame();\n } else {\n this.dispose();\n }\n }", "private void errorPopUp() {\n new AlertDialog.Builder(mActivity)\n .setTitle(\"Oops\")\n .setMessage(\"Please choose an emotional state or enter a date and time\")\n .setPositiveButton(\"Ok\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n //Go back without changing anything\n dialogInterface.dismiss();\n }\n })\n .create()\n .show();\n }", "String getPlayerName() {\r\n EditText editText = (EditText) findViewById(R.id.name_edit_text_view);\r\n return editText.getText().toString();\r\n }", "private String getPlayerName() {\n EditText name = (EditText) findViewById(R.id.name_edittext_view);\n return name.getText().toString();\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tEditNameDialogListener activity = (EditNameDialogListener)getActivity();\n\t\t\t\tactivity.onFinishEditDialog(nombre.getText().toString(), organizacion.getText().toString(), \n\t\t\t\t\t\t\"sexo\", telefono.getText().toString(), email.getText().toString());\n\t\t\t\tgetDialog().dismiss();\n\t\t\t}", "private void displayDuplicateInputError(){\n\t\tAlert alert = new Alert(Alert.AlertType.INFORMATION);\n\t\talert.setTitle(\"Duplicate Letter Dialog\");\n\t\talert.setHeaderText(\"Pay Attention!\");\n\t\talert.setContentText(\"You have already tried that letter, please try again\");\n\t\talert.showAndWait();\n\t}", "private void clickOk(){\n bnOk.setOnClickListener(new View.OnClickListener(){\n @Override\n public void onClick(View v){\n if(nameTask.getText().toString().matches(\"\")){\n Toast.makeText(activity.getApplicationContext(), activity.getResources().getString(R.string.noNameEntered), Toast.LENGTH_SHORT ).show();\n return;\n }\n\n schedulerDB.updateData(id, nameTask.getText().toString(), day);\n dismiss();\n\n }\n });\n }", "public void NoGodHasSuchName() {\n notifyGodNotCorrect(this.getCurrentTurn().getCurrentPlayer().getNickname(), availableGods, chosenGodList);\n }", "public void onClick(DialogInterface dialog, int id) {\n String name = t.getText().toString();\n if(name.length() > 15) {\n Toast.makeText(context, \"Ime igralca ne sme biti daljše od 15 znakov!\" , Toast.LENGTH_SHORT ).show();\n }else{\n players.add(new Player(name,numberOfPlayers-i));\n\n mPlayers = i - 1;\n // when the last name is assigned the next button creates an instance\n if (i == 1) {\n String title = editTextTitle.getText().toString();\n listener.onDialogPositiveClick(title, players);\n return;\n }\n //Creating new dialogs until we run out of players\n CreatePlayerNamesDialog(mPlayers);\n }\n }", "private void rename(int scope) {\n\t\tProgramGUI.scope = scope;\n\t\tProgramGUI.this.dispose();\n\t\tif(scope == ALL) {\n\t\t\tframe = new JFrame(\"Rename a User\");\n\t\t\tframe.setSize(FRAME_WIDTH, FRAME_HEIGHT);\n\t\t\tframe.setDefaultCloseOperation(EXIT_ON_CLOSE);\n\t\t\tframe.setLocationRelativeTo(null);\n\t\t\tJPanel panel = new JPanel();\n\t\t\tpanel.setLayout(new GridLayout(2, 2));\n\t\t\tpanel.add(new JLabel(\"Rename which user: \"));\n\t\t\toldUser = new JTextField();\n\t\t\tuser = new JTextField();\n\t\t\tpanel.add(oldUser);\n\t\t\tpanel.add(new JLabel(\"Rename to: \"));\n\t\t\tpanel.add(user);\n\t\t\tpanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));\n\t\t\tframe.add(panel, BorderLayout.NORTH);\n\t\t\tJPanel button = new JPanel();\n\t\t\tJButton confirm = new JButton(\"Confirm Rename\");\n\t\t\tJButton cancel = new JButton(\"Cancel\");\n\t\t\tcancel.addActionListener(new ButtonListener());\n\t\t\tconfirm.addActionListener(new RenameListener());\n\t\t\tbutton.add(confirm);\n\t\t\tbutton.add(cancel);\n\t\t\tframe.add(button, BorderLayout.SOUTH);\n\t\t\tframe.setVisible(true);\n\t\t}\n\t\telse {\n\t\t\tframe = new JFrame(\"Rename a User\");\n\t\t\tframe.setSize(FRAME_WIDTH, FRAME_HEIGHT);\n\t\t\tframe.setDefaultCloseOperation(EXIT_ON_CLOSE);\n\t\t\tframe.setLocationRelativeTo(null);\n\t\t\tJPanel panel = new JPanel();\n\t\t\tpanel.setLayout(new GridLayout(1, 2));\n\t\t\tpanel.add(new JLabel(\"Rename to: \"));\n\t\t\tuser = new JTextField();\n\t\t\tpanel.add(user);\n\t\t\tpanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));\n\t\t\tframe.add(panel, BorderLayout.NORTH);\n\t\t\tJPanel button = new JPanel();\n\t\t\tJButton confirm = new JButton(\"Confirm Rename\");\n\t\t\tJButton cancel = new JButton(\"Cancel\");\n\t\t\tcancel.addActionListener(new ButtonListener());\n\t\t\tconfirm.addActionListener(new RenameListener());\n\t\t\tbutton.add(confirm);\n\t\t\tbutton.add(cancel);\n\t\t\tframe.add(button, BorderLayout.SOUTH);\n\t\t\tframe.setVisible(true);\n\t\t}\n}", "private void saveAsConfirmButton(){\n //Check if the input is valid (lcase and no spaces)\n String input = SaveAsLabNameTextField.getText();\n \n if(input.contains(\" \") || !input.equals(input.toLowerCase())){ \n SaveAsErrorLabel.setText(\"Lab name must be lowercase and contain no spaces!\");\n SaveAsErrorLabel.setVisible(true);\n }\n //Check if lab already exists\n else if(Arrays.asList(labsPath.list()).contains(input)){ \n SaveAsErrorLabel.setText(\"Lab already exists!\");\n SaveAsErrorLabel.setVisible(true);\n }\n else{\n SaveAsErrorLabel.setVisible(false);\n saveAs(input);\n SaveAsDialog.setVisible(false);\n } \n }", "public static String input (Resources loader,\r\n\t\tComponent frame, String name, Object args[], Object defaultVal) {\r\n\r\n\t\tString retVal = (String)JOptionPane.showInputDialog(frame,\r\n\t\t\tloader.getResourceMessage(name.concat(\".message\"), args),\r\n\t\t\tloader.getResourceMessage(name.concat(\".title\"), args),\r\n\t\t\tJOptionPane.QUESTION_MESSAGE, null, null, defaultVal);\r\n\r\n\t\treturn (retVal);\r\n\t}", "void cancelButton_actionPerformed(ActionEvent e)\n\t{\n\t\tcloseDlg();\n }", "public void showDuplicatePlayerNameMessage() {\n Optional<SelectGameScreen> maybeSelectGameScreen = getSelectGameScreenIfActive();\n if (maybeSelectGameScreen.isPresent()) {\n maybeSelectGameScreen.get().showDuplicatePlayerNameMessage();\n } else {\n showError(\"Player name already exists.\");\n }\n }", "private void renameCharacter(final Context context, final Character character) {\n LayoutInflater li = LayoutInflater.from(context);\n View dialogView = li.inflate(R.layout.dialog_rename, null);\n //get the new name Edit text\n final EditText newnameEditText = (EditText) dialogView.findViewById(R.id.newnameEditText);\n newnameEditText.setText(character.getName());\n\n //build the dialog\n AlertDialog.Builder builder = new AlertDialog.Builder(context);\n builder.setView(dialogView);\n builder.setPositiveButton(R.string.ok,\n new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int choice) {\n switch (choice) {\n case DialogInterface.BUTTON_POSITIVE:\n String newName = newnameEditText.getText().toString();\n if (!TextUtils.isEmpty(newName)) {\n //--- change in database\n DatabaseReference database = DataUtils.getDatabase();\n //remove from user\n database.child(\"characters\").child(character.getUid())\n .child(\"name\").setValue(newName);\n //--- change in object\n character.setName(newName);\n\n if (changeListener != null) {\n changeListener.onChange(character);\n }\n\n Toast.makeText(context, String.format(\"The character's name was changed\"),\n Toast.LENGTH_SHORT).show();\n }\n break;\n case DialogInterface.BUTTON_NEGATIVE:\n break;\n }\n }\n })\n .setNegativeButton(R.string.cancel,\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n dialog.cancel();\n }\n })\n .show();\n }", "private void setName(String nameIn){\r\n\t\tplayerName = nameIn;\r\n\t}", "public static void error (Resources loader,\r\n\t\tComponent frame, String name, Object[] args) {\r\n\r\n\t\tJOptionPane.showMessageDialog(frame,\r\n\t\t\tloader.getResourceMessage(name.concat(\".message\"), args),\r\n\t\t\tloader.getResourceMessage(name.concat(\".title\"), args),\r\n\t\t\tJOptionPane.ERROR_MESSAGE);\r\n\t}", "public void Name_Setter() {\n Dialog<Pair<String, String>> dialog = new Dialog<>();\n dialog.setTitle(\"Developer Login\");\n FontAwesomeIconView icon = new FontAwesomeIconView(FontAwesomeIcon.EXPEDITEDSSL);\n icon.setGlyphSize(40);\n icon.setGlyphStyle(\"-fx-fill:green;\");\n\n dialog.setGraphic(icon);\n dialog.setHeaderText(\"Only Developers Authorised..\");\n\n //set Button types\n ButtonType lbutton = new ButtonType(\"Open\", ButtonData.NO);\n dialog.getDialogPane().getButtonTypes().addAll(lbutton, 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(0, 20, 10, 10));\n\n JFXTextField fld = new JFXTextField();\n fld.setPromptText(\"Developer email\");\n fld.setMinWidth(200);\n\n JFXPasswordField pfld = new JFXPasswordField();\n pfld.setPromptText(\"Developer Password\");\n\n Label infor = new Label(\"Enter Email and Password\");\n\n grid.add(fld, 2, 2);\n grid.add(pfld, 2, 5);\n grid.add(infor, 4, 8);\n\n dialog.getDialogPane().setContent(grid);\n\n Optional<Pair<String, String>> result = dialog.showAndWait();\n\n String pass = pfld.getText();\n String uname = fld.getText();\n\n if (pass.equals(\"erickerickyaah\") && uname.equals(\"[email protected]\")) {\n\n reportgenthree.ReportGenThree.NameSetter();\n\n } else {\n\n infor.setText(\"Wrong Password..\");\n }\n\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n name = nameField.getText();\n ok.setEnabled(false);\n nameField.setEnabled(false);\n\n playAgain.setEnabled(true);\n if (levelNum < 5) {\n nextLevel.setEnabled(true);\n }\n menu.setEnabled(true);\n\n enteredName = true;\n }", "@Override\r\n\tpublic void onCancel(DialogInterface dialog) {\n\r\n\t}", "@Test\r\n\tpublic void testNameInvalid() {\r\n\t\tassertFalse(Activity5Query.isNameCorrect(\"\"));\r\n\t\tassertFalse(Activity5Query.isNameCorrect(\"*\"));\r\n\t\tassertFalse(Activity5Query.isNameCorrect(\"-\"));\r\n\t\tassertFalse(Activity5Query.isNameCorrect(\"0-\"));\r\n\t\tassertFalse(Activity5Query.isNameCorrect(\"324tggs\"));\r\n\t\tassertFalse(Activity5Query.isNameCorrect(\"-feioj\"));\r\n\t\tassertFalse(Activity5Query.isNameCorrect(\"/\"));\r\n\t\tassertFalse(Activity5Query.isNameCorrect(\"@\"));\r\n\t\tassertFalse(Activity5Query.isNameCorrect(\" \"));\r\n\t}", "public void cancel() { Common.exitWindow(cancelBtn); }", "String getInputName() {\n return (nameInput.getText());\n }" ]
[ "0.68187314", "0.6700333", "0.6650651", "0.6639648", "0.6622038", "0.6548485", "0.65311044", "0.6523487", "0.65113217", "0.6348558", "0.6348353", "0.6346492", "0.63148224", "0.62906945", "0.61653626", "0.61650306", "0.6161009", "0.61595726", "0.61560565", "0.6148765", "0.61009336", "0.6074775", "0.60511774", "0.603662", "0.6036369", "0.59997374", "0.59850377", "0.5975446", "0.5952374", "0.59407645", "0.5927069", "0.59244895", "0.5920563", "0.5917597", "0.58682114", "0.58619356", "0.5859928", "0.5850154", "0.5843307", "0.58293164", "0.58287764", "0.5825405", "0.582533", "0.5823796", "0.58210826", "0.58075696", "0.5806845", "0.57961017", "0.5785088", "0.57624376", "0.5758396", "0.5755614", "0.5742964", "0.57422096", "0.57259107", "0.57226735", "0.5713711", "0.57134396", "0.5708371", "0.5707771", "0.5702239", "0.5694596", "0.5692558", "0.5691733", "0.56865525", "0.5679129", "0.56752133", "0.5668861", "0.56625617", "0.5661786", "0.56547266", "0.5651999", "0.5647305", "0.5646111", "0.56357324", "0.56320554", "0.56201845", "0.56199527", "0.5611458", "0.56112725", "0.5611062", "0.5609629", "0.5605238", "0.5599518", "0.559396", "0.55876225", "0.5586563", "0.5579283", "0.5576931", "0.5574917", "0.55735123", "0.5569524", "0.5559055", "0.554827", "0.554709", "0.554252", "0.5529183", "0.5529133", "0.5525257", "0.552425" ]
0.56597686
70
Collects Player names and instantiates a new game, a game loop and a new game view.
public void createNewGame(Stage menuStage) { this.menuStage = menuStage; this.menuStage.hide(); view = new GameView(inputs[1]); try { view.show(); game = new Game(getNames(), inputs[0]); turned = false; view.initialisePlayerViews(nameList); createKeyListeners(); createGameLoop(); }catch (IndexOutOfBoundsException ex){ throw new GameException("User cancelled game"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void createPlayers() {\n\tGlobal.camera_player1 = new Camera(new OrthographicCamera());\n\tGlobal.camera_player2 = new Camera(new OrthographicCamera());\n\tGlobal.camera_ui = new OrthographicCamera();\n\tGlobal.player1 = new Plane(Global.player1_respawn.x,\n\t\tGlobal.player1_respawn.y, 0, new Planetype(PlaneTypes.F35),\n\t\tEntityType.PLAYER1);\n\tGlobal.player2 = new Plane(Global.player2_respawn.x,\n\t\tGlobal.player2_respawn.y, 0, new Planetype(PlaneTypes.F35),\n\t\tEntityType.PLAYER2);\n }", "public void newGame() {\n // this.dungeonGenerator = new TowerDungeonGenerator();\n this.dungeonGenerator = cfg.getGenerator();\n\n Dungeon d = dungeonGenerator.generateDungeon(cfg.getDepth());\n Room[] rooms = d.getRooms();\n\n String playername = JOptionPane.showInputDialog(null, \"What's your name ?\");\n if (playername == null) playername = \"anon\";\n System.out.println(playername);\n\n this.player = new Player(playername, rooms[0], 0, 0);\n player.getCurrentCell().setVisible(true);\n rooms[0].getCell(0, 0).setEntity(player);\n\n frame.showGame();\n frame.refresh(player.getCurrentRoom().toString());\n frame.setHUD(player.getGold(), player.getStrength(), player.getCurrentRoom().getLevel());\n }", "public static void createPlayers() {\n\t\tcomputer1 = new ComputerSpeler();\n\t\tspeler = new PersoonSpeler();\n//\t\tif (Main.getNumberOfPlayers() >= 3) { \n//\t\t\tSpeler computer2 = new ComputerSpeler();\n//\t\t}\n//\t\tif (Main.getNumberOfPlayers() == 4) {\n//\t\t\tSpeler computer3 = new ComputerSpeler();\n//\t\t}\n\n\n\t}", "@Override\n\tpublic void createNewGame() \n\t{\n\t\t//Create new game\n\t\tboolean randomhexes = getNewGameView().getRandomlyPlaceHexes();\n\t\tboolean randomnumbers = getNewGameView().getRandomlyPlaceNumbers();\n\t\tboolean randomports = getNewGameView().getUseRandomPorts();\n\t\tString title = getNewGameView().getTitle();\n\t\t\n\t\ttry \n\t\t{\n\t\t\tReference.GET_SINGLETON().proxy.createGame(title, randomhexes, randomnumbers, randomports);\n\t\t} \n\t\tcatch (JoinExceptions e) \n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t//Refresh game list\n\t\tList<Game> gamelist = Reference.GET_SINGLETON().proxy.getGameList();\n\t\tGameInfo[] games = new GameInfo[gamelist.size()];\n\t\tint counter = 0;\n\t\tfor(Game game: gamelist)\n\t\t{\n\t\t\tGameInfo thisgame = new GameInfo();\n\t\t\tthisgame.setId(game.getId());\n\t\t\tthisgame.setTitle(game.getTitle());\n\t\t\tfor(Player player : game.getPlayers())\n\t\t\t{\n\t\t\t\tPlayerInfo player_info = new PlayerInfo(player);\n\t\t\t\tplayer_info.setColor(player.getColor());\n\t\t\t\tif(!(player.color == null))thisgame.addPlayer(player_info);\n\t\t\t}\n\t\t\tgames[counter] = thisgame;\n\t\t\tcounter++;\n\t\t}\n\t\t\n\t\tReference ref = Reference.GET_SINGLETON();\n\t\t\n\t\tPlayerInfo ourguy = new PlayerInfo();\n\t\t\n\t\tourguy.setId(ref.player_id);\n\t\tourguy.setName(ref.name);\n\t\tif(getNewGameView().isModalShowing())\n\t\t{\n\t\t\tgetNewGameView().closeModal();\n\t\t}\n\t\tif (getNewGameView().isModalShowing())\n\t\t{\n\t\t\tgetNewGameView().closeModal();\n\t\t}\n\n\t\tgetJoinGameView().setGames(games, ourguy);\n\t\t\n\t}", "public void createPlayers() {\n\t\t\n\t\twhite = new Player(Color.WHITE);\n\t\twhite.initilizePieces();\n\t\tcurrentTurn = white;\n\t\t\n\t\tblack = new Player(Color.BLACK);\n\t\tblack.initilizePieces();\n\t}", "public void createNewGame(int numPlayers, String playersAndTheirNames){\n\t\tcurrentGame = new GameController(new GameModel(numPlayers), new GamePanel(numPlayers), playersAndTheirNames, numPlayers);\n\t\t\n\t\tframe.setFrameContent(currentGame.getGamePanel());\n\t}", "public void startNewGame()\n {\n // Display the Banner Page.\n \n System.out.println(\"\\nWelcome to the city of Aaron.\");\n \n // Prompt for and get the user’s name.\n String name;\n System.out.println(\"\\nPlease type in your first name: \");\n name = keyboard.next();\n\n // Call the createNewGame() method in the GameControl class\n \n GameControl.createNewGame(name);\n\n // Display a welcome message\n System.out.println(\"Welcome \" + name + \" have fun!!!\");\n \n //Call the GameMenuView\n GameMenuView gmv = new GameMenuView();\n gmv.displayMenu();\n }", "private void createPlayers() {\n // create human player first\n Player human = new Player(\"Player 1\", true);\n players.add(human);\n \n // create remaining AI Players\n for (int i = 0; i < numAIPlayers; i++) {\n Player AI = new Player(\"AI \" + (i + 1), false);\n players.add(AI);\n }\n }", "void createNewGame(Player player);", "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 static void StartGame(ArrayList<String> names) {\n for (String name : names) {\n Player player = new Player();\n player.Name = name;\n player.Color = new Color(0,0,0);\n players.add(player);\n }\n generateColor();\n // Read XML\n readXML();\n GameRunning = true;\n trackDices=false;\n dicesEqual=0;\n gameboard=new GameBoard();\n gameboard.initGame();\n }", "public Game() \n {\n Logger.setLogger(null);\n createInstances();\n parser = new Parser();\n player = new Player();\n userInputs = new ArrayList<String>();\n }", "public Game(){\n player = new Player(createRooms());\n parser = new Parser(); \n }", "void newGame() {\n logger.log(\"New game starting.\");\n logger.log(divider);\n\n\n // Create the deck.\n createDeck();\n logger.log(\"Deck loaded: \" + deck.toString());\n\t logger.log(divider);\n\n\n // Shuffle the deck.\n shuffleDeck();\n logger.log(\"Deck shuffled: \" + deck.toString());\n logger.log(divider);\n\n // Create the players.\n createPlayers();\n setGameState(GameState.PLAYERS_SPAWNED);\n\n // Deal cards to players' decks.\n deal();\n for (Player player : players) {\n logger.log(\"Hand: \" + player);\n }\n \n\n // Randomly select the active player for the first round.\n selectRandomPlayer();\n\n setGameState(GameState.NEW_GAME_INITIALISED);\n }", "GameGUI() {\r\n _randomSource = new Random();\r\n _players = new Player[2];\r\n _input = new BufferedReader(new InputStreamReader(System.in));\r\n _players[0] = new HumanPlayer(BP, this);\r\n _players[1] = new MachinePlayer(WP, this);\r\n _playing = false;\r\n }", "public void InitGame(){\n System.out.format(\"New game initiated ...\");\n Game game = new Game(client_List);\n SetGame(game);\n }", "private void setupPlayers() {\n\t\tuserData=(UserData) Main.currentStage.getUserData();\n\t\tnumberPlayers=userData.getNumberPlayers();\n\t\tplayerNames=userData.getPlayerNames();\n\t\tcurrentPlayer=userData.getFirstPlayer();\n\t\tlb_currentplayername.setText(playerNames[currentPlayer]);\n\t\tplayers =new Player[4];\n\t\tfor(int i=0;i<4;i++) {\n\t\t\tif(i<numberPlayers) {\n\t\t\t\tplayers[i]=new Player(playerNames[i], false, i) {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void rollDices() {\n\t\t\t\t\t\trotatedDice1();\n\t\t\t\t\t\trotatedDice2();\n\t\t\t\t\t\t//waiting for player choose what way to go then handler that choice\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\tplayers[i]=new Player(playerNames[i], true, i) {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void rollDices() {\n\t\t\t\t\t\trotatedDice1();\n\t\t\t\t\t\trotatedDice2();\n\t\t\t\t\t\t//randomchoice and next player rolldice\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\tswitch (i) {\n\t\t\t\tcase 0:{\n\t\t\t\t\tplayers[i].setHorseColor(yh0, yh1, yh2, yh3);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 1:{\n\t\t\t\t\tplayers[i].setHorseColor(bh0, bh1, bh2, bh3);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 2:{\n\t\t\t\t\tplayers[i].setHorseColor(rh0, rh1, rh2, rh3);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 3:{\n\t\t\t\t\tplayers[i].setHorseColor(gh0, gh1, gh2, gh3);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "public void start() {\n ArrayList<String> names = new ArrayList<>();\n game.initialize(names);\n //game.play(this.mainPkmn, this.attack);\n\n }", "private void startGame() {\n\t\tmain.next_module = new Game(main, inputs, gameSelectionData);\n\t}", "public Game() \n {\n parser = new Parser();\n name = new String();\n player = new Player();\n ai = new AI();\n createRooms();\n rand = -1;\n enemyPresent = false;\n wantToQuit = false;\n alive = true;\n createItems();\n createWeapons();\n createEnemy();\n setEnemy();\n setItems();\n setWeapons();\n setExits();\n }", "void startNewGame(String playerName, String gameType) throws GameServiceException;", "private void newGame() {\n\t\t// Firstly, we spawn the player.\n\t\tplayer = new AsteroidsPlayer(GameObject.ROOT, this);\n\t\tspawnPlayer();\n\n\t\t// Make sure that no other objects exist.\n\t\tasteroids.clear();\n\t\tlaserShots.clear();\n\t\totherObjects.clear();\n\n\t\t// Then we create the score text using two strings.\n\t\tAsteroidsString scoreText = new AsteroidsString(GameObject.ROOT, \"SCORE\", true, false);\n\t\tscoreText.translate(new Vector3(-cameraZoom, cameraZoom - 1));\n\t\totherObjects.add(scoreText);\n\t\tscoreString = new AsteroidsString(GameObject.ROOT, Integer.toString(score), true, false);\n\t\tscoreString.translate(new Vector3(-cameraZoom, cameraZoom - 3));\n\t\totherObjects.add(scoreString);\n\n\t\t// We set our starting lives to 3.\n\t\tlives = 3;\n\n\t\t//And we also create the lives text.\n\t\tAsteroidsString livesText = new AsteroidsString(GameObject.ROOT, \"LIVES\", false, true);\n\t\tlivesText.translate(new Vector3(cameraZoom, cameraZoom - 1));\n\t\totherObjects.add(livesText);\n\t\tlivesString = new AsteroidsString(GameObject.ROOT, Integer.toString(lives), false, true);\n\t\tlivesString.translate(new Vector3(cameraZoom, cameraZoom - 3));\n\t\totherObjects.add(livesString);\n\n\t\t// Then we just set the delay to the first asteroid.\n\t\ttimeToNextAsteroid = asteroidDelay;\n\t}", "Game() {\n _randomSource = new Random();\n\n _players = new Player[2];\n _input = new BufferedReader(new InputStreamReader(System.in));\n _players[0] = new HumanPlayer(BP, this);\n _players[1] = new MachinePlayer(WP, this);\n _playing = false;\n }", "private void createGame(String name){\n\n }", "@Override\n\tpublic void start() \n\t{\n\t\tServerPoller.getServerPoller().setObserver(this);\n\t\tList<Game> gamelist = Reference.GET_SINGLETON().proxy.getGameList();\n\t\tGameInfo[] games = new GameInfo[gamelist.size()];\n\t\tint counter = 0;\n\t\tfor(Game game: gamelist)\n\t\t{\n\t\t\tGameInfo thisgame = new GameInfo();\n\t\t\tthisgame.setId(game.getId());\n\t\t\tthisgame.setTitle(game.getTitle());\n\t\t\tfor(Player player : game.getPlayers())\n\t\t\t{\n\t\t\t\tPlayerInfo player_info = new PlayerInfo(player);\n\t\t\t\tplayer_info.setColor(player.getColor());\n\t\t\t\tif(!(player.color == null))thisgame.addPlayer(player_info);\n\t\t\t}\n\t\t\tgames[counter] = thisgame;\n\t\t\tcounter++;\n\t\t}\n\n\t\tif (Reference.GET_SINGLETON().getPlayer_color() != null) return;\n\t\tif (!hasChanged(games, oldGames)) return;\n\t\toldGames = games;\n\t\t\n\t\tReference ref = Reference.GET_SINGLETON();\n\t\t\n\t\tPlayerInfo ourguy = new PlayerInfo();\n\t\t\n\t\tourguy.setId(ref.player_id);\n\t\tourguy.setName(ref.name);\n\t\t\n\t\tgetJoinGameView().setGames(games, ourguy);\n\n\t\tif (getJoinGameView().isModalShowing()) getJoinGameView().closeModal();\n\t\tif(!getJoinGameView().isModalShowing())\n\t\t{\n\t\t\tgetJoinGameView().showModal();\n\t\t}\n\t}", "public Game(String customMapName) {\n genericWorldMap = new GenericWorldMap(customMapName);\n players = new LinkedList<Player>();\n dice = new Dice();\n observers = new LinkedList<>();\n gameState = GameState.MESSAGE;\n }", "public void createPlayer() {\n ColorPicker colorPicker = new ColorPicker();\n\n for (Player player : players) {\n if (player.getColor() == color(0, 0, 0) || (player.hasName() == false)) {\n pickColor(player, colorPicker);\n return;\n }\n }\n\n // if (ENABLE_SOUND) {\n // sfx.moveToGame();\n // }\n\n state = GameState.PLAY_GAME;\n\n // Spawn players\n int index = 0;\n for (int i=players.size()-1; i>=0; i--) {\n String dir = directions.get(index); // Need to add players in reverse so that when they respawn, they move in the right direction\n players.get(i).setSpawn(spawns.get(dir)).setDirection(dir);\n index++;\n }\n\n // Update game state only if all players have name and color\n}", "public void newGame() {\n gameString = playerPlays = computerPlays = \"\";\n pScore = cScore = 0;\n setLabels();\n }", "public void createGame()\n {\n //call Client Controller's setState method with\n //a parameter of new ClientLobbyState()\n clientController.startMultiPlayerGame(\"GameLobby\");\n }", "public GameLuncher(GameGUI gameGUI) {\n this.gameGUI = gameGUI;\n createGame();\n }", "public void createPlayers() {\r\n\t\tPlayerList playerlist = new PlayerList();\r\n\t\tPlayer p = new Player();\r\n\t\tfor (int x = 0; x <= players; x++) {\r\n\t\t\tplayerlist.createPlayer(p);\r\n\t\t}\r\n\r\n\t\tScanner nameScanner = new Scanner(System.in);\r\n\r\n\t\tfor (int createdPlayers = 1; createdPlayers < players; createdPlayers++) {\r\n\t\t\tSystem.out.println(\"Enter next player's name:\");\r\n\t\t\tplayerlist.namePlayer(createdPlayers, nameScanner.nextLine());\r\n\t\t}\r\n\t\tnameScanner.close();\r\n\t}", "public CastleWarsGame(Collection<Player> players) {\n\t\tthis.players = players;\n\t\tinit();\n\t\tWorld.sendGlobalMessage(\"@dre@[Castle-Wars] -> A new game has just begun.\", true);\n\t\tSystem.out.println(\"Game started\");\n\t}", "public void startProgram()\r\n\t{\r\n\t\tview.displayPlayerNames();\r\n\t\tview.loadGameData();\r\n\t\tview.displayGame();\r\n\t}", "private void createPlayers() {\n\t\t//Randomize roles\n\t\tArrayList<AdventurerEnum> randomisedRoles = getRandomisedRoles();\n\t\tfor(int i=0; i<numPlayers; i++) \n\t\t\tcreateOnePlayer(randomisedRoles.get(i), i+1);\n\t}", "public void startGame() {\n\t\t\n\t\tPlayer p1;\n\t\tPlayer p2;\n\t\t\n\t\tif(player1.getSelectionModel().getSelectedItem().equals(_HUMAN)) {\n\t\t\tp1 = new Human(1, main);\n\t\t}\n\t\telse {\n\t\t\tString difficulty = player1Diff.getSelectionModel().getSelectedItem();\n\t\t\t\n\t\t\tint diff = difficulty.equals(_DIFFICULTY1) ? 1 : difficulty.equals(_DIFFICULTY2) ? 2 : 3;\n\t\t\t\n\t\t\tp1 = new AI(1, diff, main);\n\t\t}\n\t\t\n\t\t\n\t\tif(player2.getSelectionModel().getSelectedItem().equals(_HUMAN)) {\n\t\t\tp2 = new Human(2, main);\n\t\t}\n\t\telse {\n\t\t\tString difficulty = player2Diff.getSelectionModel().getSelectedItem();\n\t\t\t\n\t\t\tint diff = difficulty.equals(_DIFFICULTY1) ? 1 : difficulty.equals(_DIFFICULTY2) ? 2 : 3;\n\t\t\t\n\t\t\tp2 = new AI(2, diff, main);\n\t\t}\n\t\t\n\t\t\n\t\tmain.startGame(p1, p2);\n\t\t\n\t}", "public Game()\r\n\t{\r\n\t\tthis.players = new Player[Config.PlayerLimit];\r\n\t\tthis.resetGame();\r\n\t}", "public void createGame(View view) {\n EditText editText = (EditText) findViewById(R.id.enter_game_keyword);\n gameName = editText.getText().toString();\n\n if (!nameEntered(gameName)) {\n return;\n }\n GameNameHandler.createGameHandler(this,gameName, getPlayerName());\n saveInPreferences(gameName);\n }", "@Override\n public void startNewGame(String[] playerNames, int matches) {\n GameSettings gameSettings = null;\n try {\n gameSettings = initialiseNewGame(playerNames, matches);\n } catch (IncorrectPlayerNameException e) {\n System.out.println(\"Game settings not initialized! \" + e.getMessage());\n System.exit(0);\n }\n\n gameField = createGameField(gameSettings);\n gameField.setCurrentPlayer(players[0]);\n ShowTwoPlayersGame showTwoPlayersGame = new ShowTwoPlayersGame();\n TwoPlayersArtificialIntelligence twoPlayersArtificialIntelligence =\n new TwoPlayersArtificialIntelligence();\n\n do {\n changePlayer();\n if (gameField.getCurrentPlayer().getName().equals(playerNames[0])) {\n showTwoPlayersGame.printMatchesOnField(gameField.getCurrentMatches());\n makeMove(gameField, showTwoPlayersGame.askMatchesCount(gameField.getCurrentMatches()));\n } else {\n showTwoPlayersGame.printMatchesOnField(gameField.getCurrentMatches());\n int move = twoPlayersArtificialIntelligence.chooseMove(\n gameField.getCurrentMatches());\n showTwoPlayersGame.printArtificialIntelligenceMove(move);\n makeMove(gameField, move);\n }\n } while (!checkGameOver(gameField.getCurrentMatches()));\n\n showTwoPlayersGame.printWinner(gameField.getCurrentPlayer().getName());\n\n }", "public void newGame() {\n\n //reset game board before initializing newgame\n clearGame();\n \n whiteplayer = new Player(\"white\", chessboard, this);\n blackplayer = new Player(\"black\", chessboard, this);\n colorsTurn = \"white\";\n gamelog.logCurrentTurn(colorsTurn);\n\n }", "public Game()//Method was given\n {\n parser = new Parser();\n player = new Player();\n }", "public GameManager(List<String> botNames){\n\t\tdeck = new Deck();\n\t\ttable = new Table();\n\t\tplayers = new ArrayList<Bot>();\n\t\t\n\t\t//create player objects via reflection\n\t\tfor (String botName : botNames){\n\t\t\ttry {\n\t\t\t\tplayers.add(newInstance(botName));\n\t\t\t} catch (ClassNotFoundException | NoSuchMethodException\t| InstantiationException | \n\t\t\t\t\tIllegalAccessException| IllegalArgumentException | InvocationTargetException e) {\n\t\t\t\t\t\tSystem.err.println(\"No such bot class found: \" + botName);\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t}\n\t}", "public void startGame(){\n\n AgentAddress coordinatorAddressPre = getAgentWithRole(\"investment_game\", \"tout_le_monde\", \"coordinator\");\n\n if (coordinatorAddressPre==null){\n Coordinator coordinator = new Coordinator();\n\n launchAgent(coordinator);\n\n pause(1000);\n }\n\n Set<Player> players = new HashSet<Player>();\n Player primaryPlayer = null;\n\n //now launch all human player avatar agents, each of them will be initialized as agent having a GUI frame\n Iterator<GameSpecification.PlayerSpecification> playerSpecs = gameSpecification.getPlayerSpecifications().iterator();\n\n int launchedHumanPlayers = 0;\n\n while (playerSpecs.hasNext()){\n GameSpecification.PlayerSpecification spec = playerSpecs.next();\n\n if (spec instanceof GameSpecification.HumanPlayerSpecification){\n\n HumanPlayerAvatar humanPlayerAvatar = new HumanPlayerAvatar(spec.getName());\n\n launchAgent(humanPlayerAvatar,true);\n\n players.add(humanPlayerAvatar);\n\n launchedHumanPlayers++;\n\n if (null == primaryPlayer){\n primaryPlayer=humanPlayerAvatar;\n }\n\n }\n }\n\n //launch computer player agents. If no human players have been launched, the first computer player will display a GUI frame.\n playerSpecs = gameSpecification.getPlayerSpecifications().iterator();\n\n boolean first = true;\n\n while (playerSpecs.hasNext()){\n GameSpecification.PlayerSpecification spec = playerSpecs.next();\n\n if (spec instanceof GameSpecification.ComputerPlayerSpecification){\n\n ChooseAmountStrategy chooseAmountStrategy = ((GameSpecification.ComputerPlayerSpecification) spec).getChooseAmountStrategy();\n\n SelectOpponentStrategy selectOpponentStrategy = ((GameSpecification.ComputerPlayerSpecification) spec).getSelectOpponentStrategy();\n \n ComputerPlayer computerPlayer = new ComputerPlayer(spec.getName(),spec.getPictureFileName(), chooseAmountStrategy, selectOpponentStrategy);\n\n chooseAmountStrategy.setPlayer(computerPlayer);\n\n selectOpponentStrategy.setPlayer(computerPlayer);\n\n launchAgent(computerPlayer, launchedHumanPlayers == 0 && first);\n\n players.add(computerPlayer);\n\n if (null == primaryPlayer){\n primaryPlayer=computerPlayer;\n }\n\n first = false;\n\n }\n }\n\n //request new game from coordinator\n AgentAddress coordinatorAddress;\n\n while((coordinatorAddress = getAgentWithRole(\"investment_game\",\"tout_le_monde\",\"coordinator\"))==null){\n pause(750);\n }\n\n String requestGameSpec = \"<new_game> <for> \"+gameSpecification.getPlayerSpecifications().size()+\" <players> <having> \"+gameSpecification.getRounds()+\" <rounds> <invite> 0 <computer_players>\";\n\n ActMessage reply = (ActMessage)sendMessageWithRoleAndWaitForReply(coordinatorAddress,new ActMessage(\"request_game\",requestGameSpec),\"jeromes_assistant\");\n\n if (reply.getAction().equals(\"game_initialized\")){\n\n final String gameId = reply.getContent();\n\n //let players join the game\n Iterator<Player> playerIterator = players.iterator();\n\n while (playerIterator.hasNext()){\n\n final Player player = playerIterator.next();\n final boolean isPrimaryPlayer = player.equals(primaryPlayer);\n\n new Thread(){\n @Override\n public void run() {\n player.joinGame(gameId,isPrimaryPlayer,player.getPicturePath());\n }\n }.start();\n\n }\n }else{\n //TODO throw Exception\n }\n\n }", "public void setUpPlayers() {\n this.players.add(new Player(\"Diogo\"));\n this.players.add(new Player(\"Hayden\"));\n this.players.add(new Player(\"Gogo\"));\n }", "public void newGameRPS() {\n newGame();\n myctr.setLabels();\n }", "public SinglePlayerGameController() {\n player1 = new Player(\"Player 1\");\n computer = new Player(\"Computer\");\n game = new Game(new Dice(), player1, computer);\n player1.setColor(\"blue\");\n computer.setColor(\"red\");\n diceImage = new DiceImage();\n }", "private void initPlayers() {\n this.playerOne = new Player(1, 5, 6);\n this.playerTwo = new Player(2, 0, 1);\n this.currentPlayer = playerOne;\n\n }", "public static void InitGame(ArrayList<Player> players) {\n PlayersLoop.setPlayers(players);\n _gameWindow.getBoard().makePlayersLayer();\n PlayersLoop.setCurrentPlayer(players.get(0));\n Dice.Reset();\n // todo Dice player order \n\n }", "public void playGame() {\n\t\tdo {\n\t\t\tSystem.out.print(\"How many people are playing (1-5)? \");\n\t\t\tusers = kb.nextInt();\n\n\t\t} while (users > 5 || users < 0);\n\n\t\tplayer = new Player[users];\n\t\tdeck = new Deck();\n\n\t\tfor (int i = 0; i < users; i++) {\n\t\t\tSystem.out.print(\"What is player \" + (i + 1) + \"'s name? \");\n\t\t\tString name;\n\t\t\tname = kb.next();\n\t\t\tplayer[i] = new Player();\n\t\t\tplayer[i].setName(name);\n\t\t}\n\t}", "public Game()\n {\n createRooms();\n parser= new Parser();\n }", "public GameState(){\n this.gameResults = \"\";\n initVars();\n this.theme = DEFAULT_THEME;\n this.board = new Board(DEFAULT_BOARD);\n createSetOfPlayers(DEFAULT_PLAYERS, DEFAULT_AUTOPLAYER, DEFAULT_AUTOMODE);\n }", "public void start(){\n int numberOfPlayers = Integer.parseInt(JOptionPane.showInputDialog(\"How many players\"));\n player1 = new Player(JOptionPane.showInputDialog(\"What is your name?\"));\n if(numberOfPlayers == 1){\n player2 = new Player(\"Computer\");\n }\n else if(numberOfPlayers == 2){\n player2 = new Player(JOptionPane.showInputDialog(\"What is the second player name?\"));\n }\n\n }", "public void startGame() {\n\t\tinitChips();\n\t\tassignAndStartInitialProjects();\n\t}", "void startGame(int gameId) {\n game = new Game(gameId);\n }", "public Game() \n {\n createRooms();\n parser = new Parser();\n }", "public Game() \n {\n createRooms();\n parser = new Parser();\n }", "private void createGame(int port, String playername) throws UnableToCreateSocketException, UnknownHostException, IOException, ClassNotFoundException, UnableToStartGameException\n\t{\n\t\tgameServer = new GameServer(port);\n\t\tnew Thread(gameServer).start();\n\t\tjoinGame(\"localhost\", port, playername);\n\t}", "public void newGame() {\n init();\n updateScoreBoard();\n Toast.makeText(getContext(), \"New Game started\", Toast.LENGTH_LONG).show();\n }", "public Game(Player[] players) {\r\n this.players = new ArrayList<>();\r\n this.players.addAll(Arrays.asList(players));\r\n dealer = new Dealer();\r\n this.players.add(dealer);\r\n nbRound = 1;\r\n\r\n String title = \"Nouvelle partie avec \";\r\n for (int i = 0; i < this.players.size(); i++) {\r\n title += this.players.get(i).getName() + \", \";\r\n }\r\n Logger.write(title);\r\n\r\n // launch the first round.\r\n round();\r\n }", "public void startGame() {\n int numberOFPlayers = view.askForNumberOfPlayers();\n\n // adding dealer...\n players.add(dealer);\n //...and players to 'players' ArrayList\n for (int i = 1; i < numberOFPlayers; i++) {\n players.add(new RegularPlayer(i + 1));\n }\n\n // dealing cards to players\n dealer.dealCardsToPlayers(players);\n // Game\n while (!(players.size() == 1)) {\n\n for (int i = 0; i < players.size(); i++) {\n\n // printowanie ilości kart kazdego z graczy dla testów\n if (checkGameStatus()) {\n try {\n // display no of cards for each player\n for (Player player : players) {\n view.print(\"Player \" + player.getPlayerId() + \" no of cards: \" + player.getCardsCount());\n }\n\n round(players.get(i), players);\n } catch (IndexOutOfBoundsException e) {\n continue;\n }\n } else {\n break;\n }\n }\n }\n }", "public Game() {\n\t\tusers = new ArrayList<>();\n\t\ttmpTeam = new UserTeam();\n\t\tcore = new Core();\n\t\tmarket = new Market(core);\n\t}", "Player createPlayer();", "public void createChooseGameUI()\n {\n \tHashMap<InventoryRunnable, InventoryItem> inventoryStuff = new HashMap<InventoryRunnable, InventoryItem>();\n \t\n \tInventoryRunnable gladiatorJoinRunnable = new GladiatorJoinInventoryRunnable(plugin);\n \t\n \tArrayList<String> gladiatorLore = new ArrayList<String>();\n \tgladiatorLore.add(\"FIGHT TO THE DEATH AND WIN YOUR FREEDOM\");\n \tgladiatorLore.add(\"GOOD LUCK WARRIOR!\");\n \tInventoryItem gladiatorItem = new InventoryItem(plugin, Material.SHIELD, \"GLADIATOR\", gladiatorLore, 1, true, 1);\n \tinventoryStuff.put(gladiatorJoinRunnable, gladiatorItem);\n \t\n \tchooseGameUI = new GUIInventory(plugin, \"MINIGAMES\", inventoryStuff, 3);\n }", "@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 }", "@Override\n\tpublic void startCreateNewGame() \n\t{\t\n\t\tgetNewGameView().setTitle(\"\");\n\t\tgetNewGameView().setRandomlyPlaceHexes(false);\n\t\tgetNewGameView().setRandomlyPlaceNumbers(false);\n\t\tgetNewGameView().setUseRandomPorts(false);\n\t\tif(!getNewGameView().isModalShowing())\n\t\t{\n\t\t\tgetNewGameView().showModal();\n\t\t}\n\t}", "public static void startGame() {\r\n\t\tfor (MovingUnit mu : _players) {\r\n\t\t\t((WinningInterface) mu).startUnit();\r\n\t\t}\r\n\t}", "private void createGameController() {\n\t\tLog.i(LOG_TAG, \"createGameController\");\n\n\t\tBundle intent = this.getIntent().getExtras();\n\t\t\n\t\tthis.punchMode = intent.getString(\"punchMode\");\n\t\t\n\t\tthis.gameController = new TimeTrialGameController( this.timerTextView,\n\t\t\t\tthis.numberOfPunchesCounterTextView, this.punchMode);\n\t\t\n\t\tthis.gameController.addObserver(this);\n\t}", "private void newGame()\r\n {\r\n //close the current screen\r\n screen.dispose();\r\n //start back at the set up menu\r\n SetupView screen = new SetupView();\r\n SetupController controller = new SetupController(screen);\r\n screen.registerObserver(controller);\r\n }", "public void initGame() {\n this.game = new Game();\n }", "public void startProgram() {\n this.displayBanner();\n// prompt the player to enter their name Retrieve the name of the player\n String playersName = this.getPlayersName();\n// create and save the player object\n User user = ProgramControl.createPlayer(playersName);\n// Display a personalized welcome message\n this.displayWelcomeMessage(user);\n// Display the Main menu.\n MainMenuView mainMenu = new MainMenuView();\n mainMenu.display();\n }", "public void createGame();", "private void createHumanPlayer() {\n humanPlayer = new Player(\"USER\");\n players[0] = humanPlayer;\n }", "private GUIGameInfo() {\n this.board = new GUIBoard();\n this.logic = new regLogic();\n this.players = new Player[2];\n this.players[0] = new Player(Symbol.BLACK);\n this.players[1] = new Player(Symbol.WHITE);\n this.guiPlayers = new GUIPlayer[2];\n this.guiPlayers[0] = new GUIPlayer(this.players[0]);\n this.guiPlayers[1] = new GUIPlayer(this.players[1]);\n\n }", "private void createAllGames() {\n\t\t// Create a melee game for each melee arena\n\t\tmeleeArenaManager.loadArenas();\n\t\tmeleeArenaManager.getArenas().forEach(meleeArena -> {\n\t\t\tMeleeGame game = new MeleeGame(meleeArena);\n\t\t\tmeleeGameManager.addGame(meleeArena.getName(), game, new PerMapLegacyLobby(game, PlayerProfile::restore, Melee.MELEE_CHAT_PREFIX));\n\t\t});\n\t\t\n\t\t// Create a rabbit game for each rabbit arena\n\t\trabbitArenaManager.loadArenas();\n\t\trabbitArenaManager.getArenas().forEach(rabbitArena -> {\n\t\t\tRabbitGame game = new RabbitGame(rabbitArena);\n\t\t\trabbitGameManager.addGame(rabbitArena.getName(), game, new PerMapLegacyLobby(game, PlayerProfile::restore, Melee.RABBIT_CHAT_PREFIX));\n\t\t});\n\t\t\n\t\t// Log out what games were created\n\t\tString meleeGamesList = meleeGameManager.getGamesList().stream()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .map(game -> game.getArena().getName())\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .collect(Collectors.joining(\", \"));\n\t\tgetLogger().info(\"Created Melee Games for arenas : \" + meleeGamesList);\n\n\t\tString rabbitGamesList = rabbitGameManager.getGamesList().stream()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .map(game -> game.getArena().getName())\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .collect(Collectors.joining(\", \"));\n\t\tgetLogger().info(\"Created Rabbit Games for arenas : \" + rabbitGamesList);\n\t}", "void newGame() {\n\t\tstate = new model.State () ; \n\t\tif(host != null ) host.show(state) ; \n\t}", "@Override\n\tpublic void newGame() {\n\t\tround = 0;\n\t\tnewRound();\n\t\t\n\t\tgameOverSoundPlayed = false;\n\t\t\n\t\t// Reset player scores\n\t\tfor (Player player : players) {\n\t\t\tsetPlayerScore(player, 0);\n\t\t}\n\t\t\n\t\t// Reset all button press counters\n\t\tfor (IButton button : buttons) {\n\t\t\tbutton.resetPressCounter();\n\t\t}\n\t\t\n\t\t// Start the game timer\n\t\tdeltaTimeAlive = getPhysicsTickMillis();\n\t\tdeltaTimeDead = deltaTimeAlive / 4;\n\t}", "private void launchCreateGame() {\n\t\tString name = nameText.getText().toString();\n\t\tString cycle = cycleText.getText().toString();\n\t\tString scent = scentText.getText().toString();\n\t\tString kill = killText.getText().toString();\n\t\t\n\t\tif (name.equals(\"\")){\n\t\t\tname = defaultName;\n\t\t} \n\t\tif (cycle.equals(\"\")) {\n\t\t\tcycle = \"720\";\n\t\t} \n\t\tif (scent.equals(\"\")) {\n\t\t\tscent = \"1.0\";\n\t\t}\n\t\tif (kill.equals(\"\")) {\n\t\t\tkill = \".5\";\n\t\t}\n\t\t\n\t\t\t\n\t\tAsyncJSONParser pewpew = new AsyncJSONParser(this);\n\t\tpewpew.addParameter(\"name\", name);\n\t\tpewpew.addParameter(\"cycle_length\", cycle);\n\t\tpewpew.addParameter(\"scent_range\", scent);\n\t\tpewpew.addParameter(\"kill_range\", kill);\n\t\tpewpew.execute(WerewolfUrls.CREATE_GAME);\n\t\t\n\t\tsetProgressBarEnabled(true);\n\t\tsetErrorMessage(\"\");\n\t}", "public void createStartingPlayers(CFrame frame) {\r\n\t\tSet<String> passableActions = new HashSet<String>();\r\n\t\tint playerNumber = Integer.parseInt(frame.getSidePanel().getButtons().getButton(\"start\", null));\r\n\t\tString name =\"\", charr;\r\n\t\tMap<String, String> pc = new HashMap<String, String>();\r\n\t\t\r\n\t\tframe.getSidePanel().getText().setText(\"Please select a character\\nand enter your name\\n\");\r\n\t\tfor(int i =0;i<playerNumber;i++){\r\n\t\t\tString test = frame.getSidePanel().getButtons().getButton(\"characterSelect\", passableActions);\r\n\r\n\t\t\tString Playercharacter[] = test.split(\",\");\r\n\t\t\tname= Playercharacter[0];\r\n\t\t\tcharr= Playercharacter[1];\r\n\t\t\tpassableActions.add(charr);\r\n\t\t\t\r\n\t\t\tpc.put(charr, name);\r\n\r\n\t\t\tSystem.out.println(\"Output: \" + name+\" : \"+charr);\r\n\t\t}\r\n\t\t\r\n\t\tfor(BoardObject object: boardObjects){\r\n\t\t\tSystem.out.println(object.getName() +\" \"+passableActions);\r\n\t\t\tif(object instanceof Character && passableActions.contains(object.getName())){\r\n\t\t\t\tSystem.out.println(object.getName());\r\n\t\t\t\t((Character) object).setAsPlayer(true);\r\n\t\t\t\t((Character) object).setPlayerName(pc.get(object.getName()));\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tdeck.deal(players(), players().size());\r\n\r\n\t\t//Testing allocation\r\n\t\tfor(Character c: players())\r\n\t\t\tSystem.out.println(c.getName() + \": \" + c.playerName());\r\n\t}", "void createPlayer(Player player);", "public GameManager(int numberOfPlayers, int numberOfPcPlayers, String[] names, Scanner scanner) {\n gameStatus = true;\n state = new State(numberOfPlayers);\n cards = new ArrayList<>();\n //call make card depend on number of player\n for (int i = 0; i <= (numberOfPlayers-1)/10; i++) {\n makeCards();\n }\n //make instances of player and control.\n players = new ArrayList<>();\n controls = new ArrayList<>();\n for (int i = 0; i < numberOfPlayers; i++) {\n ArrayList<Card> playerCards = new ArrayList<>();\n for (int j = 0; j < 7; j++) {\n playerCards.add(cards.get(0));\n cards.remove(0);\n }\n players.add(new Player(names[i], playerCards));\n if (i < numberOfPcPlayers) {\n controls.add(new PcControl(players.get(i),state));\n }\n else {\n controls.add(new HumanControl(players.get(i), scanner));\n }\n }\n //put first current card\n putCurrentCard();\n }", "public void GameStart()\n\t\t{\n\t\t\tplayers_in_game++;\n\t\t}", "@Override\n public LocalGame createLocalGame() {\n return new LocalGameActual();\n }", "void createNewGame() {\n _gameList.add(new GameObject());\n Log.i(\"createGame\", \"Created New Game\");\n }", "public GameManager(){\r\n init = new Initialisation();\r\n tower=init.getTower();\r\n courtyard=init.getCourtyard();\r\n kitchen=init.getKitchen();\r\n banquetHall=init.getBanquetHall();\r\n stock=init.getStock();\r\n throneHall=init.getThroneHall();\r\n vestibule=init.getVestibule();\r\n stables=init.getStables();\r\n\r\n this.player = new Player(tower);\r\n\r\n push(new IntroductionState());\r\n\t}", "public Game createGame();", "public Player1() {\n dbg = new DBG(DBG.PLAYERS, \"Player1\");\n }", "public static void main(String[] args) {\n\t\tGame game = new Football();\n\t\tgame.play();\n\n\t\tgame = new Cricket();\n\t\tgame.play();\n\t}", "public void setUpPlayers(final JLabel amountOfPlayers){\n\t\tplayers = new Player[amountPlayers];\n\t\ttext = new JTextField[amountPlayers];\n\t\tfor(int i = 0; i < amountPlayers; i++){\n\t\t\tJLabel name = new JLabel(\"Name: \");\n\t\t\tname.setForeground(Color.WHITE);\n\t\t\ttext[i] = new JTextField(\"\",10);\n\t\t\tpanel.add(name);\n\t\t\tpanel.add(text[i]);\n\t\t}\n\t\tpanel.add(Box.createVerticalStrut(100));\n\t\tfinal JButton done = new JButton(\"Start Game\");\n\t\tdone.addActionListener(new ActionListener(){\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tstartButton();\n\t\t\t\tpanel.remove(done);\n\t\t\t\tpanel.remove(amountOfPlayers);\n\t\t\t}\n\t\t});\n\t\tpanel.add(done,BorderLayout.SOUTH);\n\t\tframe.revalidate();\n\t\tframe.repaint();\n\t}", "public Game() {\n\t\tbPlayer = new Player(false);\n\t\twPlayer = new Player(true);\n\t\t// TODO Auto-generated constructor stub\n\t}", "public void newGame()\n\t{\n\t\tplanet.setLevel(0);\n\t\tship.resetScore();\n\t\tstopThreads();\n\t\tplanet = new Planet(750,600);\n\t\tship = new Ship(20.0,750,600,planet);\n\t\tbuttonPanel.update(ship,planet);\n\t\tgamePanel.update(ship,planet);\n\n\t\trestartThreads();\n\t}", "public void newGame(){\n\t\tsoundMan.BackgroundMusic1();\n\n\t\tstatus.setGameStarting(true);\n\n\t\t// init game variables\n\t\tbullets = new ArrayList<Bullet>();\n\n\t\tstatus.setShipsLeft(8);\n\t\tstatus.setGameOver(false);\n\n\t\tif (!status.getNewLevel()) {\n\t\t\tstatus.setAsteroidsDestroyed(0);\n\t\t}\n\n\t\tstatus.setNewAsteroid(false);\n\n\t\t// init the ship and the asteroid\n\t\tnewShip(gameScreen);\n\t\tnewAsteroid(gameScreen);\n\n\t\t// prepare game screen\n\t\tgameScreen.doNewGame();\n\t\tsoundMan.StopMusic2();\n\t\tsoundMan.StopMusic3();\n\t\tsoundMan.StopMusic4();\n\t\tsoundMan.StopMusic5();\n\t\tsoundMan.StopMusic6();\n\t\t// delay to display \"Get Ready\" message for 1.5 seconds\n\t\tTimer timer = new Timer(1500, new ActionListener(){\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tstatus.setGameStarting(false);\n\t\t\t\tstatus.setGameStarted(true);\t\n\n\t\t\t\tstatus.setLevel(1);\n\t\t\t\tstatus.setNumLevel(1);\n\t\t\t\tstatus.setScore(0);\n\t\t\t\tstatus.setYouWin(false);\n\t\t\t\tstatus.setBossLife(0);\n\t\t\t}\n\t\t});\n\t\ttimer.setRepeats(false);\n\t\ttimer.start();\n\t}", "public Game() {\n generatePort();\n status = Status.ATTENTE;\n generateGameID();\n name = \"GameG4B\";\n players = new ArrayList<>();\n maxRealPlayer = 0;\n maxVirtualPlayer = 0;\n realPlayerNb = 0;\n virtualPlayerNb = 0;\n rounds = new ArrayList<>();\n currentRound = 0;\n }", "private void setupGame(@NotNull String data) {\n if (game == null) {\n throw new IllegalArgumentException(\"Tried to start game with a null reference to GameGraphics\");\n }\n NewGameDto newGameDto = GameGraphics.gson.fromJson(data, NewGameDto.class);\n RoboRally.scheduleSync(() -> {\n game.setScreen(new GameScreen(game, newGameDto, this));\n writeToServer(ServerAction.FINISHED_SETUP + \"\");\n IPlayerHandler playerHandler = GameGraphics.getRoboRally().getPlayerHandler();\n if (playerHandler instanceof MultiPlayerHandler) {\n this.playerHandler = (MultiPlayerHandler) playerHandler;\n } else {\n throw new IllegalStateException(\"Player handler is not for multiplayer\");\n }\n\n }, 0);\n }", "private void initViews() {\n TextView textViewPlayer1 = (TextView) findViewById(R.id.textView_player1);\n TextView textViewScorePlayer1 = (TextView) findViewById(R.id.textView_player1_score);\n ProgressBar progressBarPlayer1 = (ProgressBar) findViewById(R.id.progressBar_player1);\n\n TextView textViewPlayer2 = (TextView) findViewById(R.id.textView_player2);\n TextView textViewScorePlayer2 = (TextView) findViewById(R.id.textView_player2_score);\n ProgressBar progressBarPlayer2 = (ProgressBar) findViewById(R.id.progressBar_player2);\n\n ImageView imageViewDie = (ImageView) findViewById(R.id.imageView_die);\n\n TextView textViewAccumulated = (TextView) findViewById(R.id.textView_accumulated);\n TextView textViewPlayerTurn = (TextView) findViewById(R.id.textView_player_turn);\n TextView textViewStartTurn = (TextView) findViewById(R.id.textView_start_turn);\n\n Button buttonCollect = (Button) findViewById(R.id.button_collect);\n Button buttonThrow = (Button) findViewById(R.id.button_throw);\n\n // The views are stored in objects which handle its behaviour //\n BarScore barScorePlayer1 =\n new BarScore(textViewPlayer1, textViewScorePlayer1, progressBarPlayer1);\n BarScore barScorePlayer2 =\n new BarScore(textViewPlayer2, textViewScorePlayer2, progressBarPlayer2);\n ScoreBoard scoreBoard = new ScoreBoard(barScorePlayer1, barScorePlayer2);\n DieView dieView = new DieView(imageViewDie);\n GameInfo gameInfo =\n new GameInfo(textViewAccumulated, textViewPlayerTurn, textViewStartTurn);\n ButtonsToPlay buttons = new ButtonsToPlay(buttonThrow, buttonCollect);\n\n // These objects with views are GameObjects, so they are stored in a global array //\n gameObjects = new GameObject[]{scoreBoard, dieView, gameInfo, buttons};\n\n // The AlertDialog to show the winner message or exit message -> onBackPressed() //\n gameAlertDialog = new GameAlertDialog(this, game, gameObjects);\n\n // Listeners //\n buttonThrow.setOnClickListener(new ThrowListener(game, gameAlertDialog, gameObjects));\n buttonCollect.setOnClickListener(new CollectListener(game, gameObjects));\n textViewStartTurn.setOnClickListener(new StartTurnListener(game, gameObjects));\n }", "public Game populateGames(String name);", "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 }", "private synchronized void startNewGame(List<ClientInfo> players) {\n\t\tClientServerHandler clientServerHandler = new ClientServerHandler(players);\n\t\tfor (ClientInfo player : players) {\n\t\t\tplayersInGame.add(player);\n\t\t}\n\t\texecutor.submit(clientServerHandler);\n\t}", "private Game (String[] args) {\n numTotalPlayers = Integer.valueOf(args[2]); \n try {\n numComputerPlayers = Integer.parseInt(args[3]);\n } catch (ArrayIndexOutOfBoundsException e) {\n numComputerPlayers = 0;\n System.out.println(\"No computer players enabled.\");\n }\n numHumanPlayers = numTotalPlayers - numComputerPlayers;\n board = Board.getInstance(args[0], args[1]);\n view = View.getInstance();\n }", "public GamePlayer() {}", "private void startNewGame()\n {\n \n \t//this.mIsSinglePlayer = isSingle;\n \n \tmGame.clearBoard();\n \n \tfor (int i = 0; i < mBoardButtons.length; i++)\n \t{\n \t\tmBoardButtons[i].setText(\"\");\n \t\tmBoardButtons[i].setEnabled(true);\n \t\tmBoardButtons[i].setOnClickListener(new ButtonClickListener(i));\n \t\t//mBoardButtons[i].setBackgroundDrawable(getResources().getDrawable(R.drawable.blank));\n \t}\n \n \t\tmPlayerOneText.setText(\"Player One:\"); \n \t\tmPlayerTwoText.setText(\"Player Two:\"); \n \n \t\tif (mPlayerOneFirst) \n \t{\n \t\t\tmInfoTextView.setText(R.string.turn_player_one); \n \t\tmPlayerOneFirst = false;\n \t}\n \telse\n \t{\n \t\tmInfoTextView.setText(R.string.turn_player_two); \n \t\tmPlayerOneFirst = true;\n \t}\n \t\n \n \tmGameOver = false;\n }", "static Game newGame(Player player1, Player player2) {\n return new GameImpl(player1, player2);\n }", "public void start() {\n // set player number\n playerNumber = clientTUI.getInt(\"set player number (2-4):\");\n while (true) {\n try {\n game = new Game();\n game.setPlayerNumber(playerNumber - 1);\n host = this.clientTUI.getString(\"server IP address:\");\n port = this.clientTUI.getInt(\"server port number:\");\n clientName = this.clientTUI.getString(\"your name:\");\n player = clientTUI.getBoolean(\"are you human (or AI): (true/false)\") ?\n new HumanPlayer(clientName) : new ComputerPlayer(clientName);\n game.join(player);\n // initialize the game\n game.init();\n while (clientName.indexOf(' ') >= 0) {\n clientName = this.clientTUI.getString(\"re-input your name without space:\");\n }\n this.createConnection();\n this.sendJoin(clientName);\n this.handleJoin();\n if (handshake) {\n run();\n } else {\n if (!this.clientTUI.getBoolean(\"Do you want to open a new connection?\")) {\n shutdown();\n break;\n }\n }\n } catch (ServerUnavailableException e) {\n clientTUI.showMessage(\"A ServerUnavailableException error occurred: \" + e.getMessage());\n if (!clientTUI.getBoolean(\"Do you want to open a new connection?\")) {\n shutdown();\n break;\n }\n }\n }\n clientTUI.showMessage(\"Exiting...\");\n }" ]
[ "0.70724934", "0.704879", "0.7034845", "0.6991756", "0.6984401", "0.6952472", "0.688355", "0.6863663", "0.6833408", "0.6810382", "0.6780479", "0.6775744", "0.6730692", "0.67221874", "0.6717384", "0.6717159", "0.66590595", "0.66576535", "0.6656647", "0.66505426", "0.66480863", "0.6639976", "0.6630023", "0.6624193", "0.66213995", "0.66213053", "0.6569662", "0.65043485", "0.6503128", "0.64885354", "0.6477413", "0.64662856", "0.64532775", "0.64441335", "0.6441981", "0.643232", "0.6427198", "0.64206094", "0.6418419", "0.6384239", "0.63828856", "0.6378074", "0.6363537", "0.6349557", "0.6340553", "0.63347834", "0.6329917", "0.63251877", "0.63242", "0.6314203", "0.63120204", "0.6308612", "0.63019985", "0.6272414", "0.6272414", "0.62720346", "0.627112", "0.6265512", "0.62646294", "0.62618804", "0.62575865", "0.6253618", "0.6250341", "0.62399983", "0.6239576", "0.62354743", "0.6233999", "0.62336314", "0.6222477", "0.6220407", "0.61946124", "0.61795133", "0.6178676", "0.61709344", "0.6167957", "0.6162474", "0.616194", "0.6152064", "0.6148278", "0.6146698", "0.6146238", "0.6125245", "0.6118233", "0.6111981", "0.61044526", "0.6091915", "0.60903823", "0.60803246", "0.6077663", "0.6073259", "0.60692424", "0.6064093", "0.60626423", "0.6059513", "0.6057046", "0.6056276", "0.6051739", "0.6048119", "0.60367525", "0.6033197", "0.6030886" ]
0.0
-1
/ This creates the keyboard input listeners necessary to play the game.
private void createKeyListeners() { addGameKeys(); view.getGameScene().setOnKeyPressed(event ->{ if (keyListeners.containsKey(event.getCode())) { keyListeners.put(event.getCode(), true); } }); view.getGameScene().setOnKeyReleased(event ->{ if (keyListeners.containsKey(event.getCode())) { keyListeners.put(event.getCode(), false); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setInputListeners () {\r\n // initialize input state\r\n myLastKeyPressed = NO_KEY_PRESSED;\r\n myKeys = new TreeSet<Integer>();\r\n addKeyListener(new KeyAdapter() {\r\n @Override\r\n public void keyPressed (KeyEvent e) {\r\n // resets key after being used once. Does not affect getKeysPressed.\r\n if (myLastKeyPressed == e.getKeyCode()) {\r\n myLastKeyPressed = NO_KEY_PRESSED;\r\n }\r\n else {\r\n myLastKeyPressed = e.getKeyCode();\r\n }\r\n myKeys.add(e.getKeyCode());\r\n }\r\n\r\n @Override\r\n public void keyReleased (KeyEvent e) {\r\n myKeys.remove(e.getKeyCode());\r\n }\r\n });\r\n myLastMousePosition = NO_MOUSE_PRESSED;\r\n addMouseMotionListener(new MouseMotionAdapter() {\r\n @Override\r\n public void mouseDragged (MouseEvent e) {\r\n myLastMousePosition = e.getPoint();\r\n }\r\n });\r\n addMouseListener(new MouseAdapter() {\r\n @Override\r\n public void mousePressed (MouseEvent e) {\r\n myLastMousePosition = e.getPoint();\r\n myMouseClick = true;\r\n }\r\n\r\n @Override\r\n public void mouseReleased (MouseEvent e) {\r\n myLastMousePosition = NO_MOUSE_PRESSED;\r\n myMouseClick = false;\r\n }\r\n });\r\n }", "private void initInputListeners() {\n focusGrabber = new FocusGrabber();\r\n mouseClickScroller = new MouseClickScroller();\r\n cursorChanger = new CursorChanger();\r\n wheelScroller = new MouseWheelScroller();\r\n keyScroller = new KeyScroller();\r\n }", "public void createKeyListeners() {\n\t\taddKeyListener(new KeyListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"Key typed\");\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void keyReleased(KeyEvent e) {\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void keyPressed(KeyEvent e) {\n\t\t\t\t\n\t\t\t\tif (e.getKeyCode() == KeyEvent.VK_F9) {\n\t\t\t\t\tif (e.isControlDown()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tApp.sc.rebootServer();\n\t\t\t\t\t\t} catch (IOException e1) {\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\te1.printStackTrace();\n\t\t\t\t\t\t}\t\t\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif (e.getKeyCode() == KeyEvent.VK_DELETE || e.getKeyCode() == KeyEvent.VK_BACK_SPACE) {\n\t\t\t\t\tSystem.out.println(\"Delete key pressed\");\n\t\t\t\t\tif (clicked != null) {\n\t\t\t\t\t\tremoveConnection(clicked);\n\t\t\t\t\t\trepaint();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "private void setUpKeys() {\n inputManager.addMapping(\"Up\", new KeyTrigger(KeyInput.KEY_W));\n inputManager.addMapping(\"Down\", new KeyTrigger(KeyInput.KEY_S));\n inputManager.addMapping(\"Left\", new KeyTrigger(KeyInput.KEY_A));\n inputManager.addMapping(\"Right\", new KeyTrigger(KeyInput.KEY_D));\n inputManager.addMapping(\"Click\", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));\n inputManager.addListener(this, \"Up\");\n inputManager.addListener(this, \"Down\");\n inputManager.addListener(this, \"Left\");\n inputManager.addListener(this, \"Right\");\n inputManager.addListener(this, \"Click\");\n }", "private void setUpKeys() {\n inputManager.addMapping(\"Left\", new KeyTrigger(KeyInput.KEY_A));\n inputManager.addMapping(\"Right\", new KeyTrigger(KeyInput.KEY_D));\n inputManager.addMapping(\"Up\", new KeyTrigger(KeyInput.KEY_W));\n inputManager.addMapping(\"Down\", new KeyTrigger(KeyInput.KEY_S));\n //inputManager.addMapping(\"Shoot\", new KeyTrigger (KeyInput.KEY_LSHIFT));\n inputManager.addMapping(\"Jump\", new KeyTrigger(KeyInput.KEY_SPACE));\n inputManager.addListener(this, \"Left\");\n inputManager.addListener(this, \"Right\");\n inputManager.addListener(this, \"Up\");\n inputManager.addListener(this, \"Down\");\n \n inputManager.addListener(this, \"Jump\");\n }", "public GameInput() {\n keyboard = new Keyboard();\n mouse = new Mouse();\n mouseWheel = new MouseWheel();\n }", "private void addKeyListeners()\n\t{\n\t\tentry.addKeyListener (new keyListener());\n\t}", "@Override\r\n protected void createListeners(\r\n ) {\r\n \tsuper.createListeners();\r\n \t\r\n inputManager.addMapping( \"nextScene\"\r\n , new KeyTrigger( KeyInput.KEY_RETURN ) );\r\n inputManager.addMapping( \"priorScene\"\r\n , new KeyTrigger( KeyInput.KEY_BACKSLASH ) );\r\n inputManager.addMapping( \"abortLoad\"\r\n , new KeyTrigger( KeyInput.KEY_DELETE ) );\r\n \r\n ActionListener aListener = new CSGTestActionListener(); \r\n inputManager.addListener( aListener, \"nextScene\" );\r\n inputManager.addListener( aListener, \"priorScene\" );\r\n inputManager.addListener( aListener, \"abortLoad\" );\r\n }", "private void initKeys()\n {\n // You can map one or several inputs to one named action\n inputManager.addMapping(\"Left\", new KeyTrigger(KeyInput.KEY_J));\n inputManager.addMapping(\"Right\", new KeyTrigger(KeyInput.KEY_L));\n inputManager.addMapping(\"Up\", new KeyTrigger(KeyInput.KEY_I));\n inputManager.addMapping(\"Down\", new KeyTrigger(KeyInput.KEY_K));\n inputManager.addMapping(\"Orient\", new KeyTrigger(KeyInput.KEY_O));\n\n // Add the names to the action listener.\n inputManager.addListener(analogListener, \"Left\", \"Right\", \"Up\", \"Down\", \"Orient\");\n }", "public void addKeyListeners() {\n\t\t\tkeyAdapter = new KeyAdapter(){\n\t\t\t\t@Override\n\t\t\t\tpublic void keyPressed(KeyEvent e){\n\t\t\t\t\tchar command;\n\t\t\t\t\tif (e.getKeyCode() == KeyEvent.VK_SHIFT) {\n//\t\t\t\t\t\tSystem.out.println(\"FORWARD\");\n\t\t\t\t\t\tcommand = 'F';\n\t\t\t\t\t} else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {\n//\t\t\t\t\t\tSystem.out.println(\"TURN RIGHT\");\n\t\t\t\t\t\tcommand = 'R';\n\t\t\t\t\t} else if (e.getKeyCode() == KeyEvent.VK_LEFT){\n//\t\t\t\t\t\tSystem.out.println(\"TURN LEFT\");\n\t\t\t\t\t\tcommand = 'L';\n\t\t\t\t\t//Let's disable 'F', 'R' and 'L' keys because they're captured by the arrow keys above\n\t\t\t\t\t} else if (e.getKeyCode() == KeyEvent.VK_F || e.getKeyCode() == KeyEvent.VK_R || e.getKeyCode() == KeyEvent.VK_L) {\n\t\t\t\t\t\tcommand = '-';\t//this signifies an invalid command.\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcommand = Character.toUpperCase(e.getKeyChar());\n\t\t\t\t\t}\n\n\n\t\t\t\t\tif (currentState == GameState.PLAYING) {\n\t\t\t\t\t\t//If this is tutorial mode, check status first to see if this action should be allowed at all.\n\t\t\t\t\t\t//If not approved, end this method immediately\n\t\t\t\t\t\tif (SAR.this.isTutorialMode()) {\n\t\t\t\t\t\t\tboolean actionApproved = tutorial.checkTutorialActionApproved(command);\n\t\t\t\t\t\t\tif (!actionApproved) return;\n\t\t\t\t\t\t} else if (SAR.this.isPracticeMissionHumanMode()) {\n\t\t\t\t\t\t\tboolean actionApproved = practiceDrillHuman.checkMissionActionApproved(command);\n\t\t\t\t\t\t\tif (!actionApproved) return;\n\t\t\t\t\t\t} else if (SAR.this.isPracticeMissionAIMode()) {\n\t\t\t\t\t\t\tboolean actionApproved = practiceDrillAI.checkMissionActionApproved(command);\n\t\t\t\t\t\t\tif (!actionApproved) return;\n\t\t\t\t\t\t} else if (SAR.this.isFinalMissionMode()){\n\t\t\t\t\t\t\tif (!finalMission.checkMissionActionApproved(command)) return;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//Depending on whether the control mode is \"H\" for manual control only, \"R\" for automated control only,\n\t\t\t\t\t\t//or \"B\" for both modes enabled, certain commands will be disabled / enabled accordingly.\n\t\t\t\t\t\t//For instance, in mode \"R\", only the spacebar command will be recognized.\n\t\t\t\t\t\tif ( (\"H\".contains(SAR.this.controlMode) && \"FRLGSQO\" .contains(String.valueOf(command))) ||\n\t\t\t\t\t\t\t (\"R\".contains(SAR.this.controlMode) && \" \" .contains(String.valueOf(command))) ||\n\t\t\t\t\t\t\t (\"B\".contains(SAR.this.controlMode) && \"FRLGSQO \".contains(String.valueOf(command))) ) {\n\t\t\t\t\t\t\tboolean validKeyTyped = updateGame(currentPlayer, command, 0); // invoke update method with the given command\n\t\t\t\t\t\t\t// Switch player (in the event that we have a 2-player mission)\n\t\t\t\t\t\t\tif(validKeyTyped) {\n\t\t\t\t\t\t\t\tSAR.this.numOfMoves++;\n\t\t\t\t\t\t\t\tPlayer nextPlayer = (currentPlayer == h1 ? h2 : h1);\n\t\t\t\t\t\t\t\tif (nextPlayer.isAlive())\n\t\t\t\t\t\t\t\t\tcurrentPlayer = nextPlayer;\n//\t\t\t\t\t\t\t\tSystem.out.printf(\"Total no. of moves so far: %s\\n\", numOfMoves);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//end nested if\n\n\t\t\t\t\t\t//If we're in tutorial mode, we need to check to see\n\t\t\t\t\t\t//if user has completed what the tutorial asked them to do\n\t\t\t\t\t\tif (SAR.this.isTutorialMode()) {\n\t\t\t\t\t\t\ttutorial.checkTutorialStatus(String.valueOf(command));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (Character.toUpperCase(command) == 'A') { // this command can be used when mission is over to restart mission\n\t\t\t\t\t\tif (SAR.this.isTutorialMode()) {\n\t\t\t\t\t\t\tinitTutorial();\t//If this was a tutorial mode, restart the same tutorial\n//\t\t\t\t\t\t\ttutorial = new Tutorial(SAR.this);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse initMission();\t\t\t\t\t\t\t\t\t//otherwise, initialize mission again\n\t\t\t\t\t} else if(Character.toUpperCase(command) == 'O' && !SAR.this.isTutorialOrMissionMode()) {\t// open options window as long as this isn't' tutorial mode\n\t\t\t\t\t\topenOptionsWindow();\t//custom method\n\t\t\t\t\t}\n\t\t\t\t\t// Refresh the drawing canvas\n\t\t\t\t\trepaint(); // Call-back paintComponent().\n\n\t\t\t\t}\n\t\t\t\t//end public void keyPressed\n\t\t\t};\n\t\t\t//end keyAdapter initialization\n\t\t\taddKeyListener(keyAdapter);\n\t\t}", "public MainGame(){\n addKeyListener(new ClavierListener());\n }", "private void setupListeners() {\t\t\n\n\t\tnextButton.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t\n\t\t\t\t gameModel.generateGame();\n\t\t\t\t \n\t\t\t\t setGameModel(gameModel);\n\t\t\t\t \n\t\t\t\t //gameModel = new GameModel(gameModel.getList());\n\t\t\t\t \n\t\t\t\n\t\t\t}\n\t\t});\n\t\t\n\t\ttilePanel.addMouseListener(new MouseAdapter() {\n\t\t\t@Override\n\t\t\tpublic void mousePressed(MouseEvent e) {\n\t\t\t\tSystem.out.println(\"PRESS\");\n\t\t\t}\n\t\t\t\n\t\t\tpublic void mouseReleased(MouseEvent e) {\n\t\t\t\tSystem.out.println(\"RELEASED\");\n\t\t\t}\n\t\t});\n\t}", "private void createEvents() {\n\t\t\n\t\ttxtXC.addKeyListener(new KeyAdapter() {\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\tchar c = e.getKeyChar();\n\t\t\t\tif (!((c >= '0') && (c <= '9') ||\n\t\t\t\t\t\t(c == KeyEvent.VK_BACK_SPACE) ||\n\t\t\t\t\t\t(c == KeyEvent.VK_DELETE))) {\n\t\t\t\t\tgetToolkit().beep();\n\t\t\t\t\te.consume();\n\t\t\t\t}\t\n\t\t\t}\n\t\t});\n\t\t\n\t\ttxtYC.addKeyListener(new KeyAdapter() {\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\tchar c = e.getKeyChar();\n\t\t\t\tif (!((c >= '0') && (c <= '9') ||\n\t\t\t\t\t\t(c == KeyEvent.VK_BACK_SPACE) ||\n\t\t\t\t\t\t(c == KeyEvent.VK_DELETE))) {\n\t\t\t\t\tgetToolkit().beep();\n\t\t\t\t\te.consume();\n\t\t\t\t}\t\n\t\t\t}\n\t\t});\n\t\t\n\t\ttxtHeight.addKeyListener(new KeyAdapter() {\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\tchar c = e.getKeyChar();\n\t\t\t\tif (!((c >= '0') && (c <= '9') ||\n\t\t\t\t\t\t(c == KeyEvent.VK_BACK_SPACE) ||\n\t\t\t\t\t\t(c == KeyEvent.VK_DELETE))) {\n\t\t\t\t\tgetToolkit().beep();\n\t\t\t\t\te.consume();\n\t\t\t\t}\t\n\t\t\t}\n\t\t});\n\t\t\n\t\ttxtWidth.addKeyListener(new KeyAdapter() {\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\tchar c = e.getKeyChar();\n\t\t\t\tif (!((c >= '0') && (c <= '9') ||\n\t\t\t\t\t\t(c == KeyEvent.VK_BACK_SPACE) ||\n\t\t\t\t\t\t(c == KeyEvent.VK_DELETE))) {\n\t\t\t\t\tgetToolkit().beep();\n\t\t\t\t\te.consume();\n\t\t\t\t}\t\n\t\t\t}\n\t\t});\n\t\t\n\t\ttxtColor.addMouseListener(new MouseAdapter() {\n\t\t\t@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\tcolor = JColorChooser.showDialog(null, \"Choose your color\", color);\n\t\t\t\tif (color == null) {\n\t\t\t\t\tcolor = Color.BLACK;\n\t\t\t\t}\n\t\t\t\ttxtColor.setBackground(color);\n\t\t\t}\n\t\t});\n\t\t\n\t\ttxtFill.addMouseListener(new MouseAdapter() {\n\t\t\t@Override\n\t\t\tpublic void mouseClicked(MouseEvent arg0) {\n\t\t\t\tfill = JColorChooser.showDialog(null, \"Choose your color\", fill);\n\t\t\t\tif (fill == null) {\n\t\t\t\t\tfill = Color.WHITE;\n\t\t\t\t}\n\t\t\t\ttxtFill.setBackground(fill);\n\t\t\t}\n\t\t});\n\t\t\n\t\tbtnOK.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\tif (txtXC.getText().trim().isEmpty() ||\n\t\t\t\t\t\ttxtYC.getText().trim().isEmpty() ||\n\t\t\t\t\t\ttxtHeight.getText().trim().isEmpty() ||\n\t\t\t\t\t\ttxtWidth.getText().trim().isEmpty()) {\n\t\t\t\t\tisOK = false;\n\t\t\t\t\tsetVisible(true);\n\t\t\t\t\tgetToolkit().beep();\n\t\t\t\t\tJOptionPane.showMessageDialog(null, \"Not all fields have entered values!\", \"Error\",\n\t\t\t\t\t\t\tJOptionPane.ERROR_MESSAGE);\n\t\t\t\t} else if (\n\t\t\t\t\t\tInteger.parseInt(txtHeight.getText()) > 999 ||\n\t\t\t\t\t\tInteger.parseInt(txtWidth.getText()) > 999) {\n\t\t\t\t\t\n\t\t\t\t\tisOK = false;\n\t\t\t\t\tsetVisible(true);\n\t\t\t\t\tgetToolkit().beep();\n\t\t\t\t\tJOptionPane.showMessageDialog(null, \"Values entered must be between 0 and 999! \\nPlease try again\", \"Error\",\n\t\t\t\t\t\t\tJOptionPane.ERROR_MESSAGE);\n\t\t\t\t\t\tif (Integer.parseInt(txtHeight.getText()) > 999) {\n\t\t\t\t\t\t\ttxtHeight.setText(\"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tif (Integer.parseInt(txtWidth.getText()) > 999) {\n\t\t\t\t\t\t\ttxtWidth.setText(\"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tisOK = true;\n\t\t\t\t\tdispose();\n\t\t\t\t\tr = new Rectangle(new Point (Integer.parseInt(txtXC.getText()), Integer.parseInt(txtYC.getText())),\n\t\t\t\t\tInteger.parseInt(txtHeight.getText()), Integer.parseInt(txtWidth.getText()),\n\t\t\t\t\tFrmDrawing.getColor1(), FrmDrawing.getColor2());\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tbtnCancel.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tint confirm = JOptionPane.showConfirmDialog (null, \"Are you sure you want to cancel your actions?\",\"Warning\", JOptionPane.YES_NO_OPTION);\n\t\t\t\tif (confirm == JOptionPane.YES_OPTION) {\n\t\t\t\t\tisOK = false;\n\t\t\t\t\tdispose();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "public void init() {\n state = new GameState();\n gameFrame.addKeyListener(state.getKeyListener());\n gameFrame.addMouseListener(state.getMouseListener());\n gameFrame.addMouseMotionListener(state.getMouseMotionListener());\n gameFrame.addFocusListener(new FocusAdapter() {\n @Override\n public void focusLost(FocusEvent e) {\n state.resetKeys();\n }\n });\n gameFrame.addMouseWheelListener(e -> {\n if (Map.map != null) {\n if (e.getWheelRotation() < 0)\n Map.zoomIn();\n else\n Map.zoomOut();\n }\n });\n //Pause Key Setting\n gameFrame.addKeyListener(new KeyAdapter() {\n @Override\n public void keyPressed(KeyEvent e) {\n keyPressed = true;\n if (e.getKeyCode() == KeyEvent.VK_ESCAPE && !gameFinished)\n pause();\n if (e.getKeyCode() == KeyEvent.VK_F1)\n GameFrame.testMode = !GameFrame.testMode;\n }\n });\n gameFrame.addMouseListener(new MouseAdapter() {\n @Override\n public void mouseClicked(MouseEvent e) {\n keyPressed = true;\n }\n });\n\n gameFrame.addKeyListener(new KeyAdapter() {\n @Override\n public void keyTyped(KeyEvent e) {\n if (e.getKeyChar() >= 'a' && e.getKeyChar() <= 'z')\n Cheater.keyPressed(e.getKeyChar());\n }\n });\n }", "private void initKeys() {\n app.getInputManager().addMapping(\"Drag\", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));\n app.getInputManager().addMapping(\"Left\", new MouseAxisTrigger(MouseInput.AXIS_X, true));\n app.getInputManager().addMapping(\"Right\", new MouseAxisTrigger(MouseInput.AXIS_X, false));\n app.getInputManager().addMapping(\"Up\", new MouseAxisTrigger(MouseInput.AXIS_Y, true));\n app.getInputManager().addMapping(\"Down\", new MouseAxisTrigger(MouseInput.AXIS_Y, false));\n app.getInputManager().addMapping(\"defaultCamPosition\", new KeyTrigger(KeyInput.KEY_MINUS));\n\n app.getInputManager().addMapping(\"camZOOM_Wheel_Minus\", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));\n app.getInputManager().addMapping(\"camZOOM_Wheel_Plus\", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));\n\n app.getInputManager().addListener(actionListener, \"defaultCamPosition\" , \"Drag\" );\n app.getInputManager().addListener(analogListener, \"Left\", \"Right\", \"Up\", \"Down\" , \"camZOOM_Wheel_Minus\" , \"camZOOM_Wheel_Plus\");\n }", "private void initKeys() { \n //add left, down, right, up\n playerKeys.add(new keyList(KeyInput.KEY_J, KeyInput.KEY_K, KeyInput.KEY_L, KeyInput.KEY_I));\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 public void initKeys()\n {\n inputManager.addMapping(\"Left\", new KeyTrigger(KeyInput.KEY_J));\n inputManager.addMapping(\"Right\", new KeyTrigger(KeyInput.KEY_L));\n inputManager.addMapping(\"Up\", new KeyTrigger(KeyInput.KEY_I));\n inputManager.addMapping(\"Down\", new KeyTrigger(KeyInput.KEY_K));\n inputManager.addMapping(\"Orient\", new KeyTrigger(KeyInput.KEY_O));\n inputManager.addMapping(\"pick target\", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));\n\n // Add the names to the listener.\n inputManager.addListener(analogListener, \"Left\", \"Right\", \"Up\", \"Down\", \"Orient\");\n inputManager.addListener(actionListener, \"pick target\");\n }", "protected void initControls()\n {\n glfwSetKeyCallback(windowID, new KeyboardInput());\n MouseInput.init(windowID);\n }", "public KeyListener getKeyboardEvent() {\n\treturn new KeyListener() {\n\t // classe anonyme et on est obliger d'implementer toutes les methodes\n\t // de la classe meme si on les utilise pas\n\t @Override\n\t public void keyPressed(KeyEvent e) {\n\t\t// recuperer l'objet board de la classe MainWindow depuis la classe\n\t\t// anonyme\n\t\tBoard board = MainWindow.this.board;\n\t\tswitch (e.getKeyCode()) {\n\t\t case KeyEvent.VK_UP:\n\t\t\tboard.playMove(Direction.UP);\n\t\t\tbreak;\n\t\t case KeyEvent.VK_DOWN:\n\t\t\tboard.playMove(Direction.DOWN);\n\t\t\tbreak;\n\t\t case KeyEvent.VK_LEFT:\n\t\t\tboard.playMove(Direction.LEFT);\n\t\t\tbreak;\n\t\t case KeyEvent.VK_RIGHT:\n\t\t\tboard.playMove(Direction.RIGHT);\n\t\t\tbreak;\n\t\t}\n\t }\n\t \n\t @Override\n\t public void keyTyped(KeyEvent e) {\n\t\t\n\t }\n\n\t @Override\n\t public void keyReleased(KeyEvent e) {\n\t\t\n\t }\n\t};\n }", "protected void inputListener(){\n }", "protected void setupInputs(SceneManager sceneManager) {\n\n\t\tmoveLeftAction = new NetworkMoveLeftAction(this, dolphinNodeOne, protocolClient);\n\t\tmoveRightAction = new NetworkMoveRightAction(this, dolphinNodeOne, protocolClient);\n\t\tmoveForwardAction = new NetworkMoveForwardAction(this, dolphinNodeOne, protocolClient);\n\t\tmoveBackwardAction = new NetworkMoveBackwardAction(this, dolphinNodeOne, protocolClient);\n\t\texitGameAction = new ExitGameAction(this);\n\t\tskipSongAction = new SkipSongAction(this);\n\t\tavatarJumpAction = new AvatarJumpAction(this, dolphinNodeOne.getName());\n\t\tavatarChargeAction = new AvatarChargeAction(this, dolphinNodeOne.getName());\n\t\tcloseConnectionAction = new CloseConnectionAction(protocolClient, this, isClientConnected);\n\t\tfireAction = new NetworkFireAction(this, dolphinNodeOne, protocolClient);\n\n\t\tArrayList<Controller> controllersArrayList = inputManager.getControllers();\n\t\tfor (Controller keyboards : controllersArrayList) {\n\t\t\tif (keyboards.getType() == Controller.Type.KEYBOARD) {\n\t\t\t\tinputManager.associateAction(keyboards, net.java.games.input.Component.Identifier.Key.A, moveLeftAction,\n\t\t\t\t\t\tInputManager.INPUT_ACTION_TYPE.REPEAT_WHILE_DOWN);\n\n\t\t\t\tinputManager.associateAction(keyboards, net.java.games.input.Component.Identifier.Key.D,\n\t\t\t\t\t\tmoveRightAction, InputManager.INPUT_ACTION_TYPE.REPEAT_WHILE_DOWN);\n\n\t\t\t\tinputManager.associateAction(keyboards, net.java.games.input.Component.Identifier.Key.W,\n\t\t\t\t\t\tmoveForwardAction, InputManager.INPUT_ACTION_TYPE.REPEAT_WHILE_DOWN);\n\n\t\t\t\tinputManager.associateAction(keyboards, net.java.games.input.Component.Identifier.Key.S,\n\t\t\t\t\t\tmoveBackwardAction, InputManager.INPUT_ACTION_TYPE.REPEAT_WHILE_DOWN);\n\n\t\t\t\tinputManager.associateAction(keyboards, net.java.games.input.Component.Identifier.Key.P, skipSongAction,\n\t\t\t\t\t\tInputManager.INPUT_ACTION_TYPE.ON_PRESS_ONLY);\n\n\t\t\t\tinputManager.associateAction(keyboards, net.java.games.input.Component.Identifier.Key.ESCAPE,\n\t\t\t\t\t\texitGameAction, InputManager.INPUT_ACTION_TYPE.ON_PRESS_AND_RELEASE);\n\n\t\t\t\tinputManager.associateAction(keyboards, net.java.games.input.Component.Identifier.Key.SPACE,\n\t\t\t\t\t\tavatarJumpAction, InputManager.INPUT_ACTION_TYPE.ON_PRESS_ONLY);\n\n\t\t\t\t// inputManager.associateAction(keyboards,\n\t\t\t\t// net.java.games.input.Component.Identifier.Key.LSHIFT,\n\t\t\t\t// avatarChargeAction, InputManager.INPUT_ACTION_TYPE.ON_PRESS_ONLY);\n\n\t\t\t\tinputManager.associateAction(keyboards, net.java.games.input.Component.Identifier.Key.K,\n\t\t\t\t\t\tcloseConnectionAction, InputManager.INPUT_ACTION_TYPE.ON_PRESS_ONLY);\n\n\t\t\t}\n\t\t\tif (keyboards.getType() == Controller.Type.MOUSE) {\n\t\t\t\tinputManager.associateAction(keyboards, net.java.games.input.Component.Identifier.Button.LEFT,\n\t\t\t\t\t\tfireAction, InputManager.INPUT_ACTION_TYPE.ON_PRESS_ONLY);\n\t\t\t}\n\t\t}\n\n\t}", "public void addListeners() {\n\n startButton.addActionListener(e -> {\n if (play) {\n gameFrame.startGame();\n } else {\n gameFrame.stopGame();\n }\n play = !play;\n setTextOfStartPause();\n });\n saveButton.addActionListener(e -> {\n gameFrame.saveGame();\n });\n loadButton.addActionListener(e -> {\n gameFrame.loadGame();\n });\n resetButton.addActionListener(e -> {\n gameFrame.clearBoard();\n play = true;\n setTextOfStartPause();\n });\n exitButton.addActionListener(e -> {\n gameFrame.exitGame();\n });\n }", "public void keyListener() {\n\t\tsetOnKeyPressed(event -> {\n\t\t\tif(death) {}\n\t\t\telse \t{\n\t\t\tif (event.getCode() == KeyCode.W || event.getCode() == KeyCode.UP)\n\t\t\t{\n\t\t\t\tmove(0, -movementY);\n\t\t\t\tsetImage(frogImg(4));\n\t\t\t\taddPoints(10);\n\n\t\t\t}\n\n\t\t\tif (event.getCode() == KeyCode.A || event.getCode() == KeyCode.LEFT)\n\t\t\t{\n\t\t\t\tmove(-movementX, 0);\n\t\t\t\tsetImage(frogImg(5));\n\t\t\t}\n\n\t\t\tif (event.getCode() == KeyCode.S || event.getCode() == KeyCode.DOWN)\n\t\t\t{\n\t\t\t\tmove(0, movementY);\n\t\t\t\tsetImage(frogImg(6));\n\t\t\t\taddPoints(-10);\n\t\t\t}\n\n\t\t\tif (event.getCode() == KeyCode.D || event.getCode() == KeyCode.RIGHT)\n\t\t\t{\n\t\t\t\tmove(movementX, 0);\n\t\t\t\tsetImage(frogImg(7));\n\t\t\t}\n\n\t\t}\n\t\t\t});\n\t\tsetOnKeyReleased(event -> {\n\t\tif (death) {}\n\t\t\telse {\n\t\t\tif (event.getCode() == KeyCode.W || event.getCode() == KeyCode.UP) {\n\t\t\t\taddPoints(10);\n\t\t\t\tsetImage(frogImg(0));\n\t\t\t\tmove(0, -movementY);\n\t\t\t}\n\t\t\tif (event.getCode() == KeyCode.A || event.getCode() == KeyCode.LEFT) {\n\t\t\t\t move(-movementX, 0);\n\t\t\t\tsetImage(frogImg(1));\n\t\t\t}\n\t\t\tif (event.getCode() == KeyCode.S || event.getCode() == KeyCode.DOWN) {\n\t\t\t\t move(0, movementY);\n\t\t\t\tsetImage(frogImg(2));\n\t\t\t\taddPoints(-10);\n\t\t\t}\n\t\t\tif (event.getCode() == KeyCode.D || event.getCode() == KeyCode.RIGHT) {\n\t\t\t\t move(movementX, 0);\n\t\t\t\tsetImage(frogImg(3));\n\t\t\t}\n\t\t}\n\t\t});\n\t}", "private void setKeyListener() {\r\n this.addKeyListener(new KeyListener() {\r\n public void keyTyped(KeyEvent key) { }\r\n public void keyPressed(KeyEvent key) { \r\n keyPress(key);\r\n }\r\n public void keyReleased(KeyEvent key) { }\r\n });\r\n }", "protected void setupInputs() {\n \tim=new GenericInputManager();\n \tArrayList<Controller> controllers=im.getControllers();\n \t\n \tfor(Controller controller:controllers) {\n \t\tplayer.setupInputs(im, controller);\n \t}\n \t\t\t\n \t\n }", "private void attachInputListeners() {\n inputTextField.textProperty().addListener((observable, oldValue, newValue) -> {\n if (userInputHistoryPointer == userInputHistory.size()) {\n currentInput = newValue;\n }\n });\n\n inputTextField.addEventHandler(KeyEvent.KEY_PRESSED, keyEvent -> {\n switch (keyEvent.getCode()) {\n case ENTER:\n keyEvent.consume();\n handleUserInput();\n break;\n case UP:\n keyEvent.consume();\n if (userInputHistoryPointer >= 1) {\n userInputHistoryPointer -= 1;\n setText(userInputHistory.get(userInputHistoryPointer));\n }\n break;\n case DOWN:\n keyEvent.consume();\n if (userInputHistoryPointer < userInputHistory.size() - 1) {\n userInputHistoryPointer += 1;\n setText(userInputHistory.get(userInputHistoryPointer));\n } else if (userInputHistoryPointer == userInputHistory.size() - 1) {\n userInputHistoryPointer += 1;\n setText(currentInput);\n }\n break;\n default:\n break;\n }\n });\n }", "public void input(){\n\t\tboolean[] inputKeyArray = inputHandler.processKeys();\n\t\tint[] inputMouseArray = inputHandler.processMouse();\n\t\tcurrentLevel.userInput(inputKeyArray, inputMouseArray);\n\t}", "@Override\r\n public void addListener(KeyListener listener) {\n }", "@SuppressWarnings(\"serial\")\n private void enableStartupKeys() {\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_C, 0), \"controls\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_A, 0), \"about\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_E, 0), \"end game\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_N, 0), \"new game\");\n\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_N, 0), \"new game\");\n getActionMap().put(\"new game\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n endGame();\n if (myGameOver || myWelcome) {\n startNewGame();\n }\n }\n });\n\n getActionMap().put(\"controls\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n pauseTimer();\n displayControlDialog();\n if (!myWelcome) {\n startTimer();\n }\n }\n });\n\n getActionMap().put(\"about\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n pauseTimer();\n displayAboutDialog();\n if (!myWelcome) {\n startTimer();\n }\n }\n });\n\n getActionMap().put(\"end game\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n endGame();\n }\n });\n }", "public void addKeys() {\n String[] keyArray = {\"SPACE\", \"W\", \"A\", \"S\", \"D\", \"RIGHT\", \"LEFT\",\n \"UP\", \"DOWN\", \"control E\", \"R\"};\n GameContainer.input.addInputKey(keyArray);\n }", "void addKeyListener(KeyListener kl);", "private void setupPlayerControls() {\n ExtendableScene currScene = SceneManager.getSceneParent();\n\n // Controls for the player\n // Delegated to player controller\n currScene.setOnKeyPressed(PlayerController.get()::onKeyPressed);\n currScene.setOnKeyReleased(PlayerController.get()::onKeyReleased);\n\n // All mouse movement events (for turret rotation)\n view.getPane().setOnMouseMoved(view::changeMouseEvent);\n view.getPane().setOnMouseDragged(view::changeMouseEvent);\n\n // Setup player shooting\n view.getPane().setOnMousePressed(view::createBullet);\n }", "public void main(String[] args) {\n this.addKeyListener(this);\n }", "@Override\n public void initialize(AppStateManager stateManager, Application app) {\n super.initialize(stateManager, app);\n this.app = (SimpleApplication) app;\n playerNode = (Node) this.app.getRootNode().getChild(Constants.UserData.PLAYER_NODE);\n player = playerNode.getChild(Constants.UserData.PLAYER);\n playerPhysics = player.getControl(BetterCharacterControl.class);\n playerControl = player.getControl(PlayerControl.class);\n isRunning = true;\n\n\n //Set mapping\n inputManager = app.getInputManager();\n inputManager.addMapping(Constants.Mapping.UP, new KeyTrigger(KeyInput.KEY_UP),\n new KeyTrigger(KeyInput.KEY_W));\n inputManager.addMapping(Constants.Mapping.DOWN, new KeyTrigger(KeyInput.KEY_DOWN),\n new KeyTrigger(KeyInput.KEY_S));\n inputManager.addMapping(Constants.Mapping.LEFT, new KeyTrigger(KeyInput.KEY_LEFT),\n new KeyTrigger(KeyInput.KEY_A));\n inputManager.addMapping(Constants.Mapping.RIGHT, new KeyTrigger(KeyInput.KEY_RIGHT),\n new KeyTrigger(KeyInput.KEY_D));\n\n // Add listeners here\n inputManager.addListener(Movement, Constants.Mapping.UP, Constants.Mapping.DOWN,\n Constants.Mapping.LEFT, Constants.Mapping.RIGHT);\n\n }", "private void initLevel() {\n addKeyListener(new TAdapter());\r\n addMouseListener(new MAdapter());\r\n\r\n setFocusable(true);\r\n setPreferredSize(new Dimension(Common.WIDTH, Common.HEIGHT));\r\n\r\n gameInit();\r\n }", "protected void addEventListeners()\n {\n // Add them to the contents.\n InteractionFigure interactionLayer =\n view.getEditor().getInteractionFigure();\n\n // let mouseState handle delete key events\n interactionLayer.addKeyListener(mouseState);\n getShell().addShellListener(new ShellAdapter() {\n @Override\n public void shellDeactivated(ShellEvent e)\n {\n mouseState.cancelDynamicOperation();\n }\n });\n }", "public InputController(Game game) {\r\n game.addKeyListener(this);\r\n this.game = game;\r\n }", "@Override\n public void initiateKeyboard() {\n\n KeyboardHandler kb = new KeyboardHandler();\n kb.addRunnablePress(37, new ScrollLeft(this.model, this.view));\n kb.addRunnablePress(39, new ScrollRight(this.model, this.view));\n kb.addRunnablePress(36, new ScrollToFront(this.model, this.view));\n kb.addRunnablePress(35, new ScrollToEnd(this.model, this.view));\n kb.addRunnablePress(32, new PauseC(this.view));\n kb.addRunnablePress(82, new ResetC(this.view));\n kb.addRunnablePress(8, new RemoveNote(this.model, this.view));\n kb.addRunnablePress(65, new ResetQueue(kb));\n\n view.addKeyListener(kb);\n\n }", "public void addButtons(){\n\t\t//play button\n\t\tplayButton.addKeyListener(new KeyListener() {\n\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tleaderButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tselectButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tleaderButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tmodifyButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyReleased(KeyEvent e) {\n\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyPressed(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tleaderButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tselectButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tleaderButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tmodifyButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tplayButton.addActionListener(new ActionListener() {\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tGamePlay play = new GamePlay(1,null);\n\t\t\t\ttimer = new Timer(1000/60, play);\n\t\t\t\ttimer.start();\n\t\t\t\tviewFrame(false);\n\t\t\t}\n\t\t});\n\n\t\t//logout button\n\t\tlogoutButton.addKeyListener(new KeyListener() {\n\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tselectButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tmodifyButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tselectButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tleaderButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyReleased(KeyEvent e) {\n\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyPressed(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tselectButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tmodifyButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tselectButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tleaderButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tlogoutButton.addActionListener(new ActionListener() {\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tDrawLogin loginMenu = DrawLogin.getInstance();\n\t\t\t\tloginMenu.viewFrame(true);\n\t\t\t\tviewFrame(false);\n\t\t\t}\n\t\t});\n\n\t\t//load button\n\t\tloadButton.addKeyListener(new KeyListener() {\n\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tmodifyButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tleaderButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tmodifyButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tselectButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyReleased(KeyEvent e) {\n\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyPressed(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tmodifyButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tleaderButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tmodifyButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tselectButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tloadButton.addActionListener(new ActionListener() {\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tString result = null;\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tFile[] files;\n\t\t\t\t\t//Show user's loaded games\n\t\t\t\t\tList<String> results = new ArrayList<String>();\n\t\t\t\t\tif((new File(\"save/\" + Login.getUser().getUsername()).exists())){\n\t\t\t\t\t\tfiles = new File(\"save/\" + Login.getUser().getUsername()).listFiles();\n\n\t\t\t\t\t\t//If this pathname does not denote a directory, then listFiles() returns null. \n\n\t\t\t\t\t\tfor (File file : files) {\n\t\t\t\t\t\t\tif (file.isFile()) {\n\t\t\t\t\t\t\t\tresults.add(file.getName());\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\telse{\n\t\t\t\t\t\tresults.add(\" \");\n\t\t\t\t\t}\n\t\t\t\t\tif (EventQueue.isDispatchThread()) {\n\t\t\t\t\t\tJPanel panel = new JPanel();\n\t\t\t\t\t\tpanel.add(new JLabel(\"Please make a selection:\"));\n\t\t\t\t\t\tDefaultComboBoxModel model = new DefaultComboBoxModel();\n\t\t\t\t\t\tfor (String temp : results) {\n\t\t\t\t\t\t\tmodel.addElement(temp);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tJComboBox comboBox = new JComboBox(model);\n\t\t\t\t\t\tpanel.add(comboBox);\n\n\t\t\t\t\t\tint iResult = JOptionPane.showConfirmDialog(null, panel, \"Flavor\", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);\n\t\t\t\t\t\tswitch (iResult) {\n\t\t\t\t\t\tcase JOptionPane.OK_OPTION:\n\t\t\t\t\t\t\tresult = (String) comboBox.getSelectedItem();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif((new File(\"save/\" + Login.getUser().getUsername()).exists())){\n\t\t\t\t\t\tFileInputStream fileIn = new FileInputStream(\"save/\" + Login.getUser().getUsername() + \"/\" + result);\n\t\t\t\t\t\tObjectInputStream in = new ObjectInputStream(fileIn);\n\t\t\t\t\t\tgame = (Map) in.readObject();\n\t\t\t\t\t\tin.close();\n\t\t\t\t\t\tfileIn.close();\n\t\t\t\t\t}\n\t\t\t\t}catch(IOException i)\n\t\t\t\t{\n\t\t\t\t\ti.printStackTrace();\n\t\t\t\t\treturn;\n\t\t\t\t}catch(ClassNotFoundException c)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"map class not found\");\n\t\t\t\t\tc.printStackTrace();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tSystem.out.println(\"Load Game\");\n\t\t\t\tviewFrame(false);\n\t\t\t\tGamePlay play = new GamePlay(0, game);\n\t\t\t\ttimer = new Timer(1000/60, play);\n\t\t\t\ttimer.start();\n\t\t\t\tviewFrame(false);\n\t\t\t}\n\t\t});\n\n\n\t\t//modify button\n\t\tmodifyButton.addKeyListener(new KeyListener() {\n\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tloadButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tplayButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tloadButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tlogoutButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyReleased(KeyEvent e) {\n\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyPressed(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tloadButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tplayButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tloadButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tlogoutButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tmodifyButton.addActionListener(new ActionListener() {\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tModifyAccount md = new ModifyAccount();\n\t\t\t\tviewFrame(false);\n\t\t\t}\n\t\t});\n\n\t\t//leaderboard button\n\t\tleaderButton.addKeyListener(new KeyListener() {\n\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tplayButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tlogoutButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tplayButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tloadButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyReleased(KeyEvent e) {\n\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyPressed(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tplayButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tlogoutButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tplayButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tloadButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tleaderButton.addActionListener(new ActionListener() {\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t//Display leaderboard\n\t\t\t\ttry {\n\t\t\t\t\tLeaderboard lb = new Leaderboard();\n\t\t\t\t} catch (IOException e1) {\n\t\t\t\t}\n\t\t\t\tviewFrame(false);\n\t\t\t\tSystem.out.println(\"View Leaderboards\");\n\t\t\t}\n\t\t});\n\n\t\tselectButton.addKeyListener(new KeyListener() {\n\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tlogoutButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tloadButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tlogoutButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tplayButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyReleased(KeyEvent e) {\n\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyPressed(KeyEvent e) {\n\t\t\t\tint value = e.getKeyCode();\n\t\t\t\tif (value == KeyEvent.VK_DOWN){\n\t\t\t\t\tlogoutButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value == KeyEvent.VK_LEFT ){\n\t\t\t\t\tloadButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if(value ==KeyEvent.VK_UP){\n\t\t\t\t\tlogoutButton.requestFocus();\n\t\t\t\t}\n\t\t\t\telse if( value == KeyEvent.VK_RIGHT){\n\t\t\t\t\tplayButton.requestFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tselectButton.addActionListener(new ActionListener() {\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tviewFrame(false);\n\t\t\t\ttry {\n\t\t\t\t\tls = new LevelSelect();\n\t\t\t\t} catch (IOException e1) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te1.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "void onKeyEvents(int targetDisplayId, @NonNull List<KeyEvent> keyEvents);", "public void interactWithKeyboard() {\n StdDraw.setCanvasSize(WIDTH * 16, HEIGHT * 16);\n StdDraw.setXscale(0, WIDTH);\n StdDraw.setYscale(0, HEIGHT);\n createMenu();\n StdDraw.enableDoubleBuffering();\n while (true) {\n if (StdDraw.hasNextKeyTyped()) {\n char input = Character.toUpperCase(StdDraw.nextKeyTyped());\n if (input == 'v' || input == 'V') {\n StdDraw.enableDoubleBuffering();\n StdDraw.clear(Color.BLACK);\n StdDraw.text(WIDTH / 2, HEIGHT * 2 / 3, \"Enter a name: \" + name);\n StdDraw.text(WIDTH / 2, HEIGHT * 5 / 6, \"Press # to finish.\");\n StdDraw.show();\n while (true) {\n if (StdDraw.hasNextKeyTyped()) {\n char next = StdDraw.nextKeyTyped();\n if (next == '#') {\n createMenu();\n break;\n } else {\n name += next;\n StdDraw.enableDoubleBuffering(); StdDraw.clear(Color.BLACK);\n StdDraw.text(WIDTH / 2, HEIGHT * 2 / 3, \"Enter a name: \" + name);\n StdDraw.text(WIDTH / 2, HEIGHT * 5 / 6, \"Press # to finish.\");\n StdDraw.show();\n }\n }\n }\n }\n if (input == 'l' || input == 'L') {\n toInsert = loadWorld();\n if (toInsert.substring(0, 1).equals(\"k\")) {\n floorTile = Tileset.GRASS;\n }\n toInsert = toInsert.substring(1);\n interactWithInputString(toInsert);\n ter.renderFrame(world);\n startCommands();\n }\n if (input == 'n' || input == 'N') {\n toInsert += 'n';\n StdDraw.enableDoubleBuffering();\n StdDraw.clear(Color.BLACK);\n StdDraw.text(WIDTH / 2, HEIGHT * 2 / 3, \"Enter a seed: \" + toInsert);\n StdDraw.show();\n while (true) {\n if (!StdDraw.hasNextKeyTyped()) {\n continue;\n }\n char c = StdDraw.nextKeyTyped();\n if (c == 's' || c == 'S') {\n toInsert += 's';\n StdDraw.enableDoubleBuffering();\n StdDraw.clear(Color.BLACK);\n StdDraw.text(WIDTH / 2, HEIGHT * 2 / 3, \"Enter a seed: \" + toInsert);\n StdDraw.show(); interactWithInputString(toInsert);\n ter.renderFrame(world); mouseLocation(); startCommands();\n break;\n }\n if (c != 'n' || c != 'N') {\n toInsert += c;\n StdDraw.enableDoubleBuffering(); StdDraw.clear(Color.BLACK);\n StdDraw.text(WIDTH / 2, HEIGHT * 2 / 3, \"Enter a seed: \" + toInsert);\n StdDraw.show();\n }\n }\n }\n if (input == 'l' || input == 'L') {\n toInsert = loadWorld();\n if (toInsert.substring(0, 1).equals(\"k\")) {\n floorTile = Tileset.GRASS;\n }\n toInsert = toInsert.substring(1); interactWithInputString(toInsert);\n ter.renderFrame(world); startCommands();\n }\n }\n }\n }", "public void init()\n\t{\n\t\taddKeyListener(this);\n\t\taddMouseListener(this);\n\t\taddMouseMotionListener(this);\n\t\n\t}", "GameGUI() {\r\n _randomSource = new Random();\r\n _players = new Player[2];\r\n _input = new BufferedReader(new InputStreamReader(System.in));\r\n _players[0] = new HumanPlayer(BP, this);\r\n _players[1] = new MachinePlayer(WP, this);\r\n _playing = false;\r\n }", "public void addListeners() {\n\t\tsave.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\t//Set the window variables\r\n\t\t\t\tEnvironmentVariables.setWidth(Float.parseFloat(width.getText()));\r\n\t\t\t\tEnvironmentVariables.setHeight(Float.parseFloat(height.getText()));\r\n\t\t\t\tEnvironmentVariables.setTitle(title.getText());\r\n\t\t\t\tupdateGameWorld();\r\n\t\t\t\t//go to save function\r\n\t\t\t\tsaveGame();\r\n\t\t\t\t\r\n\t\t\t\tWindow.getFrame().setVisible(false);\r\n\t\t\t\tWindow.getFrame().dispose();\r\n\t\t\t\t\r\n\t\t\t\tHomePage.buildHomePage();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t});\r\n\t\t\r\n\t\t//reset to empty world\r\n\t\treset.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\tEnvironmentVariables.clearWorld();\r\n\t\t\t\tWindow.render();\r\n\t\t\t}\r\n\t\t});\r\n\t}", "@SuppressWarnings(\"serial\")\n private void enableGamePlayKeys() {\n if (CLASSIC_MODE.equals(myGameMode)) {\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), \"left\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), \"right\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), \"down\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), \"rotateCW\");\n }\n else {\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), \"left\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), \"right\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), \"down\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), \"rotateCW\");\n }\n\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), \"drop\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_P, 0), \"pause\");\n getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_Z, 0), \"rotateCCW\");\n\n getActionMap().put(\"left\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n myBoard.left();\n }\n });\n\n getActionMap().put(\"right\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n myBoard.right();\n }\n });\n\n getActionMap().put(\"down\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n myBoard.down();\n }\n });\n\n getActionMap().put(\"rotateCW\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n myBoard.rotateCW();\n }\n });\n\n getActionMap().put(\"rotateCCW\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n myBoard.rotateCCW();\n }\n });\n\n getActionMap().put(\"right\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n myBoard.right();\n }\n });\n\n getActionMap().put(\"drop\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n myBoard.drop();\n }\n });\n\n getActionMap().put(\"pause\", new AbstractAction() {\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n if (myTimer.isRunning()) {\n pauseTimer();\n } else {\n startTimer();\n }\n }\n });\n }", "@Override\n\tpublic void onKeyInput(long window, int key, int scancode, int action,\n\t\t\tint mods) {\n\n\t}", "private void enableInput(Scene gameScene){\n gameScene.setOnKeyPressed(new EventHandler<KeyEvent>() {\n @Override\n public void handle(KeyEvent event) {\n oldState = levelCreator.CloneDynamicGrid(dynamicLevel);\n\n switch (event.getCode()) {\n case UP:\n dynamicLevel.updatePlayerPos(Direction.UP);\n break;\n case W:\n dynamicLevel.updatePlayerPos(Direction.UP);\n break;\n case DOWN:\n dynamicLevel.updatePlayerPos(Direction.DOWN);\n break;\n case S:\n dynamicLevel.updatePlayerPos(Direction.DOWN);\n break;\n case LEFT:\n dynamicLevel.updatePlayerPos(Direction.LEFT);\n break;\n case A:\n dynamicLevel.updatePlayerPos(Direction.LEFT);\n break;\n case RIGHT:\n dynamicLevel.updatePlayerPos(Direction.RIGHT);\n break;\n case D:\n dynamicLevel.updatePlayerPos(Direction.RIGHT);\n break;\n case R:\n initLevel();\n default:\n dynamicLevel.updatePlayerPos(Direction.NOTHING);\n break;\n }\n colDetector.HandleCollision(baseLevel, dynamicLevel, oldState);\n }\n\n });\n }", "public interface InputListener {\n\n void onPress(MotionEvent event, int index);\n void onMove(MotionEvent event, int index);\n void onRelease(MotionEvent event, int index);\n\n}", "protected void setupListeners() {\n\t\t\n\t\tloginBtn.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent click) {\n\t\t\t\tSession session = theController.validateUser(usernameField.getText(), passwordField.getText());\n\t\t\t\tif(session != null) {\n\t\t\t\t\ttheController.login();\n\t\t\t\t} else {\n\t\t\t\t\tlblInvalid.setVisible(true);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tbtnRegister.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent click) {\n\t\t\t\ttheController.register();\n\t\t\t}\n\t\t});\n\t\t\n\t\tbtnGuide.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent click) {\n\t\t\t\ttheController.viewGuide();\n\t\t\t}\n\t\t});\n\t\t\n\t}", "private void init() {\n display = new Display(title, getWidth(), getHeight()); \n Assets.init();\n player = new Player(getWidth() / 2 - 50, getHeight() - 50, 100, 30, this);\n rayo = new Rayo(getWidth() / 2 - 10, player.y - player.height , 10, 30, 0, 0, this);\n borrego = new Borrego(-80, 60 , 50, 20, 0, 0, this);\n generateEnemies();\n generateFortalezas();\n bombas= new ArrayList<Bomba>();\n \n \n display.getJframe().addKeyListener(keyManager);\n }", "public void init() \r\n\t{\n\t\tthis.resize((int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(),\r\n\t\t\t\t\t(int)Toolkit.getDefaultToolkit().getScreenSize().getHeight());\r\n\t\t//sets the screen size to the set default screen size\r\n\t\tbubbles = new Bubble[MAX_CIRCLES]; //uses new array of type bubble\r\n\t\tboolean good = true;\r\n\t\t//initializes player position\r\n\t\tplayerX = this.getWidth() / 2;\r\n\t\tplayerY = this.getHeight() / 4 * 3;\r\n\t\tfor(int count = 0;count < MAX_CIRCLES; count++)\r\n\t\t{\r\n\t\t\tbubbles[count] = new Bubble(this.getWidth(), this.getHeight(), MAX_Y_VELOCITY, MAX_X_VELOCITY, MAX_SIZE, good);//creates new bubble objects\r\n\t\t\tgood = !good; //makes it so half the bubbles are \"good\", half are not\r\n\t\t}\r\n\t\t\r\n\t\t//I needed this to use \"repaint\" the screen. It uses a timer which is \"listenedTo\" by an ActionListener\r\n\t\tActionListener taskPerformer = new ActionListener() \r\n\t\t{\r\n\t\t\tpublic void actionPerformed(ActionEvent evt) \r\n\t\t\t{\r\n\t\t\t\trepaint();\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\t\r\n\t\t//Initializes a KeyListener to detect keypresses, add them to keys ArrayList\r\n\t\tKeyListener keyDetector = new KeyListener()\r\n\t\t{\r\n\t\t\tpublic void keyPressed(KeyEvent press) {\r\n\t\t\t\tif (!keys.contains(press.getKeyCode())) {\r\n\t\t\t\t\tkeys.add(press.getKeyCode());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tpublic void keyReleased(KeyEvent release) {\r\n\t\t\t\tkeys.remove(keys.indexOf(release.getKeyCode()));\r\n\t\t\t}\r\n\r\n\t\t\tpublic void keyTyped(KeyEvent arg0) {}\r\n\t\t};\r\n\t\t\r\n\t\t//Adds keyDetector to the applet\r\n\t\tthis.addKeyListener(keyDetector);\r\n\t\t\r\n\t\tnew Timer(DELAY, taskPerformer).start();\r\n\t\t\r\n\t}", "private void adicionaListeners() {\r\n\t\t\taddFocusListener(this);\r\n\t\t\taddKeyListener(this);\r\n\t\t\taddMouseListener(this);\r\n\t\t}", "private void init() {\n display = new Display(title, getWidth(), getHeight());\n Assets.init();\n player = new Player(getWidth() / 2, getHeight() - 100, 1, 60, 40, this);\n for (int i = 0; i < 4; i++) {\n for (int j = 0; j < 6; j++) {\n aliens.add(new Alien(150 + 50 * j, 50 + 50 * i, 1, 40, 40, this));\n }\n }\n display.getJframe().addKeyListener(keyManager);\n }", "public abstract InputListener getInputListener(GameObject object);", "@Override\n\tpublic void start() {\n\t\tif(Boolean.parseBoolean(this.configuration.get(ConfigurationEnum.KEYBOARD_LISTENER_ACTIVE.toString()))){\n\t\t\tthis.keyboardListener.registerNativeHook();\n\t\t\tthis.keyboardListenerIsActive = true;\n\t\t}\n\t\t//If the mouse listener is active by configuration\n\t\tif(Boolean.parseBoolean(this.configuration.get(ConfigurationEnum.MOUSE_LISTENER_ACTIVE.toString()))){\n\t\t\tthis.mouseListener.registerNativeHook();\n\t\t\tthis.mouseListenerIsActive = true;\n\t\t}\n\t\t//If the mouse motion listener is active by configuration\n\t\tif(Boolean.parseBoolean(this.configuration.get(ConfigurationEnum.MOUSE_LISTENER_ACTIVE.toString()))){\n\t\t\tthis.mouseMotionListener.registerNativeHook();\n\t\t\tthis.mouseMotionListenerIsActive = true;\n\t\t}\n\t\t//If the mouse wheel listener is active by configuration\n\t\tif(Boolean.parseBoolean(this.configuration.get(ConfigurationEnum.MOUSE_WHEEL_LISTENER_ACTIVE.toString()))){\n\t\t\tthis.mouseWheelListener.registerNativeHook();\n\t\t\tthis.mouseWheelListenerIsActive = true;\n\t\t}\n\t}", "private void registerListeners() {\n\n\t\tline.addActionListener(new LineButtonListener());\n\t\trect.addActionListener(new RectButtonListener());\n\t\toval.addActionListener(new OvalButtonListener());\n\t\timage.addActionListener(new ImageButtonListener());\n\n\t\tMouseListener listener = new ListenToMouse();\n\t\tMouseMotionListener motionListener = new ListenToMouse();\n\n\t\tcanvas.addMouseMotionListener(motionListener);\n\t\tcanvas.addMouseListener(listener);\n\n\t}", "public void add(InputChangedListener listener)\r\n {\r\n\r\n }", "public interface InputListener {\r\n void input(InputEvent ie);\r\n}", "public void init() {\n\t\tinstallNewPiece();\n W(\"\\n\\n\\n\\nMAX LEVEL \"+P.MaxLevels+\"\\n\\n\\n\\n\");\n TimeInLevelList = CreateTimeInLevelList(P.MaxLevels);\n \n\t\tpause_resume_butt.setEnabled(false);\n\t\tstart_newgame_butt.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent ae) {\n\t\t\t\tif(start_newgame_butt.getLabel().equals(\"Start\"))\n\t\t\t\t\tstartGame();\n\t\t\t\telse\n\t\t\t\t\tnewGame();\n\t\t\t}\n\t\t});\t\t\n\t\tpause_resume_butt.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent ae) {\n\t\t\t\tif(pause_resume_butt.getLabel().equals(\"Pause\"))\n\t\t\t\t\tpauseGame();\n\t\t\t\telse\n\t\t\t\t\tresumeGame();\n\t\t\t}\n\t\t});\n\t\t\n\t\t//create key listener for rotating, moving left, moving right\n\t\tKeyListener key_listener = new KeyAdapter() {\n\t\t\tpublic void keyPressed(KeyEvent e) {\n long tmp = LastButtonPressTime;\n LastButtonPressTime=(System.nanoTime()- StartTime)/1000000;\n if(LastButtonPressTime!=0 && LastButtonUnpressTime!=0)\n KeyUpQueue.add(new Tuple<Long,Long>(LastButtonUnpressTime,LastButtonPressTime));\n \n LastButtonUnpressTime=0; // this is just asking for trouble\n LastButtonPressTime=0; // but its for bugfixing purposes so its ok\n //W(\"\"+tmp+\",\"+LastButtonUnpressTime);\n \n \n if(StartTime != tmp_start_time)\n W(\"START TIME CHANGED\\n\\n\\n\"+StartTime+\",\"+tmp_start_time+\"\\n\\n\\n\\n\\n\");\n tmp_start_time = StartTime;\n \n if(KeyUpQueue.size()>0){\n KeyUpQueue = ContainWithinTimeWindow(KeyUpQueue, (System.nanoTime()-StartTime)/1000000,KeyUpTimeWindow);\n //DisplayDropPercentList(KeyUpQueue, KeyUpTimeWindow,\"outside\");\n UnpressPercent=UnpressPercentSanitized(KeyUpQueue, KeyUpTimeWindow, (System.nanoTime()-StartTime)/1000000);\n //W(\"unpress_percent \"+UnpressPercent);\n }\n \n\t\t\t\tif(timer.isPaused()) //don't do anything if game is paused\n\t\t\t\t\treturn;\n \n /* \n // this code has problems\n // we may still add sound in the future if we have time\n // for now its dummied out\n if (e.getKeyCode() >= 37 & e.getKeyCode() <= 40){\n if(!SoundKeyPressed[e.getKeyCode()-37] ){\n snd.PlayWave(\"bip\");\n // this works correctly but when buttons are pressed a bunch in quick succession it slows down the main loop\n }\n SoundKeyPressed[e.getKeyCode()-37]=true;\n }\n */\n\t\t\t\tif (e.getKeyCode() == 37 || e.getKeyCode() == 39) { //left or right arrow pressed\n if (e.getKeyCode() == 37) KeyCounter[0]++;\n\t\t\t\t\tif (e.getKeyCode() == 39) KeyCounter[1]++;\n\t\t\t\t\tint dir = e.getKeyCode() == 37 ? -1 : 1;\n\t\t\t\t\tsynchronized(timer) {\n\t\t\t\t\t\tcur_piece.cut();\n\t\t\t\t\t\tcur_piece.setX(cur_piece.getX() + dir); // try to move\n\t\t\t\t\t\tif( ! cur_piece.canPaste())\n\t\t\t\t\t\t\tcur_piece.setX(cur_piece.getX() - dir); // undo move\n\t\t\t\t\t\tcur_piece.paste();\n\t\t\t\t\t}\n\t\t\t\t\tgame_grid.repaint();\n \n\t\t\t\t}\n\t\t\t\telse if (e.getKeyCode() == 38) { //rotate\n KeyCounter[2]++;\n\t\t\t\t\tsynchronized(timer) {\n\t\t\t\t\t\tcur_piece.cut();\n\t\t\t\t\t\tcur_piece.rotate();\n\t\t\t\t\t\tif( ! cur_piece.canPaste())\n\t\t\t\t\t\t\tcur_piece.rotateBack();\n\t\t\t\t\t\tcur_piece.paste();\n\t\t\t\t\t}\n\t\t\t\t\tgame_grid.repaint();\n\t\t\t\t}\n\t\t\t\tif (e.getKeyCode() == 40) { //down arrow pressed; drop piece\n\t\t\t\t\tKeyCounter[3]++;\n DropStartTime=System.nanoTime();\n DownStartTime=(System.nanoTime()- StartTime)/1000000;\n timer.setFast(true);\n OutputTheDataWhenFirstFast = true;\n\t\t\t\t} \n if (e.getKeyCode() == KeyEvent.VK_CONTROL) ControlKeyPressed = true;\n if (e.getKeyCode() == KeyEvent.VK_F && ControlKeyPressed){\n ControlKeyPressed = false;\n SwitchToFocusTask();\n W(\"Mode=\"+LDS.Parameters.Mode);\n //return; // REMOVE LATER MAYBE\n //System.exit(998);\n }\n if (e.getKeyCode()==KeyEvent.VK_SUBTRACT) MinusKeyPressed = true;\n \n \n LogEvent(\"key_press_\"+ e.getKeyText(e.getKeyCode()));\n \n\t\t\t}\n \n public void keyReleased(KeyEvent e) {\n \n if (e.getKeyCode() >= 37 & e.getKeyCode() <= 40){\n SoundKeyPressed[e.getKeyCode()-37]=false;\n } \n \n LastButtonUnpressTime=(System.nanoTime()- StartTime)/1000000;\n \n if(LastButtonUnpressTime == tmp_unpress_time)\n W(\"UNPRESS IDENTICAL\\n\\n\\n\"+LastButtonUnpressTime+\",\"+tmp_unpress_time+\"\\n\\n\\n\\n\\n\");\n tmp_unpress_time = LastButtonUnpressTime;\n //W(\"Set unpress at \"+LastButtonUnpressTime);\n if (e.getKeyCode() == 40) { //down arrow pressed; drop piece\n timer.setFast(false);\n // down queue stuff\n DropDurationQueue=addToQueue(DropDurationQueue, (int) (System.nanoTime()-DropStartTime)/1000000, queue_history); \n DownEndTime=(System.nanoTime()- StartTime)/1000000;\n \n // drop percent stuff\n DownQueue.add(new Tuple<Long,Long>(DownStartTime,DownEndTime));\n DownStartTime = LongMin; // reset them back to \"not dropping\"\n DownEndTime = LongMin;\n DownQueue = removeOldFromQueue(DownQueue,(System.nanoTime()-StartTime)/1000000,DropPercentageTimeWindow);\n }\n if (e.getKeyCode() == KeyEvent.VK_CONTROL) ControlKeyPressed = false;\n if (e.getKeyCode()==KeyEvent.VK_SUBTRACT) MinusKeyPressed = false;\n LogEvent(\"key_release_\"+ e.getKeyText(e.getKeyCode()));\n \n }\n \n\t\t};\n\t\t\n\t\t// add the key listener to all components that might get focus\n\t\t// so that it'll work regardless of which has focus\n\t\tstart_newgame_butt.addKeyListener(key_listener);\n\t\tpause_resume_butt.addKeyListener(key_listener);\n\t\t\n\t\tPanel right_panel = new Panel(new GridLayout(3, 1));\t\n\t\tright_panel.setBackground(BACKGROUND_COLOR);\n\t\t\n\t\tPanel control_panel = new Panel();\n\t\tcontrol_panel.add(start_newgame_butt);\n\t\tcontrol_panel.add(pause_resume_butt);\n\t\tcontrol_panel.setBackground(BACKGROUND_COLOR);\n\t\tright_panel.add(control_panel);\n\t\t\n\t\tPanel stats_panel1 = new Panel(new GridLayout(5, 2));\n\t\tstats_panel1.add(new TetrisLabel(\"Use Arrow Keys\"));\n //stats_panel1.add(new TetrisLabel(\"Keys\"));\n\t\tstats_panel1.add(blank_label);\n stats_panel1.add(new TetrisLabel(\" Rows Deleted: \"));\n\t\t//stats_panel1.add(blank_label);\n //stats_panel1.add(level_label);\n stats_panel1.add(rows_deleted_label);\n stats_panel1.add(new TetrisLabel(\" Speed: \"));\n\t\tstats_panel1.add(speed_label);\n stats_panel1.add(new TetrisLabel(\" Duration: \"));\n\t\tstats_panel1.add(level_duration_label);\n stats_panel1.add(new TetrisLabel(\" Score: \"));\n\t\tstats_panel1.add(score_label);\n //right_panel.add(stats_panel1);\n\t\tPanel tmp1 = new Panel(new BorderLayout());\n\t\ttmp1.setBackground(BACKGROUND_COLOR);\n\t\ttmp1.add(\"Center\", stats_panel1);\n\t\tright_panel.add(tmp1);\n\t\t\n Panel tmp = new Panel(new BorderLayout());\n\t\ttmp.add(\"North\", new TetrisLabel(\" Next Piece:\"));\n\t\ttmp.add(\"Center\", next_piece_canvas);\n\t\ttmp.setBackground(BACKGROUND_COLOR);\n\t\tright_panel.add(tmp);\n\t\t\n//\t\tPanel stats_panel = new Panel(new GridLayout(4, 2));\n//\t\tstats_panel.add(new TetrisLabel(\"Use Left Right Up \"));\n//\t\tstats_panel.add(new TetrisLabel(\"Down Arrow Keys\"));\n\t\t//stats_panel.add(rows_deleted_label);\n//\t\tstats_panel.add(new TetrisLabel(\" Rows Deleted: \"));\n//\t\tstats_panel.add(rows_deleted_label);\n\t\t//stats_panel.add(new TetrisLabel(\" Level: \"));\n\t\t//stats_panel.add(level_label);\n//\t\tstats_panel.add(new TetrisLabel(\" Score: \"));\n//\t\tstats_panel.add(score_label);\n//\t\tstats_panel.add(new TetrisLabel(\" High Score: \"));\n//\t\tstats_panel.add(high_score_label);\n//\t\ttmp = new Panel(new BorderLayout());\n//\t\ttmp.setBackground(BACKGROUND_COLOR);\n//\t\ttmp.add(\"Center\", stats_panel);\n\t\t//right_panel.add(tmp);\n\t\t\n\t\t// finaly, add all the main panels to the applet panel\n\t\tthis.setLayout(new GridLayout(1, 2));\n\t\tthis.add(game_grid);\n\t\tthis.add(right_panel);\n\t\tthis.setBackground(BACKGROUND_COLOR);\n\t\tthis.validate();\n// Parameters P = new Parameters(\"PARAMETERS\");\n\t}", "public void listen( CKeyboard keyboard )\r\n\t{\n\t\t// Abonnement aux listener\r\n\t\t// =============================================================\r\n\t\tfor( int i = 0 ; i < keyboard.groupCount() ; ++i )\r\n\t\t{\r\n\t\t\tCKeyGroup keyGroup = keyboard.getKeyGroup( i );\r\n\t\t\tif( keyGroup != null )\r\n\t\t\t{\r\n\t\t\t\tfor( int j = 0 ; j < keyGroup.listCount() ; ++j )\r\n\t\t\t\t{\r\n\t\t\t\t\tCKeyList keyList = keyGroup.getkeyList( j );\r\n\t\t\t\t\tif( keyList != null )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfor( int k = 0 ; k < keyList.keyCount() ; ++k )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tCKeyKeyboard keyboardKey = keyList.getKeyKeyboard( k );\r\n\t\t\t\t\t\t\tif( keyboardKey != null )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t// on cast pour savoir de quel type est la key\r\n\t\t\t\t\t\t\t\tif( keyboardKey instanceof CKeyLevel )\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t((CKeyLevel)keyboardKey).addOnClickKeyLevelListener( this );\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}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public abstract void keyboardInput();", "public abstract void onInput();", "protected void init(){\n ac = new ButtonEventManager(this);\n \n nameField = new JTextField();\n \n done = new JButton(\"DONE\");\n back = new JButton(\"MAIN MENU\");\n quit = new JButton(\"QUIT\");\n \n done.setActionCommand(\"go to game menu after saving\");\n back.setActionCommand(\"go to the main menu\");\n quit.setActionCommand(\"quit the game\");\n \n Font font = new Font(\"Arial\", Font.PLAIN, 10);\n \n nameField.setFont(font);\n \n nameField.setBounds(2 * this.getWidth() / 3 - buttonWidth / 2, (int)(0.4 * this.getHeight() - textFieldHeight / 2), buttonWidth, textFieldHeight);\n \n done.setBounds((this.getWidth() / 2 - buttonWidth) / 2, (int)(0.7 * this.getHeight() - buttonHeight / 2), buttonWidth, buttonHeight);\n back.setBounds((this.getWidth() - buttonWidth) / 2, (int)(0.7 * this.getHeight() - buttonHeight / 2), buttonWidth, buttonHeight);\n quit.setBounds(3 * (this.getWidth() - buttonWidth) / 2, (int)(0.7 * this.getHeight() - buttonHeight / 2), buttonWidth, buttonHeight);\n \n done.addActionListener(ac);\n back.addActionListener(ac);\n quit.addActionListener(ac);\n \n add(nameField);\n \n add(done);\n add(back);\n add(quit);\n }", "public void handleInput(KeyEvent kEvent, MouseEvent mEvent, ViewController viewController) {\n Game game = Game.getInstance();\n switch (game.getGameState()) {\n case GAME_SCREEN:\n if (kEvent != null) {\n if (!game.isGameStarted() && !game.isPlayerDead()) {\n if (game.startGame()) {\n viewController.isDeathAnimPlaying = false;\n viewController.isDeathAnimFinished = true;\n }\n }\n if (kEvent.getCode().equals(inputsMap.get(Input.UP_P1)))\n game.setNextPlayerAction(Movement.UP, 0);\n if (kEvent.getCode().equals(inputsMap.get(Input.DOWN_P1)))\n game.setNextPlayerAction(Movement.DOWN, 0);\n if (kEvent.getCode().equals(inputsMap.get(Input.RIGHT_P1)))\n game.setNextPlayerAction(Movement.RIGHT, 0);\n if (kEvent.getCode().equals(inputsMap.get(Input.LEFT_P1)))\n game.setNextPlayerAction(Movement.LEFT, 0);\n\n if (kEvent.getCode().equals(inputsMap.get(Input.UP_P2)))\n game.setNextPlayerAction(Movement.UP, 1);\n if (kEvent.getCode().equals(inputsMap.get(Input.DOWN_P2)))\n game.setNextPlayerAction(Movement.DOWN, 1);\n if (kEvent.getCode().equals(inputsMap.get(Input.RIGHT_P2)))\n game.setNextPlayerAction(Movement.RIGHT, 1);\n if (kEvent.getCode().equals(inputsMap.get(Input.LEFT_P2)))\n game.setNextPlayerAction(Movement.LEFT, 1);\n\n if (kEvent.getCode().equals(inputsMap.get(Input.ENTER)))\n if (game.isGameFinished() && game.isPlayerDead() && viewController.isDeathAnimFinished) {\n viewController.initButtons();\n game.runLater(() -> game.setGameState(GameState.MENU_SCREEN));\n Menu.getInstance().setTab(MenuTab.HIGHSCORE_ENTER);\n }\n }\n break;\n case MENU_SCREEN:\n switch (Menu.getInstance().getTab()) {\n case MAIN:\n if (mEvent != null) {\n Point mouseCoords = new Point((int) (mEvent.getSceneX() / ViewController.SCALE), (int) (mEvent.getSceneY() / ViewController.SCALE));\n if (Utils.isInside(mouseCoords, MenuTab.MAIN.getButton(\"1-player\").getHitbox())) {\n game.runLater(() -> game.setGameState(GameState.GAME_SCREEN));\n game.setNbPlayer(1);\n viewController.resetSprites();\n viewController.whenToStopDeathAnim = System.currentTimeMillis() - 1;\n viewController.whenToStopScoreAnim = System.currentTimeMillis() - 1;\n viewController.audioController.canPlayIntro(true);\n }\n if (Utils.isInside(mouseCoords, MenuTab.MAIN.getButton(\"2-players\").getHitbox())) {\n game.runLater(() -> game.setGameState(GameState.GAME_SCREEN));\n game.setNbPlayer(2);\n viewController.resetSprites();\n viewController.whenToStopDeathAnim = System.currentTimeMillis() - 1;\n viewController.whenToStopScoreAnim = System.currentTimeMillis() - 1;\n viewController.audioController.canPlayIntro(true);\n }\n if (Utils.isInside(mouseCoords, MenuTab.MAIN.getButton(\"controls\").getHitbox()))\n Menu.getInstance().setTab(MenuTab.CONTROLS);\n if (Utils.isInside(mouseCoords, MenuTab.MAIN.getButton(\"highscore\").getHitbox()))\n Menu.getInstance().setTab(MenuTab.HIGHSCORE);\n if (Utils.isInside(mouseCoords, MenuTab.MAIN.getButton(\"editor\").getHitbox())) {\n game.setGameState(GameState.LEVEL_EDITOR);\n if (!editorLaunched) {\n Runnable runnable = () -> {\n try {\n EditorViewController editorController = new EditorViewController();\n editorController.setInputController(this);\n editorController.start(new Stage());\n } catch (IOException e) {\n e.printStackTrace();\n }\n };\n Platform.runLater(runnable);\n editorLaunched = true;\n }\n }\n }\n break;\n case CONTROLS:\n boolean isButtonFocused = false;\n Input selectedInput = null;\n for (String id : MenuTab.CONTROLS.getButtonList())\n if (MenuTab.CONTROLS.getButton(id).isSelected()) {\n isButtonFocused = true;\n selectedInput = Input.valueOf(id);\n }\n if (mEvent != null) {\n Point mouseCoords = new Point((int) (mEvent.getSceneX() / ViewController.SCALE), (int) (mEvent.getSceneY() / ViewController.SCALE));\n if (!isButtonFocused) {\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(\"back\").getHitbox()))\n Menu.getInstance().setTab(MenuTab.MAIN);\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.UP_P1.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.UP_P1.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.UP_P1);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.DOWN_P1.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.DOWN_P1.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.DOWN_P1);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.RIGHT_P1.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.RIGHT_P1.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.RIGHT_P1);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.LEFT_P1.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.LEFT_P1.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.LEFT_P1);\n }\n\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.UP_P2.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.UP_P2.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.UP_P2);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.DOWN_P2.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.DOWN_P2.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.DOWN_P2);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.RIGHT_P2.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.RIGHT_P2.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.RIGHT_P2);\n }\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(Input.LEFT_P2.toString()).getHitbox())) {\n MenuTab.CONTROLS.getButton(Input.LEFT_P2.toString()).setSelected(true);\n currentCode = inputsMap.get(Input.LEFT_P2);\n }\n }\n }\n if (kEvent != null) {\n if (isButtonFocused && selectedInput != null) {\n if (currentCode == kEvent.getCode() || !inputsMap.containsValue(kEvent.getCode())) {\n setKey(selectedInput, kEvent.getCode());\n MenuTab.CONTROLS.getButton(selectedInput.toString()).setSelected(false);\n MenuTab.CONTROLS.getButton(selectedInput.toString()).setText(kEvent.getCode().getName());\n Loader.getInstance().saveConfigs(inputsMap);\n currentCode = null;\n } else\n audioController.warning();\n }\n }\n break;\n case HIGHSCORE:\n if (mEvent != null) {\n Point mouseCoords = new Point((int) (mEvent.getSceneX() / ViewController.SCALE), (int) (mEvent.getSceneY() / ViewController.SCALE));\n if (Utils.isInside(mouseCoords, MenuTab.CONTROLS.getButton(\"back\").getHitbox()))\n Menu.getInstance().setTab(MenuTab.MAIN);\n }\n break;\n case HIGHSCORE_ENTER:\n if (kEvent != null) {\n Button button = MenuTab.HIGHSCORE_ENTER.getButton(\"name\");\n if ((kEvent.getCode().isLetterKey() || kEvent.getCode().isDigitKey())&& (button.getText().length() < 5))\n button.setText(button.getText() + kEvent.getText());\n else if (kEvent.getCode() == KeyCode.BACK_SPACE && button.getText().length() >= 1)\n button.setText(button.getText().substring(0, button.getText().length() - 1));\n else if (kEvent.getCode().equals(inputsMap.get(Input.ENTER)) && button.getText().length() > 0) {\n game.runLater(() -> game.addHighscore(new Score(game.getScoreToSave(), button.getText())));\n Loader.getInstance().saveHighscore(game.getHighscores());\n Menu.getInstance().setTab(MenuTab.MAIN);\n }\n }\n }\n break;\n }\n }", "protected void processInputs() {\n\t\twhile (InputInfo.size() > 0) {\n\t\t\tInputInfo info = InputInfo.get();\n\n\t\t\tif (info.kind == 'k' && (info.action == GLFW_PRESS\n\t\t\t\t\t|| info.action == GLFW_REPEAT)) {\n\t\t\t\tint code = info.code;\n\n\t\t\t}// input event is a key\n\t\t\telse if (info.kind == 'm') {// mouse moved\n\t\t\t\t// System.out.println( info );\n\t\t\t} else if (info.kind == 'b') {// button action\n\t\t\t\t// System.out.println( info );\n\t\t\t}\n\n\t\t}// loop to process all input events\n\n\t}", "protected EventHandler<KeyEvent> playKeyEvent() {\n EventHandler<KeyEvent> keyEventHandler;\n keyEventHandler = new EventHandler<KeyEvent>() {\n @Override\n public void handle(KeyEvent keyEvent) {\n // Rotates the boat.\n if (keyEvent.getCode() == KeyCode.R) {\n if(rotationIsValide){\n if(activeBoat!=null){\n drawRotation(activeBoat); \n }\n } \n }\n // Relocates the boat to origin.\n if (keyEvent.getCode() == KeyCode.DELETE) {\n if(activeBoat!=null) {\n reinitBoat(activeBoat);\n // enable validate button if all boats are well placed\n valider.setDisable(!allBoatsArePlaced());\n }\n // enable validate button if all boats are well placed\n valider.setDisable(!allBoatsArePlaced());\n }\n keyEvent.consume();\n }\n };\n return keyEventHandler;\n }", "public static void init(GameContainer c) {\r\n \t//if an older input exists, remove the listener\r\n \tif (input!=null)\r\n \t\tinput.removeListener(INPUT_LISTENER);\r\n \t\r\n \t//update fields\r\n container = c;\r\n input = c.getInput();\r\n defaultFont = c.getDefaultFont();\r\n\r\n \t//add listener\r\n input.addPrimaryListener(INPUT_LISTENER);\r\n }", "public void initialize() {\n // create a runner using a function\n this.createScreenBorders();\n // create a keyboard sensor.\n this.keyboard = this.runner.getGUI().getKeyboardSensor();\n //create the environment for the game (game environment and sprites collection)\n this.createEnvironment();\n // BACKGROUND CREATION //\n this.createBackground();\n // create the counters for the game.\n this.createCounters();\n // LISTENERS CREATION //\n //create a message printing listener.\n HitListener phl = new PrintingHitListener();\n //create a new block remover listener.\n HitListener blockrmv = new BlockRemover(this, blockCounter);\n //create a new ball remover listener.\n HitListener ballrmv = new BallRemover(this, ballCounter);\n //create a new score counter listener.\n HitListener scorelstn = new ScoreTrackingListener(this.scoreCounter);\n // BLOCKS CREATION //\n this.createBlocks(phl, blockrmv, scorelstn);\n // SIDE BLOCKS CREATION //\n this.createSideBlocks();\n // DEATH BLOCK CREATION //\n this.createDeathBlock(ballrmv);\n // LEVEL'S NAME //\n LevelsName name = new LevelsName(this.levelInfo.levelName());\n // add the whole-game indicators to the sprites list.\n this.sprites.addSprite(scoreIndi);\n this.sprites.addSprite(lifeIndi);\n this.sprites.addSprite(name);\n }", "public void init()\r\n\t{\n\t\tsetSize(300,300);\r\n\t\taddKeyListener(this); //ajout d'ecouteur de clavier\r\n\t\t\r\n\t}", "private void initListener() {\n initPieceListener();\n initButtonsListener();\n }", "private void setKeyBindings() {\n\t\tKeyboard.getPressedActions().register(\"playerMovement\",\n\t\t\t\tnew InputAction<KeyEvent>() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void actionPerformed(KeyEvent event) {\n\t\t\t\t\t\tint key = event.getKeyCode();\n\n\t\t\t\t\t\tif (key == KeyEvent.VK_W) {\n\t\t\t\t\t\t\tsetDirection(Direction.NORTH);\n\t\t\t\t\t\t} else if (key == KeyEvent.VK_S) {\n\t\t\t\t\t\t\tsetDirection(Direction.SOUTH);\n\t\t\t\t\t\t} else if (key == KeyEvent.VK_D) {\n\t\t\t\t\t\t\tsetDirection(Direction.EAST);\n\t\t\t\t\t\t} else if (key == KeyEvent.VK_A) {\n\t\t\t\t\t\t\tsetDirection(Direction.WEST);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\tKeyboard.getReleasedActions().register(\"playerMovement\",\n\t\t\t\tnew InputAction<KeyEvent>() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void actionPerformed(KeyEvent event) {\n\t\t\t\t\t\tint key = event.getKeyCode();\n\n\t\t\t\t\t\tif (key == KeyEvent.VK_W || key == KeyEvent.VK_S\n\t\t\t\t\t\t\t\t|| key == KeyEvent.VK_D || key == KeyEvent.VK_A) {\n\t\t\t\t\t\t\tsetDirection(Direction.NONE);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t}", "private void initActions() {\n\t\tthis.back.addActionListener(new ActionListener() {\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tlistener.act(PokePartyPanel.MANAGE_TRAINERS_PANEL, \n\t\t\t\t\t\tPokePartyPanel.MANAGE_TRAINERS_PANEL);\n\t\t\t}\n\t\t\t\n\t\t});\n\t\tthis.pass.addKeyListener(new KeyListener() {\n\n\t\t\t@Override\n\t\t\tpublic void keyTyped(KeyEvent e) {\n\t\t\t\t\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyPressed(KeyEvent e) {\n\t\t\t\t\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void keyReleased(KeyEvent e) {\n\t\t\t\tif(e.getKeyChar() == KeyEvent.VK_ENTER) {\n//\t\t\t\t\tSystem.out.println(PokeUtils.doPass(pass.getPassword()));\n\t\t\t\t\tif(df.login(userID, PokeUtils.doPass(pass.getPassword()))) {\n\t\t\t\t\t\tlistener.act(PokePartyPanel.TEAM_PANEL, String.valueOf(userID));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tJOptionPane.showMessageDialog(null, msg, title,\n\t\t\t\t\t\t\t\tJOptionPane.ERROR_MESSAGE, null);\n\t\t\t\t\t}\n\t\t\t\t\tpass.setText(\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t});\n\t}", "Game() {\n _randomSource = new Random();\n\n _players = new Player[2];\n _input = new BufferedReader(new InputStreamReader(System.in));\n _players[0] = new HumanPlayer(BP, this);\n _players[1] = new MachinePlayer(WP, this);\n _playing = false;\n }", "private void initKeybinds() {\n spellbind1 = KeyBindingHelper.registerKeyBinding(new KeyBinding(\n \"key.malazan.spell1\", // The translation key of the keybinding's name\n InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.\n GLFW.GLFW_KEY_Z, // The keycode of the key\n \"category.malazan.spells\"\n ));\n // The translation key of the keybinding's name\n // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.\n // The keycode of the key\n // The translation key of the keybinding's category.\n spellbind2 = KeyBindingHelper.registerKeyBinding(new KeyBinding(\n \"key.malazan.spell2\", // The translation key of the keybinding's name\n InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.\n GLFW.GLFW_KEY_X, // The keycode of the key\n \"category.malazan.spells\" // The translation key of the keybinding's category.\n ));\n }", "public Board() {\n \tSettingsManager.readSettings();\n this.keyStateManager = KeysStateManager.getInstance();\n addMouseListener(MouseInputListener.getInstance());\n FontManager.initFont(this.getClass());\n initApp();\n initSounds();\n initSuppliers();\n initGame();\n }", "private void init() {\n\t\tdisplay = new Display(title, width, height);\n\t\tdisplay.getFrame().addKeyListener(keyManager); //lets us access keyboard\n\t\tdisplay.getFrame().addMouseListener(mouseManager);\n\t\tdisplay.getFrame().addMouseMotionListener(mouseManager);\n\t\tdisplay.getCanvas().addMouseListener(mouseManager);\n\t\tdisplay.getCanvas().addMouseMotionListener(mouseManager);\n\t\tAssets.init();\n\t\t\n\t\tgameCamera = new GameCamera(this, 0,0);\n\t\thandler = new Handler(this);\n\t\t\n\t\tgameState = new GameState(handler);\n\t\tmenuState = new MenuState(handler);\n\t\tsettingState = new SettingState(handler);\n\t\tmapState = new mapState(handler);\n\t\tmansionState = new mansionState(handler);\n\t\tparkState = new parkState(handler);\n\t\tjazzState = new jazzState(handler);\n\t\tmansionGardenState = new mansionGardenState(handler);\n\t\tmansionArcadeState = new mansionArcadeState(handler);\n\t\tmansionStudyState = new mansionStudyState(handler);\n\t\tjazzPRoomState = new jazzPRoomState(handler);\n\t\tState.setState(menuState);\n\t}", "public void KeyListenerAdded(KeyEvent e) throws InterruptedException {\n char keyPressed = e.getKeyChar();\n // CTRL-1: start a new game at level 1\n if(keyPressed == '1' || (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_1)){\n startGameByLevel(1);\n }\n\n if(gameStarted == false){return; }\n String str = \"\";\n boolean moved= false;\n\n // Press wasd or UP, DOWN, LEFT, RIGHT ARROWS.\n if (keyPressed == 'w' || keyPressed == 'W' || e.getKeyCode() == KeyEvent.VK_UP) {\n str = \"up\";\n moved = board.moveChip(str);\n if(moved == false && muteMusic == false){\n music.playAudio(\"ErrorSound\");\n }\n } else if (keyPressed == 's' || keyPressed == 'S' || e.getKeyCode() == KeyEvent.VK_DOWN) {\n str = \"down\";\n moved = board.moveChip(str);\n if(moved == false && muteMusic == false){\n music.playAudio(\"ErrorSound\");\n }\n } else if (keyPressed == 'a' || keyPressed == 'A' || e.getKeyCode() == KeyEvent.VK_LEFT) {\n str = \"left\";\n moved = board.moveChip(str);\n if(moved == false && muteMusic == false){\n music.playAudio(\"ErrorSound\");\n }\n } else if (keyPressed == 'd' || keyPressed == 'D' || e.getKeyCode() == KeyEvent.VK_RIGHT) {\n str = \"right\";\n moved = board.moveChip(str);\n if(moved == false && muteMusic == false){\n music.playAudio(\"ErrorSound\");\n }\n }\n if(moved){\n checkMovedRedraw();\n }\n // CTRL-X:\n if(keyPressed == 'x' || keyPressed == 'X' || (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_X)){\n if(gameStarted == false) { return; }\n exited = true;\n gamePaused = true;\n timeRuunableThread.setPause(gamePaused);\n timeRuunableThread.setDrawNumber(false);\n if(muteMusic == false){\n music.stopPlayingAudio(\"All\");\n music.playAudio(\"LoadingScreenMusic\");\n }\n musicName = \"LoadingScreenMusic\";\n animationThread.start();\n\n // clean the infoCanvas\n CleanInfoCanvas();\n }\n\n // CTRL-S: exit the game, saves the game state, game will resume next time the application will be started\n if((e.isControlDown() && e.getKeyCode() == KeyEvent.VK_S)){\n SaveGame();\n }\n\n // CTRL-R: resume a saved game\n if(keyPressed == 'r' || keyPressed == 'R' || (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_R)){\n if(canLoadGame == false){ return; }\n // loadGame();\n replayGame();\n }\n\n // CTRL-P: start a new game at the last unfinished level\n if(keyPressed == 'p' || keyPressed == 'P' || (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_P)){\n animationThread.stop();\n Thread.sleep(100);\n JOptionPane.showMessageDialog(null, \"Resume from the last unfinished level: \" + level, \"Message\", 1);\n newGameStart(level);\n }\n\n // SPACE: pause and continue\n if(e.getKeyCode()==KeyEvent.VK_SPACE){\n pauseAndContinue();\n }\n\n // ESC: escape from pause\n if(e.getKeyCode() == KeyEvent.VK_ESCAPE){\n gamePaused = false;\n timeRuunableThread.setPause(gamePaused);\n jf_Pause.dispose();\n }\n }", "public Game(KeybListener keyblis, Window win){//, Container contain) {\n keybl = keyblis;\n window = win;\n container = win.getContentPane();\n\n container.setFocusable(true);\n container.addKeyListener(keybl);\n container.requestFocus();\n\n bf = window.getBf();\n\n for(i=0;i<9;i++) tile[i] = window.getTile(i);\n this.initializeVariables();\n this.gameLoop();\n }", "private void setupListeners() {\n\t\tfor (int i = 0; i < _controlPoints.length; i++) {\n\t\t\taddControlPointListener(_controlPoints[i][0], i);\n\t\t\taddControlPointListener(_controlPoints[i][1], i);\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < _selectionButtons.length; i++) {\n\t\t\taddPointSelectionButtonListener(i);\n\t\t}\n\t}", "private void setUpKeyboardButtons() {\n mQWERTY = \"qwertyuiopasdfghjklzxcvbnm_\";\n mQWERTYWithDot = \"qwertyuiopasdfghjklzxcvbnm.\";\n\n mKeySize = mQWERTY.length();\n\n mLetterButtons = new Button[mQWERTY.length()];\n mKeyObjects = new KeyObject[mQWERTY.length() + 10];\n mIsShiftPressed = false;\n\n\n for (int i = 0; i < mQWERTY.length(); i++) {\n int id = getResources().getIdentifier(mQWERTY.charAt(i) + \"Button\", \"id\", getPackageName());\n mLetterButtons[i] = (Button) findViewById(id);\n\n final int finalI = i;\n mLetterButtons[i].setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View v, MotionEvent event) {\n // create KeyObject when button is pressed and assign pressed features\n if (event.getAction() == MotionEvent.ACTION_DOWN) {\n mKeyObjects[finalI] = new KeyObject();\n\n Rect buttonShape = new Rect();\n v.getLocalVisibleRect(buttonShape);\n\n mKeyObjects[finalI].setPressedPressure(event.getPressure());\n mKeyObjects[finalI].setPressedTime(event.getEventTime());\n\n mKeyObjects[finalI].setCoordXPressed(event.getX());\n mKeyObjects[finalI].setCoordYPressed(event.getY());\n\n mKeyObjects[finalI].setCenterXCoord(buttonShape.exactCenterX());\n mKeyObjects[finalI].setCenterYCoord(buttonShape.exactCenterY());\n }\n\n // assign release features, check if button is canceled\n if (event.getAction() == MotionEvent.ACTION_UP) {\n mKeyObjects[finalI].setReleasedPressure(event.getPressure());\n mKeyObjects[finalI].setReleasedTime(event.getEventTime());\n\n mKeyObjects[finalI].setCoordXReleased(event.getX());\n mKeyObjects[finalI].setCoordYReleased(event.getY());\n\n if (mIsShiftPressed) {\n mKeyObjects[finalI].setKeyChar(Character.toUpperCase(mQWERTYWithDot.charAt(finalI)));\n } else {\n mKeyObjects[finalI].setKeyChar(mQWERTYWithDot.charAt(finalI));\n }\n\n Log.d(TAG, mKeyObjects[finalI].toString());\n\n\n // add key to buffer and update EditText\n if (mKeyBuffer.add(mKeyObjects[finalI]))\n if (mIsShiftPressed) {\n mPasswordEditText.append((mQWERTYWithDot.charAt(finalI) + \"\").toUpperCase());\n switchToLowerCase();\n } else {\n mPasswordEditText.append(mQWERTYWithDot.charAt(finalI) + \"\");\n }\n }\n\n return false;\n }\n });\n }\n\n mShiftButton = (Button) findViewById(R.id.shiftButton);\n mShiftButton.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n if (mIsShiftPressed) {\n switchToLowerCase();\n } else {\n switchToUpperCase();\n }\n }\n });\n }", "private void listenersInitiation() {\n ActionSelectors listener = new ActionSelectors();\n submit.addActionListener(listener);\n goBack.addActionListener(listener);\n }", "private void initButtons() {\r\n\t\texitGameButton\t\t= game.screenHelper.createTextButton(BUTTON_EXIT_GAME_TEXT, BUTTON_EXIT_GAME_MOUSEOVER_TEXT, menuText);\r\n\t\tcancelExitButton\t= game.screenHelper.createTextButton(BUTTON_CANCEL_EXIT_TEXT, BUTTON_CANCEL_EXIT_MOUSEOVER_TEXT, menuText);\r\n\t\tcancelExitButton.addListener(new ChangeScreenInputListener(new MenuScreenChangeCommand()));\r\n\t\t// Event Listeners \r\n\t\t// TODO: clean up this giant piece of shitty code.\r\n\t\t\r\n\t\texitGameButton.addListener(new InputListener() {\r\n\t\t\tpublic boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {\r\n\t\t\t\texitGame();\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t});\r\n\t}", "private void addListeners() {\n\t\t\n\t\tloadJokesOptionMenu.addActionListener((event) -> {\n\t\t\tJFileChooser openDialog = new JFileChooser();\n\t\t\t\n\t\t FileNameExtensionFilter filter = new FileNameExtensionFilter(\"text files\", \"txt\");\n\t\t openDialog.setFileFilter(filter);\n\t\t int returnVal = openDialog.showOpenDialog(null);\n\t\t if(returnVal == JFileChooser.APPROVE_OPTION) {\t \n\t\t jokeFile = openDialog.getSelectedFile().getAbsolutePath();\n\t\t }\n\t\t});\n\t\t\n\t\tstartServerFileMenu.addActionListener(event -> startServer());\n\t\tstopServerFileMenu.addActionListener(event -> stopServer());\n\t\t\n\t\texitFileMenu.addActionListener(event -> quitApp());\n\n\t\tsetupServerInfoOptionMenu.addActionListener(event -> setupServerInfo());\n\t\t\n\t\taboutHelpMenu.addActionListener(event -> {\n\t\t\tJOptionPane.showMessageDialog(null, \"Knock Knock Server v1.0 Copyright 2017 RLTech Inc\");\n\t\t});\n\t\t\n\t\tstartServerToolBarButton.addActionListener(event -> {\n\t\t\tstartServer();\n\t\t\tstartServerToolBarButton.setEnabled(false);\n\t\t\tstopServerToolBarButton.setEnabled(true);\n\t\t});\n\t\t\n\t\tstopServerToolBarButton.addActionListener(event -> {\n\t\t\tstopServer();\n\t\t\tstartServerToolBarButton.setEnabled(true);\n\t\t\tstopServerToolBarButton.setEnabled(false);\n\t\t});\n\n\t\tkkClientToolBarButton.addActionListener(event -> {\n\n\t\t\ttry {\n\t\t\t\tRuntime.getRuntime().exec(\"java -jar KKClient.jar\");\n\t\t\t} catch (IOException e1) {\n\t\t\t\t//e1.printStackTrace();\n\t\t\t\tUtility.displayErrorMessage(\"Fail to find or launch KKClient.jar client app. Make sure Java run time (JRE) is installed and KKClient.jar is stored in the same path as this server app.\");\n\t\t\t}\n\t\t});\n\t\t\n\t\taddWindowListener(new WindowAdapter() {\n\t\t public void windowClosing(WindowEvent e) {\n\t\t \tquitApp();\t\n\t\t }\n\t\t});\n\t}", "public interface InputEventListener {\n /**\n * this method is called, when some button is pressed or released\n *\n * @param view on which the user is pressing the button\n * @param buttons Bit-Encoded buttons\n */\n void onInputEvent(View view, int buttons);\n }", "private void pollInput() {\n\t\t// check to see if the w key is down\n\t\tif (Keyboard.isKeyDown(Keyboard.KEY_W)) {\n\t\t\twKeyDown = true;\n\t\t} else\n\t\t\twKeyDown = false;\n\t\t// check to see if the a key is down\n\t\tif (Keyboard.isKeyDown(Keyboard.KEY_A)) {\n\t\t\taKeyDown = true;\n\t\t} else\n\t\t\taKeyDown = false;\n\t\t// check to see if the s key is down\n\t\tif (Keyboard.isKeyDown(Keyboard.KEY_S)) {\n\t\t\tsKeyDown = true;\n\t\t} else\n\t\t\tsKeyDown = false;\n\t\t// check to see if the d key is down\n\t\tif (Keyboard.isKeyDown(Keyboard.KEY_D)) {\n\t\t\tdKeyDown = true;\n\t\t} else\n\t\t\tdKeyDown = false;\n\t\t// check to see if the left mouse button is down\n\t\tif (Mouse.isButtonDown(0)) {\n\t\t\tmouseDown = true;\n\t\t} else\n\t\t\tmouseDown = false;\n\t\t// check to see if the F button is pressed and shows the shop screen if so\n\t\tif (Keyboard.isKeyDown(Keyboard.KEY_F)) {\n\t\t\tshowShopScreen();\n\t\t}\n\t\t// check to see if the esc button is pressed; if so, go to title screen\n\t\tif (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {\n\t\t\tshowTitleScreen();\n\t\t}\n\t}", "private void setupGameWindow()\n {\n uControll.setWindowProperties(new WindowListener() {\n @Override\n public void windowOpened(WindowEvent we) {\n }\n\n @Override\n public void windowClosing(WindowEvent we) {\n menuPanel.open();\n }\n\n @Override\n public void windowClosed(WindowEvent we) {\n }\n\n @Override\n public void windowIconified(WindowEvent we) {\n }\n\n @Override\n public void windowDeiconified(WindowEvent we) {\n }\n\n @Override\n public void windowActivated(WindowEvent we) {\n }\n\n @Override\n public void windowDeactivated(WindowEvent we) {\n }\n });\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}", "public void setKeyListener(HumanSnakeController listener) {\n\t\tcanvas.addKeyListener(listener);\n\t}", "public static void init() {\n\t \n\t flight = new KeyBinding(\"key.flight\", Keyboard.KEY_F, \"key.categories.modmoi\");\n\t \n\t boost = new KeyBinding(\"key.boost\", Keyboard.KEY_LCONTROL, \"key.categories.modmoi\");\n\t \n\t nv = new KeyBinding(\"key.nvision\", Keyboard.KEY_N, \"key.categories.modmoi\");\n\n\t // Register both KeyBindings to the ClientRegistry\n\t ClientRegistry.registerKeyBinding(flight);\n\t // ClientRegistry.registerKeyBinding(bot);\n\t ClientRegistry.registerKeyBinding(boost);\n\t ClientRegistry.registerKeyBinding(nv);\n\t }", "private void initializeFields() {\r\n myFrame = new JFrame();\r\n myBoard = new Board();\r\n myBoard.addObserver(this);\r\n myTimer = new Timer(DEFAULT_TIMER_SPEED, new TimerListener(myBoard));\r\n myGamePanel = new TetrisPanel(myBoard);\r\n myNextPiecePanel = new NextPiecePanel(myBoard);\r\n myScorePanel = new ScorePanel(myBoard, myTimer, DEFAULT_TIMER_SPEED);\r\n myInfoPanel = new InfoPanel();\r\n myGamePaused = false;\r\n myGameOver = false;\r\n myPlayer = null;\r\n\r\n final MyKeyAdapter handler = new MyKeyAdapter();\r\n myFrame.addKeyListener(handler);\r\n }", "public void add(InputChangedListener listener)\r\n\t{\r\n\r\n\t}", "@Override\n public void keyPressed(KeyEvent e) {\n\n\n }", "private void start() {\n GameStateManager gameStateManager = new GameStateManager();\n JPanel jPanel = gameStateManager.getGameState().getJPanel();\n jPanel.setVisible(true);\n GUI gui = GUI.getInstance();\n gui.setjPanel(jPanel);\n gui.addKeyListener(gameStateManager);\n GameStateObserver gameStateObserver = new GameStateObserver(gameStateManager,gui);\n gameStateManager.addObserver(gameStateObserver);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n \n api = new Api();\n \n outputConsole = (TextView) findViewById(R.id.outputConsole);\n \n inputLine = (EditText) findViewById(R.id.inputLine); \n inputLine.setOnKeyListener(this);\n }", "public void setKeyListener(KeyListener input) {\n edittext.setKeyListener(input);\n }", "public void run() {\n addMouseListeners();\n playGame();\n }", "void handleKeyboard(KeyboardHandler kh, Player player) throws IOException {\n\n if (kh.wPressed()) {\n if (player.checkCollisionHorizWall(90) == 1) {\n player.setDeltaY(-7);\n }\n else {\n player.setDeltaY(0);\n }\n }\n if (kh.sPressed()) {\n if (player.checkCollisionHorizWall(height-220) == 0) {\n player.setDeltaY(7);\n }\n else {\n player.setDeltaY(0);\n }\n }\n if (kh.aPressed()) {\n if (player.checkCollisionVerticalWall(150) == 1) {\n player.setDeltaX(-7);\n }\n else {\n player.setDeltaX(0);\n }\n }\n if (kh.dPressed()) {\n if (player.checkCollisionVerticalWall(width-200) == 0) {\n player.setDeltaX(7);\n }\n else {\n player.setDeltaX(0);\n }\n }\n\n if (kh.shiftPressed()) {\n shiftPress = 1;\n }\n else {\n if (shiftPress == 1) {\n\n player.meleeAttack();\n }\n shiftPress = 0;\n }\n\n if (kh.onePressed()) {\n onePress = 1;\n }\n else {\n if (onePress == 1) {\n\n player.shootArrow();\n }\n onePress = 0;\n }\n\n if (!kh.wPressed() && !kh.sPressed()) {\n player.setDeltaY(0);\n }\n\n if (!kh.aPressed() && !kh.dPressed()) {\n player.setDeltaX(0);\n }\n\n if (kh.escapePressed()) {\n escapePress = 1;\n }\n else {\n if (escapePress == 1) {\n \tingamemenu = new Menuingame(window, kh, level.getLevelNum());\n }\n escapePress = 0;\n }\n\n /*\n End keyboard handling block\n */\n }", "public Game()\n\t{\n\t\tsetSize(Main.FRAMEWIDTH, Main.FRAMEHEIGHT);\n\t\taddMouseListener(mouse);\n\t\taddMouseMotionListener(mouse);\n\t\taddKeyListener(key);\n\t\taddMouseWheelListener(mouse);\n\t\tsetFocusable(true);\n\t\t//setVisible(false);\n\t\t\n\t\tengine.start();\n\t}", "public GameScreen() {\n\n\t\tint midPointY = (int) (Const.GAME_HEIGHT / 2);\n\n\t\tworld = new GameWorld(midPointY);\n\t\trenderer = new GameRenderer(world);\n\n\t\tGdx.input.setInputProcessor(new InputHandler(world.getVentilatorUp(), world.getVentilatorDown()));\n\t\t// Gdx.input.setInputProcessor(new\n\t\t// InputHandler(world.getVentilatorTwo()));\n\t}" ]
[ "0.734322", "0.71589535", "0.69012964", "0.68552995", "0.682068", "0.6798985", "0.67654043", "0.67568165", "0.6716732", "0.66963416", "0.6635227", "0.6618318", "0.6601759", "0.6588935", "0.65356433", "0.64226687", "0.6401041", "0.63922596", "0.6391928", "0.63859755", "0.63838667", "0.62893176", "0.6287095", "0.6272151", "0.6268111", "0.62588006", "0.6231875", "0.6213533", "0.61907893", "0.6184655", "0.61703616", "0.6153343", "0.6152691", "0.61488146", "0.61343247", "0.6108417", "0.61009204", "0.60948604", "0.6050191", "0.60408145", "0.60400283", "0.6037737", "0.60278404", "0.6008724", "0.5972568", "0.59267265", "0.58710504", "0.5846152", "0.58281636", "0.58150226", "0.5806257", "0.5806202", "0.58018416", "0.5800659", "0.58002603", "0.5796539", "0.57946044", "0.5794019", "0.57925564", "0.57876587", "0.578639", "0.57808423", "0.57563525", "0.5755331", "0.57537544", "0.5752219", "0.57495266", "0.57476306", "0.5742597", "0.5738605", "0.5730371", "0.57302624", "0.5727932", "0.57256806", "0.57118416", "0.57065403", "0.5699636", "0.56785005", "0.5678486", "0.5667619", "0.56648964", "0.56351495", "0.56273776", "0.5624355", "0.5620138", "0.5615993", "0.5611609", "0.561076", "0.5610196", "0.56059384", "0.5600021", "0.55968106", "0.5586238", "0.5586153", "0.55802345", "0.5576407", "0.55741894", "0.55739844", "0.557233", "0.55646014" ]
0.7818621
0
/ This takes the current number of cards from the model, and updates the view.
private void displayPlayers() { for (Player p: game.getPlayers()) { view.updateDisplay(p.getId(), p.getDeck().getNumberOfCards()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void updateCards() {\r\n riderUserCards.setAll(riderUserModel.getCards());\r\n if (riderUserCards.size() != 0) {\r\n riderUserView.noCards.setVisible(false);\r\n riderUserView.dropDownOfCards.getSelectionModel().selectFirst();\r\n setCardSelected(riderUserView.dropDownOfCards.getValue());\r\n riderUserView.balanceText.setText(\r\n \"The balance of Card \" + riderUserView.dropDownOfCards.getValue().getId() + \" is:\");\r\n riderUserView.currentCardBalance.setText(\r\n NumberFormat.getCurrencyInstance()\r\n .format((Double) riderUserView.dropDownOfCards.getValue().getBalance()));\r\n riderUserView.addBalanceButton.setText(\r\n \"Add Balance to \" + riderUserView.dropDownOfCards.getValue().getId());\r\n getCardRecentTrips();\r\n riderUserView.dropDownOfCards.setVisible(true);\r\n riderUserView.balanceText.setVisible(true);\r\n riderUserView.currentCardBalance.setVisible(true);\r\n riderUserView.addBalanceButton.setVisible(true);\r\n } else {\r\n riderUserView.noCards.setVisible(true);\r\n riderUserView.dropDownOfCards.setVisible(false);\r\n riderUserView.balanceText.setVisible(false);\r\n riderUserView.currentCardBalance.setVisible(false);\r\n riderUserView.addBalanceButton.setVisible(false);\r\n }\r\n }", "protected void increment(View view){\r\n\r\n if (quantity==99){\r\n return;\r\n }\r\n quantity++;\r\n display(quantity);\r\n }", "private void setCardNumber() {\n String temp = \"\";\n temp = \"\" + (curIndex + 1) + \"/\" + deckOfCards.size();\n cardNumberString.setText(temp);\n }", "public void increment (View view)\n {\n numOfCufee++;\n display(numOfCufee);\n }", "private void updateView() {\n model.inlezenHighscore();\n for (int i = 0; i < 10; i++) {\n view.getNaamLabels(i).setText(model.getNaam(i));\n view.getScoreLabels(i).setText(model.getScores(i));\n }\n }", "public void increment(View view) {\n quantity = quantity + 1;\n display(quantity);\n\n }", "public void increment(View view) {\n quantity = quantity + 1;\n display(quantity);\n\n }", "private void addCardsToViews()\n\t{\n\t\taddCardsToCorkboardView();\n\t\t\n\t}", "public void increment(View view){\n quant++;\n display(quant);\n }", "void updateViewFromModel();", "private void addCardsToCorkboardView()\n\t{\n\t\tfor(Card card : cards) {\n\t\t\t\n\t\t\taddCardLabel(card);\n\t\t\t\n\t\t}\n\t\t\n\t}", "public void increment(View view) {\n if (quantity == 100){\n return;\n }\n quantity = quantity + 1;\n displayQuantity(quantity);\n }", "public void increment(View view) {\n if(quantity < 100)\n quantity++;\n displayQuantity(quantity);\n }", "private void syncCardsWithViews()\n\t{\n\t\t\n\t\t// Remove all cards from all views\n\t\tremoveCardsFromViews();\n\t\t\n\t\t// Add all cards to all views\n\t\taddCardsToViews();\n\t\t\n\t\t// Repaint everything\n\t\trepaintViews();\n\t\t\n\t}", "public void rMadridRCard(View view) {\n r_cardCountRmadrid = r_cardCountRmadrid + 1;\n displayR_CardForRmadrid(r_cardCountRmadrid);\n }", "private void cards() {\n newUserCard();\n editTypeCard();\n changePasswordCard();\n }", "@Override\n public void onClick(View theView) {\n if(curIndex == deckOfCards.size()-1){\n ArrayList<FlashCard> newDeck = new ArrayList<FlashCard>();\n for(int i = 0; i < deckOfCards.size(); i++){\n newDeck.add(deckOfCards.get(i));\n }\n Intent intent = new Intent(getApplicationContext(), FinishScreenActivity.class);\n intent.putParcelableArrayListExtra(\"data\", newDeck);\n intent.putParcelableArrayListExtra(\"originalDeck\", originalCards);\n startActivity(intent);\n finish();\n }else{\n ++curIndex;\n curCard = deckOfCards.get(curIndex);\n Log.d(TAG, \"on card number \" + curIndex);\n refreshButtons();\n setFrontSide();\n }\n\n }", "private void updateCollectedView() {\n mCollectedCoins = Data.getCollectedCoins();\n mRecyclerViewRec.setVisibility(View.INVISIBLE);\n mRecyclerViewCol.setVisibility(View.VISIBLE);\n mCollectedAdapter.notifyDataSetChanged();\n }", "public void increaseCount(View view) {\n count++;\n display(count);\n }", "public void updateScoreCard(){\n scoreCard.setText(correct+\"/\"+total);\n }", "public void rMadridYCard(View view) {\n y_cardCountRmadrid = y_cardCountRmadrid + 1;\n displayY_CardForRmadrid(y_cardCountRmadrid);\n }", "void updateModelFromView();", "public int getNumCards() {\n return this.numCards;\n }", "public void increament(View view) {\n if(!(quantity>=100)) {\n quantity++;\n display(quantity);\n }\n }", "private void updateCards(ListView cardMenu) {\n ObservableList<String> scoresList = FXCollections.observableArrayList();\n for (int i = 0; i < customDeck.size(); i++) {\n scoresList.add(customDeck.get(i).toString());\n }\n cardMenu.setItems(scoresList);\n setCellFormat(cardMenu);\n }", "private void updateActionCards() {\n\t\tcleanActionCards();\n\t\tLinearLayout layoutActionCards = (LinearLayout) findViewById(R.id.layoutActionCards);\n\t\tArrayList<String> actionCards = ((ApplicationExtension) getApplication())\n\t\t\t\t.getCharacter().getActionCards();\n\t\tfor (int i = 0; i < actionCards.size(); ++i) {\n\t\t\tString cardName = actionCards.get(i);\n\t\t\tTextView textCardName = new TextView(this);\n\t\t\t// temporaryText.add(textCardName);\n\t\t\ttextCardName.setText(cardName + \":\");\n\t\t\ttextCardName.setLayoutParams(new LayoutParams(\n\t\t\t\t\tLayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));\n\t\t\tlayoutActionCards.addView(textCardName);\n\n\t\t\tResultTypeUtility utility = new ResultTypeUtility();\n\t\t\tutility.setupDamage();\n\t\t\tfor (int j = 0; j <= Character.MAX[SKULL]; ++j) {\n\t\t\t\tString buttonName = \"toggleButtonSkull\" + j;\n\t\t\t\tint buttonId = getResources().getIdentifier(buttonName, \"id\",\n\t\t\t\t\t\t\"com.roxolan.warhammeroptimiserapp\");\n\t\t\t\tToggleButton button = (ToggleButton) findViewById(buttonId);\n\t\t\t\tif (button.isChecked()) {\n\t\t\t\t\tTextView textAverageDamage = new TextView(this);\n\t\t\t\t\ttextAverageDamage.setText(R.string.computing);\n\t\t\t\t\ttextAverageDamage.invalidate();\n\t\t\t\t\ttextAverageDamage.requestLayout();\n\t\t\t\t\t// temporaryText.add(textAverageDamage);\n\t\t\t\t\tlayoutActionCards.addView(textAverageDamage);\n\t\t\t\t\tdouble averageDamage;\n\t\t\t\t\tCharacter player = ((ApplicationExtension) getApplication()).getCharacter();\n\t\t\t\t\tCharacter monster = new Character(SKULL, j);\n\t\t\t\t\tSystem.out.println(\"Passing card \" + cardName \n\t\t\t\t\t\t\t+ \", rank \" + player.getLevel() + \", skull \" + monster.getLevel() \n\t\t\t\t\t\t\t+ \", damage utility = \" + utility.getUtility(DEAL, DAMAGE));\n\t\t\t\t\ttry {\n\t\t\t\t\t\taverageDamage = Optimiser.averageUtility(this, cardName, player, monster, utility);\n\t\t\t\t\t\ttextAverageDamage.setText(j + \" \"\n\t\t\t\t\t\t\t\t+ getString(R.string.skulls) + \": \"\n\t\t\t\t\t\t\t\t+ averageDamage);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\ttextAverageDamage.setText(R.string.errorCardNotFound);\n\t\t\t\t\t}\n\t\t\t\t\ttextAverageDamage.invalidate();\n\t\t\t\t\ttextAverageDamage.requestLayout();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Override\n public void onClick(View theView) {\n --curIndex;\n curCard = deckOfCards.get(curIndex);\n refreshButtons();\n setFrontSide();\n\n }", "public void restartCards() {\n productCards = productRepository.getCardProducts();\n ((MutableLiveData<Integer>) pairsFound).setValue(0);\n ((MutableLiveData<Integer>) pairsLeft).setValue(10);\n }", "public int getNumCards()\r\n {\r\n return numCards;\r\n }", "public int getCardCount() {\r\n return cardCount;\r\n\t}", "public static void UpdateCardsTable() {\n\t\tString url = null;\n\t\tString cards = null;\n\n\t\ttry {\n\t\t\tfor (int i = 0; i < Config.getHundredsOfCardsAvailable(); i++) {\n\t\t\t\turl = \"https://contentmanager-lb.interact.io/content-cards/search?offset=\" + i * 100 + \"&limit=100\";\n\t\t\t\t// hard-set limit of Content Manager is 100 cards\n\t\t\t\tcards = Requester.sendPostRequest(url);\n\n\t\t\t\tString id;\n\t\t\t\tString metaDataContentType;\n\n\t\t\t\tfor (int cardIndex = 0; cardIndex < 100; cardIndex++) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (isCardToBeAdded(cards, cardIndex)) {\n\t\t\t\t\t\t\tid = JsonPath.parse(cards).read(\"$.data.[\" + cardIndex + \"].id\");\n\t\t\t\t\t\t\tmetaDataContentType = JsonPath.parse(cards)\n\t\t\t\t\t\t\t\t\t.read(\"$.data.[\" + cardIndex + \"].metadata.contentType\");\n\t\t\t\t\t\t\t// Logger.print(id);\n\t\t\t\t\t\t\t// Logger.print(metaDataContentType);\n\t\t\t\t\t\t\tString labeledCardTag = metaDataContentType.replaceAll(\" \", \"_\").toLowerCase();\n\t\t\t\t\t\t\t// TODO if this tag isn't already in cards table, add it as a new column\n\t\t\t\t\t\t\taddCardToTable(id, labeledCardTag);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t// FIXME don't ignore exception here... it's bad practice\n\t\t\t\t\t\t// TODO make it so that JsonPath only checks up until there are cards\n\t\t\t\t\t\t// e.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\r\n\tpublic void increaseViewCnt(int no) {\n\t\tsqlSession.update(namespace + \".increaseViewCnt\", no);\r\n\t}", "public void lPoolRcard(View view) {\n r_cardCountLpool = r_cardCountLpool + 1;\n displayRcardForLpool(r_cardCountLpool);\n }", "public void AndUpdateCards() {\n String[] projection = {\n PanelingLampContract.FormEntry._ID,\n PanelingLampContract.FormEntry.COLUMN_NAME_TITLE,\n mCategory,\n mPos,\n PanelingLampContract.FormEntry.COLUMN_ACTIVE,\n PanelingLampContract.FormEntry.COLUMN_IS_STANDARD,\n PanelingLampContract.FormEntry.COLUMN_FAV,\n PanelingLampContract.FormEntry.COLUMN_PATH_THUMBNAIL,\n PanelingLampContract.FormEntry.COLUMN_POS_MOTOR_0,\n PanelingLampContract.FormEntry.COLUMN_POS_MOTOR_1,\n PanelingLampContract.FormEntry.COLUMN_POS_MOTOR_2,\n PanelingLampContract.FormEntry.COLUMN_POS_MOTOR_3,\n PanelingLampContract.FormEntry.COLUMN_POS_MOTOR_4,\n PanelingLampContract.FormEntry.COLUMN_LED_0,\n PanelingLampContract.FormEntry.COLUMN_LED_1,\n PanelingLampContract.FormEntry.COLUMN_LED_2,\n PanelingLampContract.FormEntry.COLUMN_LED_3,\n PanelingLampContract.FormEntry.COLUMN_LED_4,\n PanelingLampContract.FormEntry.COLUMN_LED_5,\n PanelingLampContract.FormEntry.COLUMN_LED_6\n };\n\n // How you want the results sorted in the resulting Cursor\n String sortOrder = mPos + \" ASC\";\n\n // Which row to update, based on the ID\n String selection = mCategory + \" LIKE ?\";\n // is true\n String v = mCategoryValue ? \"1\" : \"0\";\n String[] selectionArgs = {v};\n\n\n mCursor = mDB.query(\n PanelingLampContract.FormEntry.TABLE_NAME, // The table to query\n projection, // The columns to return\n selection, // The columns for the WHERE clause\n selectionArgs, // The values for the WHERE clause\n null, // don't group the rows\n null, // don't filter by row groups\n sortOrder // The sort order\n );\n\n mCards = CardHolder.createListfrom(mCursor, mCategory, mPos);\n notifyDataSetChanged();\n }", "public void ComputerUpdateTopCard(int value){\n topCard = handComputer.get(value);\n }", "public int getSize(){\r\n\t\treturn cards.size();\r\n\t}", "public void setCardNo(int cardNumber);", "private void paginate() {\n List<ItemModel> old = adapter.getItems();\n List<ItemModel> New = new ArrayList<>(addList());\n CardStackCallback callback = new CardStackCallback(old, New);\n DiffUtil.DiffResult result = DiffUtil.calculateDiff(callback);\n adapter.setItems(New);\n result.dispatchUpdatesTo(adapter);\n }", "public void updateComputerCard()\n {\n this.computerCard = highCardGame.getHand(0).inspectCard(computerCardCounter);\n }", "void updateView () {\n updateScore();\n board.clearTemp();\n drawGhostToBoard();\n drawCurrentToTemp();\n view.setBlocks(board.getCombined());\n view.repaint();\n }", "@Override\r\n\tpublic void increaseReviewViewCnt(int no) {\n\t\tsqlSession.update(namespace + \".increaseReviewViewCnt\", no);\r\n\t}", "public int getCardCount() {\r\n\t\treturn this.cards;\r\n\t}", "public void increment(View view) {\n quantity = (quantity + 1);\n submitOrder(quantity);\n\n }", "private void showCardStats() {\n TextView unlockedNum = findViewById(R.id.UnlockedNum);\n unlockedNum.setText(\n \" \" + this.masterDeck.retrieveUnlockedCardNames().size() +\n \" / \" + this.masterDeck.deckSize()\n );\n }", "public void updateContent(){\r\n\t\tthis.initRecords();\r\n\t\tlist.show(records);\r\n\t}", "public int getNumberOfCards() {\r\n\t\treturn numberOfCards;\r\n\t}", "public int getNumberOfCards()\n\t{\n\t\treturn numCards;\n\t}", "public void update()\n\t{\n\t\t//update the view's list of movies...\n\t\tthis.getRemoveButton().setEnabled((this.database.getNumberOfMovies()>0));\n\t\tthis.movieList.setListData(this.database.toList());\n\t}", "@Override\n public void onAmountChange(View view, int amount) {\n item.num = amount;\n }", "public void currentPlayerDrawCard() {\n Player currentPlayer = turnManager.currentPlayer();\n UnoCard newCard = getNextCard();\n currentPlayer.obtainCard(newCard);\n\n for (GameListener gameListener : gameListeners) {\n gameListener.cardDrawn();\n }\n\t}", "public void increment(View view) {\n if(quantity == 100){\n Toast t = Toast.makeText(this, \"You cannot have more than 100 coffees\", Toast.LENGTH_LONG);\n t.show();\n return;\n }\n\n quantity = quantity + 1;\n displayQuantity(quantity);\n }", "@Override\r\n public int getCount() {\r\n \treturn null == mCardList ? 0 : mCardList.size();\r\n //return PAGE_COUNT;\r\n }", "public int getNumCards() {\n return this.topCard;\n }", "public int numOfCards() {\n return cards.size();\n }", "private void updateHitCount(String cardId) {\n Optional<CardHitDetail> currentCard = cardRepository.findById(cardId);\n CardHitDetail currentCardHitDetail;\n if (currentCard.isPresent()) {\n currentCardHitDetail = currentCard.get();\n currentCardHitDetail.setHitCount(currentCardHitDetail.getHitCount() + 1);\n } else {\n currentCardHitDetail = new CardHitDetail();\n currentCardHitDetail.setCardId(cardId);\n currentCardHitDetail.setHitCount(1);\n }\n\n cardRepository.save(currentCardHitDetail);\n }", "public void increment(View view) {\n if(quantity ==100) {\n Toast.makeText(this, \"You cannot have more than 100 cups of coffee\", Toast.LENGTH_SHORT).show();\n return;\n }\n quantity = quantity + 1;\n displayQuantity(quantity);\n }", "@Override\r\n\tpublic void updateView(List<Pays> models) {\n\t}", "public void updateCount(){\n TextView newCoupons = (TextView) findViewById(R.id.counter);\n //couponsCount.setText(\"Pocet pouzitych kuponov je: \" + SharedPreferencesManager.getUsedCoupons());\n if(SharedPreferencesManager.getNew()>0) {\n newCoupons.setVisibility(View.VISIBLE);\n newCoupons.setText(String.valueOf(SharedPreferencesManager.getNew()));\n }\n else {\n newCoupons.setVisibility(View.GONE);\n }\n }", "private void moveToNextCard() {\r\n\t\t// This is simple enough: Move the card set to the next\r\n\t\t// card and update the label and database. If we're now on\r\n\t\t// the last card, disable the Next button and make sure\r\n\t\t// the Previous button is always enabled. Then rebuild the card\r\n\t\t// itself so the correct passcodes are displayed.\r\n \tif (cardSet.getLastCard() != Cardset.FINAL_CARD) {\r\n\t\t\tcardSet.nextCard();\r\n\t\t\tbtnPrevious.setEnabled(true);\r\n\t\t\tif (cardSet.getLastCard() == Cardset.FINAL_CARD)\r\n\t\t\t\tbtnNext.setEnabled(false);\r\n\t\t\t// Save the card set to the database:\r\n\t\t\tDBHelper.saveCardset(cardSet);\r\n\t\t\trebuildCard();\r\n\t lblCardNumber.setText(getResources().getString(R.string.cardview_card_num_prompt).replace(getResources().getString(R.string.meta_replace_token), String.valueOf(cardSet.getLastCard())));\r\n \t}\r\n }", "private void initCards() {\n\t\tArrayList<Card> cardsChart = new ArrayList<Card>();\n\t\tCard card = init_info_card(tmp.getFull(), tmp.getStatus(), tmp.getDue_date());\n\t\tcardsChart.add(card);\n\t\tcard = init_fulfilled_card();\n\t\tcardsChart.add(card);\n\t\tcard = init_proof_card();\n\t\tcardsChart.add(card);\n\t\tcard = init_chart_detail_card();\n\t\tcardsChart.add(card);\n\t\t\n\t\t/*for (int i = 0; i < 5; i++) {\n\t\t\tcard = init_chart_card();\n\t\t\tcardsChart.add(card);\n\t\t}*/\n\t\tCardArrayAdapter mCardArrayAdapterGrades = new CardArrayAdapter(getActivity(), cardsChart);\n\n\t\tCardListView listView = (CardListView) getActivity().findViewById(R.id.card_list);\n\t\tif (listView != null) {\n\t\t\tlistView.setAdapter(mCardArrayAdapterGrades);\n\t\t}\n\t}", "void updateCards(List<CardEntity> data);", "public void yelowCardA(View v) {\n yelowCardsA = yelowCardsA + 1;\n displayYelowCardA(yelowCardsA);\n }", "public void incrementCount(View view) {\n\t\tcounterModel.incrementCounter();\n\t\tcurrentCountTextView.setText(Integer.toString(counterModel.getCount()));\n\t}", "public ViewCard(@NotNull Card modelCard)\n {\n super(CARD_WIDTH, CARD_HEIGHT, CARD_DEPTH, \"file:./res/\" + getFileName(modelCard),\n CARD_FACE_TEXTURE_WIDTH, CARD_FACE_TEXTURE_HEIGHT);\n this.modelCard = modelCard;\n }", "private void display()\r\n\t{\r\n\t\tif(cardSet.getCards().size() == 0)\r\n\t\t{\r\n\t\t\tString text = \"\";\r\n\t\t\ttextBox.setText(text);\r\n\t\t\tcardCounterTxt.setText(\"0 / 0\");\r\n\t\t\tMainRunner.getCardManager().setCurrentCard(null);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tCard card = cardSet.getCards().get(currentCardIdx);\r\n\t\t//set the current card in card manager.\r\n\t\tMainRunner.getCardManager().setCurrentCard(card);\r\n\t\tString text = \"\";\r\n\t\tif(front)\r\n\t\t{\r\n\t\t\ttext = card.getFront();\r\n\t\t\ttextBoxContainer.setStyle(\"-fx-border-color: blue\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tList<String> expl = card.getBack();\r\n\t\t\tfor(int i = 0; i < expl.size(); i++)\r\n\t\t\t{\r\n\t\t\t\tif(i + 1 == expl.size())\r\n\t\t\t\t\ttext += expl.get(i);\r\n\t\t\t\telse\r\n\t\t\t\t\ttext += expl.get(i) + \"\\n\";\r\n\t\t\t}\r\n\t\t\ttextBoxContainer.setStyle(\"-fx-border-color: green\");\r\n\t\t}\r\n\t\ttextBox.setText(text);\r\n\t\t\r\n\t\tcardCounterTxt.setText(currentCardIdx + 1 + \" / \" + cardSet.getCards().size());\r\n\t}", "public int size() {\r\n\t\treturn cards.size();\r\n\t}", "private void updatePage(List<HashMap<String, Object>> cheeseCounts)\n\t{\n populateUserView();\n\t\trefreshFriendsListview(cheeseCounts, true, null);\n\t\tpopulateHistoryListView();\n\t}", "public void increment(View view) {\n if(quantity==100) {\n // Show an error message as a toast\n Toast.makeText(this, \"You cannot have more than a 100 coffees\", Toast.LENGTH_SHORT).show();\n //Exit this method early because there is nothing left to do\n return;\n }\n quantity=quantity+1;\n displayQuantity(quantity);\n\n }", "public void updateCard(Card card) {\n this.card.setValue(card);\n }", "public void updateListView(ArrayList<itemInfo> playerCards){\n final ListView itemListView = findViewById(R.id.itemListView);\n\n // Standard list view adapter\n /*\n final listViewAdapter listAdapter = new listViewAdapter(this,R.layout.itemlistlayout);\n itemListView.setAdapter(listAdapter);\n */\n\n //Array list adapter\n cardArrayAdapter myArrayAdapter = new cardArrayAdapter(this,playerCards);\n itemListView.setAdapter(myArrayAdapter);\n\n //Refresh the adapter data from the arraylist\n myArrayAdapter.notifyDataSetChanged();\n\n //playerCard = playerCards.get(cardCounter);\n\n //listAdapter.add(playerCard);\n\n listCount = itemListView.getAdapter().getCount();\n\n //cardCounter = cardCounter + 1;\n\n }", "private void updateTotal() {\r\n\t\t// We get the size of the model containing all the modules in the list.\r\n\t\tlabelTotal.setText(\"Total Modules: \" + String.valueOf(helperInstMod.model.size()));\r\n\t}", "protected void refreshCaptured(){\n\t\twhiteCount.setText(String.valueOf(game.getCapturedStones(Game.WHITE)));\n\t\tblackCount.setText(String.valueOf(game.getCapturedStones(Game.BLACK)));\t\t\n\t}", "public void redCardB(View v) {\n redCardsB = redCardsB + 1;\n displayRedCardB(redCardsB);\n }", "private void updateReceivedView() {\n mReceivedCoins = Data.getReceivedCoins();\n mRecyclerViewCol.setVisibility(View.INVISIBLE);\n mRecyclerViewRec.setVisibility(View.VISIBLE);\n mReceivedAdapter.notifyDataSetChanged();\n }", "@Override\r\n\tpublic void increaseViewcnt(int r_idx) {\n\r\n\t}", "public void current_num() {\n\t\tcourse_current_num=Integer.toString(list.size());\n\t\t}", "public int getCardsToDraw() {\r\n return cardsToDraw;\r\n }", "public void setCurrentCards(ArrayList<Card> cardsFromDealer) {\r\n this.currentCards = cardsFromDealer;\r\n }", "void updateView();", "void updateView();", "public void Next(View view)\n {\n increaseNum();\n }", "public void increase()\n {\n setCount(getCount() + 1);\n }", "public void changeCards(ArrayList<Card> topThreeCards)\n\t{\n\t\tcards = topThreeCards;\n\t\trepaint();\n\t}", "void displayCards(List<Card> cards, String title);", "private void updatePriceView() {\n int subTotal = 0;\n int cartQuantity = 0;\n int calculatedDiscount = 0;\n\n DecimalFormat decimalFormatter = new DecimalFormat(\"₹#,##,###.##\");\n\n for (CartItem cartItem : cartList) {\n cartQuantity += cartItem.getQuantity();\n subTotal += cartItem.getQuantity() * cartItem.getPrice();\n }\n\n switch (discountType) {\n case AMOUNT:\n calculatedDiscount = discount;\n break;\n case PERCENTAGE:\n calculatedDiscount = (subTotal * discount) / 100;\n break;\n }\n\n subTotalView.setText(decimalFormatter.format(subTotal));\n\n String count = \"(\" + cartQuantity;\n\n if (cartQuantity < 2) {\n count += \" Item)\";\n } else {\n count += \" Items)\";\n }\n\n textNumberItems.setText(count);\n discountView.setText(decimalFormatter.format(calculatedDiscount));\n total = subTotal - calculatedDiscount;\n totalView.setText(decimalFormatter.format(total));\n updateCartNotification(cartQuantity);\n }", "public void display(){\r\n for(Card c: cards){\r\n System.out.println(c);\r\n }\r\n }", "private void editUserCard() {\n getUserCard();\n }", "public void redCardA(View v) {\n redCardsA = redCardsA + 1;\n displayRedCardA(redCardsA);\n }", "public void update()\n {\n scorecard.update();\n scorer.update();\n }", "public void nextStepInGame(View view){\n // called by click on either card, so need to track state\n Log.d(getClass().toString(),\"playstate before = \" + playstate.toString());\n\n playstate = playstate.getNext();\n Log.d(getClass().toString(),\"playstate after update = \" + playstate.toString());\n ImageButton computerCard = (ImageButton) findViewById(R.id.computerCard);\n ImageButton youCard = (ImageButton) findViewById(R.id.youCard);\n TextView infoPanel = (TextView) findViewById(R.id.info_panel);\n switch (playstate){\n case NOCARDS: {\n // show empty buttons as no cards on table\n computerCard.setImageResource(R.color.holo_green_dark);\n computerCard.setVisibility(View.VISIBLE);\n youCard.setImageResource(R.color.holo_blue_dark);\n youCard.setVisibility(View.VISIBLE);\n infoPanel.setText(\"Click to deal cards to both players\");\n\n break;\n }\n case DEALCARDS: {\n // show backs of cards ready to play them\n computerCard.setImageResource(R.drawable.card_back);\n computerCard.setVisibility(View.VISIBLE);\n youCard.setImageResource(R.drawable.card_back);\n youCard.setVisibility(View.VISIBLE);\n infoPanel.setText(\"Click to reveal cards\");\n break;\n }\n case SHOWCARDS: {\n // playARound, but only show card faces\n game.playARound();\n String cardToShow = this.game.getTurnlog().lastEntryFor(game.getPlayers()[1]).getHand().topShownCard().toDrawableName();\n computerCard.setImageResource(getResources().getIdentifier(cardToShow, \"drawable\", \"com.codeclan.cardgame\"));\n cardToShow = this.game.getTurnlog().lastEntryFor(game.getPlayers()[0]).getHand().topShownCard().toDrawableName();\n youCard.setImageResource(getResources().getIdentifier(cardToShow, \"drawable\", \"com.codeclan.cardgame\"));\n\n infoPanel.setText(getString(R.string.computer_label) + \" has \" +\n game.getPlayers()[1].getScore().toString() + \" points,\\n\" +\n getString(R.string.player_label) + \" has \" +\n game.getPlayers()[0].getScore().toString() + \" points.\\n Click for clear table\") ;\n\n break;\n }\n\n }\n if( game.isOver() ){\n//\n// break out of onClick loop by going to new activity to display results\n//\n Intent resultsIntent = new Intent(this, G2P1CHWResultsActivity.class);\n resultsIntent.putExtra(\"player1score\", game.getPlayers()[0].getScore());\n resultsIntent.putExtra(\"dealerscore\", game.getPlayers()[1].getScore());\n resultsIntent.putExtra(\"winner\", game.winner().getName());\n\n startActivity(resultsIntent);\n }\n\n }", "public void setValueOfCard(int valueOfCard) {\n this.valueOfCard = valueOfCard;\n }", "public void updateProductViewCount(Product product) {\n\r\n\t}", "@Override\n protected void initialCardGeneration() {\n Intent intent = getIntent();\n if(intent != null)\n {\n if(intent.getBooleanExtra(\"cardPoolIntent\", false))\n {\n // Store card pools loaded in from elsewhere.\n Bundle bundle = intent.getExtras();\n openedCardPool = bundle.getParcelableArrayList(\"openedCardPool\");\n selectedCardPool = bundle.getParcelableArrayList(\"selectedCardPool\");\n\n // Gets the deck ID and stores it in case this was passed from MyDeckActivity.\n deckId = bundle.getInt(\"deckId\");\n\n // Update card counter button according to passed in selected card pool (deck).\n btnCardsInDeck.setText(selectedCardPool.size() + SEALED_DECK_NUM);\n }\n else\n {\n // Generate new cards according to Sealed rules, using the database. (6 boosters.)\n generateNewCards();\n }\n }\n else\n {\n // Generate new cards according to Sealed rules, using the database. (6 boosters.)\n generateNewCards();\n }\n }", "public void yelowCardB(View v) {\n yelowCardsB = yelowCardsB + 1;\n displayYelowCardB(yelowCardsB);\n }", "public void updateViewCnt(Integer imgnum) throws Exception;", "public int getTotalCards() {\n\t\treturn cards.size();\n\t}", "@Override\n public int getItemCount() {\n return destinationCards.size();\n }", "public int getNumberOfSimilarCards(ArrayList<CardModel> playerCardsList) {\n System.out.println(\"Similar card method\") ;\n int numberOfUnits = 0;\n int infantryCardNumber = 0;\n int artilaryCardNumber = 0;\n int cavalaryCardNumber = 0;\n ArrayList<CardModel> cards = playerCardsList;\n\n infantryCardNumber = getNumberCardTypeByCardType(cards, EnumHandler.CardType.INFANTRY);\n artilaryCardNumber = getNumberCardTypeByCardType(cards, EnumHandler.CardType.ARTILLERY);\n cavalaryCardNumber = getNumberCardTypeByCardType(cards, EnumHandler.CardType.CAVALRY);\n\n numberOfUnits += infantryCardNumber / 3;\n numberOfUnits += artilaryCardNumber / 3;\n numberOfUnits += cavalaryCardNumber / 3;\n\n if (infantryCardNumber / 3 > 0 && isUpdatePlayerDeck()) {\n setPlayerDeckByCardType(cards, EnumHandler.CardType.INFANTRY);\n }\n if (artilaryCardNumber / 3 > 0 && isUpdatePlayerDeck()) {\n setPlayerDeckByCardType(cards, EnumHandler.CardType.ARTILLERY);\n }\n if (cavalaryCardNumber / 3 > 0 && isUpdatePlayerDeck()) {\n setPlayerDeckByCardType(cards, EnumHandler.CardType.CAVALRY);\n }\n\n return numberOfUnits;\n }", "@Override\n public void onBindViewHolder(final MascotaViewHolder mascotaViewHolder, int position) {\n final Mascota mascota = mascotas.get(position);\n\n mascotaViewHolder.imgMascota.setImageResource(mascota.getFoto());\n mascotaViewHolder.tv_nombre.setText(mascota.getNombre());\n mascotaViewHolder.tv_count.setText(String.valueOf(mascota.getCount()));\n mascotaViewHolder.btn_BoneLike.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n\n Toast.makeText(activity, \"Diste BoneLike a \" + mascota.getNombre(), Toast.LENGTH_SHORT).show();\n int count=mascota.getCount();\n count = count +1;\n mascota.setCount(count);\n //Volvemos a cargar los count\n mascotaViewHolder.tv_count.setText(String.valueOf(mascota.getCount()));\n }\n\n });\n\n }", "private void updateItemDisplay(){\n String[] columnNames = new String[model.getColumns()];\n for(int i = 0; i<columnNames.length; i++){\n columnNames[i] = String.valueOf(i);\n }\n view.updateItemsDisplay(model.itemMapTo2DArray(model.getVendMacItemMap()), columnNames);\n }" ]
[ "0.6746697", "0.63058406", "0.62678784", "0.6152301", "0.6138497", "0.60463786", "0.60463786", "0.60244626", "0.6003096", "0.60002834", "0.599487", "0.59516865", "0.58838177", "0.58618385", "0.5849901", "0.5842742", "0.5842649", "0.58293605", "0.58293533", "0.58054596", "0.5788946", "0.5776519", "0.57747614", "0.57690775", "0.5768019", "0.5759916", "0.57548743", "0.57466406", "0.5745242", "0.57403946", "0.5738439", "0.5691257", "0.56647253", "0.564762", "0.56449234", "0.5632605", "0.5629423", "0.5611953", "0.56069434", "0.56045485", "0.5601248", "0.5597889", "0.55912864", "0.5589841", "0.5587743", "0.55874187", "0.55787545", "0.55640084", "0.55445254", "0.5527371", "0.5509066", "0.54817724", "0.5468828", "0.54675555", "0.54662794", "0.54622114", "0.5454157", "0.5439687", "0.5434461", "0.54273576", "0.54234344", "0.54227525", "0.5420669", "0.5416828", "0.54089326", "0.5407113", "0.5404324", "0.53995717", "0.5395929", "0.53880286", "0.5376428", "0.5376127", "0.5366041", "0.53374404", "0.5322884", "0.5320945", "0.5319931", "0.5319676", "0.53186786", "0.53186786", "0.5317864", "0.53147906", "0.5312049", "0.53109217", "0.5310507", "0.53007007", "0.5298288", "0.5295909", "0.5285478", "0.5275955", "0.5273444", "0.52677697", "0.5263456", "0.52627605", "0.5253098", "0.52443093", "0.5243239", "0.5239139", "0.52390146", "0.5237684" ]
0.52372056
100
/ This verifies that the player who pressed a snap key is not already out of the game.
private boolean playerHasPressed(PlayerView p) { return (!game.getPlayer(p.getId() - 1).getHasLost() && keyListeners.get(p.getKeyCode())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void checkSnap() {\n\t\tif (turned && view.getInstructions().getHidden())\n\t\t\tfor (PlayerView p: view.getPlayerViewList())\n\t\t\t\tif (playerHasPressed(p)) {\n\t\t\t\t\t// If last card is null, the turned card is the first card in the pile and can't be snap.\n\t\t\t\t\tif(game.getLastCard() != null)\n\t\t\t\t\t\tview.showLastCard(game.getLastCard().getValue());\n\t\t\t\t\tview.showSnapResult(p.getId(), game.snap(game.getPlayer(p.getId()-1)));\n\t\t\t\t\tdisplayPlayers();\n\t\t\t\t\tturned = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t}", "private void checkKeys() \n {\n ignite(Greenfoot.isKeyDown(\"up\"));\n\n if(Greenfoot.isKeyDown(\"left\")) {\n setRotation(getRotation() - 5);\n } \n if(Greenfoot.isKeyDown(\"right\")) {\n setRotation(getRotation() + 5);\n }\n if(Greenfoot.isKeyDown(\"space\")) {\n fire(\"GreenLaser\", getGunReloadTime());\n \n } \n }", "boolean isGameSpedUp();", "protected boolean checkWin(int pno) {\n\t\tint[] pos = playerPosition.get(pno);\n\t\tif (collectedGold.get(pno) >= map.getWin() && \n\t\t\t\tmap.lookAtTile(pos[0], pos[1]) == 'E') {\n\t\t\tremovePlayer(pno);\n\t\t\tSystem.out.println(\"Client \" + pno + \" has escaped!\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean isValidMove(int pressedHole) {\n return getPlayerHole(pressedHole).getKorgools() != 0;\n }", "private boolean hasEatenPowerUp() {\r\n if (snake[HEAD].row == powerUp.row && \r\n snake[HEAD].column == powerUp.column) { \r\n growSnake();\r\n newPowerUp();\r\n MainClass.totalPoints++;\r\n return true;\r\n }\r\n return false;\r\n }", "public boolean CheckWin(){\n\t return false;\n\t }", "private void checkGameInput(float dt) {\n\t\tif (!(talkmode || showSignDialog)) {\n\t\t\tif (player.moving) {\n\t\t\t\tboolean shouldStop = true;\n\t\t\t\tfor (int i = UP; i <= LEFT; i++) {\n\t\t\t\t\tif (!gameActions[i].isReleased()) {\n\t\t\t\t\t\tshouldStop = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (shouldStop) {\n\t\t\t\t\tplayer.stop();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint dir = -1;\n\t\t\tint count = gameActions[LEFT].isPressed() ? 1 : 0;\n\t\t\tboolean found = false;\n\t\t\tfor (int i = UP; i <= LEFT; i++) {\n\t\t\t\tif (gameActions[i].isPressed()) {\n\t\t\t\t\tcount++;\n\t\t\t\t} else {\n\t\t\t\t\tif (count == 2) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcount = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!found) {\n\t\t\t\tfound = count == 2;\n\t\t\t}\n\t\t\tfor (int i = UP; i <= LEFT; i++) {\n\t\t\t\tif (gameActions[i].isPressed()) {\n\t\t\t\t\tmove(dt, dir = (i - UP), found);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (dir != -1) {\n\t\t\t\tplayer.setPartyMembersPositions();\n\t\t\t\t// showSignDialog = false;\n\t\t\t\t// doorSign = null;\n\t\t\t} else {\n\t\t\t\tbackground.stop();\n\t\t\t}\n\n\t\t\tif (isMenuButtonPressed(gameActions)) {\n\t\t\t\tsuper.queueEnterMenu();\n\t\t\t}\n\t\t} else if (question) {\n\t\t\tcheckDirectionalButtonsForQuestion();\n\t\t}\n\t\tif (gameActions[CROSS].isPressed()) {\n\t\t\tif (showSignDialog) {\n\t\t\t\tshowSignDialog = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcrossPressed();\n\t\t}\n\t}", "public boolean playerLoses(){\n return (curPlayerRow == curTrollRow && curPlayerCol == curTrollCol);\n }", "private boolean checkGameState() {\n\t\tint numberOfPlayers = this.manSys.lockedNavmap.size();\n\t\tfor (int i = 0; i < numberOfPlayers; i++) {\n\t\t\tif (!snakesList.get(i).isDestroyed()) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public void hasKey() {\n\t\tif (checkKey(Integer.parseInt(getCurrentPositionX()),Integer.parseInt(getCurrentPositionY()))) {\n\t\t\tDisplay.setKey(\"Yes\");\n\t\t\tDisplay.setMessage(\"You have found a key! Try to go through a house!\");\n\t\t}\n\t}", "public void checkGameOver() {\n if(snake.getX() < 0 || snake.getX() > WIDTH - 4) { setGameState(GameState.GAME_OVER); }\n if(snake.getY() < 0 || snake.getY() > HEIGHT - 4) { setGameState(GameState.GAME_OVER); }\n if(snake.hasCollided()) { setGameState(GameState.GAME_OVER); }\n\n }", "private boolean hasHitBoundry() {\r\n if (snake[HEAD].row < 0 || \r\n snake[HEAD].row >= maxRows ||\r\n snake[HEAD].column < 0 ||\r\n snake[HEAD].column >= maxColumns) {\r\n gameOver();\r\n return true;\r\n }\r\n return false;\r\n }", "public static void checkWinner() {\n\t\tcontinueGame = false;\n\t\tfor (int k = 0; k < secretWordLength; k++) {\n\t\t\tif (!unseenBoard.get(k).equals(\"*\")) {\n\t\t\t\tcontinueGame = true;\n\t\t\t}\n\t\t}\n\t}", "private void checkVictory() {\n\t\tboolean currentWin = true;\n\t\t\n\t\t//Vertical win\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][yGuess] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Horizontal win\n\t\tcurrentWin = true;\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[xGuess][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Top left bottom right diagonal win\n\t\tcurrentWin = true;\n\t\tif (xGuess == yGuess){\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t}\n\t\t\n\t\t//Bottom left top right diagonal win\n\t\tcurrentWin = true;\n\t\tif (yGuess + xGuess == DIVISIONS - 1){\n\t\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\t\tif (gameArray[i][(DIVISIONS - 1) -i] != currentPlayer){\n\t\t\t\t\tcurrentWin = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (currentWin){\n\t\t\t\tgameWon = true;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "private void checkCollision() {\n for (int i = snakeSize; i > 0; i--) {\n if (i>4 && x[0] == x[i] && y[0] == y[i]){\n isInGame=false;\n }\n }\n\n if (x[0] > FIELD_SIZE) {\n isInGame=false;\n }\n\n if (x[0] < 0) {\n isInGame=false;\n }\n\n if (y[0] > FIELD_SIZE) {\n isInGame=false;\n }\n\n if (y[0] < 0) {\n isInGame=false;\n }\n\n\n }", "private void CheckWin() throws VictoryException {\n if (!isMiddleSquareEmpty()) {\n checkDiagonalTopRightToBottomLeft();\n checkDiagonalTopLeftToBottomRight();\n }\n\n checkHorozontalWin();\n checkVercticalWin();\n\n if (didAnyoneWin) {resetBoard(myGame);\n throw (new VictoryException());\n }\n }", "private boolean isGameOver() {\n return Snake().isTouching(Wall()) || Snake().isTouching(Snake());\n }", "public boolean checkShot(int row, int col) {\n /* invalid board position */\n if(row < 1 || col < 1 || row > (this.boardHeight-1) || col > (this.boardWidth-1))\n return false;\n \n /* We have a hit! */\n if(this.board[row][col] == 'S') {\n this.board[row][col] = 'X';\n \n /* check if this was the last part of a ship, if so decrement the\n * number of ships left */\n if(this.board[row+1][col] != 'S' && this.board[row][col+1] != 'S' &&\n this.board[row-1][col] != 'S' && this.board[row][col-1] != 'S') {\n numShips--;\n }\n \n return true;\n }\n /* Did they really shoot at the same spot again? */\n else if(this.board[row][col] == 'X' || this.board[row][col] == 'O') {\n /* do nothing, penalize them for their foolish double shot! */\n return false;\n }\n /* The must have missed then */\n else {\n this.board[row][col] = 'O';\n return false;\n }\n }", "public boolean isGameOver(){\n return checkKingReachedEnd() || checkNoDragonsLeft() || checkIfKingSurrounded();\n }", "public boolean verifyEndGame(Player gamer);", "@Test\n void invalidLOST() {\n die();\n getGame().move(getPlayer(), Direction.EAST);\n getGame().stop();\n getGame().start();\n assertThat(getGame().isInProgress()).isFalse();\n verifyNoMoreInteractions(observer);\n }", "private void checkPlayerCollisions() {\r\n\t\tGObject left = getElementAt(player.getX() - 1, player.getY() + player.getHeight() / 2.0);\r\n\t\tGObject right = getElementAt(player.getX() + player.getWidth() + 1, player.getY() + player.getHeight() / 2.0);\r\n\t\tif(dragon1 != null && (left == dragon1 || right == dragon1)) {\r\n\t\t\tremove(lifeBar);\r\n\t\t\tlifeBar = null;\r\n\t\t}\r\n\t\tif(dragon2 != null && (left == dragon2 || right == dragon2)) {\r\n\t\t\tremove(lifeBar);\r\n\t\t\tlifeBar = null;\r\n\t\t}\r\n\t}", "private void checkWin() {\n // Check if a dialog is already displayed\n if (!this.gameOverDisplayed) {\n // Check left paddle\n if (Objects.equals(this.scoreL.currentScore, this.winCount) && (this.scoreL.currentScore != 0)) {\n if (twoUser) {\n gameOver(GeneralFunctions.TWO_1_WIN);\n } else {\n gameOver(GeneralFunctions.ONE_LOSE);\n }\n // Right paddle\n } else if (Objects.equals(this.scoreR.currentScore, this.winCount) && (this.scoreR.currentScore != 0)) {\n if (twoUser) {\n gameOver(GeneralFunctions.TWO_2_WIN);\n } else {\n gameOver(GeneralFunctions.ONE_WIN);\n }\n }\n }\n }", "protected boolean isStayingOnGroundSurface() {\n/* 342 */ return isShiftKeyDown();\n/* */ }", "public boolean playerShootCheck(int x, int y){\n\t\tif( opponentShips[x][y] != null ){\n\t\t\t\n\t\t\tif(opponentShips[x][y].isDestroyed()){\n\t\t\t\tint shipSize = opponentShips[x][y].getshipSize();\n\t\t\t\topponentShips[x][y] = null;\n\t\t\t\tthis.dmgLastRound = shipSize;\t\t\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\topponentShips[x][y] = null;\n\t\t\tthis.dmgLastRound = 0;\n\t\t\treturn true;\n\t\t}\n\t\telse this.dmgLastRound = -1;\n\t\treturn false;\n\t}", "private void checkForCollisionWithSelf() {\r\n if (isInSnake(snake[0].row,snake[0].column,true)) {\r\n gameOver();\r\n }\r\n }", "@Override\r\n\tboolean isFinished() {\r\n\t\t// TODO Auto-generated method stub\r\n\t\tif(checkForWin() != -1)\r\n\t\t\treturn true;\r\n\t\telse if(!(hasValidMove(0) || hasValidMove(1)))\r\n\t\t\treturn true; //game draw both are stuck\r\n\t\telse return false;\r\n\t}", "protected boolean isGameOver(){\n return (getShipsSunk()==10);\n }", "private void checkGame() {\n if (game.checkWin()) {\n rollButton.setDisable(true);\n undoButton.setDisable(true);\n this.dialogFlag = true;\n if (game.isDraw()) {\n showDrawDialog();\n return;\n }\n if (game.getWinner().getName().equals(\"Computer\")) {\n showLoserDialog();\n return;\n }\n showWinnerDialog(player1);\n }\n }", "public void keyCheck() {\n if (right) {\n ship.rotateRight();\n }\n if (left) {\n ship.rotateLeft();\n }\n if (up) {\n ship.accelerate();\n }\n if (down) {\n ship.decelerate();\n }\n if (spacebar) {\n if (one){\n fireMiniGun();\n }\n if (two){\n fireEnergyBlaster();\n }\n if (three) {\n fireGrenadeLauncher();\n }\n }\n }", "private boolean didPlayerWin() {\r\n for (int i = 0; i < targets.length; i++) {\r\n if (targets[i].getHitPoints() != 0) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }", "private void checkPlayerDeath(Invader invader) {\n\t\tif (invader.detectDownwardCollision(player.getX(), player.getY())) {\n\t\t\trunning = false;\n\t\t}\n\t}", "public boolean checkGameOver(){\n\t\tfor(int x = 0; x < this.tile[3].length; x++){\n\t\t if(this.isFilled(3, x)){\n\t\t \tSystem.out.println(\"game over\");\n\t\t return true;\n\t\t }\n\t\t}\n\t\treturn false;\n\t}", "public void checkGame() {\n\n\t}", "protected boolean checkForWin() {\r\n \t\r\n if (squaresRevealed == this.width * this.height - this.mines) {\r\n finishFlags();\r\n finish(GameStateModel.WON);\r\n return true;\r\n } \t\r\n \t\r\n return false;\r\n \t\r\n }", "private boolean checkCollisions(int keycode) {\n \t\t\n \t\tint sX = super.getX()/Main.gridSize;\n \t\tint sY = super.getY()/Main.gridSize;\n \t\t\n \t\tif (World.currentMap().solidAtPoint(sX-1, sY) && keycode == Keyboard.KEY_A) {\n \t\t\treturn false;\n \t\t} else if (World.currentMap().solidAtPoint(sX+1, sY) && keycode == Keyboard.KEY_D) {\n \t\t\treturn false;\n \t\t} else if (World.currentMap().solidAtPoint(sX, sY-1) && keycode == Keyboard.KEY_W) {\n \t\t\treturn false;\n \t\t} else if (World.currentMap().solidAtPoint(sX, sY+1) && keycode == Keyboard.KEY_S) {\n \t\t\treturn false;\n \t\t}\n \t\treturn true;\n \t}", "private void checkDeath() {\n\t\tif (player.getLives() == 0) {\n shooty.setIv(new Image(\"/img/shipdeath.png\"));\n\t\t\tdie();\n\t\t}\n\t\t// another way to die: the blocks hit you\n\t\tif(btnList.get(0).getLayoutY() >= FATAL_BUTTON_DIST) {\n\t\t\tendGame.play();\n\t\t\tdie();\n\t\t}\n\t}", "public boolean isWin_CommanderVimes(){\r\n // player got LordSelachii card\r\n Player playerHoldCard = null;\r\n for (Player player : discWorld.getPlayer_HASH().values()) {\r\n if (player.getPersonalityCardID() == 7) {\r\n playerHoldCard = player;\r\n break;\r\n }\r\n }\r\n \r\n if(playerHoldCard != null){\r\n if(discWorld.getShuffled_PlayerCard().size() == 0){\r\n return true;\r\n }\r\n } \r\n \r\n return false;\r\n }", "private void checkKey(){\n if(Greenfoot.isKeyDown(\"z\") && getJumping() == false){\n jump();\n }\n if(getCanMove()){\n if(Greenfoot.isKeyDown(\"right\")){\n moveRight();\n facingRight = true;\n }\n if(Greenfoot.isKeyDown(\"left\")){\n moveLeft();\n facingRight = false;\n }\n }\n if(Greenfoot.isKeyDown(\"x\") && getThrowing() == false){\n throwKnife(facingRight);\n changeThrowing(true);\n }\n }", "@Override\n public boolean checkWin(Box initialPos, Box finalBox) {\n return super.checkWin(initialPos, finalBox);\n }", "public boolean checkGameOver() {\n return ((posIniPiece[piece.getKind()] == piece.getPos(0)) && iteration > 0);\n }", "public void checkWin() {\n if (rockList.isEmpty() && trackerRockList.isEmpty() && bigRockList.isEmpty() && bossRockList.isEmpty()) {\n if (ship.lives < 5) {\n ship.lives++;\n }\n Level++;\n LevelIntermission = true;\n LevelIntermissionCount = 0;\n }\n }", "boolean hasWin();", "public static boolean isScratch(long snap) {\n\t\treturn snap < 0;\n\t}", "public void checkEndGame() {\n\t\tint total = 0;\n\t\tint total2 = 0;\n\t\tfor (int i = 0; i < 6; i++) {\n\t\t\ttotal += board[i];\n\t\t}\n\t\tfor (int i = 7; i < 13; i++) {\n\t\t\ttotal2 += board[i];\n\t\t}\n\n\t\tif (total == 0 || total2 == 0) {\n\t\t\tgameOver = true;\n\t\t}\n\t}", "public boolean isWin_DragonKingOfArms(){\r\n // player got LordSelachii card\r\n /*Player playerHoldCard = null;\r\n for (Player player : discWorld.getPlayer_HASH().values()) {\r\n if (player.getPersonalityCardID() == 5) {\r\n playerHoldCard = player;\r\n break;\r\n }\r\n }*/\r\n int count = 0;\r\n for(TroubleMarker troubleMarker : discWorld.getTroubleMarker_HASH().values()){\r\n if(troubleMarker.getAreaNumber() != ConstantField.DEFAULT_PIECE_AREA_NUMBER){\r\n count++;\r\n }\r\n }\r\n \r\n if(count >= 8){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n \r\n }", "boolean checkWin(Tile initialTile);", "private void chkKeyPressed(KeyEvent e) {\r\n if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {\r\n cerrarVentana(false);\r\n } else if (UtilityPtoVenta.verificaVK_F11(e)) {\r\n aceptaCantidadIngresada(\"VK_F11\");\r\n //DVELIZ\r\n //cerrarVentana(true);\r\n \r\n \r\n } else if (UtilityPtoVenta.verificaVK_F12(e)) {\r\n if (vIndTieneSug) {\r\n aceptaCantidadIngresada(\"VK_F12\");\r\n //DVELIZ\r\n //cerrarVentana(true);\r\n }\r\n }\r\n }", "private void checkEndGame() {\n if (field.getStackSize() == (field.getPegCount() - 1)) {\n endGame = true;\n }\n }", "private void checkMouseClick()\n {\n MouseInfo userClick = Greenfoot.getMouseInfo();\n \n int columnNum;\n int rowNum;\n \n if( Greenfoot.mouseClicked(this) )\n {\n columnNum = userClick.getX() / ( getWidth() / 3 );\n rowNum = userClick.getY() / ( getHeight() / 3 );\n \n if( board[rowNum][columnNum] == \"\" )\n {\n if( PlayerOneTurn == true )\n {\n board[rowNum][columnNum] = \"X\";\n \n PlayerOneTurn = false;\n messageShown = false;\n }\n else\n {\n board[rowNum][columnNum] = \"O\";\n \n PlayerOneTurn = true;\n messageShown = false;\n }\n }\n else\n {\n JOptionPane.showMessageDialog( null, \"you should select a different spot.\", \"Wrong step\", JOptionPane.PLAIN_MESSAGE );\n }\n }\n \n }", "void check_game_state() {\n // Game over\n if (lives <= 0){ // No lives left\n end_game();\n }\n for (Alien alien : aliens){ // Aliens reached bottom of screen\n if (alien.y_position + alien.alien_height >= ship.y_position) {\n end_game();\n break;\n }\n }\n\n // Empty board\n if (aliens.isEmpty()) { // All aliens defeated\n if (level < 3) { // Level up\n level_up();\n alien_setup();\n }\n else { // Victory\n end_game();\n }\n }\n }", "public void checkDeath()\n {\n if (player.getY() >= 549)\n {\n gameOver();\n }\n }", "@Override\n\tpublic boolean isGameTied() {\t\n\t\treturn false;\n\t}", "private boolean checkGameOver() {\n\t\tboolean singlePlayerWon = otherPlayer.getLife() == 0;\n\t\tboolean otherPlayerWon = singlePlayer.getLife() == 0;\n\n\t\tif (singlePlayerWon || otherPlayerWon) {\n\t\t\tthis.singlePlayer.createEndButton(singlePlayerWon);\n\t\t\tthis.singlePlayer.onGameOver();\n\t\t\tthis.otherPlayer.onGameOver();\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "@Override\n public boolean isGameOver() {\n //TODO Implement this method\n return false;\n }", "public boolean wonGame() {\n for (int x = 0; x < maxX; x++) {\n for (int y = 0; y < maxY; y++) {\n if (snakeSquares[x][y] == NOT_A_SEGMENT) {\n //there is still empty space on the screen, so haven't won\n return false;\n }\n }\n }\n //But if we get here, the snake has filled the screen. win!\n SnakeGame.setGameStage(SnakeGame.GAME_WON);\n\n return true;\n }", "private void checkPreviousSquare(){\n\t\t\n\t\tif(!frontIsClear()){\n\t\t\tfaceBackwards();\n\t\t\tmove();\n\t\t\tif(!beepersPresent()){\n\t\t\t\tfaceBackwards();\n\t\t\t\tmove();\n\t\t\t\tputBeeper();\n\t\t\t} else {\n\t\t\t\tfaceBackwards();\n\t\t\t\tmove();\n\t\t\t}\n\t\t}\n\t}", "private void whichPlayerHasTurn() throws PlayerOutOfTurn {\n if (test.equals(lastPicked)) {\n throw (new PlayerOutOfTurn());\n }\n }", "Boolean checkEndGame() {\n for (WarPlayer player : players) {\n if (player.getHand().size() == 0)\n return true;\n }\n return false;\n }", "private void checkGameOver() {\n boolean isGameOver = true;\n for(int i = 0; i< noOfColumns; i++)\n for(int j = 0; i< noOfRows; i++)\n if(cards[i][j].getCardState() != CardState.MATCHED){\n isGameOver = false;\n break;\n }\n if(isGameOver){\n endGame();\n }\n }", "private boolean checkVictory(){\r\n boolean wins = true;\r\n for (int i = 0; i < hidden.length; i++){\r\n if (hidden[i] == '_'){\r\n wins = false;\r\n }\r\n }\r\n return wins;\r\n }", "private boolean validMove(GameWorld world, Character nextKey) {\n if (nextKey.equals('Q') || nextKey.equals('q') || nextKey.equals(':')) {\n return true;\n } else if (nextKey.equals('W') || nextKey.equals('w')) {\n if (world.world[world.avatarPosition.x]\n [world.avatarPosition.y + 1].equals(Tileset.WALL)) {\n return false;\n }\n } else if (nextKey.equals('S') || nextKey.equals('s')) {\n if (world.world[world.avatarPosition.x]\n [world.avatarPosition.y - 1].equals(Tileset.WALL)) {\n return false;\n }\n } else if (nextKey.equals('D') || nextKey.equals('d')) {\n if (world.world[world.avatarPosition.x + 1]\n [world.avatarPosition.y].equals(Tileset.WALL)) {\n return false;\n }\n } else if (nextKey.equals('A') || nextKey.equals('a')) {\n if (world.world[world.avatarPosition.x - 1]\n [world.avatarPosition.y].equals(Tileset.WALL)) {\n return false;\n }\n } else {\n return true;\n }\n return true;\n }", "public void checkGame(){\r\n\t\tif (foodCounter == 0){ // all food is gone, win\r\n\t\t\tSystem.out.println(\"You won!\");\r\n\t\t\t//stops ghosts and pacman\r\n\t\t\tpacman.speed = 0;\r\n\t\t\tg1.speed = 0;\r\n\t\t\tg2.speed = 0;\r\n\t\t\tg3.speed = 0;\r\n\t\t\tlost = true; // return to menu \r\n\t\t}\r\n\t\t// if pacman collide with ghost, lose\r\n\t\tif (collision2(pacmansprite,g1.sprite) || collision2(pacmansprite,g2.sprite) || collision2(pacmansprite,g3.sprite)){\r\n\t\t\tSystem.out.println(\"You lost\");\r\n\t\t\tlost = true;\r\n\t\t}\r\n\t}", "private boolean isOver() {\r\n return players.size() == 1;\r\n }", "private static boolean checkWin() {\n\t\tfor (int i = 0; i < nRows; i++)\n\t\t\tfor (int j = 0; j < nColumns; j++) {\n\t\t\t\tCell cell = field.getCellAt(i, j);\n\t\t\t\tif (cell.hasMine() && !cell.hasSign())\t // if the cell has a mine\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// but has no flag\n\t\t\t\t\treturn false;\n\t\t\t\tif (cell.getFlag() >= 0 && !cell.getVisiblity()) // if the cell has no\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// mine in it but\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// it is not visible\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\twin = gameOver = true;\n\t\treturn true;\n\t}", "public boolean playerEnters(Player player) throws Exception\n {\n dungeon.fancyOutput(\"You, pushing onwards, stumble into a pitch black room\");\n dungeon.pause(1000);\n dungeon.fancyOutput(\"Before your eyes ajust to the low lighting, the room explodes in a flash of orange glow\");\n dungeon.pause(1000);\n dungeon.fancyOutput(\"As you open your eyes, you relize that there are 5 torches alit in the room\");\n dungeon.pause(2000);\n dungeon.fancyOutput(\"Intrigued by the enticing glow of the torches, you walk towards them and notice a wooden sign that reads:\\n\");\n dungeon.pause(2000);\n dungeon.fancyOutput(\"'Welcome to the tomb of King Knuth III. Passage will only be granted to those that are able to solve the problem laid before you'\");\n dungeon.pause(3000);\n dungeon.fancyOutput(\"'If you're ready, place your palm against the indent in the stone slab in front of the room'\\n\");\n dungeon.fancyOutput(\"0) Place hand\");\n dungeon.fancyOutput(\"1) do nothing\");\n int userInput = dungeon.getIntSafe();\n if(userInput == 1)\n {\n dungeon.fancyOutput(\"The ground starts to shake and large chunks of stone start falling from the roof...\");\n int test = (int)(Math.random() * 4);\n if(test == 1)\n {\n dungeon.fancyOutput(\"You look up towards the ceiling just as a rock lands on top of you\");\n dungeon.fancyOutput(\"You crawl through the rubble and manage to find the exit door but remain severly injured\");\n return false;\n }\n dungeon.fancyOutput(\"Being the agile and lucky individual you are, you manage to sprint to the stone and place your palm against it\");\n dungeon.fancyOutput(\"The room immediately ceases to shake\");\n dungeon.pause(2000);\n }\n else if(userInput != 0)\n {\n dungeon.fancyOutput(\"You feel a sharp pain in the back of your head... to stop the pain, you rush to the stone to place your palm upon it\");\n dungeon.fancyOutput(\"(Perhaps the pain was caused by your lack of a proper input...)\");\n dungeon.pause(2000);\n }\n\n dungeon.fancyOutput(\"Words instantly start appearing in the wall... almost like they were being ingraved in front of your eyes\");\n dungeon.pause(1500);\n dungeon.fancyOutput(\"'Before you lies 5 torches..''\", 35);\n dungeon.pause(700);\n dungeon.fancyOutput(\"'You must extinguish the torches in the correct order to pass this room'\", 35);\n dungeon.pause(700);\n dungeon.fancyOutput(\"'To find the correct order, you must derive the answer from the hints provided'\\n\", 35);\n dungeon.pause(700);\n dungeon.waitForEnter();\n dungeon.fancyOutput(\"Correctly answering this question will award you with the right answer:\");\n dungeon.pause(2000);\n\n\n dungeon.fancyOutput(\"What is the answer to: (10 * 12 + 3) % 2\"); //FIRST QUESTION\n if(askAnswers(\"0\", \"5\", \"10\", \"1\", 3))\n dungeon.fancyOutput(\"After inputing your answer, the wall reads: 'The FIRST torch to pull is the 4th torch'\");\n else if(getHurt())\n return false;\n else\n dungeon.fancyOutput(\"The room stops shaking and the wall reads: 'The FIRST torch to pull is the 4th torch'\");\n torchOrder = \"\" + 4;\n dungeon.fancyOutput(\"Known order so far: \" + torchOrder + \"\\n\");\n\n\n dungeon.fancyOutput(\"'Here is the second question:'\"); // SECOND QUESTION\n dungeon.fancyOutput(\"How about a riddle this time?: Which of the following is faster than an FRS going downhill? \");\n if(askAnswers(\"A tesla\" , \"An imported Civic\" , \"Derek's car\", \"Trick question... (Does not compile)\", 0))\n dungeon.fancyOutput(\"After inputing your answer, the wall reads: 'The SECOND torch to pull is the 1st torch'\");\n else if(getHurt())\n return false;\n else\n dungeon.fancyOutput(\"The room stops shaking and the wall reads: 'The SECOND torch to pull is the 1st torch'\");\n\n torchOrder += 1;\n dungeon.fancyOutput(\"Known order so far: \" + torchOrder + \"\\n\");\n\n\n\n dungeon.fancyOutput(\"'Here is the third question:'\"); // THIRD QUESTION\n dungeon.fancyOutput(\"What happend to the grape when it was stepped on?\");\n dungeon.fancyOutput(\"(Hint: pick the one that makes the most sense for a joke)\");\n if(askAnswers(\"It was forced into the stone-cold pavement\" , \"It let out a little wine ;)\" , \"The following quote was made: 'Life is too short not to eat jam out of the jar'\" , \"Brennan's mom located said grape and blamed Max for it unfortunately being smashed into the carpet :/\" , 1))\n dungeon.fancyOutput(\"After inputing your answer, the wall reads: 'The THIRD torch to pull is the 2nd torch'\");\n else if(getHurt())\n return false;\n else\n dungeon.fancyOutput(\"The room stops shaking and the wall reads: 'The THIRD torch to pull is the 2nd torch'\");\n\n torchOrder += 2;\n dungeon.fancyOutput(\"Known order so far: \" + torchOrder + \"\\n\");\n\n\n dungeon.fancyOutput(\"'Here is the forth question:'\"); // FORTH QUESTION\n dungeon.fancyOutput(\"Picture the following sceanario: Derek and Brennan role up to a stoplight. Derek starts reving his engine, (thus initiating a race)... What does derek request if he wins the race?\");\n if(askAnswers(\"A cup of coffee\" , \"A full tank of gass\" , \"The answers to a few leetcode questions\" , \"Nothing, he had his poker face on. This wasnt his first rodeo\" , 2))\n dungeon.fancyOutput(\"After inputing your answer, the wall reads: 'The FORTH torch to pull is the 5th torch'\");\n else if(getHurt())\n return false;\n else\n dungeon.fancyOutput(\"The room stops shaking and the wall reads: 'The FORTH torch to pull is the 5th torch'\");\n\n torchOrder += 5;\n dungeon.fancyOutput(\"Known order so far: \" + torchOrder + \"\\n\");\n\n\n dungeon.fancyOutput(\"'Here is the final question:''\"); // FIFTH QUESTION\n dungeon.fancyOutput(\"Just as a dog is a man's best friend, johnny's best 'friend' is: \");\n if(askAnswers(\"His favorite pencil\", \"TacoBell serving plates (so he can drift his front-wheel drive car\", \"Max? probably not...\", \"A cold root-beer with his old man\", 1))\n dungeon.fancyOutput(\"After inputing your answer, the wall reads: 'The LAST torch to pull is the 3rd torch'\");\n else if(getHurt())\n return false;\n else\n dungeon.fancyOutput(\"The room stops shaking and the wall reads: 'The LAST torch to pull is the 3rd torch'\");\n\n torchOrder += 3;\n dungeon.fancyOutput(\"Known order so far: \" + torchOrder + \"\\n\");\n\n \n dungeon.fancyOutput(\"You proceed to extingush the torches in the order that you discovered\");\n dungeon.fancyOutput(\"The wall reads: 'Congratulations on passing this room! I, King Brandank, apluad you and grant you passage onwards.\");\n dungeon.fancyOutput(\"Please, before your departure, accept my gift of gratitude\\n\\n\");\n player.giveItem(\"Rusty Shiv\");\n //dungeon.fancyOutput(\"(Sorry for the extensive amount of text... I hope you got a good laugh out of this :D)\");\n return true;\n\n\n\n }", "public boolean checkWin() {\r\n\t\tif (checkAcross() || checkDiagonal() || checkUpDown()) {\r\n\t\t\t//win = true;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "private boolean hitSides() {\n if (b.numY + 60 >= BOX_HEIGHT || (b.numY - 60 <= 0)) {\n return true;\n } else {\n return false;\n }\n }", "private boolean checkTopLeftDownDiag(char playerSymbol) {\n //checking the top left-bottom right diagonal\n for (int i = 0; i < N; i++) {\n if (grid[i][i].getSymbol() != playerSymbol) {\n return false;\n }\n }\n return true;\n }", "private void checkVercticalWin() throws VictoryException {\n\n for (int x = 0; x < 3; x++) {\n if (myGame.myBoard[x].getText().toUpperCase().length() > 0) {\n\n if (myGame.myBoard[x].getText().toUpperCase().equals(myGame.myBoard[x + 3].getText().toUpperCase())\n && myGame.myBoard[x].getText().toUpperCase().equals(myGame.myBoard[x + 6].getText().toUpperCase())) {\n didAnyoneWin = true;\n }\n }\n\n if (didAnyoneWin) {\n throw (new VictoryException());\n }\n }\n }", "void checkWinner() {\n\t}", "@Test\n public void isGameOver()\n {\n // Setup.\n final CheckersGameInjector injector = new CheckersGameInjector();\n final List<Agent> agents = createAgents(injector);\n final CheckersEnvironment environment = createEnvironment(injector, agents);\n final CheckersAdjudicator adjudicator = injector.injectAdjudicator();\n\n // Run / Verify.\n assertFalse(adjudicator.isGameOver(environment));\n }", "public void isPickingUpPowerup(Player player) {\n if (player.getActivePowerup() == null) {\n for (Powerup powerup : powerups) {\n if (powerup.getBoundsInParent().intersects(player.getBoundsInParent())) {\n player.setActivePowerup(powerup);\n fieldPane.getChildren().remove(powerup);\n cleanup.add(powerup);\n }\n }\n }\n }", "@Override\n protected boolean isFinished() {\n return (Math.abs(hpIntake.getWristPosition()) - HatchPanelIntake.positions[position.ordinal()] < Math.PI/12);\n }", "private void testGrab()\n {\n if(gamepad1.y) {\n //move to position where it touches block ----might have to change angle based on trial----\n //Drastic angles at the moment for testing\n servoLeft.setPosition(0.5);\n //servoRight.setPosition(0.5);\n }\n }", "public boolean didEatAxe(Axe axe) {\n //Is this kibble in the snake? It should be in the same square as the snake's head\n if (axe.getKibbleX() == snakeHeadX && axe.getKibbleY() == snakeHeadY) {\n return axe.isVisible();\n }\n return false;\n }", "@Override\n\tpublic boolean checkWinner( int player) {\n\t\t\n\t\treturn didWin(player, -1, 0) ||\n\t\t\t\tdidWin(player, 0, -1) ||\n didWin(player, -1, -1) ||\n didWin(player, 1, -1);\n\t}", "public boolean xWins() {\n\t\tif (checkWinner(LETTER_X) == 1)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\t}", "private boolean playerWin(Board board)\n {\n return check(board, PLAYER);\n }", "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 }", "private void ensureNoWinner() throws CommandException {\n\t\tif (this.playerWon) {\n\t\t\tthrow new CommandException(\"the game is over\");\n\t\t}\n\t}", "private boolean didPlayerLose() {\r\n return mouseListeningMode && bird.getNumThrowsRemaining() == 0;\r\n }", "public static boolean isBusted(Player player) {\r\n if(total(player).min() > 21 && total(player).min() != 32) {\r\n return true;\r\n }\r\n return false;\r\n }", "@Override\r\n\tpublic boolean isGameOver() {\n\t\treturn !( hasMoves( Seed.CROSS) || hasMoves( Seed.NOUGHT) );\r\n\t}", "private void checkVictory()\n {\n if(throne.getEnemyHealth() <= 0)\n {\n System.out.println(\"Congrats! The land is now free from all chaos and destruction. You are now very rich and wealthy. Yay\");\n alive = false;\n }\n }", "private void checkLoosePLayer(){\n if (hero.getHp()<=0){\n loose();\n }\n\n }", "public boolean isGameOver() throws IllegalStateException {\n if (!isGameStarted) {\n throw new IllegalStateException(\"Game has not yet started!\");\n }\n List<Card> visibleCards = new ArrayList<>();\n for (int rowCount = 0; rowCount < pyramidOfCards.size(); rowCount++) {\n for (int cardCount = 0; cardCount < pyramidOfCards.get(rowCount).size(); cardCount++) {\n Card card = pyramidOfCards.get(rowCount).get(cardCount);\n if (card != null && (isVisibleRelaxed(rowCount, cardCount, rowCount + 1, cardCount)\n || isVisibleRelaxed(rowCount, cardCount, rowCount + 1, cardCount + 1))) {\n visibleCards.add(card);\n }\n }\n }\n if (visibleCards.size() == 0) {\n return true;\n } else {\n // checking for pairsum =13 in visible cards\n HashSet<Integer> hm = new HashSet<>();\n for (Card card : visibleCards) {\n int val = getIntValue(card.getFaceValue());\n if (hm.contains(13 - val) || val == 13) {\n return false;\n } else {\n hm.add(val);\n }\n }\n if (getNumDraw() != 0) {\n return false;\n }\n\n }\n return true;\n }", "public boolean mayPickup(Player debug1) {\n/* 112 */ return true;\n/* */ }", "public boolean isGameOver() {\r\n if(timesAvoid == 3) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "private boolean checkCrash (Location next)\n {\n if (next == null) {\n return true;\n }\n\n Location last = playerLocations.get(playerLocations.size()-1);\n\n LocationType type = next.getType();\n //println(getLocation(next).getType()+\" : \"+next);\n if (type == LocationType.POWERUP) {\n PowerUp p = getPowerUp(next);\n\n if (p != null) { // Basically a workaround for the NPE\n // if (ENABLE_SOUND) {\n // sfx.gainedPowerUp();\n // }\n addSpeed(1);\n speedTimer += (int) frameRate * 2;\n removePowerUp(p);\n }\n\n return false;\n }\n\n if ((type == LocationType.PLAYER || type == LocationType.WALL) ||\n (next.getY() != last.getY() && (direction == LEFTKEY || direction == RIGHTKEY)) ||\n (next.getX() != last.getX() && (direction == UPKEY || direction == DOWNKEY))) { // This is to prevent bike from wrapping around edge of grid, because grid is a 1d array\n //sfx.lostALife(); //Commented out because you hear a shrill sound at the end for some reason\n return true;\n }\n\n return false;\n }", "boolean hasPlayerBag();", "private boolean inGameInvariant(){\n if (owner != null && troops >= 1)\n return true;\n else\n throw new IllegalStateException(\"A Territory is left without a Master or Troops\");\n }", "private void checkForPlayerChance()\n\t\t\t{\n\t\t\t\tf = false;\n\t\t\t\tfor (j = 0; j < 8; ++j)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (win[j] == 2 && lose[j] == 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tf = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\tif (f == false)\n\t\t\t\t\tj = 10;\n\n\t\t\t}", "boolean gameOver() {\n return piecesContiguous(BP) || piecesContiguous(WP);\n }", "private boolean playerWonGameWithVerticalLine(Player player) {\n char playerSymbol = player.getType(); \n for (int i = 0; i < 3; i++) {\n if (boardState[0][i] == playerSymbol && boardState[1][i] == playerSymbol \n && boardState[2][i] == playerSymbol) {\n return true; \n }\n \n }\n return false; \n }", "public boolean isCycleOver(){\n if(playersTurns.isEmpty()) {\n eventListener.addEventObject(new RoundEvent(EventNamesConstants.RoundEnded));\n return true;\n }\n return false;\n }", "public boolean meWin(){\n return whitePieces.size() > blackPieces.size() && isWhitePlayer;\n }", "private boolean validMove(int dir) {\n return !(dir == UPKEY && direction == DOWNKEY || dir == DOWNKEY && direction == UPKEY || dir == LEFTKEY && direction == RIGHTKEY || dir == RIGHTKEY && direction == LEFTKEY);\n }", "public boolean isLegalStep(MoveDirection dir){\r\n GamePosition curPos = currentGame.getCurrentPosition();\n\t\tPlayer white = currentGame.getWhitePlayer();\n\t\tint[] toCheckPos = new int[2];\n\t\tint[] existingPos = new int[2];\n\t\tif(curPos.getPlayerToMove().equals(white)) {\n\t\t\ttoCheckPos[0] = curPos.getWhitePosition().getTile().getColumn();\n\t\t\ttoCheckPos[1] = curPos.getWhitePosition().getTile().getRow();\n\t\t\t\n\t\t\texistingPos[0] = curPos.getBlackPosition().getTile().getColumn();\n\t\t\texistingPos[1] = curPos.getBlackPosition().getTile().getRow();\n\t\t\t\n\t\t} else {\n\t\t\ttoCheckPos[0] = curPos.getBlackPosition().getTile().getColumn();\n\t\t\ttoCheckPos[1] = curPos.getBlackPosition().getTile().getRow();\n\t\t\t\n\t\t\texistingPos[0] = curPos.getWhitePosition().getTile().getColumn();\n\t\t\texistingPos[1] = curPos.getWhitePosition().getTile().getRow();\n\t\t}\n\t\t//0 = column, 1 = row\n\t\tif(dir == MoveDirection.North) {\n\t\t\tif(toCheckPos[1] == 1) return false;\n\t\t\tif(toCheckPos[1] - 1 == existingPos[1] && toCheckPos[0] == existingPos[0]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), -1, 0);\n\t\t} else if(dir == MoveDirection.South) {\n\t\t\tif(toCheckPos[1] == 9) return false;\n\t\t\tif(toCheckPos[1] + 1 == existingPos[1] && toCheckPos[0] == existingPos[0]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 1, 0);\n\t\t} else if(dir == MoveDirection.East) {\n\t\t\tif(toCheckPos[0] == 9) return false;\n\t\t\tif(toCheckPos[0] + 1 == existingPos[0] && toCheckPos[1] == existingPos[1]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 0, 1);\n\t\t} else if(dir == MoveDirection.West) {\n\t\t\tif(toCheckPos[0] == 1) return false;\n\t\t\tif(toCheckPos[0] - 1 == existingPos[0] && toCheckPos[1] == existingPos[1]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 0, -1);\n\t\t}\n\t\t\n\t\treturn false;\r\n }" ]
[ "0.72269076", "0.63959223", "0.6383143", "0.6338227", "0.6290123", "0.6278244", "0.6206561", "0.6174575", "0.6143241", "0.61366475", "0.6110763", "0.60916126", "0.6078778", "0.60642356", "0.6044855", "0.6033168", "0.6031459", "0.60163116", "0.60113645", "0.5989497", "0.59823", "0.59820974", "0.5955834", "0.59446996", "0.59427977", "0.5930384", "0.5924272", "0.59174085", "0.5912629", "0.590917", "0.5893182", "0.5888845", "0.58715487", "0.58602715", "0.58541375", "0.5846773", "0.5845929", "0.5833819", "0.58265257", "0.58168656", "0.58136785", "0.58109367", "0.58100086", "0.5803768", "0.57971823", "0.57955533", "0.5787143", "0.57791793", "0.5773478", "0.5760709", "0.57606345", "0.57553226", "0.5755234", "0.5751404", "0.5749798", "0.5736483", "0.57364696", "0.5730796", "0.57290864", "0.57250756", "0.57150996", "0.5710811", "0.57044554", "0.56986475", "0.5697129", "0.5695564", "0.5681078", "0.56773007", "0.5675577", "0.5668699", "0.56664604", "0.5661083", "0.5654095", "0.5650286", "0.56480217", "0.56439865", "0.5642377", "0.56338954", "0.5631819", "0.5627502", "0.562363", "0.56177557", "0.5614864", "0.5609855", "0.5605013", "0.5604684", "0.56022954", "0.5600334", "0.56002665", "0.55973023", "0.5595487", "0.55951667", "0.55926377", "0.558949", "0.55877054", "0.55842125", "0.5583244", "0.5579375", "0.5575376", "0.55753" ]
0.594603
23
/ First we check if a new card has been turned (to prevent multiple snaps on the same card, and we verify that the instructions scene is not obscuring the game play, then we check if any player has pressed snap, and if that snap is valid.
private void checkSnap() { if (turned && view.getInstructions().getHidden()) for (PlayerView p: view.getPlayerViewList()) if (playerHasPressed(p)) { // If last card is null, the turned card is the first card in the pile and can't be snap. if(game.getLastCard() != null) view.showLastCard(game.getLastCard().getValue()); view.showSnapResult(p.getId(), game.snap(game.getPlayer(p.getId()-1))); displayPlayers(); turned = false; break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void checkCards(){\r\n if (Card1.getSource().equals(Card2.getSource())){\r\n Card1.setEnabled(false); \r\n Card2.setEnabled(false);\r\n Card1.setBackground(new Color(190, 190, 255));\r\n Card2.setBackground(new Color(190, 190, 255));\r\n Card1.setFace(true); \r\n Card2.setFace(true);\r\n if (this.isGameWon()){\r\n \t_s.stopThread();\r\n \tint[] x = _s.getTime();\r\n \tString s = \"\" + x[0] + \":\" + x[1] + \":\" + x[2] + \":\" + x[3];\r\n \tUIManager.put(\"OptionPane.background\",new ColorUIResource(0,255,0));\r\n UIManager.put(\"Panel.background\",new ColorUIResource(250,0,150));\r\n UIManager.put(\"OptionPane.messageFont\", new FontUIResource(new Font( \r\n \"Times New Roman\", Font.BOLD, 18)));\r\n JOptionPane.showMessageDialog(this, \"You win!\\n\"\r\n \t\t+ \"Your time is: \" + s +\"\\n\"\r\n \t\t\t\t+ \"You're (probably) getting better...\", \"\", -1, null);\r\n JOptionPane.showMessageDialog(this, \"Thanks for playing!\\n\"\r\n \t\t+ \"(Rhythm Heaven is a property of Nintendo and Tsunku.)\", \"\", -1, null);\r\n System.exit(0);\r\n }\r\n }\r\n\r\n else{\r\n Card1.setIcon(null); \r\n Card2.setIcon(null);\r\n }\r\n Card1 = null; \r\n Card2 = null;\r\n }", "public static void hitCorrect()\n\t{\n\t\tplayersCards.add(deck.deal());\n\t\tcurrentValue();\n\t\tuserCardImg[playersCards.size()-1].setIcon(new ImageIcon(Gameplay.class.getResource(getCard(playersCards.get(playersCards.size()-1)))));\n\t\tresume();\n\t\tif(calculateHand(playersCards)>21 || playersCards.size()==4 || calculateHand(playersCards)==0)\n\t\t{\n\t\t\troundEnd();\n\t\t}\n\t\t\n\t}", "public boolean isWin_CommanderVimes(){\r\n // player got LordSelachii card\r\n Player playerHoldCard = null;\r\n for (Player player : discWorld.getPlayer_HASH().values()) {\r\n if (player.getPersonalityCardID() == 7) {\r\n playerHoldCard = player;\r\n break;\r\n }\r\n }\r\n \r\n if(playerHoldCard != null){\r\n if(discWorld.getShuffled_PlayerCard().size() == 0){\r\n return true;\r\n }\r\n } \r\n \r\n return false;\r\n }", "public void checkIfWinOrDraw() {\r\n\t\tif (theModel.getIsDraw() == true) {\r\n\t\t\tDrawNum++;\r\n\t\t\tactivePlayer = winningPlayer;\r\n\t\t\t// cards go to communalPile\r\n\r\n\t\t} else {\r\n\t\t\ttheModel.winningCard(winningPlayer);\r\n\t\t\ttheModel.transferWinnerCards(winningPlayer);\r\n\t\t}\r\n\r\n\t}", "public boolean isWin_DragonKingOfArms(){\r\n // player got LordSelachii card\r\n /*Player playerHoldCard = null;\r\n for (Player player : discWorld.getPlayer_HASH().values()) {\r\n if (player.getPersonalityCardID() == 5) {\r\n playerHoldCard = player;\r\n break;\r\n }\r\n }*/\r\n int count = 0;\r\n for(TroubleMarker troubleMarker : discWorld.getTroubleMarker_HASH().values()){\r\n if(troubleMarker.getAreaNumber() != ConstantField.DEFAULT_PIECE_AREA_NUMBER){\r\n count++;\r\n }\r\n }\r\n \r\n if(count >= 8){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n \r\n }", "public void checkWin() {\n if (rockList.isEmpty() && trackerRockList.isEmpty() && bigRockList.isEmpty() && bossRockList.isEmpty()) {\n if (ship.lives < 5) {\n ship.lives++;\n }\n Level++;\n LevelIntermission = true;\n LevelIntermissionCount = 0;\n }\n }", "public boolean CheckForCapture(int landed){\n //player0 captures\n if (this.playerNumber == 0 && landed > -1 && landed < 6){\n if (this.gameBoard[landed] == 1) {\n return true;\n }\n }\n //player2 captures\n if (this.playerNumber == 1 && landed > 6 && landed < 13){\n if (this.gameBoard[landed] == 1) {\n return true;\n }\n }\n return false;\n }", "public void checkFinished() {\n int check = 0;\n for (int i = 0; i < cards.size(); i++) {\n if (cards.get(i).getTurned() == true) {\n check++;\n }\n }\n if (check == cards.size()) {\n clip.stop();\n resultGUI = new ResultGUI(p1Points, p2Points);\n resultGUI.setSize(700, 500);\n resultGUI.setVisible(true);\n setVisible(false);\n }\n }", "public boolean validMove(int playerID, Card selectedCard){\n // turn == playerID\n if(gameStage == 3){\n if(numPlays == 0){\n if(playerID == 0){\n player1Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player1Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player2Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player3Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player4Play.getSuit();\n }\n numPlays++;\n turn = 0;\n return true;\n }\n }\n else if(numPlays < 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n turn = 0;\n return true;\n }\n }\n // if three cards have been played this is the last card\n else if(numPlays == 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n }\n }\n return false;\n }", "protected boolean checkForWin() {\r\n \t\r\n if (squaresRevealed == this.width * this.height - this.mines) {\r\n finishFlags();\r\n finish(GameStateModel.WON);\r\n return true;\r\n } \t\r\n \t\r\n return false;\r\n \t\r\n }", "private void checkGame() {\n if (game.checkWin()) {\n rollButton.setDisable(true);\n undoButton.setDisable(true);\n this.dialogFlag = true;\n if (game.isDraw()) {\n showDrawDialog();\n return;\n }\n if (game.getWinner().getName().equals(\"Computer\")) {\n showLoserDialog();\n return;\n }\n showWinnerDialog(player1);\n }\n }", "public void checkGame() {\n\n\t}", "private void checkGameInput(float dt) {\n\t\tif (!(talkmode || showSignDialog)) {\n\t\t\tif (player.moving) {\n\t\t\t\tboolean shouldStop = true;\n\t\t\t\tfor (int i = UP; i <= LEFT; i++) {\n\t\t\t\t\tif (!gameActions[i].isReleased()) {\n\t\t\t\t\t\tshouldStop = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (shouldStop) {\n\t\t\t\t\tplayer.stop();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint dir = -1;\n\t\t\tint count = gameActions[LEFT].isPressed() ? 1 : 0;\n\t\t\tboolean found = false;\n\t\t\tfor (int i = UP; i <= LEFT; i++) {\n\t\t\t\tif (gameActions[i].isPressed()) {\n\t\t\t\t\tcount++;\n\t\t\t\t} else {\n\t\t\t\t\tif (count == 2) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcount = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!found) {\n\t\t\t\tfound = count == 2;\n\t\t\t}\n\t\t\tfor (int i = UP; i <= LEFT; i++) {\n\t\t\t\tif (gameActions[i].isPressed()) {\n\t\t\t\t\tmove(dt, dir = (i - UP), found);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (dir != -1) {\n\t\t\t\tplayer.setPartyMembersPositions();\n\t\t\t\t// showSignDialog = false;\n\t\t\t\t// doorSign = null;\n\t\t\t} else {\n\t\t\t\tbackground.stop();\n\t\t\t}\n\n\t\t\tif (isMenuButtonPressed(gameActions)) {\n\t\t\t\tsuper.queueEnterMenu();\n\t\t\t}\n\t\t} else if (question) {\n\t\t\tcheckDirectionalButtonsForQuestion();\n\t\t}\n\t\tif (gameActions[CROSS].isPressed()) {\n\t\t\tif (showSignDialog) {\n\t\t\t\tshowSignDialog = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcrossPressed();\n\t\t}\n\t}", "private boolean isValidMove(int pressedHole) {\n return getPlayerHole(pressedHole).getKorgools() != 0;\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 }", "public void checkPlay(int[][] boardState)\n {\n if(ai)\n {\n takeTurn(boardState);\n }\n }", "public void tryStand() {\n if(player.getHand().size() > 0){\n firstStand = true;\n dealerTurn(1);\n } else{\n errorFlag = true;\n userMessage = \"You must get your initial hand dealt before you can stand\";\n }\n\n\n }", "public void nextStepInGame(View view){\n // called by click on either card, so need to track state\n Log.d(getClass().toString(),\"playstate before = \" + playstate.toString());\n\n playstate = playstate.getNext();\n Log.d(getClass().toString(),\"playstate after update = \" + playstate.toString());\n ImageButton computerCard = (ImageButton) findViewById(R.id.computerCard);\n ImageButton youCard = (ImageButton) findViewById(R.id.youCard);\n TextView infoPanel = (TextView) findViewById(R.id.info_panel);\n switch (playstate){\n case NOCARDS: {\n // show empty buttons as no cards on table\n computerCard.setImageResource(R.color.holo_green_dark);\n computerCard.setVisibility(View.VISIBLE);\n youCard.setImageResource(R.color.holo_blue_dark);\n youCard.setVisibility(View.VISIBLE);\n infoPanel.setText(\"Click to deal cards to both players\");\n\n break;\n }\n case DEALCARDS: {\n // show backs of cards ready to play them\n computerCard.setImageResource(R.drawable.card_back);\n computerCard.setVisibility(View.VISIBLE);\n youCard.setImageResource(R.drawable.card_back);\n youCard.setVisibility(View.VISIBLE);\n infoPanel.setText(\"Click to reveal cards\");\n break;\n }\n case SHOWCARDS: {\n // playARound, but only show card faces\n game.playARound();\n String cardToShow = this.game.getTurnlog().lastEntryFor(game.getPlayers()[1]).getHand().topShownCard().toDrawableName();\n computerCard.setImageResource(getResources().getIdentifier(cardToShow, \"drawable\", \"com.codeclan.cardgame\"));\n cardToShow = this.game.getTurnlog().lastEntryFor(game.getPlayers()[0]).getHand().topShownCard().toDrawableName();\n youCard.setImageResource(getResources().getIdentifier(cardToShow, \"drawable\", \"com.codeclan.cardgame\"));\n\n infoPanel.setText(getString(R.string.computer_label) + \" has \" +\n game.getPlayers()[1].getScore().toString() + \" points,\\n\" +\n getString(R.string.player_label) + \" has \" +\n game.getPlayers()[0].getScore().toString() + \" points.\\n Click for clear table\") ;\n\n break;\n }\n\n }\n if( game.isOver() ){\n//\n// break out of onClick loop by going to new activity to display results\n//\n Intent resultsIntent = new Intent(this, G2P1CHWResultsActivity.class);\n resultsIntent.putExtra(\"player1score\", game.getPlayers()[0].getScore());\n resultsIntent.putExtra(\"dealerscore\", game.getPlayers()[1].getScore());\n resultsIntent.putExtra(\"winner\", game.winner().getName());\n\n startActivity(resultsIntent);\n }\n\n }", "@Override\n public boolean onTouchEvent(MotionEvent event) {\n if (event.getAction() == MotionEvent.ACTION_DOWN) {\n final int column = (int)(event.getX() / cardWidth);\n final int row = (int)(event.getY() / cardHeight);\n\n if(column<4 && row <4) {\n if(cards[column][row].getCardState() == CardState.FACE_DOWN && !(playerManager.getPlayerClicks()<=0)){\n cards[column][row].flipCard();\n invalidate();\n\n playerManager.reduceClicks();\n updateScoreBoard();\n\n if(playerManager.getPlayerClicks() == 0){\n cardsClicked[0] = cards[column][row];\n\n final Handler handler = new Handler();\n handler.postDelayed(new Runnable() {\n @Override\n public void run() {\n checkCardMatch(cardsClicked[0], cardsClicked[1]);\n updateScoreBoard();\n invalidate();\n }\n }, 1000);\n } else{\n cardsClicked[1] = cards[column][row];\n updateScoreBoard();\n invalidate();\n }\n } else {\n Toast.makeText(getContext(), \"Invalid Touch\", Toast.LENGTH_LONG).show();\n }\n }\n }\n\n return true;\n }", "public void checkGameStatus() {\n everyTenthGoalCongrats();\n randomPopUpBecauseICan();\n }", "@Override\r\n\tboolean isFinished() {\r\n\t\t// TODO Auto-generated method stub\r\n\t\tif(checkForWin() != -1)\r\n\t\t\treturn true;\r\n\t\telse if(!(hasValidMove(0) || hasValidMove(1)))\r\n\t\t\treturn true; //game draw both are stuck\r\n\t\telse return false;\r\n\t}", "@Test\n public void testIsValidTap() {\n setUpCorrect();\n assertTrue(boardManager.isValidTap(11));\n assertTrue(boardManager.isValidTap(14));\n assertFalse(boardManager.isValidTap(10));\n }", "boolean checkWin(Tile initialTile);", "private void SecondStateFiringChecks()\n {\n List<Player> AffectedPlayers = game.GetAffectedPlayers(geoTarget, game.GetConfig().GetBlastRadius(missileType));\n\n if(AffectedPlayers.size() == 1)\n {\n final Player affectedPlayer = AffectedPlayers.get(0);\n\n if(lLastWarnedID != affectedPlayer.GetID() && affectedPlayer.GetRespawnProtected())\n {\n final LaunchDialog launchDialog = new LaunchDialog();\n launchDialog.SetHeaderLaunch();\n launchDialog.SetMessage(context.getString(R.string.attacking_respawn_protected, affectedPlayer.GetName(), TextUtilities.GetTimeAmount(affectedPlayer.GetStateTimeRemaining())));\n launchDialog.SetOnClickYes(new View.OnClickListener()\n {\n @Override\n public void onClick(View view)\n {\n launchDialog.dismiss();\n lLastWarnedID = affectedPlayer.GetID();\n Launch();\n }\n });\n launchDialog.SetOnClickNo(new View.OnClickListener()\n {\n @Override\n public void onClick(View view)\n {\n launchDialog.dismiss();\n }\n });\n launchDialog.show(activity.getFragmentManager(), \"\");\n }\n else if(lLastWarnedID != affectedPlayer.GetID() && game.GetNetWorthMultiplier(game.GetOurPlayer(), affectedPlayer) < Defs.NOOB_WARNING)\n {\n final LaunchDialog launchDialog = new LaunchDialog();\n launchDialog.SetHeaderLaunch();\n launchDialog.SetMessage(context.getString(R.string.attacking_noob, affectedPlayer.GetName()));\n launchDialog.SetOnClickYes(new View.OnClickListener()\n {\n @Override\n public void onClick(View view)\n {\n launchDialog.dismiss();\n lLastWarnedID = affectedPlayer.GetID();\n Launch();\n }\n });\n launchDialog.SetOnClickNo(new View.OnClickListener()\n {\n @Override\n public void onClick(View view)\n {\n launchDialog.dismiss();\n }\n });\n launchDialog.show(activity.getFragmentManager(), \"\");\n }\n else if(lLastWarnedID != affectedPlayer.GetID() && game.GetNetWorthMultiplier(game.GetOurPlayer(), affectedPlayer) > Defs.ELITE_WARNING)\n {\n final LaunchDialog launchDialog = new LaunchDialog();\n launchDialog.SetHeaderLaunch();\n launchDialog.SetMessage(context.getString(R.string.attacking_elite, affectedPlayer.GetName()));\n launchDialog.SetOnClickYes(new View.OnClickListener()\n {\n @Override\n public void onClick(View view)\n {\n launchDialog.dismiss();\n lLastWarnedID = affectedPlayer.GetID();\n Launch();\n }\n });\n launchDialog.SetOnClickNo(new View.OnClickListener()\n {\n @Override\n public void onClick(View view)\n {\n launchDialog.dismiss();\n }\n });\n launchDialog.show(activity.getFragmentManager(), \"\");\n }\n else\n {\n Launch();\n }\n }\n else\n {\n Launch();\n }\n }", "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}", "boolean isGameSpedUp();", "public void isTrickComplete() {\n if(numPlays!=4){return;}\n if(player1Play == null | player2Play == null | player3Play == null | player4Play == null){return;}//should only call when all have played\n // reset numPlayed\n numPlays = 0;\n // find if the round is over\n currentMiddle.clear();\n trickNum++;\n try {\n sleep(200);//display all four cards before determining winner\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n int trickWinner;\n trickWinner = trickWinner();\n turn = trickWinner;\n if(trickWinner == 0 | trickWinner == 2){\n redTrickScore++;\n }\n else if(trickWinner == 1 | trickWinner == 3){\n blueTrickScore++;\n }\n player1Hand.remove(player1Play);//clear middle\n player2Hand.remove(player2Play);\n player3Hand.remove(player3Play);\n player4Hand.remove(player4Play);\n\n player1Play = null;\n player2Play = null;\n player3Play = null;\n player4Play = null;\n\n if(trickNum == 5){\n // reset everything for new round\n currentTrumpSuit = null;\n numPass = 0;\n isRoundOver();\n if(dealer == 3){\n dealer = 0;\n turn = 1;\n }\n else{\n dealer++;\n turn = dealer + 1;\n }\n gameStage = 0;\n deal();\n trickNum = 0;\n }\n\n\n\n }", "@Override\n public boolean anotherPlayIsPossible()\n {\n \t\n List<Integer> test = cardIndexes();\n return containsSum13(test) || containsK(test);\n \n }", "public static boolean dcheck() {\n if ((card[0][0] == 0 && card[1][1] == 0 && card[2][2] == 0 && card[3][3] == 0 && card[4][4] == 0) || (card[0][4] == 0 && card[1][3] == 0 && card[2][2] == 0 && card[3][1] == 0 && card[4][0] == 0)) {\n System.out.println(\"BINGO\");\n System.out.println(\"The numbers called is \" + called);\n return true;\n } else {\n return false;\n }\n }", "private void checkPreviousSquare(){\n\t\t\n\t\tif(!frontIsClear()){\n\t\t\tfaceBackwards();\n\t\t\tmove();\n\t\t\tif(!beepersPresent()){\n\t\t\t\tfaceBackwards();\n\t\t\t\tmove();\n\t\t\t\tputBeeper();\n\t\t\t} else {\n\t\t\t\tfaceBackwards();\n\t\t\t\tmove();\n\t\t\t}\n\t\t}\n\t}", "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 boolean isValidMove(Card card)\n {\n return false;\n }", "private boolean isNextMoveEnPassentCapture(Move move)\r\n\t{\r\n\t\tif (!(move.capture instanceof Pawn)) return false;\r\n\t\tif (Math.abs(move.from.coordinate.x - move.to.coordinate.x) != 1) return false;\r\n\t\tif (Math.abs(move.from.coordinate.y - move.to.coordinate.y) != 1) return false;\r\n\t\tif (!move.to.isEmpty()) return false;\r\n\t\treturn true;\r\n\t}", "public void checkWin(){\n boolean result = false;\n if(game.getTurn() > 3){\n Player currentPlayer = game.getPlayerTurn();\n int playernumber = currentPlayer.getPlayericon();\n result = game.winChecker(game.getBored(),playernumber);\n if(result == true) {\n setWinMsgBox(currentPlayer.getPlayerName() + \" Is victorious :)\",\"WIN\");\n }else if(game.getTurn() == 8 && result == false){\n setWinMsgBox(\"Too bad it is a draw, No one out smarted the other -_-\",\"DRAW\");\n }else{}\n }else{\n result = false;\n }\n }", "public boolean checkIf_one_cardAwayFromStraight() {\n boolean oneAway = false;\n //CASE 1: Four in a row and missing one _ X X X X _ ---> open ended straight draw \n if (numSequentially == 4 && lowestValOfNumSequentially >= 2 && lowestValOfNumSequentially <= 10) {// _ 2 3 4 5 _, we can get ANY ace or ANY 6\n oneAway = true;\n numOuts += 8;\n bestHandFromCardsNickNameString = \"Open-Ended Straight Draw\";\n } else if (numSequentially == 4) {// A 2 3 4// any 5\n oneAway = true;\n numOuts += 4;\n bestHandFromCardsNickNameString = \"Single-Sided Straight Draw\";\n } else if (numSequentially == 3) {// CASE 2: 3 in a row and missing one between so either X _ X X X OR OR X X X _ X\n if (handContainsValueZ(lowestValOfNumSequentially - 2) || handContainsValueZ(lowestValOfNumSequentially + 4)) {\n numOuts += 4;\n oneAway = true;\n bestHandFromCardsNickNameString = \"Gutshot Straight Draw\";\n }\n } else if (numSequentially == 2) {//lowest value of num sequentially will be the higher pair X X _ K X (will be k)\n if (handContainsValueZ(lowestValOfNumSequentially - 2) && handContainsValueZ(lowestValOfNumSequentially - 3)) {\n numOuts += 4;\n oneAway = true;\n bestHandFromCardsNickNameString = \"Bulls-Eye Gutshot Straight Draw\";\n }\n\n }\n\n return oneAway;\n }", "public void takeTurnsDebug() {\n boolean antFound = false;\n int gridPos = 0;\n while (antFound == false) {\n if (antGrid[gridPos] != null && antGrid[gridPos].getId() == 14) {\n antGrid[gridPos].moving = true;\n antFound = true;\n } else {\n gridPos++;\n }\n }\n \n takeTurn(antGrid[gridPos], gridPos);\n }", "private void CheckWin() throws VictoryException {\n if (!isMiddleSquareEmpty()) {\n checkDiagonalTopRightToBottomLeft();\n checkDiagonalTopLeftToBottomRight();\n }\n\n checkHorozontalWin();\n checkVercticalWin();\n\n if (didAnyoneWin) {resetBoard(myGame);\n throw (new VictoryException());\n }\n }", "public boolean checkCapture(Move move, Piece board[][]) {\n\n if (board[move.getEnd_column()][move.getEnd_row()] != null) {\n if (board[move.getEnd_column()][move.getEnd_row()].getColor() == getColor()) {\n return false;\n }\n //adds the taken piece to move-object\n move.setTakenPiece(board[move.getEnd_column()][move.getEnd_row()]);\n }\n\n return true;\n }", "public void newSlot(boolean moved, boolean check)\r\n {\r\n \r\n // Insert Win and Lose Situation\r\n if (high < currentScore) high = currentScore;\r\n if (moved == true && !(check)){\r\n Random rand = new Random();\r\n int slot, x, y;\r\n slot = rand.nextInt((4 * 4));\r\n x = slot % 4;\r\n y = slot / 4;\r\n for (int i = 0; i < 16; i++) {\r\n if (grid[y][x] == 0) {\r\n int a = rand.nextInt(5)+1;\r\n if (a == 1 || a == 4|| a == 3 || a == 5) a = 1;\r\n if (a == 2 ) a = 2;\r\n grid[y][x] = a;\r\n gui.setNewSlotBySlotIndex(y, x, grid[y][x]);\r\n break;\r\n } else if (x == 3) {\r\n x = 0;\r\n y++;\r\n } else\r\n x++;\r\n if (y == 4)\r\n y = 0; \r\n }}}", "public boolean extraTurn() {\n\t\tif (isPlayer1() && currentPit == 6 || !isPlayer1() && currentPit == 13) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\r\n public void testPlayer_getDumbStrategyCard_differentWinners() {\r\n player2 = new Player(\"\", true);\r\n player2.setHand(strategyHand.getAllCards());\r\n boolean differentLegalCardFound = false;\r\n Card firstDiscard = player2.getDumbStrategyCard(yellowSix, yellowSix.getColor());\r\n for(int i = 0; i < 25; i++) {\r\n Card loopCard = player2.getDumbStrategyCard(yellowSix, yellowSix.getColor());\r\n if(!loopCard.equals(firstDiscard)) {\r\n differentLegalCardFound = true;\r\n }\r\n }\r\n assertTrue(differentLegalCardFound);\r\n }", "public void checkMove(int playerID, int[] cardIdx) {\n\t\tHand attempt = cardIdx != null ? composeHand(this.getPlayerList().get(playerID),this.getPlayerList().get(playerID).play(cardIdx)) : null;\n\t\tif (cardIdx == null && (playerID == lastHandIdx || firstturn)) {\n\t\t\ttable.printMsg(\"{pass}\");\n\t\t\ttable.printMsg(\" <== Not a legal move!!!\\n\");\n\t\t} else if (cardIdx == null){\n\t\t\ttable.printMsg(\"{pass}\\n\");\n\t\t\tcurrentIdx = (playerID + 1) % getNumOfPlayers();\n\t\t\ttable.setActivePlayer(this.getCurrentIdx());\n\t\t\tfirstturn = false;\n\t\t\ttable.printMsg(this.getPlayerList().get(this.getCurrentIdx()).getName()+\"'s turn:\\n\");\n\t\t} else if (attempt == null) {\n\t\t\ttable.print(this.getPlayerList().get(playerID).play(cardIdx));\n\t\t\ttable.printMsg(\" <== Not a legal move!!!\\n\");\n\t\t} else if (firstturn && !attempt.contains(new BigTwoCard(0,2))) {\n\t\t\ttable.print(attempt);\n\t\t\ttable.printMsg(\" <== Not a legal move!!!\\n\");\n\t\t} else if ((!this.getHandsOnTable().isEmpty() && attempt!=null && playerID != lastHandIdx) ? (!(attempt.beats(this.getHandsOnTable().get(this.getHandsOnTable().size() - 1))) || attempt.size() != this.getHandsOnTable().get(this.getHandsOnTable().size() - 1).size()) : false) {\n\t\t\ttable.print(attempt);\n\t\t\ttable.printMsg(\" <== Not a legal move!!!\\n\");\n\t\t} else {\n\t\t\tthis.getPlayerList().get(playerID).removeCards(this.getPlayerList().get(playerID).play(cardIdx));\n\t\t\tattempt.sort();\n\t\t\tthis.getHandsOnTable().add(attempt);\n\t\t\tlastHandIdx = playerID;\n\t\t\ttable.printMsg(\"{\"+attempt.getType()+\"} \");\n\t\t\ttable.print(attempt);\n\t\t\ttable.printMsg(\"\\n\");\n\t\t\tcurrentIdx = (playerID + 1) % getNumOfPlayers();\n\t\t\ttable.setActivePlayer(this.getCurrentIdx());\n\t\t\tfirstturn = false;\n\t\t\ttable.printMsg(this.getPlayerList().get(this.getCurrentIdx()).getName()+\"'s turn:\\n\");\n\t\t}\n\t\ttable.resetSelected();\n\t\ttable.repaint();\n\t\t\n\t\tif (endOfGame()) {\n\t\t\ttable.printMsg(\"Game ends\\n\");\n\t\t\tfor (int i = 0; i < this.getNumOfPlayers(); i++) {\n\t\t\t\tif (this.getPlayerList().get(i).getNumOfCards() == 0) {\n\t\t\t\t\ttable.printMsg(this.getPlayerList().get(i).getName() + \" wins the game.\\n\");\n\t\t\t\t} else {\n\t\t\t\t\ttable.printMsg(this.getPlayerList().get(i).getName() + \" has \" + this.getPlayerList().get(i).getNumOfCards() + \" cards in hand.\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t\ttable.disable();\n\t\t}\n\t}", "private void checkWin() {\n // Check if a dialog is already displayed\n if (!this.gameOverDisplayed) {\n // Check left paddle\n if (Objects.equals(this.scoreL.currentScore, this.winCount) && (this.scoreL.currentScore != 0)) {\n if (twoUser) {\n gameOver(GeneralFunctions.TWO_1_WIN);\n } else {\n gameOver(GeneralFunctions.ONE_LOSE);\n }\n // Right paddle\n } else if (Objects.equals(this.scoreR.currentScore, this.winCount) && (this.scoreR.currentScore != 0)) {\n if (twoUser) {\n gameOver(GeneralFunctions.TWO_2_WIN);\n } else {\n gameOver(GeneralFunctions.ONE_WIN);\n }\n }\n }\n }", "private boolean validInput(Player player, int choice) {\n if (0 <= choice && choice < player.getCards().size()) {\n if(state.getWildDrawPenalty() != 1 && player.getCards().get(choice) instanceof WildDrawCard) {\n return true;\n }\n if( state.getWildDrawPenalty() != 1 && !(player.getCards().get(choice) instanceof WildDrawCard)) {\n System.out.println(\"You should put WildDraw card.\");\n return false;\n }\n if( player.getCards().get(choice) instanceof WildDrawCard){\n boolean validWildDraw = true;\n for (Card temp: player.getCards()) {\n if(temp.isValidCard(currentCard)) {\n validWildDraw = false;\n }\n }\n if (validWildDraw) {\n return true;\n }\n else {\n System.out.println(\"You can't put WildDraw card.\");\n return false;\n }\n }\n if(state.getDrawPenalty() != 1 && player.getCards().get(choice) instanceof Draw2Card) {\n return true;\n }\n if (state.getDrawPenalty() != 1 && !(player.getCards().get(choice) instanceof Draw2Card)) {\n System.out.println(\"You should put Draw2 card.\");\n return false;\n }\n if ( player.getCards().get(choice).isValidCard(currentCard)) {\n return true;\n }\n System.out.println(\"Enter valid card.\");\n return false;\n }\n System.out.println(\"Enter a number between 1-\" + player.getCards().size() );\n return false;\n }", "@Override\n public boolean isWaitingForTurnPhase() {return true;}", "public boolean isLegalStep(MoveDirection dir){\r\n GamePosition curPos = currentGame.getCurrentPosition();\n\t\tPlayer white = currentGame.getWhitePlayer();\n\t\tint[] toCheckPos = new int[2];\n\t\tint[] existingPos = new int[2];\n\t\tif(curPos.getPlayerToMove().equals(white)) {\n\t\t\ttoCheckPos[0] = curPos.getWhitePosition().getTile().getColumn();\n\t\t\ttoCheckPos[1] = curPos.getWhitePosition().getTile().getRow();\n\t\t\t\n\t\t\texistingPos[0] = curPos.getBlackPosition().getTile().getColumn();\n\t\t\texistingPos[1] = curPos.getBlackPosition().getTile().getRow();\n\t\t\t\n\t\t} else {\n\t\t\ttoCheckPos[0] = curPos.getBlackPosition().getTile().getColumn();\n\t\t\ttoCheckPos[1] = curPos.getBlackPosition().getTile().getRow();\n\t\t\t\n\t\t\texistingPos[0] = curPos.getWhitePosition().getTile().getColumn();\n\t\t\texistingPos[1] = curPos.getWhitePosition().getTile().getRow();\n\t\t}\n\t\t//0 = column, 1 = row\n\t\tif(dir == MoveDirection.North) {\n\t\t\tif(toCheckPos[1] == 1) return false;\n\t\t\tif(toCheckPos[1] - 1 == existingPos[1] && toCheckPos[0] == existingPos[0]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), -1, 0);\n\t\t} else if(dir == MoveDirection.South) {\n\t\t\tif(toCheckPos[1] == 9) return false;\n\t\t\tif(toCheckPos[1] + 1 == existingPos[1] && toCheckPos[0] == existingPos[0]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 1, 0);\n\t\t} else if(dir == MoveDirection.East) {\n\t\t\tif(toCheckPos[0] == 9) return false;\n\t\t\tif(toCheckPos[0] + 1 == existingPos[0] && toCheckPos[1] == existingPos[1]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 0, 1);\n\t\t} else if(dir == MoveDirection.West) {\n\t\t\tif(toCheckPos[0] == 1) return false;\n\t\t\tif(toCheckPos[0] - 1 == existingPos[0] && toCheckPos[1] == existingPos[1]) return false;\n\t\t\treturn QuoridorController.noWallBlock(curPos.getPlayerToMove(), 0, -1);\n\t\t}\n\t\t\n\t\treturn false;\r\n }", "public static boolean isScratch(long snap) {\n\t\treturn snap < 0;\n\t}", "public void play() {\n\t\t// setting up\n\t\tdeck = new Deck();\n\t\tdeck.shuffle();\n\t\tint turn = 0;\n\t\tRandom rand = new Random();\n\t\tCardRank previousCardRank = null;\n\t\tboolean snapTime = false;\n\t\t\n\t\t// the turning card loop, which ends when two cards with the same value/rank are revealed\n\t\t// or when no cards are left in the deck\n\t\twhile (!snapTime) {\n\t\t\tString currentPlayer = (turn % 2 == 0) ? player1 : player2;\n\t\t\t\n\t\t\tint timeout = 1000 + rand.nextInt(1000);\n\t\t\t\n\t\t\ttry {\n\t\t\t\tTimeUnit.MILLISECONDS.sleep((long) timeout);\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t\n\t\t\tCard nextCard = deck.turnCard();\n\t\t\t\n\t\t\t// possible draw if no cards are left in the deck\n\t\t\tif (nextCard == null) {\n\t\t\t\tSystem.out.println(\"No cards left in the deck! It's a draw!\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tSystem.out.println(currentPlayer + \" turns card \\'\" + nextCard + \"\\'\");\n\t\t\t\n\t\t\tturn++;\n\t\t\t\n\t\t\t// trigger the end of the turning card loop\n\t\t\tif (nextCard.getCardRank() == previousCardRank) {\n\t\t\t\tsnapTime = true;\n\t\t\t}\n\t\t\tpreviousCardRank = nextCard.getCardRank();\n\t\t}\n\t\t\n\t\t// simulate the time needed for both players to say \"SNAP!\"\n\t\tint snapTimeoutP1 = 500 + rand.nextInt(1000);\n\t\tint snapTimeoutP2 = 500 + rand.nextInt(1000);\n\t\t\n\t\t// rare draw situation, if the two players say \"SNAP!\" at the same time\n\t\tif (snapTimeoutP1 == snapTimeoutP2) {\n\t\t\ttry {\n\t\t\t\tTimeUnit.MILLISECONDS.sleep((long) snapTimeoutP1);\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tSystem.out.println(\"SNAP! It's a draw!\");\n\t\t}\n\t\t// in most cases, a player will say \"SNAP!\" first, and they will be the winner\n\t\telse {\n\t\t\tString result = String.format(\"SNAP! %s is the winner!\", (snapTimeoutP1 < snapTimeoutP2) ? player1 : player2);\n\t\t\t\n\t\t\ttry {\n\t\t\t\tTimeUnit.MILLISECONDS.sleep((long) Math.min(snapTimeoutP1, snapTimeoutP2));\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tSystem.out.println(result);\n\t\t}\n\t}", "@Override\n public boolean onTouch(View v, MotionEvent event) {\n //Initialize an array to store the indices of the card being dragged\n //and set userClick to true to reset the clock\n int[] thisCard;\n userClick = true;\n\n /**\n * External Citation\n * Date: 19 September 2021\n * Problem: onTouch would only hit the case for action down\n * Resource: https://stackoverflow.com/questions/24287292/returning-true-\n * and-false-in-ontouch\n * Solution: I needed to return true. This resource helped me discover that\n */\n\n //Switch case for the action to analyze which state of the drag we are in\n switch(event.getActionMasked()) {\n\n //Case 1: User initially clicks card\n case MotionEvent.ACTION_DOWN:\n //Get the xy coordinates of the click and use it to find the\n //indices of the clicked card. Store these indices in new variables\n xLoc = event.getX();\n yLoc = event.getY();\n thisCard = findCard(xLoc, yLoc);\n xCard = thisCard[0];\n yCard = thisCard[1];\n\n //Error check to see if the user grabbed an invalid card\n //or no card at all\n if (xCard == -1) {\n return false;\n }\n if (cardArray[xCard][yCard].getCardNum() == 16) {\n return false;\n }\n\n //Populate the coordinate variables of the original card\n origX = cardArray[xCard][yCard].getXVal();\n origY = cardArray[xCard][yCard].getYVal();\n origBottomX = cardArray[xCard][yCard].getBottomX();\n origBottomY = cardArray[xCard][yCard].getBottomY();\n userClick = true;\n break;\n\n //Case 2: User is dragging\n case MotionEvent.ACTION_MOVE:\n //Update the coordinates of the card to map the users drag\n //Give an offset value so that the card is dragged from the middle\n cardArray[xCard][yCard].setXVal(event.getX() - 100);\n cardArray[xCard][yCard].setYVal(event.getY() - 100);\n cardArray[xCard][yCard].setBottomX(event.getX() + 200 - 100);\n cardArray[xCard][yCard].setBottomY(event.getY() + 200 - 100);\n\n //Update userClick to reset clock and didDrag so\n //that just a click is invalid\n userClick = true;\n didDrag = true;\n\n //Change the cards color to blue to show it is being dragged\n // and call invalidate\n //to reflect the dragging motion and change in color\n cardArray[xCard][yCard].setColor(0, 0, 255);\n invalidate();\n break;\n\n //Case 3: The user releases the drag\n case MotionEvent.ACTION_UP:\n //Set the card color back to red\n cardArray[xCard][yCard].setColor(255, 0, 0);\n\n //Error check to ensure the user dragged and did not just click\n //Then check if user dropped the card within the empty card\n if(didDrag == true) {\n if ((event.getX() >= blankCardTopX) &&\n (event.getX() <= blankCardBottomX) &&\n (event.getY() >= blankCardTopY) &&\n (event.getY() <= blankCardBottomY)) {\n\n //Check if the card and the empty card are neighbors\n if (arraySwap(xCard, yCard) == true) {\n //Update userClick to continue the clock\n //and reset didDrag for the next drag\n userClick = false;\n didDrag = false;\n\n //Call invalidate to show the swap change\n invalidate();\n return true;\n }\n\n //If arraySwap is not true then the card was not a neighbor\n //of the blank card. Send the card back to it's original\n // location and reset the original coordinates for the\n //next iteration. Call invalidate to reflect the changes\n else {\n cardArray[xCard][yCard].setXVal(origX);\n cardArray[xCard][yCard].setYVal(origY);\n cardArray[xCard][yCard].setBottomX(origX + 200);\n cardArray[xCard][yCard].setBottomY(origY + 200);\n origX = -1;\n origY = -1;\n origBottomX = -1;\n origBottomY = -1;\n blankCardTopX = -1;\n blankCardTopY = -1;\n blankCardBottomX = -1;\n blankCardBottomY = -1;\n userClick = false;\n didDrag = false;\n invalidate();\n }\n }\n\n //If the user did not drop the card into the empty cards bounds then\n //send the card back to its original location and reset all values\n else {\n cardArray[xCard][yCard].setXVal(origX);\n cardArray[xCard][yCard].setYVal(origY);\n cardArray[xCard][yCard].setBottomX(origX + 200);\n cardArray[xCard][yCard].setBottomY(origY + 200);\n origX = -1;\n origY = -1;\n origBottomX = -1;\n origBottomY = -1;\n blankCardTopX = -1;\n blankCardTopY = -1;\n blankCardBottomX = -1;\n blankCardBottomY = -1;\n userClick = false;\n didDrag = false;\n invalidate();\n }\n }\n break;\n }\n\n //Return true to recursively hit switch cases\n return true;\n }", "private void dealerTurns()\r\n\t{\r\n\t\t// loops until dealer stands or wins/loses\r\n\t\twhile ( !dealer.getStand() && !endGame )\r\n\t\t{\r\n\t\t\t// checks total score of dealer's hand\r\n\t\t\tif ( dealer.getTotal() < 17)\r\n\t\t\t{\r\n\t\t\t\t// adds card to dealer hand from cardDeck\r\n\t\t\t\tdealer.hit( cardDeck.draw() );\r\n\t\t\t\t\r\n\t\t\t\t// displays current dealer hand\r\n\t\t\t\tdisplayPlayerCards(DEALER_ID);\r\n\t\t\t\t\r\n\t\t\t\t// evaluates victory conditions\r\n\t\t\t\tevaluateWin(false);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t/* Dealer stands if they reach or already have 17 points in their hand.\r\n\t\t\t\tNo evaluation is called, because this will be handled by the final victory check. */\r\n\t\t\t\tdealer.stand();\r\n\t\t\t} // end if else\r\n\t\t} // end while\r\n\t}", "private boolean checkGameState() {\n\t\tint numberOfPlayers = this.manSys.lockedNavmap.size();\n\t\tfor (int i = 0; i < numberOfPlayers; i++) {\n\t\t\tif (!snakesList.get(i).isDestroyed()) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "private boolean playerWonGameWithDiagonalLine(Player player) {\n char playerSymbol = player.getType();\n if (boardState[0][0] == playerSymbol && boardState[1][1] == playerSymbol \n && boardState[2][2] == playerSymbol) {\n return true; \n } else if (boardState[0][2] == playerSymbol && boardState[1][1] == playerSymbol \n && boardState[2][0] == playerSymbol) {\n return true; \n }\n return false; \n }", "private void checkMouseClick()\n {\n MouseInfo userClick = Greenfoot.getMouseInfo();\n \n int columnNum;\n int rowNum;\n \n if( Greenfoot.mouseClicked(this) )\n {\n columnNum = userClick.getX() / ( getWidth() / 3 );\n rowNum = userClick.getY() / ( getHeight() / 3 );\n \n if( board[rowNum][columnNum] == \"\" )\n {\n if( PlayerOneTurn == true )\n {\n board[rowNum][columnNum] = \"X\";\n \n PlayerOneTurn = false;\n messageShown = false;\n }\n else\n {\n board[rowNum][columnNum] = \"O\";\n \n PlayerOneTurn = true;\n messageShown = false;\n }\n }\n else\n {\n JOptionPane.showMessageDialog( null, \"you should select a different spot.\", \"Wrong step\", JOptionPane.PLAIN_MESSAGE );\n }\n }\n \n }", "public void signalCheck() {\n if(moves.length == 0){\n setiHaveCheck(false);\n pathToKing = null;\n rangeOfCheck = null;\n }\n for(int i = 0; i < moves.length; i++) {\n Space tmp = Board.fetchSpace(moves[i]);\n if(tmp.getPiece() != null) {\n if(this.getType().charAt(0) != tmp.getPiece().getType().charAt(0) && tmp.getPiece().getType().charAt(1) == 'K') {\n setiHaveCheck(true);\n calcPathToKing(tmp);\n break;\n }\n else {\n setiHaveCheck(false);\n pathToKing = null;\n rangeOfCheck = null;\n }\n }\n else {\n setiHaveCheck(false);\n pathToKing = null;\n rangeOfCheck = null;\n }\n }\n }", "boolean isPlayerTurn();", "protected abstract boolean isCardActivatable(Card card);", "public void checkInputs() {\n\n gearShift = driveStick.getXButtonReleased();\n slow = driveStick.getAButtonReleased();\n\n manualClimb = driveStick.getBumper(Hand.kLeft) && driveStick.getBumper(Hand.kRight);\n\n //climbToggle = driveStick.getBumperReleased(Hand.kLeft);\n climbToggle = false;\n climbRelease = driveStick.getStartButton();\n\n resetBalls = gunnerStick.getStartButtonReleased();\n visionShoot = gunnerStick.getBButtonReleased();\n manualShoot = gunnerStick.getYButton();\n distShoot = gunnerStick.getAButton();\n intakeToggle = gunnerStick.getBumperReleased(Hand.kRight);\n hoodToggle = gunnerStick.getBumperReleased(Hand.kLeft);\n intakeReverse = gunnerStick.getXButtonReleased();\n magazineReverse = gunnerStick.getBackButton();\n\n\n //Switch statement to determine controls for the driver\n switch (driverScheme) {\n case \"Reverse Turning\":\n XSpeed = -driveStick.getY(Hand.kLeft);\n ZRotation = driveStick.getX(Hand.kRight);\n break;\n default:\n XSpeed = driveStick.getY(Hand.kLeft);\n ZRotation = -driveStick.getX(Hand.kRight);\n break;\n }\n\n //Switch statement to determine controls for the gunner\n switch (gunnerScheme) {\n case \"Fun Mode\":\n\n discoToggle = gunnerStick.getBackButtonReleased();\n break;\n\n default:\n\n // if ((gunnerStick.getTriggerAxis(Hand.kRight) >= 0.75) && (gunnerStick.getTriggerAxis(Hand.kLeft) >= 0.75) && !overriding) {\n // overrideSafeties = !overrideSafeties;\n // overriding = true;\n // } else if ((gunnerStick.getTriggerAxis(Hand.kRight) <= 0.75) && (gunnerStick.getTriggerAxis(Hand.kLeft) <= 0.75)) {\n // overriding = false;\n // }\n\n break;\n }\n }", "public boolean canDoBuildInitialRoad(){\n\t\t // If the player already has two roads on the board then he has already placed the initial roads\n\t\t if(playerPieces.getNumberOfRoads() < 14){\n\t\t\t return false;\n\t\t }\n\t\t return true;\n\t }", "private void checkBeforeMoving(final StoryPaths storyPath) {\n // Check resource requirements\n Resource resourceNeeded=storyPath.getResourceNeeded();\n if (resourceNeeded!=null) {\n int amountNeeded=storyPath.getAmountNeeded();\n if (resourceNeeded.getStock() < amountNeeded) {\n //TODO: change resourceNeeded to resourcesNeeded to support multiple resource requirements. need modify StoryPaths parsing.\n Toast.makeText(getApplicationContext(),\"Requires: \"+amountNeeded+\" \"+resourceNeeded.getName(),Toast.LENGTH_SHORT).show();\n return;\n }\n }\n // Create chance event prompt\n if (storyPath.isChanceEvent()) {\n double chance = storyPath.getChance();\n AlertDialog.Builder builder;\n builder = new AlertDialog.Builder(StoryActivity.this);\n builder.setTitle(\"CHANCE EVENT!\")\n .setMessage(\"You estimate that you have a \" + Math.round((1-chance) * 100) + \"% chance of succeeding in this action. Continue?\")\n .setPositiveButton(\"CONTINUE\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n moveToNextStoryNode(storyPath);\n }\n })\n .setNegativeButton(\"BACK\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n // do nothing\n }\n })\n .setIcon(android.R.drawable.ic_dialog_alert)\n .show();\n } else {\n moveToNextStoryNode(storyPath);\n }\n }", "public boolean isGameWon(){\r\n for(Card c: this.cards){\r\n if (c.getFace() == false){\r\n return false;\r\n }\r\n }\r\n return true;\r\n }", "private void checkCollision() {\n for (int i = snakeSize; i > 0; i--) {\n if (i>4 && x[0] == x[i] && y[0] == y[i]){\n isInGame=false;\n }\n }\n\n if (x[0] > FIELD_SIZE) {\n isInGame=false;\n }\n\n if (x[0] < 0) {\n isInGame=false;\n }\n\n if (y[0] > FIELD_SIZE) {\n isInGame=false;\n }\n\n if (y[0] < 0) {\n isInGame=false;\n }\n\n\n }", "public boolean checkDiagonal() {\n\t\t// conditions fo player X\n\t\tif ((bt[0].getText().equals(\"X\") && bt[4].getText().equals(\"X\") && bt[8].getText().equals(\"X\"))\n\t\t\t\t|| (bt[2].getText().equals(\"X\") && bt[4].getText().equals(\"X\") && bt[6].getText().equals(\"X\"))) {\n\t\t\tjtf.setText(\" PLAYER X WON!\");\n\t\t\tjtf.setForeground(Color.red);\n\t\t\tjtf.setFont(new Font(\"Arial Black\", Font.BOLD, 50));\n\t\t\tfor (i = 0; i < xo.length; i++) {\n\t\t\t\tbt[i].setEnabled(false);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\t// conditions fo player O\n\t\tif ((bt[0].getText().equals(\"O\") && bt[4].getText().equals(\"O\") && bt[8].getText().equals(\"O\"))\n\t\t\t\t|| (bt[2].getText().equals(\"O\") && bt[4].getText().equals(\"O\") && bt[6].getText().equals(\"O\"))) {\n\t\t\tjtf.setText(\" PLAYER O WON!\");\n\t\t\tjtf.setForeground(Color.blue);\n\t\t\tjtf.setFont(new Font(\"Arial Black\", Font.BOLD, 50));\n\t\t\tfor (i = 0; i < xo.length; i++) {\n\t\t\t\tbt[i].setEnabled(false);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public boolean checkForVictory() {\n // keep track of whether we have seen any pieces of either color.\n boolean anyWhitePieces = false;\n boolean anyRedPieces = false;\n // iterate through each row\n for (Row row : this.redBoard) {\n // whether we iterate through the red or white board does not matter; they contain the same pieces, just\n // in a different layout\n // iterate through each space in a row\n for (Space space : row) {\n // if there is a piece on this space\n if (space.getPiece() != null) {\n if (space.getPiece().getColor() == Piece.COLOR.RED) {\n // and if it's red, we have now seen at least one red piece\n anyRedPieces = true;\n } else if (space.getPiece().getColor() == Piece.COLOR.WHITE) {\n // and if it's white, we have now seen at least one white piece\n anyWhitePieces = true;\n }\n }\n }\n }\n // if we haven't seen any pieces of a color, then the other player has won\n if (!anyRedPieces) {\n // white player has won\n markGameAsDone(getWhitePlayer().getName() + \" has captured all the pieces.\");\n return true;\n } else if (!anyWhitePieces) {\n // red player has won\n markGameAsDone(getRedPlayer().getName() + \" has captured all the pieces.\");\n return true;\n }\n return false;\n }", "private void action() {\r\n moveSnake();\r\n if (hasEatenPowerUp() == false) checkForCollisionWithSelf();\r\n if (hasHitBoundry() == false) redraw();\r\n }", "public boolean wonGame() {\n for (int x = 0; x < maxX; x++) {\n for (int y = 0; y < maxY; y++) {\n if (snakeSquares[x][y] == NOT_A_SEGMENT) {\n //there is still empty space on the screen, so haven't won\n return false;\n }\n }\n }\n //But if we get here, the snake has filled the screen. win!\n SnakeGame.setGameStage(SnakeGame.GAME_WON);\n\n return true;\n }", "public void testCanPlayOn() {\n \n DrawCard redDraw2 = new DrawCard(Card.COLOUR_RED, 2);\n \n // create another 4 normal cards\n \n Card card1 = new Card(Card.COLOUR_BLUE, 5);\n Card card2 = new Card(Card.COLOUR_BLUE,2);\n \n //card 1 and card 2 should yield false on the method\n assertFalse(redDraw2.canPlayOn(card1));\n assertFalse(redDraw2.canPlayOn(card2));\n \n Card card3 = new Card(Card.COLOUR_RED, 5);\n Card card4 = new Card(Card.COLOUR_RED,2);\n \n // card 3 and card 4 should gives true\n \n assertTrue(redDraw2.canPlayOn(card3));\n assertTrue(redDraw2.canPlayOn(card4));\n \n }", "private boolean draw(Board board)\n {\n return full(board) && !computerWin(board) && playerWin(board);\n }", "public boolean buildNextStage(Player player, Card card){\n //TODO: build the next stage of the Wonder\n return false;\n }", "private boolean checkGameStatus() {\n int res = model.getWinner();\n if (res == Model.DRAW) {\n draw();\n return false;\n } else if (res == Model.WHITE) {\n whiteScore++;\n view.getPrompt().setText(whiteName + \" win!\");\n prepareRestart();\n return false;\n } else if (res == Model.BLACK) {\n blackScore++;\n view.getPrompt().setText(blackName + \" win!\");\n prepareRestart();\n return false;\n }\n return true;\n }", "public void checkWin() \n {\n if (lWin ==8)\n {\n Greenfoot.playSound(\"finalWin.wav\");\n setLocation(getWorld().getWidth() / 2, getWorld().getHeight() / 2);\n setImage(win);\n Greenfoot.stop();\n \n \n }\n \n if (rWin ==8)\n {\n \n \n Greenfoot.playSound(\"finalWin.wav\");\n setLocation(getWorld().getWidth() / 2, getWorld().getHeight() / 2);\n setImage(win);\n \n Greenfoot.stop();\n \n \n \n \n \n }\n \n }", "public boolean winCheck(){\n for(int i=0; i<3; i++){//goes through rows\n for(int j=0; j<4; j++){//goes through columns\n if(board[i][j+3] != 0 && board[i+1][j+2] != 0 && board[i+2][j+1] != 0 && \n board[i+3][j] != 0)\n if(board[i][j+3]==(board[i+1][j+2]))\n if(board[i][j+3]==(board[i+2][j+1]))\n if(board[i][j+3]==(board[i+3][j])){\n GBoard[i][j+3].setIcon(star);\n GBoard[i+1][j+2].setIcon(star);\n GBoard[i+2][j+1].setIcon(star);\n GBoard[i+3][j].setIcon(star);\n wonYet=true;\n return true;\n }\n }\n }\n //checks for subdiagonals\n for(int i=0; i<3; i++){//goes through rows\n for(int j=0; j<4; j++){//goes through columns\n if(board[i][j] != 0 && board[i+1][j+1] != 0 && board[i+2][j+2] != 0 &&\n board[i+3][j+3] != 0)\n if(board[i][j] == (board[i+1][j+1]))\n if(board[i][j] == (board[i+2][j+2]))\n if(board[i][j] == (board[i+3][j+3])){\n GBoard[i][j].setIcon(star);\n GBoard[i+1][j+1].setIcon(star);\n GBoard[i+2][j+2].setIcon(star);\n GBoard[i+3][j+3].setIcon(star);\n wonYet=true;\n return true;\n } \n }\n }\n //check horizontals\n for(int i=0; i<6; i++){//goes through rows\n for(int j=0; j<4; j++){//goes through columns\n if(board[i][j] != 0 && board[i][j+1] != 0 && board[i][j+2] != 0 && \n board[i][j+3] != 0){\n if(board[i][j]==(board[i][j+1]))\n if(board[i][j]==(board[i][j+2]))\n if(board[i][j]==(board[i][j+3])){\n GBoard[i][j].setIcon(star);\n GBoard[i][j+1].setIcon(star);\n GBoard[i][j+2].setIcon(star);\n GBoard[i][j+3].setIcon(star);\n wonYet=true;\n return true;\n }\n }\n }\n }\n //checks for vertical wins\n for(int i=0; i<3; i++){//checks rows\n for(int j=0; j<7; j++){//checks columns\n if(board[i][j] != 0 && board[i+1][j] != 0 && board[i+2][j] != 0 && \n board[i+3][j] != 0){\n if(board[i][j]==(board[i+1][j]))\n if(board[i][j]==(board[i+2][j]))\n if(board[i][j]==(board[i+3][j])){\n GBoard[i][j].setIcon(star);\n GBoard[i+1][j].setIcon(star);\n GBoard[i+2][j].setIcon(star);\n GBoard[i+3][j].setIcon(star);\n wonYet=true;\n return true;\n }\n }\n }\n }\n return false; \n }", "private void checkForPlayerChance()\n\t\t\t{\n\t\t\t\tf = false;\n\t\t\t\tfor (j = 0; j < 8; ++j)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (win[j] == 2 && lose[j] == 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tf = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\tif (f == false)\n\t\t\t\t\tj = 10;\n\n\t\t\t}", "public void VerifyButtons(){\n if (currentTurn.getSiguiente() == null){\n next_turn.setEnabled(false);\n } else{\n next_turn.setEnabled(true);\n }\n if (currentTurn.getAnterior() == null){\n prev_turn.setEnabled(false);\n } else{\n prev_turn.setEnabled(true);\n }\n if (current.getSiguiente() == null){\n next_game.setEnabled(false);\n } else{\n next_game.setEnabled(true);\n }\n if (current.getAnterior() == null){\n prev_game.setEnabled(false);\n } else{\n prev_game.setEnabled(true);\n }\n }", "public boolean checkShot(int row, int col) {\n /* invalid board position */\n if(row < 1 || col < 1 || row > (this.boardHeight-1) || col > (this.boardWidth-1))\n return false;\n \n /* We have a hit! */\n if(this.board[row][col] == 'S') {\n this.board[row][col] = 'X';\n \n /* check if this was the last part of a ship, if so decrement the\n * number of ships left */\n if(this.board[row+1][col] != 'S' && this.board[row][col+1] != 'S' &&\n this.board[row-1][col] != 'S' && this.board[row][col-1] != 'S') {\n numShips--;\n }\n \n return true;\n }\n /* Did they really shoot at the same spot again? */\n else if(this.board[row][col] == 'X' || this.board[row][col] == 'O') {\n /* do nothing, penalize them for their foolish double shot! */\n return false;\n }\n /* The must have missed then */\n else {\n this.board[row][col] = 'O';\n return false;\n }\n }", "private void checkToDrawAnotherCard(final SwccgGame game, final OptionalGameTextTriggerAction action, final String playerId) {\n if (GameConditions.hasReserveDeck(game, playerId)\n && GameConditions.numCardsInHand(game, playerId) < 6) {\n action.appendEffect(\n new PlayoutDecisionEffect(action, playerId,\n new YesNoDecision(\"Do you want to draw another card from Reserve Deck?\") {\n @Override\n protected void yes() {\n action.appendEffect(\n new DrawCardIntoHandFromReserveDeckEffect(action, playerId) {\n @Override\n protected void cardDrawnIntoHand(PhysicalCard cardDrawn) {\n checkToDrawAnotherCard(game, action, playerId);\n }\n }\n );\n }\n }\n )\n );\n }\n }", "public boolean checkWin (int totalPieces){\n\t\treturn isFull();\n\t}", "private boolean isCheckMate() {\n if (whitePlayer.getOccupiedSet().isEmpty()) {\n System.out.println(\"BLACK PLAYER WINS\");\n return true;\n }\n else if (blackPlayer.getOccupiedSet().isEmpty()) {\n System.out.println(\"WHITE PLAYER WINS\");\n return true;\n }\n else return false;\n }", "public boolean TapCard(float x, float y) { return false; }", "@Test\r\n public void testIsValidTap() {\r\n assertTrue(boardManager3.isValidTap(7));\r\n assertTrue(boardManager3.isValidTap(5));\r\n assertFalse(boardManager3.isValidTap(0));\r\n }", "private void drawCard1(){\n Shoe s = new Shoe(1);\n\n boolean[][] gotPicked=new boolean[4][13];\n\n for(int i=0; i<Deck.getNumCardsInDeck(); i++){\n Card c=s.drawCard();\n int st=c.getSuit();\n int rnk=c.getRank();\n gotPicked[st][rnk]=true;\n }\n\n for(int i=0; i<gotPicked.length;i++){\n for(int j=0;j<gotPicked[0].length;j++){\n Assert.assertTrue(gotPicked[i][j]);\n }\n }\n }", "private boolean validCapture(int xf, int yf) {\n if (!isPiece(xf, yf)) {\n return false; \n } else if (pieceAt(xf, yf).isFire() == firesTurn) {\n return false;\n } else {\n return true;\n }\n }", "public void catchCard(){\r\n changePlace(deck);\r\n changePlace(hand);\r\n }", "public boolean isGameDraw() {\n if (this.winner == 0 && isBoardFull() && this.gameStarted) {\n return true; \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 }", "public boolean checkDiagonalWin(){\n\t\treturn true;\n\t}", "private void calculate()\n {\n if( firstCard ==secondCard)\n {\n if (clickedFirst == 0)\n {\n iv_11.setVisibility(View.INVISIBLE);\n }\n if (clickedFirst == 1)\n {\n iv_12.setVisibility(View.INVISIBLE);\n }\n else if (clickedFirst == 2)\n {\n iv_13.setVisibility(View.INVISIBLE);\n }\n else if (clickedFirst == 3)\n {\n iv_14.setVisibility(View.INVISIBLE);\n }\n\n\n if (clickedSecond == 0)\n {\n iv_11.setVisibility(View.INVISIBLE);\n }\n else if (clickedSecond == 1)\n {\n iv_12.setVisibility(View.INVISIBLE);\n }\n else if (clickedSecond == 2)\n {\n iv_13.setVisibility(View.INVISIBLE);\n }\n else if (clickedSecond == 3)\n {\n iv_14.setVisibility(View.INVISIBLE);\n }\n }\n else\n {\n iv_11.setImageResource(R.drawable.ic_back);\n iv_12.setImageResource(R.drawable.ic_back);\n iv_13.setImageResource(R.drawable.ic_back);\n iv_14.setImageResource(R.drawable.ic_back);\n }\n\n iv_11.setEnabled(true);\n iv_12.setEnabled(true);\n iv_13.setEnabled(true);\n iv_14.setEnabled(true);\n\n //check if the game is over\n checkEnd();\n\n\n }", "private boolean checkOrTurn(int row,int column, ItemState itemStateCurrentPlayer, int x, int y) {\n\t\t if(column==Settings.nbrRowsColumns||column<0){\n\t\t\t return false; //Get the hell out\n\t\t }\n\t\t if(row==Settings.nbrRowsColumns||row<0){ \n\t\t\t return false; //Get the hell out\n\t\t }\n\t\t if (gameStateInt[row][column]==Helpers.getOpponentPlayerCorrespondingInt(itemStateCurrentPlayer)){ //Still another color\n\t\t\t if(checkOrTurn(row+y,column+x, itemStateCurrentPlayer, x, y)){ //continue check next\n\t\t\t\t\t changed.add(new Action(row,column));\n\t\t\t\t return true;\n\t\t\t }else{\n\t\t\t\t return false;\n\t\t\t }\n\t\t }else if (gameStateInt[row][column]==Helpers.getPlayerCorrespondingInt(itemStateCurrentPlayer)){\n\t\t\t return true; //found same color\n\t\t }else{\n\t\t\t return false; //found grass\n\t\t }\n\t }", "public boolean didEatAxe(Axe axe) {\n //Is this kibble in the snake? It should be in the same square as the snake's head\n if (axe.getKibbleX() == snakeHeadX && axe.getKibbleY() == snakeHeadY) {\n return axe.isVisible();\n }\n return false;\n }", "public boolean checkWin() {\r\n\t\tif (checkAcross() || checkDiagonal() || checkUpDown()) {\r\n\t\t\t//win = true;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public boolean isPickItUp(int playerID, Card discard){\n if(turn == playerID && gameStage == 1 && dealer == playerID){\n currentTrumpSuit = middleCardSuit;\n // make dealer discard a card and give them the middle card\n if(dealer == 0){\n //discard card that player taps\n if(player1Hand.get(0) == discard){\n player1Hand.remove(0);\n player1Hand.add(middleCard);\n turn++;\n gameStage = 3;\n }\n else if(player1Hand.get(1) == discard){\n player1Hand.remove(1);\n player1Hand.add(middleCard);\n turn++;\n gameStage = 3;\n }\n else if(player1Hand.get(2) == discard){\n player1Hand.remove(2);\n player1Hand.add(middleCard);\n turn++;\n gameStage = 3;\n }\n else if(player1Hand.get(3) == discard){\n player1Hand.remove(3);\n player1Hand.add(middleCard);\n turn++;\n gameStage = 3;\n }\n else if(player1Hand.get(4) == discard){\n player1Hand.remove(4);\n player1Hand.add(middleCard);\n turn++;\n gameStage = 3;\n }\n }\n }\n return false;\n }", "public boolean isHisTurn(UnoCard clickedCard) {\n\t\tfor (Player p : getPlayers()) {\n\t\t\tif (p.hasCard(clickedCard) && p.isMyTurn())\n\t\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public final boolean checkForDraw() {\r\n boolean result = false;\r\n String player = \"\";\r\n \r\n for (Rail rail : rails) {\r\n if (rail.isWinner()) {\r\n return false;\r\n }\r\n }\r\n \r\n if (tilesPlayed == 9) {\r\n draws++;\r\n // window.getStatusMsg().setText(DRAW_MSG); \r\n result = true;\r\n }\r\n \r\n return result;\r\n }", "public boolean canUseCard(Card card) {\r\n\t\tif (card.cardColor.contains(CardColor.GREEN)\r\n\t\t\t\t|| card.cardColor.contains(CardColor.GREY)) {\r\n\t\t\treturn false;\r\n\t\t} else if (this.blackTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.PURPLE)\r\n\t\t\t\t&& this.purpleTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.RED) && this.redTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BLUE)\r\n\t\t\t\t&& this.blueTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BROWN)\r\n\t\t\t\t&& this.brownTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else\r\n\t\t\treturn false;\r\n\t}", "private boolean diagWin(){ \r\n\t\treturn ((checkValue (board[0][0],board[1][1],board[2][2]) == true) || \r\n\t\t\t\t(checkValue (board[0][2], board[1][1], board[2][0]) == true)); \r\n\t}", "private boolean isNextMoveRochade(Move move)\r\n\t{\r\n\t\tif (!(move.from.piece instanceof King)) return false;\r\n\t\tint xDiffAbs = Math.abs(move.to.coordinate.x - move.from.coordinate.x); \r\n\t\treturn xDiffAbs == 2;\r\n\t}", "public boolean checkSavedGrid(UUID uuid, int slot, int updown) {\n TARDISARSMapData md = map_data.get(uuid);\n TARDISARSSaveData sd = save_map_data.get(uuid);\n int[][][] grid = sd.getData();\n int yy = md.getY() + updown;\n // avoid ArrayIndexOutOfBoundsException if gravity well extends beyond ARS area\n if (yy < 0 || yy > 2) {\n return false;\n }\n int[] coords = getCoords(slot, md);\n int xx = coords[0];\n int zz = coords[1];\n int prior = grid[yy][xx][zz];\n for (int i : room_ids) {\n if (prior == i) {\n return true;\n }\n }\n return false;\n }", "private boolean checkDraw()\n {\n \tboolean IsDraw = true;\n \tfor(int i =0;i<movesPlayed.length;i++)\n \t{\n \t\t//\"O\" or \"X\"\n \t\tif (!\"X\".equals(movesPlayed[i]) || !\"O\".equals(movesPlayed[i]))\n \t\t//if(movesPlayed[i] != 'X' || movesPlayed[i] != 'O')\n \t\t{\n \t\t\t//System.out.println(movesPlayed[i]);\n \t\t\t//System.out.println(\"False condition \");\n \t\t\tIsDraw = false;\n \t\t\treturn IsDraw;\n \t\t}\n \t}\n \t//System.out.println(\"true condition \");\n \t\n \treturn IsDraw;\n }", "public boolean checkForWin()\n {\n //Horizontal win\n for (int r = 0; r <= 5; r++)\n {\n for (int c = 0; c <= 3; c++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r] == player_turn &&\n current_board[c+2][r] == player_turn &&\n current_board[c+3][r] == player_turn)\n return true;\n }\n }\n //Vertical win\n for (int c = 0; c <= 6; c++)\n {\n for (int r = 0; r <= 2; r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c][r+1] == player_turn &&\n current_board[c][r+2] == player_turn &&\n current_board[c][r+3] == player_turn)\n return true;\n }\n }\n //Shortest diagonals/anti diagonals (cell length == 4)\n //postive slope\n if (current_board[0][2] == player_turn && current_board[1][3] == player_turn && current_board[2][4] == player_turn && current_board[3][5] == player_turn)\n return true;\n if (current_board[3][0] == player_turn && current_board[4][1] == player_turn && current_board[5][2] == player_turn && current_board[6][3] == player_turn)\n return true;\n //negative slope\n if (current_board[0][3] == player_turn && current_board[1][2] == player_turn && current_board[2][1] == player_turn && current_board[3][0] == player_turn)\n return true;\n if (current_board[3][5] == player_turn && current_board[4][4] == player_turn && current_board[5][3] == player_turn && current_board[6][2] == player_turn)\n return true;\n\n //Medium-length diagonals/anti diagonals (cell length == 5)\n //positive slope\n if (current_board[0][1] == player_turn && current_board[1][2] == player_turn && current_board[2][3] == player_turn && current_board[3][4] == player_turn)\n return true;\n if (current_board[1][2] == player_turn && current_board[2][3] == player_turn && current_board[3][4] == player_turn && current_board[4][5] == player_turn)\n return true;\n if (current_board[2][0] == player_turn && current_board[3][1] == player_turn && current_board[4][2] == player_turn && current_board[5][3] == player_turn)\n return true;\n if (current_board[3][1] == player_turn && current_board[4][2] == player_turn && current_board[5][3] == player_turn && current_board[6][4] == player_turn)\n return true;\n //negative slope\n if (current_board[0][4] == player_turn && current_board[1][3] == player_turn && current_board[2][2] == player_turn && current_board[3][1] == player_turn)\n return true;\n if (current_board[1][3] == player_turn && current_board[2][2] == player_turn && current_board[3][1] == player_turn && current_board[4][0] == player_turn)\n return true;\n if (current_board[2][5] == player_turn && current_board[3][4] == player_turn && current_board[4][3] == player_turn && current_board[5][2] == player_turn)\n return true;\n if (current_board[3][4] == player_turn && current_board[4][3] == player_turn && current_board[5][2] == player_turn && current_board[6][1] == player_turn)\n return true;\n\n //Longest diagonals/anti diagonals (cell length == 6)\n //positive slope\n for (int c=0, r=0; c <= 2 && r <= 2; c++, r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r+1] == player_turn &&\n current_board[c+2][r+2] == player_turn &&\n current_board[c+3][r+3] == player_turn)\n return true;\n }\n for (int c=1, r=0; c <= 3 && r <= 2; c++, r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r+1] == player_turn &&\n current_board[c+2][r+2] == player_turn &&\n current_board[c+3][r+3] == player_turn)\n return true;\n }\n //negative slope\n for (int c=0, r=5; c <= 2 && r >= 3; c++, r--)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r-1] == player_turn &&\n current_board[c+2][r-2] == player_turn &&\n current_board[c+3][r-3] == player_turn)\n return true;\n }\n for (int c=1, r=5; c <= 3 && r >= 3; c++, r--)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r-1] == player_turn &&\n current_board[c+2][r-2] == player_turn &&\n current_board[c+3][r-3] == player_turn)\n return true;\n }\n\n return false;\n }", "@Override\n public boolean isUsable(Player player, boolean firstTurn) {\n\n return player.canPlaceOnThisTurn(firstTurn) && player.canUseCardOnThisTurn(firstTurn) && player.getGrid().getPlacedDice() >0;\n }", "public void isOrderUpTrump(int playerID){\n if(turn == playerID && gameStage == 1 && dealer != 0){\n currentTrumpSuit = middleCardSuit;\n // make dealer discard a card and give them the middle card\n if(dealer == 1){\n // remove a card from the player's hand and add the middle card\n player2Hand.remove(2);\n player2Hand.add(middleCard);\n turn = 2;\n gameStage = 3;\n }\n else if(dealer == 2){\n // remove a card from the player's hand and add the middle card\n player3Hand.remove(2);\n player3Hand.add(middleCard);\n turn = 3;\n gameStage = 3;\n }\n else if(dealer == 3){\n // remove a card from the player's hand and add the middle card\n player4Hand.remove(2);\n player4Hand.add(middleCard);\n turn = 0;\n gameStage = 3;\n }\n }\n }" ]
[ "0.64403737", "0.6320917", "0.62064457", "0.6145509", "0.61358875", "0.6085974", "0.6075557", "0.6057143", "0.6029872", "0.60294694", "0.6023852", "0.59813577", "0.5966225", "0.5957991", "0.5909138", "0.5894764", "0.58906764", "0.58823514", "0.5874369", "0.5872806", "0.58367735", "0.58360046", "0.58347815", "0.5826134", "0.5820533", "0.58129257", "0.5812207", "0.5804272", "0.5800937", "0.5795331", "0.5787567", "0.57787657", "0.5778139", "0.57755595", "0.5759388", "0.5757606", "0.57509065", "0.57475084", "0.5742034", "0.57310766", "0.57209885", "0.5716627", "0.5705006", "0.5704723", "0.56969035", "0.56937265", "0.568433", "0.5683625", "0.56750417", "0.5665877", "0.56594056", "0.5657567", "0.5657385", "0.5652756", "0.56509614", "0.5640403", "0.5638809", "0.56258094", "0.5622293", "0.5619784", "0.5606981", "0.56036127", "0.5603608", "0.5594714", "0.55879647", "0.55879414", "0.5585248", "0.5581671", "0.55815446", "0.5573506", "0.5572596", "0.55725145", "0.5571558", "0.5570198", "0.55696183", "0.55649555", "0.5560248", "0.5559396", "0.5559353", "0.55584115", "0.5557429", "0.5555592", "0.5555317", "0.55498224", "0.5548817", "0.55409056", "0.5538661", "0.5537278", "0.5529729", "0.55273217", "0.55163026", "0.55149287", "0.5514771", "0.5507173", "0.55048984", "0.5503831", "0.5501825", "0.54988444", "0.549655", "0.5495155" ]
0.81145954
0
The H key shows/hides the help instructions scene
@Override public void handle(long now) { if (keyListeners.get(KeyCode.H)) { view.moveInstructions(); keyListeners.put(KeyCode.H, false); } //The space bar turns a new card if ((view.getInstructions().getHidden()) && keyListeners.get(KeyCode.SPACE)){ turnCard(); displayPlayers(); } checkSnap(); resetKeys(); if (game.getGameOver()) { endGame(); this.stop(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void ShowHelpScreen() {\n ToggleVisibility(HelpPage.window);\n }", "public void displayHelpMenuView()\n {\n System.out.println(\"\\nHelp menu selected.\");\n }", "void showHelp() {\n\t\tif (helpScreen == null) {\n\t\t helpScreen = new Form(\"Walking Help\");\n\t\t helpScreen.append(\"^ = walk forward\\n\");\n\t\t helpScreen.append(\"v = walk backwards\\n\");\n\t\t helpScreen.append(\"< = turn left\\n\");\n\t\t helpScreen.append(\"> = turn right\\n\");\n\t\t helpScreen.append(\"fire = change reverb manually\\n\");\n\t\t}\n\t\thelpScreen.addCommand(toggleCommand);\n\t\thelpScreen.setCommandListener(this);\n\t\tdisplay.setCurrent(helpScreen);\n }", "public void helpPressed() {\n Stage mainStage = (Stage)pane.getScene().getWindow();\n PresentationCtrl.getInstance().showNotification(\"Information\", \"Information\", null,\n \"- Click <Clear> button to clear the history\\n\\n- Click <Refresh> button to refresh the history\" +\n \"\\n\\n- Double clicks on a row to see the detailed information\", mainStage);\n }", "@FXML\n public void handleHelp() {\n if (!helpWindow.isShowing()) {\n helpWindow.show();\n } else {\n helpWindow.focus();\n }\n }", "public void handleHelp() {\n if (!helpWindow.isShowing()) {\n helpWindow.show();\n } else {\n helpWindow.focus();\n }\n }", "private void showHelpDialog() {\n\n view.helpDialog();\n }", "private void btn_HelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_HelpActionPerformed\n // go to help screen\n SIHS = new HelpScreen(value);\n SIHS.setVisible(true);\n\n\n }", "protected void handleHelp(ActionEvent event) {\n\t}", "public void showHelp();", "@Override\n\tprotected void handleHelp(ClickEvent event) {\n\t\t\n\t}", "private void showHelp() {\n System.out.println(\"new: \");\n System.out.println(\"new chess and throw the chess bevor away\");\n System.out.println(\"move from to:\");\n System.out.println(\"take the pawn from position from to position to \");\n System.out.println(\"print:\");\n System.out.println(\"print the chess now \");\n System.out.println(\"help:\");\n System.out.println(\"show help\");\n System.out.println(\"quit:\");\n System.out.println(\"quit out\");\n }", "public void showHelp(CommandSender sender) {\n\t\t\n\t}", "@Override\r\n public final void display() {\r\n System.out.println(\"\\n\\t===============================================================\");\r\n System.out.println(\"\\tEnter the letter associated with one of the following commands:\");\r\n \r\n for (String[] menuItem : HelpMenuView.menuItems) {\r\n System.out.println(\"\\t \" + menuItem[0] + \"\\t\" + menuItem[1]);\r\n }\r\n System.out.println(\"\\t===============================================================\\n\");\r\n }", "public static void displayHelp() {\n\t\thelp = getInstance();\n\t\tUIMain.popUpHelp(commandList, inputCommand);\t\n\t\tLoggingLogic.logging(HELP_MESSAGE);\n\t}", "@FXML\n public void help() {\n dialogContainer.getChildren().addAll(\n DialogBox.getDukeDialog(HelpCommand.HELP, dukeImage)\n );\n }", "protected void HelpActionPerformed(ActionEvent e) {\n\t\tthis.setVisible(false);\n\t\tHelp frame = new Help();\n\t\tframe.UpFrame=this;\n\t\tframe.setVisible(true);\n\t}", "public void aboutMenu(ActionEvent actionEvent) {\n anchorHelp.setVisible(true);\n paneNotation.setVisible(false);\n paneAbout.setVisible(true);\n }", "public boolean isHelpMode();", "public static void help() {\n System.out.println(\"MENU : \");\n System.out.println(\"Step 1 to create a default character.\"); // create and display a character\n System.out.println(\"Step 2 to display characters.\");\n System.out.println(\"Step 3 to choice a character for list his details. \");\n System.out.println(\"Step 4 to start fight between 2 characters\");\n System.out.println(\"step 5 to remove a character.\");\n System.out.println(\"step 6 to create a Warrior.\");\n System.out.println(\"step 7 to create a Wizard.\");\n System.out.println(\"step 8 to create a Thief.\");\n System.out.println(\"Step 9 to exit the game. \");\n System.out.println(\"Step 0 for help ....\");\n\n }", "@Override\n \t\t\t\tpublic void doHelp() {\n \n \t\t\t\t}", "public void HelpTopicsActionPerformed(java.awt.event.ActionEvent evt) {\n\n HelpWindow helpWindow = new HelpWindow(this);\n helpWindow.setVisible(true);\n\n\n // HTMLDisplay helpdisplay = new HTMLDisplay( str, \"TerpPaint Help\" );\n //\t helpdisplay.setVisible( true );\n // System.out.println(\"help topics\");\n }", "void showAbout() {\n\t\tif (aboutScreen == null) {\n\t\t aboutScreen = new Form(\"About AMMS Mansion demo\");\n\t\t aboutScreen.append(\"This MIDlet demonstrates the 3D audio capabilities of AMMS API.\\n\");\n\t\t aboutScreen.append(\"\\n\");\n\t\t aboutScreen.append(\"Copyright (c) 2006 Nokia. All rights reserved.\\n\");\n\t\t aboutScreen.append(\"\\n\");\n\t\t aboutScreen.append(\"\\n\");\n\t\t}\n\t\taboutScreen.addCommand(toggleCommand);\n\t\taboutScreen.setCommandListener(this);\n\t\tdisplay.setCurrent(aboutScreen);\n }", "public void help() {\n System.out.println(\"Type 'commands' to list all \" +\n \"available commands\");\n System.out.println(\"Type 'start' to play game\");\n System.out.println(\"Player to remove the last stone loses!\");\n System.out.println();\n }", "public void showInstructionsPanel()\n {\n setWidgetAsExample(introPanel);\n }", "@Override\n\t\t\tpublic void handle(ActionEvent event) {\n\t\t\t\tlogger.info(\"click rootstage's help button\");\n\t\t\t\tshowRootDocumentScreen(ID_HELP);\n\t\t\t}", "private void showHelp() {\n\t\tif (_OpenHelpFrame != null) {\n\t\t\t_OpenHelpFrame.requestFocus();\n\t\t\treturn;\n\t\t}\n\n\t\tfinal JTextArea textPane = new JTextArea();\n\t\ttextPane.setEditable(JEntityEditor.this.security.level >= JEntityEditor.this.entity\n\t\t\t\t.getPermission(Entity.PERMISSION_EDIT_HELP).level);\n\t\ttextPane.setLineWrap(true);\n\t\ttextPane.setWrapStyleWord(true);\n\t\ttextPane.setText(state.help == null ? \"\" : state.help);\n\n\t\t_OpenHelpFrame = new JFrame();\n\t\t_OpenHelpFrame.setMinimumSize(new Dimension(300, 400));\n\t\t_OpenHelpFrame.setModalExclusionType(Dialog.ModalExclusionType.NO_EXCLUDE);\n\t\t_OpenHelpFrame.setAlwaysOnTop(true);\n\t\t_OpenHelpFrame.setLocationRelativeTo(this);\n\t\t_OpenHelpFrame.setLocation(this.getWidth(), 0);\n\t\t_OpenHelpFrame.setTitle(\"Help\");\n\t\t_OpenHelpFrame.addWindowListener(new WindowListenerAdapter() {\n\n\t\t\t@Override\n\t\t\tprotected void event(WindowEvent e) {\n\t\t\t\tif (e.getID() != WindowEvent.WINDOW_CLOSING && e.getID() != WindowEvent.WINDOW_CLOSED)\n\t\t\t\t\treturn;\n\t\t\t\tif (security.level >= JEntityEditor.this.entity.getPermission(Entity.PERMISSION_EDIT_HELP).level)\n\t\t\t\t\tstate.help = textPane.getText();\n\t\t\t\t_OpenHelpFrame = null;\n\t\t\t}\n\t\t});\n\t\t_OpenHelpFrame.add(new JScrollPane(textPane));\n\t\t_OpenHelpFrame.setVisible(true);\n\t}", "private void showHelp() {\n\t\tJOptionPane.showMessageDialog(this, \"Created by Mario Bobić\", \"About File Encryptor\", JOptionPane.INFORMATION_MESSAGE);\n\t}", "public void newHelp() {\n\t\tif(helpWindow){\n\t\t\tJOptionPane.showMessageDialog(null, \"Une fenêtre d'aide est déjà ouverte.\");\n\t\t}\n\t\telse {\n\t\t\thelpWindow = true;\n\t\t\t\n\t\t\tJFrame aide = new JFrame();\n\t\t\t\n\t\t\taide.setTitle(\"Aide\");\n\t\t\taide.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);\n\t\t\taide.setSize(700,500);\n\t\t\taide.setLocationRelativeTo(null);\n\t\t\taide.setVisible(true);\n\n\t\t\tJTextArea helpText = new JTextArea();\n\t\t\thelpText.setText(Constants.HELP);\n\t\t\thelpText.setEditable(false);\n\n\t\t\tJScrollPane scrollbar = new JScrollPane(helpText);\n\t\t\tscrollbar.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);\n\t\t\tscrollbar.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);\n\n\t\t\taide.add(scrollbar);\n\t\t\t\n\t\t\taide.addWindowListener(new WindowAdapter() {\n\t\t\t public void windowClosed(WindowEvent e) {\n\t\t\t \thelpWindow = false;\n\t\t\t }\n\t\t\t});\n\t\t}\n\t}", "public static void printHelpGuide() {\n printDivider();\n System.out.println(\"Help arrives!\\n\");\n printUserGuide();\n printDivider();\n }", "public void showInstructionsPanel() {\n\t\tsetWidgetAsExample(introPanel);\n\t}", "private void mnHelpActionPerformed(java.awt.event.ActionEvent evt) {\n\n }", "private static void displayHelp(){\n System.out.println(\"-host hostaddress: \\n\" +\n \" connect the host and run the game \\n\" +\n \"-help: \\n\" +\n \" display the help information \\n\" +\n \"-images: \\n\" +\n \" display the images directory \\n\" +\n \"-sound: \\n\" +\n \" display the sounds file directory \\n\"\n\n );\n }", "public void updateHelp() {\n\tif (help != null) {\n\t help.setTitle(helpPrefix + title);\n\t help.setContent(getHelp());\n\t if (followPos) {\n\t\thelp.focusOn(this, helpYoffset);\n\t } else {\n\t\thelp.setDefaultPos();\n\t\thelp.hideArrow();\n\t }\n\t}\n }", "protected void do_mntmStudentIHelp_actionPerformed(ActionEvent arg0) {\n\t\tDelVecchioMCSRStudentHelpFrame studentHelpFrame = new DelVecchioMCSRStudentHelpFrame();\n\t\tstudentHelpFrame.setVisible(true);\n\t\t\n\t}", "public void help(View v) {\n\t // Do something in response to button\n\t\tIntent intent = new Intent(this, Help.class);\n\t startActivity(intent);\n\n\t}", "private void setHelp() {\n\t\tHelpOpt.add(\"-h\");\n\t\tHelpOpt.add(\"/h\");\n\t\tHelpOpt.add(\"help\");\n\t}", "private void jMenu_HelpTabMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu_HelpTabMouseClicked\n DigPopGUIUtilityClass.loadDefaultHelpGUIByScreenName(SCREEN_NAME);\n }", "@FXML\n private void showHelp(ActionEvent actionEvent)\n {\n DialogBox.showInformation(\"Welcome To Keycrypt\",\n \"Enter the password which corresponds to your access level. \" +\n \"Ask your system administrator which password you have access to.\\n\\n\" +\n \"The password entered will grant you access only to specific directories \" +\n \"within the application.\");\n }", "public void helpAboutAction() {\n new HelpAbout(this.parentFrame);\n }", "public void helpRequested(HelpEvent event) {\r\n }", "private void helpDocItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helpDocItemActionPerformed\n helpBox.setVisible(true);\n }", "public void jMenuHelpAbout_actionPerformed(ActionEvent e) {\n }", "public void displayMenu()\n {\n System.out.println(\"-----------------Welcome to 256 Game------------------\");\n System.out.println(\"press 1 to register a player\");\n System.out.println(\"press 2 to start a new game\");\n System.out.println(\"press 3 to view a help menu\");\n System.out.println(\"press 4 to exist\");\n System.out.println(\"------------------------------------------------------\");\n }", "private void helpAbout() {\n JOptionPane.showMessageDialog(this, new ConsoleWindow_AboutBoxPanel1(), \"About\", JOptionPane.PLAIN_MESSAGE);\n }", "public void printHelp() \n {\n System.out.println(\"You are lost. You are alone. You wander\");\n System.out.println(\"around at the university.\");\n System.out.println();\n System.out.println(\"Your command words are:\");\n System.out.println(\" go quit help\");\n }", "@FXML\n public void handleHelp() {\n HelpWindow helpWindow = new HelpWindow();\n\t\tTemplateClass.instrum(\"LineNumber: \",\"191\", \"Type: \",\"org.eclipse.jdt.core.dom.VariableDeclarationStatement\", \"Method: \",\"handleHelp\", \"Class: \",\"MainWindow\", \"VariableName: \",\"HelpWindow\", \"VariableName: \",\"helpWindow\", \"VariableName: \",\"HelpWindow\");\n helpWindow.show();\n\t\tTemplateClass.instrum(\"LineNumber: \",\"192\", \"Type: \",\"org.eclipse.jdt.core.dom.ExpressionStatement\", \"Method: \",\"handleHelp\", \"Class: \",\"MainWindow\");\n }", "@Override\n\tpublic void sendHelp(ICommandSender sender) {\n\t}", "public void help();", "@Override\n public void help(CommandSender sender) {\n \n }", "@Override\n public void actionPerformed(ActionEvent e) {\n helpPopUp();\n }", "public JMenu helpMenu() {\r\n final JMenu helpMenu = new JMenu(\"Help\");\r\n helpMenu.setMnemonic(KeyEvent.VK_H);\r\n final JMenuItem about = new JMenuItem(\"About...\");\r\n about.setMnemonic(KeyEvent.VK_A);\r\n about.addActionListener((theEvent) -> {\r\n final ImageIcon img = new ImageIcon(\"images//Lion.png\");\r\n final String sb = \"TCSS 305\\nAutumn 2016\\nKeldon Fischer\\n\";\r\n JOptionPane.showMessageDialog(null, sb, \r\n \"About\", \r\n JOptionPane.PLAIN_MESSAGE, img);\r\n });\r\n helpMenu.add(about);\r\n \r\n return helpMenu;\r\n }", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\tg.printHelp(\"OthelloHelp.txt\");\n\t}", "protected void showHelp() {\n try {\n String appletPath = getClass().getName().replace('.', '/');\n URL url = new URL(getCodeBase(), appletPath+\"Help.html\");\n getAppletContext().showDocument(url, \"Help\");\n } catch (IOException e) {\n showStatus(\"Help file not found\");\n }\n\n }", "private static void help() {\n System.out.println(\"Supported Command List:\");\n System.out.println(\"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\");\n System.out.println(\"To draw canvas press: C <width> <height>\");\n System.out.println(\"To draw rectangle press: R <x1> <y1> <x2> <y2>\");\n System.out.println(\"To draw Line press : L <x1> <y1> <x2> <y2>\");\n System.out.println(\"To fill canvas press : B <x> <y> <c>\");\n System.out.println(\"To quit press: Q\");\n System.out.println(\"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\");\n System.out.println();\n }", "@Override\n public void help() {\n\n }", "private void doHelp()\r\n {\r\n Help.showHelp(page, ref, null);\r\n }", "public void showInstructions()\n {\n //make the instructions window visible\n instructionScreen.setVisible(true);\n }", "void help();", "private void setupHelpButton() {\n\t\tImageIcon help_button_image = new ImageIcon(parent_frame.getResourceFileLocation() + \"help.png\");\n\t\tJButton help_button = new JButton(\"\",help_button_image);\n\t\thelp_button.setBorderPainted(false);\n\t\thelp_button.setBounds(1216, 24, 100, 100);\n\t\thelp_button.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tHelp help_frame=new Help(PanelID.Quiz);\n\t\t\t\thelp_frame.setVisible(true);\n\t\t\t\tinput_from_user.requestFocusInWindow();//gets focus back to the spell here field\n\t\t\t}\n\t\t});\n\t\thelp_button.addMouseListener(new VoxMouseAdapter(help_button,null));\n\t\tadd(help_button);\n\t}", "public void showTitleScreen() {\n frame.showMenu();\n }", "public boolean isFullHelpMode();", "private void showHelpFragment() {\n if (!helpFragment.isVisible()) {\n FragmentManager manager = getFragmentManager();\n FragmentTransaction transaction = manager.beginTransaction();\n transaction.add(R.id.relativeLayout, helpFragment, \"helpFragment\");\n transaction.commit();\n }\n\n else getFragmentManager().beginTransaction().remove(getFragmentManager().findFragmentByTag(\"helpFragment\")).commit();\n }", "public void openHelp(View view) {\n setViewBackgroundWithoutResettingPadding(view, R.drawable.bkg_button_on);\n\n // Starts the new activity\n Intent intent = new Intent(this, HelpActivity.class);\n startActivity(intent);\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\n\t\t\t\tKF5SDKConfig.INSTANCE.startHelpCenterActivity(MainActivity.this, HelpCenterType.HELPCENTERDEFAULT );\n\n\t\t\t}", "private void help() {\n System.out.println(\"PLACE X,Y,F #Placing the robot in (X,Y) facing F. \\n\" +\n \"\\tX and Y are numbers between 0 AND 5, F is NORTH, EAST, WEST, SOUTH directions\\n\" +\n \"MOVE #Move one position towards the current direction\\n\" +\n \"LEFT #Turn left\\n\" +\n \"RIGHT #Turn right\\n\" +\n \"REPORT #Prints current position and the direction\\n\" +\n \"HELP #Help menu\");\n }", "@FXML public void handleSentimentRelatedFeaturesHelp() {\n\t\t// Help.help(HelpConstants.FeaturesSets.BASIC_SENTIMENT_BASED_FEATURES);\n\t\ttry {\n\t\t\tRuntime.getRuntime().exec(\"hh.exe \" + Constants.helpFile + \"::1- Sentiment Features.html\");\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void HelpButtonClick(View view) {\n GeneralHelper.ShowHelpInWishActivity(\"step_test.html\", \"\", this);\n return;\n }", "public void launchHelp(View view){\n Intent intent = new Intent(this, HelpActivity.class);\n startActivity(intent);\n }", "public void help()\r\n {\r\n \tJFrame insScr=new JFrame(\"Instructions\");\r\n \tJLabel instructions=new JLabel(new ImageIcon(getClass().getResource(\"Instructions.png\")));\r\n \t\r\n insScr.add(instructions);\r\n insScr.setSize(900,600);\r\n insScr.setVisible(true);\r\n \r\n Dimension screenLoc=Toolkit.getDefaultToolkit().getScreenSize();\r\n\t\tinsScr.setLocation(screenLoc.width/2-insScr.getSize().width/2, screenLoc.height/2-insScr.getSize().height/2);\r\n \r\n }", "private void helpWindow() {\n\n\t\t// Open a new window\n\t\tJFrame frame2 = new JFrame(\"Help\");\n\n\t\t// Create mainPanel2\n\t\tContainer mainPanel2 = frame2.getContentPane();\n\t\tmainPanel2.setLayout(new BoxLayout(mainPanel2, BoxLayout.Y_AXIS));\n\t\tmainPanel2.setForeground(Color.WHITE);\n\t\tmainPanel2.setBackground(Color.BLACK);\n\n\t\t// Add a jeditorpane\n\t\tJEditorPane instructions = new JEditorPane();\n\t\tinstructions.setText(\"TO PLAY NOTES:\\n \" + \"Click a key or use the following format: \\n \"\n\t\t\t\t+ \"\tA B B A --> Basic musical notes \\n\" + \"\tD# --> Make a note sharp \\n\"\n\t\t\t\t+ \"\tA R C --> R adds a rest \\n\" + \"\tE5 --> Play E in 5th octave \\n\"\n\t\t\t\t+ \"\tC5q+E5q+G5q A+G A+G --> Play chord using +\\n\\n\"\n\t\t\t\t+ \"To change note lengths the following characters can be used:\\n\" + \"\tw whole\\n\" + \"\th half\\n\"\n\t\t\t\t+ \"\tq quarter\\n\" + \"\ti eighth\\n\" + \"\ts sixteenth\\n\\n\" + \"TO PLAY RHYTHMS:\\n\"\n\t\t\t\t+ \"The following drum sounds are available:\\n\" + \"\tO bass drum\\n\" + \"\to bass drum 2\\n\"\n\t\t\t\t+ \"\t^ hi hat\\n\" + \"\t* snare drum\\n\" + \"\t! crash cymbal\\n\" + \"\t. ride cymbal\");\n\t\tinstructions.setForeground(Color.WHITE);\n\t\tinstructions.setBackground(Color.BLACK);\n\t\tinstructions.setFont(new Font(\"Ariel\", Font.PLAIN, 16));\n\n\t\t// Add instructions to the mainPanel\n\t\tmainPanel2.add(instructions);\n\n\t\t// Set the frame size and visible\n\t\tframe2.setSize(500, 550);\n\t\tframe2.setVisible(true);\n\n\t}", "private JMenu setupHelpMenu(final MyBoardPanel theBoardPanel,\n final MyBoardPanel theSecondBoardPanel) {\n final JMenu help = new JMenu(\"Help\");\n help.setMnemonic(KeyEvent.VK_H);\n \n final JMenuItem aboutItem = new JMenuItem(\"About\");\n aboutItem.setMnemonic(KeyEvent.VK_A);\n aboutItem.addActionListener(new ActionListener() {\n\n @Override\n public void actionPerformed(final ActionEvent theEvent) {\n myAboutPanel.setVis();\n if (!myPauseItem.isSelected()) {\n myPauseItem.doClick();\n }\n theBoardPanel.pauseGame();\n theSecondBoardPanel.pauseGame();\n }\n });\n help.add(aboutItem);\n return help;\n }", "Menu getMenuHelp();", "@Override\n\t\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\t\tJFrame hel=new JFrame(\"help\");\n\t\t\t\t\thel.setBounds(400, 200,675, 575);\n\t\t\t\t\thel.setResizable(false);\n\t\t\t\t\tJLabel l=new JLabel();\n\t\t\t\t\tl.setIcon(new ImageIcon(\"about.png\"));\n\t\t\t\t\n\t\t\t\t\thel.add(l);\n\t\t\t\t\thel.setVisible(true);\n\t\t\t\t}", "private void printHelp() \n {\n System.out.println(\"You are lost. You are alone. You wander\");\n System.out.println(\"around at the university.\");\n System.out.println();\n System.out.println(\"Your command words are:\");\n parser.showCommands();\n }", "@FXML\r\n\tvoid help_btn_clicked(MouseEvent event) {\r\n\t\tDialog<String> dia = new Dialog<>();\r\n\t\tStage stage = (Stage) dia.getDialogPane().getScene().getWindow();\r\n\t\tDialogPane dialogPane = dia.getDialogPane();\r\n\t\tdialogPane.getStylesheets().add(getClass().getResource(\"/client/boundry/dialog.css\").toExternalForm());\r\n\t\tdialogPane.getStyleClass().add(\"dialog\");\r\n\t\tdia.setTitle(\"Help Dialog\");\r\n\t\tdia.setHeaderText(\"Guide:\");\r\n\t\tdia.setGraphic(new ImageView(this.getClass().getResource(\"/icons8-info-48.png\").toString()));\r\n\t\t// Add a custom icon.\r\n\t\tstage.getIcons().add(new Image(this.getClass().getResource(\"/icons8-help-24.png\").toString()));\r\n\t\tdia.getDialogPane().getButtonTypes().addAll(ButtonType.OK);\r\n\t\tdia.setContentText(\r\n\t\t\t\t\"Main Sale Pattern Screen\\nIn this screen you can choose sale from table,add sale, delete and open\\n\"\r\n\t\t\t\t\t\t+ \"for full information, click on specific sale and choose an action, in addition you can click\"\r\n\t\t\t\t\t\t+ \"on \\\"Statistics\\\" for statistic inforamtion\");\r\n\t\tdia.show();\r\n\t}", "public void testHelp() {\n // increasing time because opening of help window can last longer on slower machines\n JemmyProperties.setCurrentTimeout(\"JMenuOperator.PushMenuTimeout\", 60000);\n // open \"Help|Contents\"\n HelpOperator helpOper = HelpOperator.invoke();\n // check help window opened\n // title is \"Help - All\"\n helpOper.close();\n }", "protected void ACTION_B_HELP(ActionEvent arg0) {\n\t\t\r\n\t\tString msg = \"Network Packet Sniffer is JAva packet capturing and traffic analysis application\"\r\n\t\t\t\t+ \"\\n CAPTURE : Start capturing packets on the interface\"\r\n\t\t\t\t+ \"\\nSTOP : Stop capturing packets on the interface\"\r\n\t\t\t\t+ \"\\n LIST : List Network Interfaces on the host\"\r\n\t\t\t\t+ \"\\n SELECT : Select Interface to capture Packets with\"\r\n\t\t\t\t+ \"\\n FILTER : Filter on the selected port when filtering is enabled\"\r\n\t\t\t\t+ \"\\n ENABLE : Enable Port Filtering\"\r\n\t\t\t\t+ \"\\n HELP : Displays the help screen\"\r\n\t\t\t\t+ \"\\n SAVE : Save the information about the packet\"\r\n\t\t\t\t+ \"\\n LOAD : Load the saved data on the interface \"\r\n\t\t\t\t+ \"\\n \";\r\n\t\t\r\n\t\tJOptionPane.showMessageDialog(null, msg);\r\n\t}", "private void printHelp() \n {\n System.out.println(\"You are lost. You are alone. You wander\");\n System.out.println(\"around in a dense woods.\");\n System.out.println();\n System.out.println(\"Your command words are:\");\n parser.showCommands();\n }", "@FXML\n\tvoid helpBTNE(MouseEvent event) throws IOException {\n\t\tMainAllControllers.setWindowVar(\"UserHelp\");\n\t\tMainAllControllers.changeWin();\n\t}", "public void helpBtn( View v )\n {\n \t// Display help here \t\n\t\tAlertDialog.Builder builder = new AlertDialog.Builder( this );\n\t\tbuilder.setMessage( R.string.help_manage_id )\n\t .setTitle( R.string.help_warning );\n\t\tbuilder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener() {\n\t public void onClick(DialogInterface dialog, int idx) {\n\t // User clicked OK button \n\t }\n\t });\t\t\n\t\tAlertDialog dialog = builder.create();\n\t\tdialog.show();\t\t\n }", "protected void initializeHelpMenu() {\n\t\tfinal JMenu helpMenu = new JMenu(\"Help\");\n\t\tthis.add(helpMenu);\n\t\t// Help\n\t\tfinal JMenuItem sysHelpItem = new JMenuItem();\n\t\tsysHelpItem.setAction(this.commands.findById(CmdHelp.DEFAULT_ID));\n\t\tsysHelpItem.setAccelerator(KeyStroke.getKeyStroke('H',\n\t\t\t\tInputEvent.CTRL_DOWN_MASK));\n\t\thelpMenu.add(sysHelpItem);\n\t}", "@Override\n\tpublic void showKeyboard() {\n\t\t\n\t}", "@Override\n\tpublic void show() {\n\t worldRenderer = new WorldRenderer(game);\n\t\tGdx.input.setCatchBackKey(true);\n\t\t// TODO Auto-generated method stub\n\t\t\n\t}", "protected abstract void addHelpHandler(boolean hoverListener);", "public void help() {\n\t\tString format = \"%-20s%s%n\";\n\t\tString[] commands = new String[5];\n\t\tcommands[0] = \"help\";\n\t\tcommands[1] = \"learn\";\n\t\tcommands[2] = \"alphabet:create\";\n\t\tcommands[3] = \"alphabet:destroy\";\n\t\tcommands[4] = \"alphabet:compose\";\n\n\t\tString[] explanation = new String[5];\n\t\texplanation[0] = \"display this message\";\n\t\texplanation[1] = \"starts a learning process. Note: with a large alphabet, this\\ncan take a \"\n\t\t\t\t+ \"very long time!\";\n\t\texplanation[2] = \"creates an alphabet. Currently only working for Android, the\\n\"\n\t\t\t\t+ \"creation of an iOS alphabet has to be done more or less manually\";\n\t\texplanation[3] = \"deletes an existing alphabet\";\n\t\texplanation[4] = \"composes an alphabet from existing window dumps.\";\n\n\t\tfor (int i = 0; i < commands.length; i++) {\n\t\t\tSystem.out.printf(format, commands[i], explanation[i]);\n\t\t}\n\t}", "public void helpSpecificAction() {\n new Help(getSpecificHelpTitle(), getSpecificHelp());\n }", "public void openHelp(){\n\n Intent helpIntent = new Intent(this, Help.class);\n startActivity(helpIntent);\n\n }", "@DISPID(-2147412099)\n @PropGet\n java.lang.Object onhelp();", "public void showHelp() {\n final Snackbar snackBar = Snackbar.make(findViewById(R.id.mapscontainer),\n \"Select a location by clicking the map. Press go to search your categories.\",\n Snackbar.LENGTH_INDEFINITE);\n\n snackBar.setAction(\"Got it!\", new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n snackBar.dismiss();\n }\n })\n .setActionTextColor(Color.WHITE);\n snackBar.show();\n }", "private void printHelp() \n {\n System.out.println(\"Your command words are:\");\n parser.showCommands();\n }", "void printHelp();", "public void helpMenu()\n {\n System.out.println(\"*********************************************Help Menue**************************************************************\");\n System.out.println(\"Each player starts the game with zero points.\");\n System.out.println(\"Each player is given the following set of five tiles. Each tile has a value and an associated score\");\n System.out.println(\"For each round, each player will play ONE tile, with the tile value adding to the game total for that round.\"); \n System.out.println(\"Provided the game total is less than or equal to 21, the player will get the score for using that tile.\");\n System.out.println(\"If the game total is greater than 21\");\n System.out.println(\"no score is allocated to the player who played the last tile causing the score to become greater than 21.\");\n System.out.println(\"Once the round ends, Each player will get their score based on the total of the tiles they have used during the round.\");\n System.out.println(\"Any player who has NOT used the tile with the value of 5, will get a penalty of -3 points.\");\n System.out.println(\"The player who, after all deductions, has the highest score, will be the winner of that round and will get 5 points.\"); \n System.out.println(\"At the end of all the rounds, the player who has won the most rounds is declared the winner of the game.\");\n System.out.println(\"**********************************************************************************************************************\");\n getUserStringInput(\"Please enter continue\");\n }", "@FXML\n void helpEvent(ActionEvent event) {\n \tAlert help = new Alert(AlertType.INFORMATION);\n \thelp.setTitle(\"Fireworks Help\");\n \thelp.setHeaderText(null);\n \thelp.setContentText(\"This app models a firework in flight. \" + \n \t\t\t\"The firework's flight path during simulation is affected by:\\n\\n\" +\n \t \"a) Launcher angle [deg]: You can snap to an integer angle with the middle slider,\" +\n \t \" or you can directly input any real-valued angle to the middle text box (the change will register once you press ENTER).\" + \n \t \"\\nAngles allowed are between -15 and +15 degrees.\\n\\n\" + \n \t \"b) Wind Speed [km/h]: You can snap to an integer speed with the left-most slider,\" +\n \t \" or you can directly input any real-valued speed to the middle text box (the change will register once you press ENTER). \" +\n \t \"\\nSpeeds allowed are between -20 and +20 km/h.\\n\\n\" +\n \t \"You can change these values at any time during simulation!\\n\" + \n \t \"(Copyright Adan Moran-MacDonald, 2016)\");\n \t\n \thelp.showAndWait();\n }", "public void showHelp(OnClickListener cl) {\n\t\tBuilder adb = new AlertDialog.Builder(this);\n\t\tadb.setIcon(R.drawable.icon);\n \tadb.setTitle(\"Wallpaper Wizard\");\n \tadb.setMessage(Html.fromHtml(\"<b>Tap</b> the images you like, and I will \" + \n \t\t\t\"learn your preferences to suggest new images.<p>\" + \n \t\t\t\"<b>Press and Hold</b> an image to set it as your wallpaper \" + \n \t\t\t\"and save it to the 'wizard' directory on your SD card. \" + \n \t\t\t\"<p>All proceeds from ads will benefit the computer science \" + \n \t\t\t\"program at <b>Centenary College of Louisiana</b>.\"));\n \tadb.setPositiveButton(\"OK\", cl);\n \tadb.show(); \t\n }", "private static void displayMainMenu() {\n\t\tSystem.out.println(\"\\t Main Menu Help \\n\" \n\t\t\t\t+ \"====================================\\n\"\n\t\t\t\t+ \"au <username> : Registers as a new user \\n\"\n\t\t\t\t+ \"du <username> : De-registers a existing user \\n\"\n\t\t\t\t+ \"li <username> : To login \\n\"\n\t\t\t\t+ \"qu : To exit \\n\"\n\t\t\t\t+\"====================================\\n\");\n\t}", "public void shortDescribe(CoState cos) {\n\t\tcos.outputText(\"Home menu.\");\r\n\t}", "public static void inventoryMenuHeader() {\n System.out.print(\"Welcome to Inventory Menu!\\nType \\\"help\\\" for Inventory menu commands\\n\");\n }", "private void makeHelpMenu() {\r\n\t\tJMenu helpMnu = new JMenu(\"Ayuda\");\r\n\r\n\t\tJMenuItem tipMenuItem = new JMenuItem(\"Tips...\");\r\n\t\ttipMenuItem.setMnemonic('t');\r\n\t\ttipMenuItem.setToolTipText(\"Muestra los consejos de Store\");\r\n\t\ttipMenuItem.addActionListener(new ActionListener() {\r\n\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\tnew StoreTip();\r\n\t\t\t}\r\n\r\n\t\t});\r\n\r\n\t\thelpMnu.add(tipMenuItem);\r\n\t\thelpMnu.setMnemonic('y');\r\n\t\tadd(helpMnu);\r\n\t}", "private void howToPlay() {\n\n String s = \"You are presented with a grid of tiles, some of which contain mines.\\n\"\n + \"The aim of Minesweeper is to reveal all tiles in the grid which do not contain mines.\\n\"\n + \"To reveal a tile, click on it. If the tile you reveal is a mine, you lose the game.\\n\"\n + \"If the tile you reveal is empty, all surrounding tiles will be revealed, \\n\"\n + \"and if those are also empty, their surrounding tiles will be revealed too.\\n\"\n + \"Tiles containing numbers indicate how many mines there are surrounding that tile.\\n\"\n + \"If you think a tile contains a mine, right click on it to mark it as a mine.\\n\"\n + \"You win the game once either you mark all mines, or reveal all tiles which are not mines.\";\n\n JFrame helpframe = new JFrame(\"How to play\");\n JPanel helppanel = new JPanel();\n JButton close = new JButton(\"Got it!\");\n JTextArea text = new JTextArea(s);\n\n close.addActionListener((ActionEvent ev) -> {\n helpframe.dispose();\n });\n\n text.setEditable(false);\n text.setOpaque(false);\n text.setWrapStyleWord(true);\n helppanel.add(text);\n helppanel.add(close);\n helpframe.add(helppanel);\n helpframe.setLocationRelativeTo(null);\n helpframe.setSize(560, 200);\n helpframe.setVisible(true);\n helpframe.setResizable(false);\n }", "@Override\n public void show() {\n Label title = new Label(\"Hall of Fame\", new Label.LabelStyle(fonts.getInstance().getClouds(), Color.WHITE));\n title.setPosition(MENU_WIDTH / 2 - title.getWidth() / 2, MENU_HEIGHT / 1.9f + 3*title.getHeight());\n stage.addActor(title);\n }" ]
[ "0.7675924", "0.7671607", "0.76265585", "0.7333805", "0.7300262", "0.7232596", "0.7204855", "0.7147801", "0.70714295", "0.70387", "0.699796", "0.6948904", "0.69033295", "0.68819726", "0.68721294", "0.67778736", "0.67445534", "0.67279303", "0.6694964", "0.6680618", "0.66680646", "0.6625915", "0.6597365", "0.6574034", "0.6566946", "0.6562552", "0.65524405", "0.6550715", "0.6528013", "0.6522787", "0.65133256", "0.650825", "0.6490495", "0.64777285", "0.64765483", "0.6468532", "0.6465182", "0.64636886", "0.6462336", "0.6458144", "0.6443631", "0.6441831", "0.6441499", "0.64222616", "0.64160764", "0.63988894", "0.6394842", "0.6392886", "0.6390809", "0.6389232", "0.63871914", "0.63831395", "0.6376339", "0.6373889", "0.63669246", "0.63629097", "0.6357781", "0.63522804", "0.6334082", "0.6324773", "0.63216746", "0.6299739", "0.628547", "0.627818", "0.6274357", "0.6267226", "0.62620157", "0.62352777", "0.62281543", "0.6212987", "0.620962", "0.62070686", "0.61906934", "0.6186441", "0.61773604", "0.61694956", "0.61688596", "0.61536133", "0.61470777", "0.6146701", "0.61441004", "0.6140028", "0.6139589", "0.613625", "0.61357415", "0.6125746", "0.6124346", "0.6120605", "0.61095613", "0.6100104", "0.60959077", "0.60937697", "0.609355", "0.6076775", "0.6074551", "0.6072275", "0.60671836", "0.60632545", "0.6051063", "0.6050887", "0.6044608" ]
0.0
-1
release motors from STOPPED state without actually running them
public static synchronized void idleAllLiftMotors() { synchronized(armStage1.motorLock) { // synchronized(armStage2.motorLock) { armStage1.motorObj.set(ControlMode.PercentOutput, 0.0); // armStage1.auxMotorObj.set(ControlMode.PercentOutput, 0.0); // armStage2.motorObj.set(ControlMode.PercentOutput, 0.0); armStage1.operatingMode = OperatingModesE.IDLE; // armStage2.operatingMode = OperatingModesE.IDLE; // } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void stopMotors(){\n\t\tsynchStop(MMXCOMMAND_BRAKE);\n\t}", "public void stop() {\n climberMotors.stopMotor();\n }", "public void stop(){\n started = false;\n for (DcMotor motor :this.motors) {\n motor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n motor.setPower(0);\n }\n this.reset();\n }", "public void stop() {\n\t\tmotor1.set( Constants.CLAW_MOTOR_STOPPED );\n\t\t}", "private void stopMotors() {\n pidDrive.disable();\n pidRotate.disable();\n robot.rightDrive.setPower(0);\n robot.leftDrive.setPower(0);\n }", "@Override\n public final void stopMotor() {\n stop();\n }", "public void stopMotors() {\n\t\tRobotMap.frontLeft.set(0);\n\t\tRobotMap.backLeft.set(0);\n\t\tRobotMap.frontRight.set(0);\n\t\tRobotMap.backRight.set(0);\n\t}", "public void stop() {\n\t\tsetPower(Motor.STOP);\r\n\t}", "public void completeStop(){\n motorFrontLeft.setPower(0);\n motorFrontRight.setPower(0);\n motorBackLeft.setPower(0);\n motorBackRight.setPower(0);\n }", "public static void stopAllMotors() {\r\n\t\tleftMotorReg.stop(true);\r\n\t\trightMotorReg.stop(true);\r\n\t\tarmMotor1Reg.stop(true);\r\n\t\tarmMotor2Reg.stop(true);\r\n\t}", "public void stop()\n {\n mLeftMaster.stopMotor();\n mRightMaster.stopMotor();\n }", "public void stop() {\n\t\tif (getMainMotor() != null) {\n\t\t\tgetMainMotor().stop(0);\n\t\t}\n\t}", "void driveStop() {\n flMotor.setPower(0);\n frMotor.setPower(0);\n blMotor.setPower(0);\n brMotor.setPower(0);\n }", "public void stop() {}", "public void stop()\n\t{\n\t\tupdateState( MotorPort.STOP);\n\t}", "@Override\n public void stop() {\n smDrive.stop();\n smArm.stop();\n }", "public void stop() {\r\n running = false;\r\n }", "public void stop() {\n done=true;\n bridges.forEach(Bridge::stop);\n bridges.clear();\n }", "@SimpleFunction(description = \"Stop the drive motors of the robot.\")\n public void Stop() {\n String functionName = \"Stop\";\n if (!checkBluetooth(functionName)) {\n return;\n }\n\n for (NxtMotorPort port : driveMotorPorts) {\n setOutputState(functionName, port, 0,\n NxtMotorMode.Brake, NxtRegulationMode.Disabled, 0, NxtRunState.Disabled, 0);\n }\n }", "protected void end() {\n \tdrivemotors.stop();\n }", "@Override public void stop() {\n\t\t_active = false;\n\t}", "public final void stop() {\n running = false;\n \n \n\n }", "public synchronized void stop() {\n this.running = false;\n }", "public void stop(){\n running = false;\n }", "public void stop() {\n _running = false;\n }", "public void stop() {\n running = false;\n }", "public void stop()\n {\n running = false;\n }", "void robotStop();", "public void stop() {\n\tanimator = null;\n\toffImage = null;\n\toffGraphics = null;\n }", "public void stopRobot(){\n LAM.setPower(0);\n RAM.setPower(0);\n ILM.setPower(0);\n IRM.setPower(0);\n BLM.setPower(0);\n BRM.setPower(0);\n FLM.setPower(0);\n FRM.setPower(0);\n }", "public void stop()\n\t{\n\t\trunning = false;\n\t}", "public void stopped();", "public void stopFeeding() {\n motor.set(0);\n }", "public void stop() {\n m_enabled = false;\n }", "@Override\n public void stop() {\n\n leftDrive.setPower(0);\n rightDrive.setPower(0);\n armMotor.setPower(0);\n // extendingArm.setPower(0);\n\n telemetry.addData(\"Status\", \"Terminated Interative TeleOp Mode\");\n telemetry.update();\n\n\n }", "public void stop() {\n enable = false;\n }", "public void stop() {\r\n _keepGoing = false;\r\n }", "public void stop()\n {\n robot.FL_drive.setPower(0);\n robot.FR_drive.setPower(0);\n robot.BL_drive.setPower(0);\n robot.BR_drive.setPower(0);\n }", "static void unstop(){\n stop=false;\n }", "protected void end() {\n \t//Robot.motor.disable();\n \tRobot.motor.disable();\n }", "@Override\n public void stop() {\n leftFrontDrive.setPower(0.0);\n rightFrontDrive.setPower(0.0);\n leftRearDrive.setPower(0.0);\n rightRearDrive.setPower(0.0);\n\n // Disable Tracking when we are done;\n targetsUltimateGoal.deactivate();\n\n //closes object detection to save system resouces\n if (tfod != null) {\n tfod.shutdown();\n }\n }", "public void stopping();", "public void stop() {\n intake(0.0);\n }", "public synchronized void stop()\r\n\t\t{\r\n\t\tstate = CLOSING_DOWN;\r\n\t\t}", "private void detener() {\n player.stop();\n player.release();\n player = null;\n }", "@Override\n protected void end() {\n Robot.toteLifterSubsystem.setEjectorState(EjectorState.STOPPED, 0.0);\n }", "private void stop() {\r\n\t\t\tstopped = true;\r\n\t\t}", "public void release(){\n\t\tthis.motor.forward();\n\t}", "private void stop() {\n\t\t/*\n if (this.status != PedoListener.STOPPED) {\n this.sensorManager.unregisterListener(this);\n }\n this.setStatus(PedoListener.STOPPED);\n\t\t*/\t\t\t\t\n\t\t\t\n\t\tif (status != PedoListener.STOPPED) {\n\t\t uninitSensor();\n\t\t}\n\n\t\tDatabase db = Database.getInstance(getActivity());\n\t\tdb.setConfig(\"status_service\", \"stop\");\n\t\t//db.clear(); // delete all datas on table\n\t\tdb.close();\t\t\n\n\t\tgetActivity().stopService(new Intent(getActivity(), StepsService.class));\n\t\tstatus = PedoListener.STOPPED;\n\n\t\tcallbackContext.success();\n }", "private void safeStop() {\n getRobotDrive().stop();\n //pneumatics.stop();\n }", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stop();", "public void stopMovement() {\n this.movementComposer.stopMovement();\n }", "public abstract void stopped();", "@Override\n public void stop()\n {\n final String funcName = \"stop\";\n\n if (debugEnabled)\n {\n dbgTrace.traceEnter(funcName, TrcDbgTrace.TraceLevel.API);\n dbgTrace.traceExit(funcName, TrcDbgTrace.TraceLevel.API);\n }\n\n if (playing)\n {\n analogOut.setAnalogOutputMode((byte) 0);\n analogOut.setAnalogOutputFrequency(0);\n analogOut.setAnalogOutputVoltage(0);\n playing = false;\n expiredTime = 0.0;\n setTaskEnabled(false);\n }\n }", "public void stop()\r\n {\r\n breakoutAnimator = null;\r\n }", "public void stopWheel()\n {\n setVectorTarget(Vector2D.ZERO);\n\n turnMotor.setPosition(0.5);\n\n if (driveMotor != null)\n driveMotor.setVelocity(0);\n }", "void stopPumpingEvents();", "public void deactivate() {\n log.info(\"Stopped\");\n }", "public static void shutDown(){\n for(int i = PS3_LIST_.size()-1; i >= 0; i--){\n PS3 instance = PS3_LIST_.get(i);\n instance.setLed(false);\n instance.destroy();\n }\n PS3Logger.log(PS3Logger.TYPE.DEBUG, null, \"PS3 SHUTDOWN\");\n }", "public void stopDriver();", "protected void end() {\n \tRobot.conveyor.stop();\n }", "public synchronized void stop() {\n stopping = true;\n }", "public void stopRinging();", "public void stop() {\r\n isRunning = false;\r\n System.out.println(\"Stop sim\");\r\n }", "protected void end() {\n\t\tRobot.conveyor.Stop();\n\t}", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "public void stop() {\n }", "public void stop() {\n }", "public void stop() {\n\t\t\n\t}", "void stop() {\n this.currentDirection = 0;\n this.currentVelocity = 0;\n }", "private void stopStopHolder() {\n Log.d(TAG, \"Stop the stop holder!\");\n try {\n if (mStopHandler != null) {\n mStopHandler.removeCallbacksAndMessages(null);\n }\n } catch (NullPointerException e) {\n CordovaPluginLog.e(TAG, \"Error: \", e);\n }\n }" ]
[ "0.7670943", "0.7496989", "0.74728256", "0.72777385", "0.72559553", "0.7247844", "0.7138538", "0.71000564", "0.7070673", "0.7047288", "0.6973638", "0.6943932", "0.69079185", "0.68749344", "0.6861088", "0.68551534", "0.68327105", "0.68287385", "0.6805954", "0.67901427", "0.676846", "0.6765105", "0.67401856", "0.6737006", "0.6735516", "0.6723903", "0.6711881", "0.6706341", "0.6692371", "0.6664969", "0.6660662", "0.66562223", "0.66527724", "0.66504204", "0.6644654", "0.6644412", "0.6640516", "0.6629529", "0.66252285", "0.66205263", "0.6615215", "0.6605524", "0.6595504", "0.6591402", "0.6586226", "0.6585859", "0.65702266", "0.65694153", "0.6551629", "0.6548884", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.6548785", "0.65483075", "0.65374273", "0.65310246", "0.65097564", "0.6508105", "0.65002096", "0.64992464", "0.6482405", "0.6481813", "0.6473342", "0.64685905", "0.6464252", "0.6460375", "0.64573777", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64540136", "0.64520913", "0.64520913", "0.6430527", "0.64281285", "0.64256835" ]
0.0
-1
also see config methods in ArmLiftMotorInfo class
protected static synchronized void configLiftMotorAndEncoder(ArmLiftMotorInfo mtrCfg) { if(mtrCfg.equals(TmSsArm.armStage1)) { mtrCfg.sdKeyJoystickReading =SdKeysE.KEY_ARM_STAGE1_JOYSTICK_RDG; mtrCfg.sdKeyMtrControlMode = mtrCfg.motorObj.m_namedCntlEnt.cSdKeyMtrControlMode; //SdKeysE.KEY_ARM_STAGE1_MTR_MODE; mtrCfg.sdKeyMtrOuputPercent = mtrCfg.motorObj.m_namedCntlEnt.cSdKeyMtrPercentOut; //SdKeysE.KEY_ARM_STAGE1_MTR_OUTPUT_PERCENT; mtrCfg.sdKeyAuxMtrControlMode = mtrCfg.auxMotorObj.m_namedCntlEnt.cSdKeyMtrControlMode; //SdKeysE.KEY_ARM_STAGE1_MTR_MODE; mtrCfg.sdKeyAuxMtrOuputPercent = mtrCfg.auxMotorObj.m_namedCntlEnt.cSdKeyMtrPercentOut; //SdKeysE.KEY_ARM_STAGE1_MTR_OUTPUT_PERCENT; mtrCfg.sdKeyEncoderRdg =SdKeysE.KEY_ARM_STAGE1_ENCODER_RDG; mtrCfg.sdKeyAllowedDir =SdKeysE.KEY_ARM_STAGE1_ALLOWED_DIR; //FYI, these aren't relevant when running from joysticks mtrCfg.sdKeyClosedLoopTarget =SdKeysE.KEY_ARM_STAGE1_CLOSED_LOOP_TARGET; mtrCfg.sdKeyClosedLoopError =SdKeysE.KEY_ARM_STAGE1_CLOSED_LOOP_ERROR; mtrCfg.sdKeyClosedLoopRequestedTarget =SdKeysE.KEY_ARM_STAGE1_CLOSED_LOOP_REQUESTED_TARGET; mtrCfg.sdKeyClosedLoopWorkingTarget = SdKeysE.KEY_ARM_STAGE1_CLOSED_LOOP_WORKING_TARGET; mtrCfg.sdKeyOperatingMode = SdKeysE.KEY_ARM_STAGE1_OP_MODE; mtrCfg.percentOutToMaintainPosition = Cnst.STAGE1_MOTOR_PERCENT_OUT_TO_MAINTAIN_POSITION; mtrCfg.jsNamedControl = DsNamedControlsE.ARM_DOUBLE_STAGE_MTR_INPUT; //.ALT_ARM_TEST_STAGE1_MTR_INPUT; //// DsNamedControlsE.ALT_ARM_TEST_STAGE1_MTR_INPUT.getEnt().registerAsDsCntlUser(TmSsArm.getInstance()); // DsNamedControlsE.ARM_DOUBLE_STAGE_MTR_INPUT.getEnt().registerAsDsCntlUser(TmSsArm.getInstance()); } /* choose the sensor and sensor direction */ //2018-02-06 lab testing: powered motor such that negative joystick readings (positive PercentOutput values) moved the stage1 extender up // encoder readings decreased as stage1 went up, increased as it went down mtrCfg.encoderType = OptDefaults.ARM_CASCADING_ENCODER_ABSOLUTE ? FeedbackDevice.CTRE_MagEncoder_Absolute: FeedbackDevice.CTRE_MagEncoder_Relative; mtrCfg.motorObj.configSelectedFeedbackSensor(mtrCfg.encoderType, CtrePidIdxE.PRIMARY_CLOSED_LOOP, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); //set sensor phase before doing motor inversion.... //2018-02-06 lab testing: powered stage1 motor such that negative joystick readings (positive PercentOutput values) moved the // stage1 extender up // encoder readings decreased as stage1 went up, increased as it went down mtrCfg.motorObj.setSensorPhase(mtrCfg.sensorPhase); /* lets grab the 360 degree position of the MagEncoder's absolute position */ int absolutePosition = mtrCfg.getEncoderReading() & 0xFFF; /* keep only the bottom12 bits, we don't care about the wrap arounds */ /* use the low level API to set the quad encoder signal */ mtrCfg.motorObj.setSelectedSensorPosition(absolutePosition, CtrePidIdxE.PRIMARY_CLOSED_LOOP, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.encoderSnapshot = mtrCfg.getEncoderReading(); /* set sensor phase before doing motor inversions! */ if(mtrCfg.motorObj.m_namedCntlEnt.cMtrInversion.isInvertMotor()) { mtrCfg.motorObj.setInverted(CtreMotorInvertedE.INVERTED); } if(mtrCfg.auxMotorObj.m_namedCntlEnt.cMtrInversion.isInvertMotor()) { mtrCfg.auxMotorObj.setInverted(CtreMotorInvertedE.INVERTED); } /* set the peak and nominal outputs, 12V means full */ mtrCfg.motorObj.configNominalOutputForward(0.0, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.motorObj.configNominalOutputReverse(0.0, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.motorObj.configPeakOutputForward(1.0, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.motorObj.configPeakOutputReverse(-1.0, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.motorObj.configContinuousCurrentLimit(mtrCfg.motorObj.m_namedCntlEnt.cMaxContinuousAmps.value, Cnst.CTRE_TIMEOUT_MS_NO_WAIT_FOR_COMPLETION); mtrCfg.motorObj.configPeakCurrentLimit(mtrCfg.motorObj.m_namedCntlEnt.cMaxPeakAmps.value, Cnst.CTRE_TIMEOUT_MS_NO_WAIT_FOR_COMPLETION); mtrCfg.motorObj.configPeakCurrentDuration(mtrCfg.motorObj.m_namedCntlEnt.cMaxPeakAmpsDurationMs.value, Cnst.CTRE_TIMEOUT_MS_NO_WAIT_FOR_COMPLETION); mtrCfg.motorObj.configClosedloopRamp(Cnst.VOLTAGE_RAMP_TIME_SECS, Cnst.CTRE_TIMEOUT_MS_NO_WAIT_FOR_COMPLETION); mtrCfg.motorObj.configOpenloopRamp(Cnst.VOLTAGE_RAMP_TIME_SECS, Cnst.CTRE_TIMEOUT_MS_NO_WAIT_FOR_COMPLETION); mtrCfg.auxMotorObj.configNominalOutputForward(0.0, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.auxMotorObj.configNominalOutputReverse(0.0, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.auxMotorObj.configPeakOutputForward(1.0, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.auxMotorObj.configPeakOutputReverse(-1.0, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.auxMotorObj.configContinuousCurrentLimit(mtrCfg.auxMotorObj.m_namedCntlEnt.cMaxContinuousAmps.value, Cnst.CTRE_TIMEOUT_MS_NO_WAIT_FOR_COMPLETION); mtrCfg.auxMotorObj.configPeakCurrentLimit(mtrCfg.auxMotorObj.m_namedCntlEnt.cMaxPeakAmps.value, Cnst.CTRE_TIMEOUT_MS_NO_WAIT_FOR_COMPLETION); mtrCfg.auxMotorObj.configPeakCurrentDuration(mtrCfg.auxMotorObj.m_namedCntlEnt.cMaxPeakAmpsDurationMs.value, Cnst.CTRE_TIMEOUT_MS_NO_WAIT_FOR_COMPLETION); mtrCfg.auxMotorObj.configClosedloopRamp(Cnst.VOLTAGE_RAMP_TIME_SECS, Cnst.CTRE_TIMEOUT_MS_NO_WAIT_FOR_COMPLETION); mtrCfg.auxMotorObj.configOpenloopRamp(Cnst.VOLTAGE_RAMP_TIME_SECS, Cnst.CTRE_TIMEOUT_MS_NO_WAIT_FOR_COMPLETION); /* set the allowable closed-loop error, * Closed-Loop output will be neutral within this range. * See Table in Section 17.2.1 for native units per rotation. */ mtrCfg.motorObj.configAllowableClosedloopError(CtreSlotIdxE.PARM_SLOT_0, 0, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); /* always servo */ /* set closed loop gains in slot0 */ mtrCfg.motorObj.config_kF(CtreSlotIdxE.PARM_SLOT_0, mtrCfg.encoderPidF, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.motorObj.config_kP(CtreSlotIdxE.PARM_SLOT_0, mtrCfg.encoderPidP, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.motorObj.config_kI(CtreSlotIdxE.PARM_SLOT_0, mtrCfg.encoderPidI, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); mtrCfg.motorObj.config_kD(CtreSlotIdxE.PARM_SLOT_0, mtrCfg.encoderPidD, Cnst.CTRE_TIMEOUT_MS_WAIT_FOR_ENCODER_CFG); //assume the motor is wired to the talon in such a way that the talons can //be treated as if both motors are running the same direction mtrCfg.auxMotorObj.set(ControlMode.Follower, mtrCfg.motorObj.getDeviceID()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void init() {\n telemetry.addData(\"Status\", \"Initializing\"); //display on the drivers phone that its working\n\n FLM = hardwareMap.get(DcMotor.class, \"FLM\"); //Go into the config and get the device named \"FLM\" and assign it to FLM\n FRM = hardwareMap.get(DcMotor.class, \"FRM\"); //device name doesn't have to be the same as the variable name\n BLM = hardwareMap.get(DcMotor.class, \"BLM\"); //DcMotor.class because that is what the object is\n BRM = hardwareMap.get(DcMotor.class, \"BRM\");\n\n BigSuck = hardwareMap.get(DcMotor.class, \"BigSUCK\");\n SmallSuck = hardwareMap.get(DcMotor.class, \"SmallSUCK\");\n SmallSuck.setDirection(DcMotor.Direction.REVERSE);\n \n UpLift = hardwareMap.get(DcMotor.class, \"LIFT\");\n UpLift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n UpLift.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n //Make it so we don't have to add flip the sign of the power we are setting to half the motors\n //FRM.setDirection(DcMotor.Direction.REVERSE); //Run the right side of the robot backwards\n FLM.setDirection(DcMotor.Direction.REVERSE);\n BRM.setDirection(DcMotor.Direction.REVERSE); //the right motors are facing differently than the left handed ones\n\n FLM.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n FRM.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n BLM.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n BRM.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n DragArm = hardwareMap.servo.get(\"drag_arm\");\n DragArm.setDirection(Servo.Direction.REVERSE);\n DragArm.setPosition(DragArmRestPosition);\n\n LiftGrab = hardwareMap.servo.get(\"GRAB\");\n LiftGrab.setPosition(LiftGrabRestPosition);\n\n LiftSwivel = hardwareMap.servo.get(\"SWIVEL\");\n LiftSwivel.setPosition(LiftSwivelRestPosition);\n\n Push = hardwareMap.get(Servo.class, \"PUSH\");\n Push.setDirection(Servo.Direction.FORWARD);\n Push.setPosition(PushRestPosition);\n\n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.update();\n }", "@Override\n public void init() {\n telemetry.addData(\"Status\", \"Initialized\");\n\n // Initialize the hardware variables. Note that the strings used here as parameters\n // to 'get' must correspond to the names assigned during the robot configuration\n // step (using the FTC Robot Controller app on the phone).\n left = hardwareMap.get(DcMotor.class, \"left\");\n right = hardwareMap.get(DcMotor.class, \"right\");\n wrist = hardwareMap.crservo.get(\"wrist\");\n extension = hardwareMap.get(DcMotor.class, \"extension\");\n lift = hardwareMap.get(DcMotor.class, \"lift\");\n\n\n //lift = hardwareMap.get(DcMotor.class, \"lift\");\n bucket = hardwareMap.servo.get(\"bucket\");\n //fBucket = hardwareMap.get(DcMotor.class, \"fBucket\");\n //fBucket.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n left.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n right.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n lift.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n extension.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n collection = hardwareMap.crservo.get(\"collection\");\n //lift.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n // Most robots need the motor on one side to be reversed to drive forward\n // Reverse the motor that runs backwards when connected directly to the battery\n left.setDirection(DcMotor.Direction.FORWARD);\n right.setDirection(DcMotor.Direction.REVERSE);\n //lift.setDirection(DcMotor.Direction.FORWARD);\n // fBucket.setDirection(DcMotor.Direction.FORWARD);\n lift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n lift.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n // Tell the driver that initialization is complete.\n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.addData(\"left\", left.getPower());\n telemetry.addData(\"right\", right.getPower());\n //telemetry.addData(\"lift\", lift.getPower());\n telemetry.addData(\"collection\", collection.getPower());\n //wrist.setPosition(-1);\n //telemetry.addData(\"fBucket\", fBucket.getPower());\n //Robot robot = new Robot(lift, extension, wrist, bucket, collection, drive);\n }", "private void MotorInit()\n {\n intake_up.configFactoryDefault();\n intake_down.configFactoryDefault();\n intake_up.configOpenloopRamp(Constants.kMotorRampRate);\n intake_down.configOpenloopRamp(Constants.kMotorRampRate);\n intake_up.setInverted(PortReversed.intake_up_reversed.value);\n intake_down.setInverted(PortReversed.intake_down_reversed.value);\n intake_up.setNeutralMode(NeutralMode.Brake);\n intake_down.setNeutralMode(NeutralMode.Brake);\n }", "private void configVelocityControl() {\n //config remote sensors\n //sets the sensor to be a quad encoder, sets our feedback device to be that sensor\n m_masterMotor.configSelectedFeedbackSensor(TalonSRXFeedbackDevice.CTRE_MagEncoder_Relative, RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //zero the encoders on every init\n zeroEncoder();\n\n //sets whether our motor is inverted\n //this is currently false but can be switched based on testing\n m_masterMotor.setInverted(RobotMap.LAUNCHER_MASTER_INVERTED);\n m_masterMotor.setSensorPhase(RobotMap.LAUNCHER_MASTER_INVERTED);\n\n //this sets how often we pull data from our sensor\n m_masterMotor.setStatusFramePeriod(StatusFrame.Status_2_Feedback0, RobotMap.LAUNCHER_FEEDBACK_PERIOD_MS, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //this configs the deadband for the PID output. Any output with an absolute value less than this will be treated as zero\n m_masterMotor.configNeutralDeadband(0, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //this sets the peak output for our motor controller.\n m_masterMotor.configPeakOutputForward(RobotMap.LAUNCHER_PID_PEAK_OUTPUT, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n //this does the same thing but for the reverse direction\n m_masterMotor.configPeakOutputReverse(0, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n \n //sets the period of the velocity sample\n //effectively this defines the amount of time used to calculate the velocity\n m_masterMotor.configVelocityMeasurementPeriod(RobotMap.VELOCITY_MEASUREMENT_PERIOD, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //Sets the number of samples used in the rolling average for calculating velocity\n m_masterMotor.configVelocityMeasurementWindow(RobotMap.LAUNCHER_VELOCITY_MEASUREMENT_WINDOW, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n \n //set p, i, d, f values\n //the zero is the PID slot, in this case it is zero for the primary PID\n //the launcher has no auxillary or turning PID control\n m_masterMotor.config_kP(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_P);\n m_masterMotor.config_kI(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_I);\n m_masterMotor.config_kD(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_D);\n m_masterMotor.config_kF(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_F);\n\n //this sets the acceptable amount of Integral error, where if the absolute accumulated error exceeds this ammount, it resets to zero\n //this is designed to prevent the PID from going crazy if we move too far from our target\n m_masterMotor.config_IntegralZone(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_I_ZONE, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //sets the max output of the motor specifically within closed loop control\n m_masterMotor.configClosedLoopPeakOutput(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_PID_PEAK_OUTPUT, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //this configures an allowable error in closed loop control\n //any error less than this is treated as zero.\n m_masterMotor.configAllowableClosedloopError(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_ACCEPTABLE_ERROR, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //configures the period for closed loop calculations in MS \n //should be increased if the can bus is haveing issues\n m_masterMotor.configClosedLoopPeriod(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_CLOSED_LOOP_PERIOD_MS, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //configures ramp speed\n m_masterMotor.configOpenloopRamp(RobotMap.LAUNCHER_OPEN_LOOP_RAMP_TIME_S);\n m_masterMotor.configClosedloopRamp(0);\n\n //sets our closed loop control to use our primary PID slot\n m_masterMotor.selectProfileSlot(RobotMap.PID_PRIMARY_SLOT, 0);\n }", "@Override\n public void setMotorType(MotorConfigurationType motorType) {\n\n }", "@Override public void init() {\n /// Important Step 2: Get access to a list of Expansion Hub Modules to enable changing caching methods.\n all_hubs_ = hardwareMap.getAll(LynxModule.class);\n /// Important Step 3: Option B. Set all Expansion hubs to use the MANUAL Bulk Caching mode\n for (LynxModule module : all_hubs_ ) {\n switch (motor_read_mode_) {\n case BULK_READ_AUTO:\n module.setBulkCachingMode(LynxModule.BulkCachingMode.AUTO);\n break;\n case BULK_READ_MANUAL:\n module.setBulkCachingMode(LynxModule.BulkCachingMode.MANUAL);\n break;\n case BULK_READ_OFF:\n default:\n module.setBulkCachingMode(LynxModule.BulkCachingMode.OFF);\n break;\n }\n }\n\n /// Use the hardwareMap to get the dc motors and servos by name.\n\n motorLF_ = hardwareMap.get(DcMotorEx.class, lfName);\n motorLB_ = hardwareMap.get(DcMotorEx.class, lbName);\n motorRF_ = hardwareMap.get(DcMotorEx.class, rfName);\n motorRB_ = hardwareMap.get(DcMotorEx.class, rbName);\n motorLF_.setDirection(DcMotor.Direction.REVERSE);\n motorLB_.setDirection(DcMotor.Direction.REVERSE);\n\n // map odometry encoders\n verticalLeftEncoder = hardwareMap.get(DcMotorEx.class, verticalLeftEncoderName);\n verticalRightEncoder = hardwareMap.get(DcMotorEx.class, verticalRightEncoderName);\n horizontalEncoder = hardwareMap.get(DcMotorEx.class, horizontalEncoderName);\n\n if( USE_ENCODER_FOR_TELEOP ) {\n motorLF_.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n motorLF_.setMode ( DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n motorLB_.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n motorLB_.setMode ( DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n motorRF_.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n motorRF_.setMode ( DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n motorRB_.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n motorRB_.setMode ( DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n\n verticalLeftEncoder.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n verticalRightEncoder.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n horizontalEncoder.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n\n motorLF_.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n motorLB_.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n motorRF_.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n motorRB_.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n }\n\n if( USE_INTAKE ) {\n motor_left_intake_ = hardwareMap.get(DcMotorEx.class, \"motorLeftIntake\");\n motor_right_intake_ = hardwareMap.get(DcMotorEx.class, \"motorRightIntake\");\n motor_right_intake_.setDirection(DcMotor.Direction.REVERSE) ;\n\n motor_left_intake_.setMode( DcMotor.RunMode.STOP_AND_RESET_ENCODER );\n motor_left_intake_.setMode( DcMotor.RunMode.RUN_USING_ENCODER );\n motor_right_intake_.setMode( DcMotor.RunMode.STOP_AND_RESET_ENCODER );\n motor_right_intake_.setMode( DcMotor.RunMode.RUN_USING_ENCODER );\n\n servo_left_intake_ = hardwareMap.servo.get(\"servoLeftIntake\");\n servo_left_intake_pos_ = CR_SERVO_STOP ;\n servo_left_intake_.setPosition(CR_SERVO_STOP);\n servo_right_intake_ = hardwareMap.servo.get(\"servoRightIntake\");\n servo_right_intake_pos_ = CR_SERVO_STOP ;\n servo_right_intake_.setPosition(CR_SERVO_STOP);\n }\n if( USE_LIFT ) {\n motor_lift_ = hardwareMap.get(DcMotorEx.class, \"motorLift\");\n motor_lift_.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n motor_lift_.setMode( DcMotor.RunMode.STOP_AND_RESET_ENCODER );\n power_lift_ = 0.0;\n if( USE_RUN_TO_POS_FOR_LIFT ) {\n motor_lift_.setTargetPosition(0);\n motor_lift_.setMode( DcMotor.RunMode.RUN_TO_POSITION ); // must call setTargetPosition() before switching to RUN_TO_POSISTION\n } else {\n motor_lift_.setMode( DcMotor.RunMode.RUN_USING_ENCODER);\n }\n last_stone_lift_enc_ = -1;\n }\n\n if( USE_STONE_PUSHER ) {\n servo_pusher_ = hardwareMap.servo.get(\"servoPusher\");\n servo_pusher_.setPosition(PUSHER_INIT);\n servo_pusher_pos_ = PUSHER_INIT;\n }\n if( USE_STONE_GATER ) {\n servo_gater_ = hardwareMap.servo.get(\"servoGater\");\n servo_gater_.setPosition(GATER_INIT);\n servo_gater_pos_ = GATER_INIT;\n }\n\n if( USE_ARM ) {\n servo_arm_ = hardwareMap.servo.get(\"servoArm\");\n servo_arm_.setPosition(ARM_INIT);\n servo_arm_pos_ = ARM_INIT;\n servo_claw_ = hardwareMap.servo.get(\"servoClaw\");\n servo_claw_.setPosition(CLAW_OPEN);\n servo_claw_pos_ = CLAW_OPEN;\n }\n\n if( USE_HOOKS ) {\n servo_left_hook_ = hardwareMap.servo.get(\"servoLeftHook\");\n servo_left_hook_.setPosition(LEFT_HOOK_UP);\n servo_left_hook_pos_ = LEFT_HOOK_UP;\n servo_right_hook_ = hardwareMap.servo.get(\"servoRightHook\");\n servo_right_hook_.setPosition(RIGHT_HOOK_UP);\n servo_right_hook_pos_ = RIGHT_HOOK_UP;\n }\n\n if( USE_PARKING_STICKS ) {\n servo_left_park_ = hardwareMap.servo.get(\"servoLeftPark\");\n servo_left_park_.setPosition(LEFT_PARK_IN);\n servo_left_park_pos_ = LEFT_PARK_IN;\n servo_right_park_ = hardwareMap.servo.get(\"servoRightPark\");\n servo_right_park_.setPosition(RIGHT_PARK_IN);\n servo_right_park_pos_ = RIGHT_PARK_IN;\n }\n\n if( USE_RGB_FOR_STONE ) {\n rev_rgb_range_ = hardwareMap.get(LynxI2cColorRangeSensor.class, \"stoneColor\");\n //rev_rgb_range_ = hardwareMap.get(LynxI2cColorRangeSensor.class, \"stoneColorV3\"); // different interface for V3, can't define it as LynxI2cColorRangeSensor anymore, 2020/02/29\n if( rev_rgb_range_!=null ) {\n if( AUTO_CALIBRATE_RGB ) {\n int alpha = rev_rgb_range_.alpha();\n //double dist = rev_rgb_range_.getDistance(DistanceUnit.CM);\n double dist = rev_rgb_range_.getDistance(DistanceUnit.METER);\n if( alpha>=MIN_RGB_ALPHA && alpha<100000 ) {\n rev_rgb_alpha_init_ = alpha;\n }\n if( AUTO_CALIBRATE_RGB_RANGE && !Double.isNaN(dist) ) {\n if( dist>MIN_RGB_RANGE_DIST && dist<MAX_RGB_RANGE_DIST ) {\n rev_rgb_dist_init_ = dist;\n }\n }\n }\n }\n }\n if( USE_RGBV3_FOR_STONE ) {\n //rgb_color_stone_ = hardwareMap.get(ColorSensor.class, \"stoneColorV3\");\n rgb_range_stone_ = hardwareMap.get(DistanceSensor.class, \"stoneColorV3\");\n if( AUTO_CALIBRATE_RANGE && rgb_range_stone_!=null ) {\n while(true) { // wait till range sensor gets a valid reading\n double dis = getRangeDist(RangeName.RGB_RANGE_STONE);\n if( dis>0.0 && dis<0.2 ) {\n rgb_range_stone_dist_init_ = dis;\n break;\n }\n }\n }\n }\n\n if( USE_RIGHT_RANGE ) {\n range_right_ = (Rev2mDistanceSensor) (hardwareMap.get(DistanceSensor.class, \"rightRange\"));\n if( AUTO_CALIBRATE_RANGE && range_right_!=null ) {\n while(true) { // wait till range sensor gets a valid reading\n double dis = getRangeDist(RangeName.RANGE_RIGHT);\n if( dis>0.01 && dis<2.0 ) {\n range_right_dist_init_ = dis;\n break;\n }\n }\n }\n }\n if( USE_LEFT_RANGE ) {\n range_left_ = (Rev2mDistanceSensor) (hardwareMap.get(DistanceSensor.class, \"leftRange\"));\n if( AUTO_CALIBRATE_RANGE && range_left_!=null ) {\n while(true) { // wait till range sensor gets a valid reading\n double dis = getRangeDist(RangeName.RANGE_LEFT);\n if( dis>0.01 && dis<2.0 ) {\n range_left_dist_init_ = dis;\n break;\n }\n }\n }\n }\n\n if( USE_RANGE_FOR_STONE) {\n range_stone_ = (Rev2mDistanceSensor) (hardwareMap.get(DistanceSensor.class, \"stoneRange\"));\n if( AUTO_CALIBRATE_RANGE && range_stone_!=null ) {\n while(true) { // wait till range sensor gets a valid reading\n double dis = getRangeDist(RangeName.RANGE_STONE);\n if( dis>0.01 && dis<0.5 ) {\n range_stone_dist_init_ = dis;\n break;\n }\n }\n }\n }\n\n if( USE_INTAKE_MAG_SWITCH ) {\n intake_mag_switch_ = hardwareMap.get(DigitalChannel.class, \"intake_mag_switch\");\n intake_mag_switch_.setMode(DigitalChannelController.Mode.INPUT);\n intake_mag_prev_state_ = intake_mag_switch_.getState();\n intake_mag_change_time_ = 0.0;\n }\n if( USE_STONE_LIMIT_SWITCH ) {\n stone_limit_switch_ = hardwareMap.get(DigitalChannel.class, \"stone_limit_switch\");\n stone_limit_switch_.setMode(DigitalChannelController.Mode.INPUT);\n stone_limit_switch_prev_state_ = stone_limit_switch_.getState();\n }\n\n\n /////***************************** JOY STICKS *************************************/////\n\n /// Set joystick deadzone, any value below this threshold value will be considered as 0; moved from init() to init_loop() to aovid crash\n if(gamepad1!=null) gamepad1.setJoystickDeadzone( JOYSTICK_DEAD_ZONE );\n if(gamepad2!=null) gamepad2.setJoystickDeadzone( JOYSTICK_DEAD_ZONE );\n\n resetControlVariables();\n }", "protected void initialize() {\n \t starttime = Timer.getFPGATimestamp();\n \tthis.startAngle = RobotMap.navx.getAngle();\n \tangleorientation.setSetPoint(RobotMap.navx.getAngle());\n \t\n \tRobotMap.motorLeftTwo.enableControl();\n \tRobotMap.motorRightTwo.enableControl();\n \tRobotMap.motorLeftTwo.enableControl();\n \tRobotMap.motorRightTwo.enableControl();\n \n //settting talon control mode\n \tRobotMap.motorLeftTwo.changeControlMode(TalonControlMode.MotionMagic);\t\t\n\t\tRobotMap.motorLeftOne.changeControlMode(TalonControlMode.Follower);\t\n\t\tRobotMap.motorRightTwo.changeControlMode(TalonControlMode.MotionMagic);\t\n\t\tRobotMap.motorRightOne.changeControlMode(TalonControlMode.Follower);\n\t\t//setting peak and nominal output voltage for the motors\n\t\tRobotMap.motorLeftTwo.configPeakOutputVoltage(+12.0f, -12.0f);\n\t\tRobotMap.motorLeftTwo.configNominalOutputVoltage(0.00f, 0.0f);\n\t\tRobotMap.motorRightTwo.configPeakOutputVoltage(+12.0f, -12.0f);\n\t\tRobotMap.motorRightTwo.configNominalOutputVoltage(0.0f, 0.0f);\n\t\t//setting who is following whom\n\t\tRobotMap.motorLeftOne.set(4);\n\t\tRobotMap.motorRightOne.set(3);\n\t\t//setting pid value for both sides\n\t//\tRobotMap.motorLeftTwo.setCloseLoopRampRate(1);\n\t\tRobotMap.motorLeftTwo.setProfile(0);\n\t RobotMap.motorLeftTwo.setP(0.000014f);\n \tRobotMap.motorLeftTwo.setI(0.00000001);\n\t\tRobotMap.motorLeftTwo.setIZone(0);//325);\n\t\tRobotMap.motorLeftTwo.setD(1.0f);\n\t\tRobotMap.motorLeftTwo.setF(this.fGainLeft+0.014);//0.3625884);\n\t\tRobotMap.motorLeftTwo.setAllowableClosedLoopErr(0);//300);\n\t\t\n\t RobotMap.motorRightTwo.setCloseLoopRampRate(1);\n\t RobotMap.motorRightTwo.setProfile(0);\n\t\tRobotMap.motorRightTwo.setP(0.000014f);\n\t\tRobotMap.motorRightTwo.setI(0.00000001);\n\t\tRobotMap.motorRightTwo.setIZone(0);//325);\n\t\tRobotMap.motorRightTwo.setD(1.0f);\n\t\tRobotMap.motorRightTwo.setF(this.fGainRight);// 0.3373206);\n\t\tRobotMap.motorRightTwo.setAllowableClosedLoopErr(0);//300);\n\t\t\n\t\t//setting Acceleration and velocity for the left\n\t\tRobotMap.motorLeftTwo.setMotionMagicAcceleration(125);\n\t\tRobotMap.motorLeftTwo.setMotionMagicCruiseVelocity(250);\n\t\t//setting Acceleration and velocity for the right\n\t\tRobotMap.motorRightTwo.setMotionMagicAcceleration(125);\n\t\tRobotMap.motorRightTwo.setMotionMagicCruiseVelocity(250);\n\t\t//resets encoder position to 0\t\t\n\t\tRobotMap.motorLeftTwo.setEncPosition(0);\n\t\tRobotMap.motorRightTwo.setEncPosition(0);\n\t //Set Allowable error for the loop\n\t\tRobotMap.motorLeftTwo.setAllowableClosedLoopErr(300);\n\t\tRobotMap.motorRightTwo.setAllowableClosedLoopErr(300);\n\t\t\n\t\t//sets desired endpoint for the motors\n RobotMap.motorLeftTwo.set(motionMagicEndPoint);\n RobotMap.motorRightTwo.set(-motionMagicEndPoint );\n \t\n }", "@Override\n public void init() {\n\n try {\n\n // Get wheel motors\n wheelMotor1 = hardwareMap.dcMotor.get(\"Wheel 1\");\n wheelMotor2 = hardwareMap.dcMotor.get(\"Wheel 2\");\n\n // Initialize wheel motors\n wheelMotor1.setMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);\n wheelMotor2.setMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);\n wheelMotor1.setDirection(DcMotor.Direction.FORWARD);\n wheelMotor2.setDirection(DcMotor.Direction.REVERSE);\n robotDirection = DriveMoveDirection.Forward;\n motion = new Motion(wheelMotor1, wheelMotor2);\n\n // Get hook motor\n motorHook = hardwareMap.dcMotor.get(\"Hook\");\n motorHook.setDirection(DcMotor.Direction.REVERSE);\n\n // Get servos\n servoTapeMeasureUpDown = hardwareMap.servo.get(\"Hook Control\");\n servoClimberDumperArm = hardwareMap.servo.get(\"Climber Dumper Arm\");\n servoDebrisPusher = hardwareMap.servo.get(\"Debris Pusher\");\n servoZipLineLeft = hardwareMap.servo.get(\"Zip Line Left\");\n servoZipLineRight = hardwareMap.servo.get(\"Zip Line Right\");\n servoAllClearRight = hardwareMap.servo.get (\"All Clear Right\");\n servoAllClearLeft = hardwareMap.servo.get (\"All Clear Left\");\n\n setServoPositions();\n }\n catch (Exception ex)\n {\n telemetry.addData(\"error\", ex.getMessage());\n }\n }", "public void setMotorBehaviors(){\n motors = new ArrayList<>();\n motors.add(rf);\n motors.add(rb);\n motors.add(lf);\n motors.add(lb);\n\n //reset motor encoders\n rf.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n rb.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n lf.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n lb.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n lift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n relic_extension.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n\n //Set motor behaviors\n rf.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n rf.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n rb.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n rb.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n lf.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n lf.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n lb.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n lb.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n rf.setDirection(DcMotorSimple.Direction.REVERSE);\n rb.setDirection(DcMotorSimple.Direction.REVERSE);\n relic_extension.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n relic_extension.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n relic_extension.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n lift.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n lift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n lift.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n lift.setDirection(DcMotorSimple.Direction.REVERSE);\n\n //Set servo behaviors\n leftWheel2.setDirection(DcMotorSimple.Direction.REVERSE);\n rightWheel1.setDirection(DcMotorSimple.Direction.REVERSE);\n\n }", "@Override\n public void init() {\n // Get references to dc motors and set initial mode and direction\n // It appears all encoders are reset upon robot startup, but just in case, set all motor\n // modes to Stop-And-Reset-Encoders during initialization.\n motorLeftA = hardwareMap.dcMotor.get(MOTOR_DRIVE_LEFT_A);\n motorLeftA.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n motorLeftA.setDirection(DcMotor.Direction.FORWARD);\n\n motorLeftB = hardwareMap.dcMotor.get(MOTOR_DRIVE_LEFT_B);\n motorLeftB.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n motorLeftB.setDirection(DcMotor.Direction.FORWARD);\n\n motorRightA = hardwareMap.dcMotor.get(MOTOR_DRIVE_RIGHT_A);\n motorRightA.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n motorRightA.setDirection(DcMotor.Direction.REVERSE);\n\n motorRightB = hardwareMap.dcMotor.get(MOTOR_DRIVE_RIGHT_B);\n motorRightB.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n motorRightB.setDirection(DcMotor.Direction.REVERSE);\n\n //motorGlyphLift = hardwareMap.dcMotor.get(GLYPH_LIFT);\n //motorGlyphLift.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n //motorGlyphLift.setDirection(DcMotor.Direction.FORWARD);\n\n sGlyphL = hardwareMap.servo.get(GLYPH_LEFT);\n //sGlyphL.scaleRange(0,180);\n\n sGlyphR = hardwareMap.servo.get(GLYPH_RIGHT);\n sGem = hardwareMap.servo.get(Gem);\n\n //Initialize vex motor\n sGLift = hardwareMap.crservo.get(Servo_GlyphLift);\n\n //sGLift.setPower(0);\n\n //sGLift2 = hardwareMap.servo.get(Servo_GlyphLift);\n\n BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();\n parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;\n\n imu = hardwareMap.get(BNO055IMU.class, \"imu\");\n imu.initialize(parameters);\n\n imu = hardwareMap.get(BNO055IMU.class,\"imu\");\n imu.initialize(parameters);\n\n //servoGlyph1.setPosition(180);\n //servoGlyph2.setPosition(180);\n\n bDirection = true;\n }", "@Override\n public void init() {\n telemetry.addData(\"Status\", \"Initializing\");\n\n // Initialize the hardware variables. Note that the strings used here as parameters\n // to 'get' must correspond to the names assigned during the robot configuration\n // step (using the FTC Robot Controller app on the phone).\n leftDrive = hardwareMap.get(DcMotor.class, \"left_drive\");\n rightDrive = hardwareMap.get(DcMotor.class, \"right_drive\");\n elev = hardwareMap.get(DcMotor.class, \"elev\");\n arm = hardwareMap.get(DcMotor.class,\"arm\");\n hook = hardwareMap.get(Servo.class,\"hook\");\n claw = hardwareMap.get(Servo.class,\"claw\");\n\n // Most robots need the motor on one side to be reversed to drive forward\n // Reverse the motor that runs backwards when connected directly to the battery\n leftDrive.setDirection(DcMotor.Direction.FORWARD);\n rightDrive.setDirection(DcMotor.Direction.REVERSE);\n elev.setDirection(DcMotor.Direction.REVERSE);\n arm.setDirection(DcMotor.Direction.REVERSE);\n elev.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n arm.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n lowerLimit = hardwareMap.digitalChannel.get(\"lower_limit\");\n upperLimit = hardwareMap.digitalChannel.get(\"upper_limit\");\n lowerLimit.setMode(DigitalChannel.Mode.INPUT);\n upperLimit.setMode(DigitalChannel.Mode.INPUT);\n\n// rightElev.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); // Encoder on Left Elev only\n\n // Tell the driver that initialization is complete.\n telemetry.addData(\"Status\", \"Initialized\");\n }", "@Override\n public void robotInit() {\n m_chooser.setDefaultOption(\"Default Auto\", kDefaultAuto);\n m_chooser.addOption(\"My Auto\", kCustomAuto);\n SmartDashboard.putData(\"Auto choices\", m_chooser);\n SmartDashboard.putData(leftMotor1);\n SmartDashboard.putData(leftMotor2);\n SmartDashboard.putData(rightMotor1);\n SmartDashboard.putData(rightMotor2);\n SmartDashboard.putData(firstMotor);\n SmartDashboard.putData(secondMotor);\n \n\n\n\n }", "@Override\r\n public void init() {\r\n // Define and Initialize Motors\r\nFL = hardwareMap.get(DcMotor.class, \"Front Left\");\r\n FR = hardwareMap.get(DcMotor.class, \"Front Right\");\r\n BL = hardwareMap.get(DcMotor.class, \"Back Left\");\r\n BR = hardwareMap.get(DcMotor.class, \"Back Right\");\r\n\r\n\r\nFL.setDirection(DcMotor.Direction.FORWARD);\r\n FR.setDirection(DcMotor.Direction.REVERSE);\r\n BL.setDirection(DcMotor.Direction.FORWARD);\r\n BR.setDirection(DcMotor.Direction.REVERSE);\r\n // Set all motors to zero power\r\n FL.setPower(0);\r\n FR.setPower(0);\r\n BL.setPower(0);\r\n BR.setPower(0); }", "@Override\n public void robotInit() {\n\n // Motor controllers\n leftMotor = new CANSparkMax(1, MotorType.kBrushless);\n leftMotor.setInverted(false);\n leftMotor.setIdleMode(IdleMode.kBrake);\n\n CANSparkMax leftSlave1 = new CANSparkMax(2, MotorType.kBrushless);\n leftSlave1.setInverted(false);\n leftSlave1.setIdleMode(IdleMode.kBrake);\n leftSlave1.follow(leftMotor);\n\n CANSparkMax leftSlave2 = new CANSparkMax(3, MotorType.kBrushless);\n leftSlave2.setInverted(false);\n leftSlave2.setIdleMode(IdleMode.kBrake);\n leftSlave2.follow(leftMotor);\n\n rightMotor = new CANSparkMax(4, MotorType.kBrushless);\n rightMotor.setInverted(false);\n rightMotor.setIdleMode(IdleMode.kBrake);\n\n CANSparkMax rightSlave1 = new CANSparkMax(5, MotorType.kBrushless);\n rightSlave1.setInverted(false);\n rightSlave1.setIdleMode(IdleMode.kBrake);\n rightSlave1.follow(leftMotor);\n\n CANSparkMax rightSlave2 = new CANSparkMax(6, MotorType.kBrushless);\n rightSlave2.setInverted(false);\n rightSlave2.setIdleMode(IdleMode.kBrake);\n rightSlave2.follow(leftMotor);\n\n // Encoders\n leftEncoder = leftMotor.getEncoder();\n rightEncoder = rightMotor.getEncoder();\n\n // Gyro\n gyro = new ADXRS450_Gyro();\n\n }", "@Override\r\n public void init() {\r\n BackRight = hardwareMap.dcMotor.get(\"BackRight\");\r\n BackLeft = hardwareMap.dcMotor.get(\"BackLeft\");\r\n FrontRight = hardwareMap.dcMotor.get(\"FrontRight\");\r\n FrontLeft = hardwareMap.dcMotor.get(\"FrontLeft\");\r\n FrontRight.setDirection(DcMotor.Direction.REVERSE);\r\n BackRight.setDirection(DcMotor.Direction.REVERSE);\r\n\r\n TreadLeft = hardwareMap.dcMotor.get(\"TreadLeft\");\r\n TreadRight = hardwareMap.dcMotor.get(\"TreadRight\");\r\n\r\n ArmMotor = hardwareMap.dcMotor.get(\"ArmMotor\");\r\n }", "@Override\n public void init() {\n telemetry.addData(\"Status\", \"Initialized\");\n\n // Initialize the hardware variables. Note that the strings used here as parameters\n // to 'get' must correspond to the names assigned during the robot configuration\n // step (using the FTC Robot Controller app on the phone).\n\n VinceHardwareBruinBot robot = new VinceHardwareBruinBot();\n // Inititalize last wheel speed\n for (int i = 0; i < lastwheelSpeeds.length; i++){\n lastwheelSpeeds[i] = 0;\n }\n robot.init(hardwareMap);\n {\n //init all drive wheels\n leftFrontDrive = robot.leftFrontDrive;\n rightFrontDrive = robot.rightFrontDrive;\n leftRearDrive = robot.leftRearDrive;\n rightRearDrive = robot.rightRearDrive;\n\n // init all other motors & servos\n intakeMotor = robot.intakeMotor;\n wobbleMotor = robot.wobbleMotor;\n ringShooterMotor = robot.ringShooterMotor;\n\n fireServo = robot.fireServo;\n\n //init imu\n imu = robot.imu;\n }\n initVuforiaNavigation();\n\n // Reset the wobble motor - Use a repeatable starting position\n wobbleMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n /*\n // Get PID constants for wobble motor\n int motorIndex = ((robot.wobbleMotor).getPortNumber());\n DcMotorControllerEx motorControllerEx = (DcMotorControllerEx)robot.wobbleMotor.getController();\n PIDCoefficients pidModified = motorControllerEx.getPIDCoefficients(motorIndex, DcMotor.RunMode.RUN_TO_POSITION);\n\n // change coefficients using methods included with DcMotorEx class.\n PIDCoefficients pidNew = new PIDCoefficients(10, 2, 3);\n motorControllerEx.setPIDCoefficients(motorIndex, DcMotor.RunMode.RUN_TO_POSITION, pidNew);\n */\n //wobbleMotor.setPIDFCoefficients(DcMotor.RunMode.RUN_TO_POSITION,pidNew);\n // Tell the driver that initialization is complete.\n telemetry.addData(\"Status\", \"Initialized\");\n }", "private void initializeMap() {\n FLMotor = hardwareMap.get(DcMotor.class, \"FLMotor\");\n FRMotor = hardwareMap.get(DcMotor.class, \"FRMotor\");\n BLMotor = hardwareMap.get(DcMotor.class, \"BLMotor\");\n BRMotor = hardwareMap.get(DcMotor.class, \"BRMotor\");\n //ods = hardwareMap.get(OpticalDistanceSensor.class, \"ods\");\n //color = hardwareMap.get(ColorSensor.class, \"color\");\n //touch = hardwareMap.get(TouchSensor.class, \"touch\");\n gyro = hardwareMap.get(GyroSensor.class, \"gyro\");\n\n // Most robots need the motor on one side to be reversed to drive forward\n // Reverse the motor that runs backwards when connected directly to the battery\n BRMotor.setDirection(DcMotorSimple.Direction.FORWARD);\n BLMotor.setDirection(DcMotorSimple.Direction.REVERSE);\n FRMotor.setDirection(DcMotorSimple.Direction.FORWARD);\n FLMotor.setDirection(DcMotorSimple.Direction.REVERSE);\n }", "protected void ratCrewInit() {\n\n // Init motor state machine.\n motorTurnType = \"none\";\n motorTurnDestination = 0.0f;\n motorTurnAngleToGo = 0.0f;\n motorTurnAngleAdjustedToGo = 0.0f;\n isDriving = false;\n driveLeftStart = 0;\n driveRightStart = 0;\n driveLeftTarget = 0;\n driveRightTarget = 0;\n driveRightSpeed = 0.0f;\n driveLeftSpeed = 0.0f;\n driveAngleOffset = 0.0f;\n driveAngleCorrection = 0.0f;\n\n // TODO: push into initMotor function\n if (doMotors) {\n // Initialize Motors, finding them through the hardware map.\n leftDrive = hardwareMap.get(DcMotor.class, \"motorLeft\");\n rightDrive = hardwareMap.get(DcMotor.class, \"motorRight\");\n leftDrive.setDirection(DcMotor.Direction.REVERSE);\n rightDrive.setDirection(DcMotor.Direction.FORWARD);\n\n // initialize the encoder\n leftDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n rightDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n leftDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n rightDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n leftDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n rightDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n // Set all motors to zero power.\n leftDrive.setPower(0);\n rightDrive.setPower(0);\n\n gate = hardwareMap.get(Servo.class, \"Gate\");\n gate.setPosition(1.0);\n }\n initGyroscope();\n\n if (doVuforia){\n initVuforia();\n initTfod();\n\n if (tfod != null) {\n tfod.activate();\n\n // The TensorFlow software will scale the input images from the camera to a lower resolution.\n // This can result in lower detection accuracy at longer distances (> 55cm or 22\").\n // If your target is at distance greater than 50 cm (20\") you can adjust the magnification value\n // to artificially zoom in to the center of image. For best results, the \"aspectRatio\" argument\n // should be set to the value of the images used to create the TensorFlow Object Detection model\n // (typically 1.78 or 16/9).\n\n // Uncomment the following line if you want to adjust the magnification and/or the aspect ratio of the input images.\n tfod.setZoom(2.5, 1.78);\n }\n }\n\n // Init run state.\n madeTheRun = false;\n startTime = 0;\n telemetry.addData(\"Init\", \"motors=%b, gyro=%b, vuforia=%b\", doMotors, doGyro, doVuforia);\n telemetry.update();\n }", "void setMotorsMode(DcMotor.RunMode runMode);", "public void init(HardwareMap ahwMap) {\n // Save reference to Hardware map\n hwMap = ahwMap;\n // left frond drive motor\n try\n {\n\n left_front_drv_Motor = hwMap.dcMotor.get(\"l_f_drv\");\n }\n catch (Exception p_exeception)\n {\n\n\n left_front_drv_Motor = null;\n }\n //left back drive motor\n\n try\n {\n\n left_back_drv_Motor = hwMap.dcMotor.get(\"l_b_drv\");\n }\n catch (Exception p_exeception)\n {\n\n\n left_back_drv_Motor = null;\n }\n // right front drive motor\n try\n {\n\n right_front_drv_Motor = hwMap.dcMotor.get(\"r_f_drv\");\n }\n catch (Exception p_exeception)\n {\n\n right_front_drv_Motor = null;\n }\n //right back drive motor\n try\n {\n\n right_back_drv_Motor = hwMap.dcMotor.get(\"r_b_drv\");\n }\n catch (Exception p_exeception)\n {\n\n\n right_back_drv_Motor = null;\n }\n\n //hinge motor for arm\n\n try\n {\n\n hinge = hwMap.dcMotor.get(\"hinge\");\n }\n catch (Exception p_exeception)\n {\n\n\n hinge = null;\n }\n //hang motor to land\n try\n {\n\n hang_motor = hwMap.dcMotor.get(\"hang\");\n }\n catch (Exception p_exeception)\n {\n\n\n hang_motor= null;\n }\n //intake motor\n try\n {\n\n fly_wheel = hwMap.dcMotor.get(\"intake\");\n }\n catch (Exception p_exeception)\n {\n\n\n hang_motor= null;\n }\n\n // Servos :\n\n\n try\n {\n //v_motor_left_drive = hardwareMap.dcMotor.get (\"l_drv\");\n //v_motor_left_drive.setDirection (DcMotor.Direction.REVERSE);\n marker = hwMap.servo.get(\"marker\");\n if (marker != null) {\n marker.setPosition(SERVO_LEFT_MIN);\n }\n\n\n }\n\n catch (Exception p_exeception)\n {\n //m_warning_message (\"l_drv\");\n // DbgLog.msg (p_exeception.getLocalizedMessage ());\n\n marker = null;\n }\n\n\n //set dc motors to run without an encoder and set intial power to 0\n //l_f_drv\n if (left_front_drv_Motor != null)\n {\n //l_return = left_drv_Motor.getPower ();\n left_front_drv_Motor.setDirection(DcMotor.Direction.FORWARD); // FORWARD was moving it backwards\n left_front_drv_Motor.setPower(0);\n left_front_drv_Motor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n }\n //l_b_drv\n if (left_back_drv_Motor != null)\n {\n //l_return = left_drv_Motor.getPower ();\n left_back_drv_Motor.setDirection(DcMotor.Direction.FORWARD); // FORWARD was moving it backwards\n left_back_drv_Motor.setPower(0);\n left_back_drv_Motor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n }\n\n //r_f_drv\n if (right_front_drv_Motor != null)\n {\n //l_return = left_drv_Motor.getPower ();\n right_front_drv_Motor.setDirection(DcMotor.Direction.FORWARD);// REVERSE was moving it backwards\n right_front_drv_Motor.setPower(0);\n right_front_drv_Motor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n }\n //r_b_drv\n if (right_back_drv_Motor != null)\n {\n //l_return = left_drv_Motor.getPower ();\n right_back_drv_Motor.setDirection(DcMotor.Direction.FORWARD);// REVERSE was moving it backwards\n right_back_drv_Motor.setPower(0);\n right_back_drv_Motor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n }\n //hinge\n if (hinge != null)\n {\n //l_return = left_drv_Motor.getPower ();\n hinge.setPower(0);\n hinge.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n }\n //hang\n if(hang_motor != null)\n\n {\n hang_motor.setPower(0);\n hang_motor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n }\n //intake\n if(fly_wheel != null)\n\n {\n fly_wheel.setPower(0);\n fly_wheel.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n }\n\n/*\ninitalize the colorSensor and colorSensor\n*/\n try {\n colorSensor = hwMap.colorSensor.get(\"color\");\n }\n catch (Exception p_exeception)\n {\n //m_warning_message (\"colr_f\");\n // DbgLog.msg (p_exeception.getLocalizedMessage ());\n colorSensor = null;\n }\n\n\n try {\n LightSensorBottom = hwMap.lightSensor.get(\"ods\");\n }\n catch (Exception p_exeception)\n {\n //m_warning_message (\"ods\");\n // DbgLog.msg (p_exeception.getLocalizedMessage ());\n LightSensorBottom = null;\n }\n\n\n if (colorSensor != null) {\n //ColorFront reads beacon light and is in passive mode\n colorSensor.setI2cAddress(i2CAddressColorFront);\n colorSensor.enableLed(false);\n }\n\n if (LightSensorBottom != null) {\n //OpticalDistance sensor measures dist from the beacon\n LightSensorBottom.enableLed(false);\n }\n\n }", "@Override\n public void init() {\n telemetry.addData(\"Status\", \"Initialized Interative TeleOp Mode\");\n telemetry.update();\n\n // Initialize the hardware variables. Note that the strings used here as parameters\n // to 'get' must correspond to the names assigned during the robot configuration\n // step (using the FTC Robot Controller app on the phone).\n leftDrive = hardwareMap.dcMotor.get(\"leftDrive\");\n rightDrive = hardwareMap.dcMotor.get(\"rightDrive\");\n armMotor = hardwareMap.dcMotor.get(\"armMotor\");\n\n leftGrab = hardwareMap.servo.get(\"leftGrab\");\n rightGrab = hardwareMap.servo.get(\"rightGrab\");\n colorArm = hardwareMap.servo.get(\"colorArm\");\n leftTop = hardwareMap.servo.get(\"leftTop\");\n rightTop = hardwareMap.servo.get(\"rightTop\");\n\n /*\n left and right drive = motion of robot\n armMotor = motion of arm (lifting the grippers)\n extendingArm = motion of slider (used for dropping the fake person)\n left and right grab = grippers to get the blocks\n */\n\n }", "public void initialize() {\n leftfrontmotor.setIdleMode(CANSparkMax.IdleMode.kBrake);\n leftrearmotor.setIdleMode(CANSparkMax.IdleMode.kBrake);\n rightfrontmotor.setIdleMode(CANSparkMax.IdleMode.kBrake);\n rightrearmotor.setIdleMode(CANSparkMax.IdleMode.kBrake);\n\n leftfrontmotor.setOpenLoopRampRate(Constants.DriveBase.MotorControllers.openramprate);\n leftrearmotor.setOpenLoopRampRate(Constants.DriveBase.MotorControllers.openramprate);\n rightfrontmotor.setOpenLoopRampRate(Constants.DriveBase.MotorControllers.openramprate);\n rightrearmotor.setOpenLoopRampRate(Constants.DriveBase.MotorControllers.openramprate);\n \n\n // More Motor Tunes (to occur during each initialization period):\n leftfrontmotor.getEncoder().setPositionConversionFactor(Constants.DriveBase.Encoders.encoderconversion);\n leftrearmotor.getEncoder().setPositionConversionFactor(Constants.DriveBase.Encoders.encoderconversion);\n rightfrontmotor.getEncoder().setPositionConversionFactor(Constants.DriveBase.Encoders.encoderconversion);\n rightrearmotor.getEncoder().setPositionConversionFactor(Constants.DriveBase.Encoders.encoderconversion);\n\n turnController.setSetpoint(Constants.DriveBase.Controllers.zero);\n turnController.setTolerance(Constants.DriveBase.Controllers.turntollerance);\n\n driveController.setSetpoint(Constants.DriveBase.Controllers.zero);\n driveController.setTolerance(Constants.DriveBase.Controllers.drivetollerance);\n\n ballTurnController.setSetpoint(Constants.DriveBase.Controllers.zero);\n ballTurnController.setTolerance(Constants.DriveBase.Controllers.balltollerance);\n\n ballDriveController.setSetpoint(Constants.DriveBase.Controllers.balldrive);\n ballDriveController.setTolerance(Constants.DriveBase.Controllers.balldrivetollerance);\n \n reset();\n }", "public final void modifyMotorcycle(){\r\n \tgetOffer();\r\n \tgetExhaustSystem();\r\n \tgetTires();\r\n getWindshield();\r\n getLED();\r\n getEngineGuards();\r\n /* Note that any of this methods \r\n \t * could provide a default implementation \r\n \t * by being concretely defined\r\n \t */\r\n }", "public void init() {\n delayingTimer = new ElapsedTime();\n\n // Define and Initialize Motors and Servos: //\n tailMover = hwMap.dcMotor.get(\"tail_lift\");\n grabberServo = hwMap.servo.get(\"grabber_servo\");\n openGrabber();\n\n // Set Motor and Servo Directions: //\n tailMover.setDirection(DcMotorSimple.Direction.FORWARD);\n\n tailMover.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n tailMover.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n int prevEncoder = tailMover.getCurrentPosition();\n tailMover.setPower(-0.15);\n mainHW.opMode.sleep (300);\n Log.d(\"catbot\", String.format(\"tail lift power %.2f current position %2d prev %2d\", tailMover.getPower(), tailMover.getCurrentPosition(),prevEncoder));\n runtime.reset();\n while((Math.abs(prevEncoder - tailMover.getCurrentPosition()) > 10)&& (runtime.seconds()<3.0)){\n prevEncoder = tailMover.getCurrentPosition();\n mainHW.opMode.sleep(300);\n Log.d(\"catbot\", String.format(\"tail lift power %.2f current position %2d prev %2d\", tailMover.getPower(), tailMover.getCurrentPosition(),prevEncoder));\n }\n tailMover.setPower(0.0);\n // Set Motor and Servo Modes: //\n tailMover.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n\n tailMover.setTargetPosition(0);\n tailMover.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n closeGrabber();\n }", "public void init(HardwareMap ahwMap) {\n // Save reference to Hardware map\n hwMap = ahwMap;\n\n // Define and Initialize Motors\n try {\n leftMotor1 = hwMap.dcMotor.get(\"right_motor1\");\n leftMotor2 = hwMap.dcMotor.get(\"right_motor2\");\n rightMotor1 = hwMap.dcMotor.get(\"left_motor1\");\n rightMotor2 = hwMap.dcMotor.get(\"left_motor2\");\n //servo_one = hwMap.servo.get(\"servant\");\n leftMotor1.setDirection(DcMotor.Direction.REVERSE); // Set to REVERSE if using AndyMark motors\n leftMotor2.setDirection(DcMotor.Direction.REVERSE); // Set to REVERSE if using AndyMark motors\n rightMotor1.setDirection(DcMotor.Direction.FORWARD);// Set to FORWARD if using AndyMark motors\n rightMotor2.setDirection(DcMotor.Direction.FORWARD);// Set to FORWARD if using AndyMark motors\n\n // Set all motors to zero power\n leftMotor1.setPower(0);\n rightMotor1.setPower(0);\n leftMotor2.setPower(0);\n rightMotor2.setPower(0);\n\n // Set all motors to run without encoders.\n // May want to use RUN_USING_ENCODERS if encoders are installed.\n leftMotor1.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n rightMotor1.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n leftMotor2.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n rightMotor2.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n // Enable NavX Sensor\n\n navx_device = AHRS.getInstance(hwMap.deviceInterfaceModule.get(\"DIM1\"),\n NAVX_DIM_I2C_PORT,\n AHRS.DeviceDataType.kProcessedData,\n NAVX_DEVICE_UPDATE_RATE_HZ);\n } catch (Exception e) {\n\n RobotLog.ee(MESSAGETAG,e.getMessage());\n\n }\n }", "public ArmJoint() {\n \t\n \tMotor = new CANTalon(RobotMap.Ports.bucketLifter);\n \tMotor.setFeedbackDevice(FeedbackDevice.CtreMagEncoder_Relative);\n \tMotor.clearStickyFaults();\n \tMotor.setSafetyEnabled(false);\n \tMotor.configNominalOutputVoltage(0, 0);\n \tMotor.configPeakOutputVoltage(12, -12);\n \tMotor.setAllowableClosedLoopErr(10);\n \tMotor.setProfile(0);\n \tMotor.setP(RobotMap.Values.armPidP);\n \tMotor.setI(RobotMap.Values.armPidI);\n \tMotor.setD(RobotMap.Values.armPidD);\n \tMotor.setF(0);\n\n \t//Motor.configEncoderCodesPerRev(1);\n \t//Motor.enableLimitSwitch(true, true);\n \t//Motor.enableBrakeMode(false);\n \t//Motor.enable();\n \t//Motor.changeControlMode(TalonControlMode.PercentVbus);\n \tMotor.enableZeroSensorPositionOnReverseLimit(true);\n \tMotor.set(0);\n \t\n \tLiveWindow.addActuator(\"ArmJoint\", 1, (CANTalon) Motor);\n // Use these to get going:\n // setSetpoint() - Sets where the PID controller should move the system\n // to\n // enable() - Enables the PID controller.\n }", "@Override\n\tpublic void robotInit() {\n\t\tleftDriveBack = new VictorSP(0); // PWM Port, madke sure this is set correctly.\n\t\tleftDriveFront = new VictorSP(1);\n\t\t\n\t\trightDriveFront = new VictorSP(2);\n\t\trightDriveBack = new VictorSP(3);\n\t\t\n\t\tleftIntake = new Spark(5);\n\t\trightIntake = new Spark(6);\n\t\t\n\t\tarmMotor = new TalonSRX(10);\n\t\tarmMotor.setNeutralMode(NeutralMode.Brake);\n\t\tarmMotor.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Absolute, 0, 0);\n\t\tarmMotor.configPeakCurrentLimit(30, 0);\n\t\tarmMotor.configPeakCurrentDuration(250, 0);\n\t\tarmMotor.configContinuousCurrentLimit(20, 0);\n\t\tarmMotor.configClosedloopRamp(0.25, 0);\n\t\tarmMotor.configOpenloopRamp(0.375, 0);\n\t\tarmMotor.enableCurrentLimit(true);\n\t\t\n\t\tarmMotor.configPeakOutputForward(1.0, 0);\n\t\tarmMotor.configPeakOutputReverse(-1.0, 0);\n\t\t\n\t\tarmMotor.config_kP(0, 0.0, 0);\n\t\t\n\t\tarmSetpoint = armMotor.getSelectedSensorPosition(0);\n\t\t\n\t\tstick = new Joystick(0);\n\t\tstickReversed = false;\n\t\txbox = new XboxController(1); // USB port, set in driverstation.\n\t\t\n\t\tdriveCamera = CameraServer.getInstance().startAutomaticCapture(0);\n\t}", "@Override\n public void init() {\n \n \n rightFront = hardwareMap.dcMotor.get(\"frontR\");\n rightBack = hardwareMap.dcMotor.get(\"backR\");\n \n \n \n rightFront.setDirection(DcMotor.Direction.FORWARD); \n rightBack.setDirection(DcMotor.Direction.FORWARD);\n \n \n \n\n // Send telemetry message to signify robot waiting;\n telemetry.addData(\"Say\", \"Hello Driver\"); //\n }", "public void init(HardwareMap hwMap) {\r\n\r\n //DRIVE//\r\n front_left = hwMap.dcMotor.get(\"front_left\");\r\n front_right = hwMap.dcMotor.get(\"front_right\");\r\n back_left = hwMap.dcMotor.get(\"back_left\");\r\n back_right = hwMap.dcMotor.get(\"back_right\");\r\n\r\n hook = hwMap.dcMotor.get(\"hook\");\r\n\r\n //intake1 = hwMap.servo.get(\"intake1\");\r\n //intake2 = hwMap.servo.get(\"intake2\");\r\n //intake3 = hwMap.servo.get(\"intake3\");\r\n //intake4 = hwMap.servo.get(\"intake4\");\r\n\r\n phone = hwMap.servo.get(\"phone\");\r\n marker = hwMap.servo.get(\"marker\");\r\n\r\n //linSlide1 = hwMap.dcMotor.get(\"lin_slide1\");\r\n //linSlide2 = hwMap.dcMotor.get(\"lin_slide2\");\r\n\r\n //arm_motor_1 = hwMap.dcMotor.get(\"arm1\");\r\n //arm_motor_2 = hwMap.dcMotor.get(\"arm2\");\r\n\r\n\r\n front_left.setDirection(DcMotor.Direction.FORWARD);\r\n front_right.setDirection(DcMotor.Direction.FORWARD);\r\n back_left.setDirection(DcMotor.Direction.REVERSE);\r\n back_right.setDirection(DcMotor.Direction.REVERSE);\r\n\r\n /* front_left.setMode(DcMotor.RunMode.RUN_TO_POSITION);\r\n front_right.setMode(DcMotor.RunMode.RUN_TO_POSITION);\r\n back_left.setMode(DcMotor.RunMode.RUN_TO_POSITION);\r\n back_right.setMode(DcMotor.RunMode.RUN_TO_POSITION);\r\n */\r\n hook.setDirection(DcMotor.Direction.FORWARD);\r\n\r\n //linSlide1.setDirection(DcMotor.Direction.FORWARD);\r\n //linSlide1.setDirection(DcMotor.Direction.REVERSE);\r\n\r\n //arm_motor_1.setDirection(DcMotor.Direction.FORWARD);\r\n //arm_motor_2.setDirection(DcMotor.Direction.REVERSE);\r\n\r\n front_left.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n front_right.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n back_left.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n back_right.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n\r\n //encoder1 = hwMap.analogInput.get(\"encoder1\");\r\n //encoder2 = hwMap.analogInput.get(\"encoder2\");\r\n\r\n imu = hwMap.get(BNO055IMU.class, \"imu\");\r\n }", "@Override\n public void robotInit() {\n m_oi = new OI();\n m_chooser.setDefaultOption(\"Default Auto\", new ExampleCommand());\n // chooser.addOption(\"My Auto\", new MyAutoCommand());\n SmartDashboard.putData(\"Auto mode\", m_chooser);\n\n Comp = new Compressor();\n\n //ClimbBack = new DoubleSolenoid(PCM_COMP_24V, 0, 1);\n //ClimbFront = new DoubleSolenoid(PCM_COMP_24V, 2, 3);\n LegFrontL = new VictorSPX(30);\n LegFrontR = new Spark(9);\n LegBackL = new VictorSPX(31);\n LegBackR = new VictorSPX(32);\n\n BackFootMover = new VictorSP(1);\n FrontFootMover = new Spark(2);\n //FeetMovers = new SpeedControllerGroup(BackFootMoverFootMover);\n\n MainRight = new CANSparkMax(9, MotorType.kBrushless);\n AltRight = new CANSparkMax(10, MotorType.kBrushless);\n MainLeft = new CANSparkMax(11, MotorType.kBrushless);\n AltLeft = new CANSparkMax(12, MotorType.kBrushless);\n\n MainRight.setIdleMode(IdleMode.kCoast);\n AltRight.setIdleMode(IdleMode.kCoast);\n MainLeft.setIdleMode(IdleMode.kCoast);\n AltLeft.setIdleMode(IdleMode.kCoast);\n\n AltLeft.follow(MainLeft);\n AltRight.follow(MainRight);\n\n Drive = new DifferentialDrive(MainLeft, MainRight);\n\n Lifter = new TalonSRX(6);\n Lifter.setNeutralMode(NeutralMode.Brake);\n Lifter.enableCurrentLimit(false);\n /*Lifter.configContinuousCurrentLimit(40);\n Lifter.configPeakCurrentLimit(50);\n Lifter.configPeakCurrentDuration(1500);*/\n //Lifter.configReverseSoftLimitEnable(true);\n //Lifter.configReverseSoftLimitThreshold(-27000);\n //Lifter.configForwardLimitSwitchSource(LimitSwitchSource.FeedbackConnector, LimitSwitchNormal.NormallyOpen);\n //Lifter.configClearPositionOnLimitF(true, 0);\n Lifter.selectProfileSlot(0, 0);\n LiftSetpoint = 0;\n\n LiftFollower = new TalonSRX(5);\n LiftFollower.follow(Lifter);\n LiftFollower.setNeutralMode(NeutralMode.Brake);\n\n ArmExtender = new Solenoid(0);\n ArmOpener = new Solenoid(1);\n ArmGrippers = new Spark(0);\n\n HatchSwitch0 = new DigitalInput(0);\n HatchSwitch1 = new DigitalInput(1);\n\n Accel = new BuiltInAccelerometer(Range.k2G);\n\n //Diagnostics = new DiagnosticsLogger();\n // Uncomment this line to enable diagnostics. Warning: this may\n // cause the robot to be slower than it is supposed to be because of lag.\n //Diagnostics.start();\n\n xbox = new XboxController(0);\n joystick = new Joystick(1);\n \n LiftRamp = new SRamp();\n SpeedRamp = new SRamp();\n\n NetworkTableInstance nt = NetworkTableInstance.getDefault();\n\n VisionTable = nt.getTable(\"ChickenVision\");\n TapeDetectedEntry = VisionTable.getEntry(\"tapeDetected\");\n TapePitchEntry = VisionTable.getEntry(\"tapePitch\");\n TapeYawEntry = VisionTable.getEntry(\"tapeYaw\");\n\n LedTable = nt.getTable(\"LedInfo\");\n LedScript = LedTable.getEntry(\"CurrentScript\");\n LedScriptArgument = LedTable.getEntry(\"ScriptArgument\");\n LedArmsClosed = LedTable.getEntry(\"ArmsClosed\");\n\n UsbCamera cam = CameraServer.getInstance().startAutomaticCapture();\n cam.setPixelFormat(PixelFormat.kMJPEG);\n cam.setResolution(320, 240);\n cam.setFPS(15);\n \n\n LedScript.setString(\"ColorWaves\");\n LedScriptArgument.setString(\"\");\n\n limits = new DigitalInput[8];\n\n for (int i = 0; i < limits.length; i++) {\n limits[i] = new DigitalInput(i + 2);\n }\n }", "private void configurateSensor()\n\t{\n\t\t// change state of measurement in RestApi\n\t\trestApiUpdate(\"CONFIGURING\", \"state1\");\n\t\tcheckFirmwareVersion();\n\t\t// Write configuration file to sensor\n\t\tsetAndWriteFiles();\n\n\t\t// push comment to RestApi\n\t\ttry\n\t\t{\n\t\t\trestApiUpdate(ConnectionManager.getInstance().currentSensor(0).getSerialNumber(), \"comment\");\n\t\t}\n\t\tcatch (SensorNotFoundException e)\n\t\t{\n\t\t\tstatusBar.setText(e.getMessage());\n\t\t}\n\n\t\t// change state of measurement in RestApi\n\t\trestApiUpdate(\"SENSOR_OUTBOX\", \"state2\");\n\n\t\t// print address\n\t\tint index2 = customerList.getSelectionIndex();\n\t\tfor (Measurement element : mCollect.getList())\n\t\t{\n\t\t\tif (mCollect.getList().get(index2).getLinkId() == element.getLinkId())\n\t\t\t{\n\t\t\t\taData = new AddressData(element.getId());\n\t\t\t\tprintLabel(aData.getCustomerData(), element.getLinkId());\n\t\t\t}\n\n\t\t}\n\n\t\t// set configuration success message\n\t\tstatusBar.setText(\"Sensor is configurated.Please connect another sensor.\");\n\n\t\t// writing date to sensor for synchronization\n\t\t try\n\t\t{\n\t\t\tConnectionManager.getInstance().currentSensor(0).synchronize();\n\t\t}\n\t\tcatch (SensorNotFoundException e)\n\t\t{\n\t\t\tstatusBar.setText(e.getMessage());\n\t\t}\n\n\t\t// resetData();\n\t\t try\n\t\t{\n\t\t\tConnectionManager.getInstance().currentSensor(0).disconnect();\n\t\t}\n\t\tcatch (SensorNotFoundException e)\n\t\t{\n\t\t\tstatusBar.setText(e.getMessage());\n\t\t}\n\n\t}", "@Override\n public void init() {\n robot.init(hardwareMap, telemetry, false);\n //robot.resetServo();\n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.addData(\"Status\", \"Initialized\");\n // robot.FL.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n // robot.FR.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n // robot.BL.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n // robot.BR.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n }", "private void updateMotors() {\n\t\t//Pass filtered values to ChopperStatus.\n\t\tmStatus.setMotorFields(mMotorSpeed);\n\t\tString logline = Long.toString(System.currentTimeMillis()) + \" \" + mMotorSpeed[0] + \" \" + mMotorSpeed[1] + \" \" + mMotorSpeed[2] + \" \" + mMotorSpeed[3] + \"\\n\";\n\t\ttry {\n\t\t\tif (logfile != null) {\n\t\t\t\tlogfile.write(logline);\n\t\t\t\tlogfile.flush();\n\t\t\t}\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\t//Log.e(TAG, \"Cannot write to logfile\");\n\t\t}\n\t\t//Pass motor values to motor controller!\n\t\tMessage msg = Message.obtain();\n\t\tmsg.what = SEND_MOTOR_SPEEDS;\n\t\tmsg.obj = mMotorSpeed;\n\t\tmBt.sendMessageToHandler(msg);\n\t\t//Log.i(TAG, \"Guidance sending message.\");\n\t\t\n\t}", "public Lift (SpeedController liftMotor) {\n m_liftMotor = liftMotor;\n }", "protected void initialize() {\n\t\tRobot.motor.getPIDController().setPID(SmartDashboard.getDouble(\"MotorP\"), SmartDashboard.getDouble(\"MotorI\"), SmartDashboard.getDouble(\"MotorD\"));\n\t\tRobot.motor.setOutputRange(0, 1);\n\t\tRobot.motor.setSetpoint(SmartDashboard.getDouble(\"MotorSpeed\"));\n \tRobot.motor.enable();\n }", "public void init(HardwareMap ahwMap) {\n // Save reference to Hardware map\n hwMap = ahwMap;\n\n // Define and Initialize Motors\n// frontLeft = hwMap.get(DcMotor.class, \"frontLeft\");\n// frontRight = hwMap.get(DcMotor.class, \"frontRight\");\n// backLeft = hwMap.get(DcMotor.class, \"backLeft\");\n// lift = hwMap.get(DcMotor.class, \"lift\");\n// backRight = hwMap.get(DcMotor.class, \"backRight\");\n\n leftIntake = hwMap.get(DcMotor.class, \"leftIntake\");\n rightIntake = hwMap.get(DcMotor.class, \"rightIntake\");\n dropper = hwMap.get(DcMotor.class, \"dropper\");\n\n\n //range = hwMap.get(ModernRoboticsI2cRangeSensor.class, \"range\");\n gyro = (ModernRoboticsI2cGyro)hwMap.gyroSensor.get(\"gyro\");\n //color = hwMap.get(ModernRoboticsI2cColorSensor.class, \"color\");\n\n frontLeft.setDirection(DcMotor.Direction.REVERSE); // Set to REVERSE if using AndyMark motors\n frontRight.setDirection(DcMotor.Direction.FORWARD);// Set to FORWARD if using AndyMark motors\n backLeft.setDirection(DcMotor.Direction.REVERSE); // Set to REVERSE if using AndyMark motors\n backRight.setDirection(DcMotor.Direction.FORWARD);// Set to FORWARD if using AndyMark motors\n\n // Set all motors to zero power\n frontLeft.setPower(0);\n frontRight.setPower(0);\n backLeft.setPower(0);\n backRight.setPower(0);\n leftIntake.setPower(0);\n rightIntake.setPower(0);\n dropper.setPower(0);\n\n // Set all motors to run without encoders.\n // May want to use RUN_USING_ENCODERS if encoders are installed.\n frontLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n frontRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n backLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n backRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n leftIntake.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n rightIntake.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n dropper.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n\n // Define and initialize ALL installed servos.\n\n// claimingArm = hwMap.get(Servo.class, \"claimingArm\");\n// claw1 = hwMap.get(Servo.class, \"claw1\");\n// claw2 = hwMap.get(Servo.class, \"claw2\");\n// samplingArm = hwMap.get(Servo.class, \"samplingArm\");\n\n helper = hwMap.get(Servo.class, \"helper\");\n leftUp = hwMap.get(Servo.class, \"leftUp\");\n rightUp = hwMap.get(Servo.class, \"rightUp\");\n outLeft = hwMap.get(Servo.class, \"outLeft\");\n outRight = hwMap.get(Servo.class, \"outRight\");\n\n// claimingArm.setPosition(0); // find out what servo they are using\n// claw1.setPosition(0);\n// claw2.setPosition(0);\n// samplingArm.setPosition(0);\n\n helper.setPosition(MID_SERVO);\n leftUp.setPosition(MID_SERVO);\n rightUp.setPosition(MID_SERVO);\n outLeft.setPosition(0.5);\n outRight.setPosition(0.5);\n\n dim = hwMap.get(DeviceInterfaceModule.class, \"Device Interface Module 1\");\n\n }", "public void init() {\n // Define and Initialize Motors (note: need to use reference to actual OpMode).\n leftDrive = myOpMode.hardwareMap.get(DcMotor.class, \"left_drive\");\n rightDrive = myOpMode.hardwareMap.get(DcMotor.class, \"right_drive\");\n armMotor = myOpMode.hardwareMap.get(DcMotor.class, \"arm\");\n\n // To drive forward, most robots need the motor on one side to be reversed, because the axles point in opposite directions.\n // Pushing the left stick forward MUST make robot go forward. So adjust these two lines based on your first test drive.\n // Note: The settings here assume direct drive on left and right wheels. Gear Reduction or 90 Deg drives may require direction flips\n leftDrive.setDirection(DcMotor.Direction.REVERSE);\n rightDrive.setDirection(DcMotor.Direction.FORWARD);\n\n // If there are encoders connected, switch to RUN_USING_ENCODER mode for greater accuracy\n // leftDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n // rightDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n // Define and initialize ALL installed servos.\n leftHand = myOpMode.hardwareMap.get(Servo.class, \"left_hand\");\n rightHand = myOpMode.hardwareMap.get(Servo.class, \"right_hand\");\n leftHand.setPosition(MID_SERVO);\n rightHand.setPosition(MID_SERVO);\n\n myOpMode.telemetry.addData(\">\", \"Hardware Initialized\");\n myOpMode.telemetry.update();\n }", "public void init(HardwareMap ahwMap, boolean auto) {\n hwMap = ahwMap;\n\n // Define and Initialize Motors\n extensionArm = hwMap.get(DcMotor.class, \"extensionArm\");\n leftDrive = hwMap.get(DcMotor.class, \"leftDrive\");\n rightDrive = hwMap.get(DcMotor.class, \"rightDrive\");\n leftrotationArm = hwMap.get(DcMotor.class, \"leftrotationArm\");\n rightrotationArm = hwMap.get(DcMotor.class, \"rightrotationArm\");\n intake_motor = hwMap.get(DcMotor.class, \"intakeMotor\");\n if (auto) {\n leftDrive.setDirection(DcMotorSimple.Direction.REVERSE); // Set to REVERSE if using AndyMark motors\n leftDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER); // Set to REVERSE if using AndyMark motors\n rightDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n rightDrive.setDirection(DcMotorSimple.Direction.FORWARD);\n }else{\n rightDrive.setDirection(DcMotorSimple.Direction.REVERSE); // Set to REVERSE if using AndyMark motors\n leftDrive.setDirection(DcMotorSimple.Direction.FORWARD);\n }\n\n leftrotationArm.setDirection(DcMotorSimple.Direction.REVERSE);\n rightrotationArm.setDirection(DcMotorSimple.Direction.REVERSE);\n\n intake_motor.setDirection(DcMotorSimple.Direction.FORWARD);\n extensionArm.setDirection(DcMotorSimple.Direction.REVERSE);\n\n // Set all motors to zero power\n leftDrive.setPower(0);\n rightDrive.setPower(0);\n\n\n leftrotationArm.setPower(0);\n\n extensionArm.setPower(0);\n intake_motor.setPower(0);\n\n // Set all motors to run without encoders.\n // May want to use RUN_USING_ENCODERS if encoders are installed.\n leftDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n rightDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n // Define and initialize ALL installed servos.\n latching_linear = hwMap.get(DcMotor.class, \"latching_linear\");\n\n latchServo = hwMap.get(Servo.class, \"latchServo\");\n verticalServo = hwMap.get(Servo.class, \"yServo\");\n //horizontalServo = hwMap.get(Servo.class, \"zServo\");\n teamMarker = hwMap.get(Servo.class, \"teamMarker\");\n }", "public void init(long handle, int id, String name, String model, int encoderTicksPerRevolution) {\n // Talons do some funkiness with the ID vs what we will use as the handle\n this.id = id;\n this.handle = handle;\n\n // update the config id and handle when we create this motor\n this.config = this.config.toBuilder()\n .setHandle(this.handle)\n .setId(this.id)\n .setName(name)\n .setModel(model)\n .addFpid(RobotProto.MotorConfig.FPID.newBuilder().build()) // start with a couple empty FPID slots\n .addFpid(RobotProto.MotorConfig.FPID.newBuilder().build())\n .addFpid(RobotProto.MotorConfig.FPID.newBuilder().build())\n .addFpid(RobotProto.MotorConfig.FPID.newBuilder().build())\n .addCustomParams(0)\n .addCustomParams(0)\n .setEncoder(RobotProto.MotorConfig.Encoder.NotSet)\n .setEncoderCountsPerRevolution(encoderTicksPerRevolution)\n .build();\n }", "@Override\n public void robotInit() {\n m_chooser.setDefaultOption(\"Default Auto\", kDefaultAuto);\n m_chooser.addOption(\"My Auto\", kCustomAuto);\n SmartDashboard.putData(\"Auto choices\", m_chooser);\n\n /* lets grab the 360 degree position of the MagEncoder's absolute position */\n /* mask out the bottom12 bits, we don't care about the wrap arounds */ \n\t\tint absolutePosition = elevator.getSelectedSensorPosition(0) & 0xFFF;\n \n /* use the low level API to set the quad encoder signal */\n elevator.setSelectedSensorPosition(absolutePosition, Constants.kPIDLoopIdx, Constants.kTimeoutMs);\n\n /* choose the sensor and sensor direction */\n elevator.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, \n Constants.kPIDLoopIdx, Constants.kTimeoutMs);\n\n /* Ensure sensor is positive when output is positive */\n elevator.setSensorPhase(false);\n\n /**\n * Set based on what direction you want forward/positive to be.\n * This does not affect sensor phase. \n */ \n //elevator.setInverted(Constants.kMotorInvert);\n \n /* Config the peak and nominal outputs, 12V means full */\n elevator.configNominalOutputForward(0, Constants.kTimeoutMs);\n elevator.configNominalOutputReverse(0, Constants.kTimeoutMs);\n //elevator.configPeakOutputForward(1, Constants.kTimeoutMs);\n elevator.configNominalOutputForward(0.5);\n //elevator.configPeakOutputForward(1, Constants.kTimeoutMs);\n elevator.configPeakOutputForward(0.5);\n elevator.configPeakOutputReverse(-1, Constants.kTimeoutMs);\n \n /**\n * Config the allowable closed-loop error, Closed-Loop output will be\n * neutral within this range. See Table in Section 17.2.1 for native\n * units per rotation.\n */\n //elevator.configAllowableClosedloopError(0, Constants.kPIDLoopIdx, Constants.kTimeoutMs);\n \n /* Config Position Closed Loop gains in slot0, typically kF stays zero. */\n elevator.config_kF(Constants.kPIDLoopIdx, 0.0, Constants.kTimeoutMs);\n elevator.config_kP(Constants.kPIDLoopIdx, 0.5, Constants.kTimeoutMs);\n elevator.config_kI(Constants.kPIDLoopIdx, 0.0, Constants.kTimeoutMs);\n elevator.config_kD(Constants.kPIDLoopIdx, 0.0, Constants.kTimeoutMs);\n\n\n }", "@Override\n public void init() {\n touchSensor1 = hardwareMap.touchSensor.get(\"touchSensor1\");\n lightSensor1 = hardwareMap.lightSensor.get(\"lightSensor1\");\n motorLeft1 = hardwareMap.dcMotor.get(\"motorLeft1\");\n motorLeft2 = hardwareMap.dcMotor.get(\"motorLeft2\");\n motorRight1 = hardwareMap.dcMotor.get(\"motorRight1\");\n motorRight2 = hardwareMap.dcMotor.get(\"motorRight2\");\n\n //Setup Hardware\n motorLeft1.setDirection(DcMotor.Direction.REVERSE);\n motorLeft2.setDirection(DcMotor.Direction.REVERSE);\n\n // Set up the parameters with which we will use our IMU. Note that integration\n // algorithm here just reports accelerations to the logcat log; it doesn't actually\n // provide positional information.\n BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();\n parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;\n parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;\n parameters.calibrationDataFile = \"AdafruitIMUCalibration.json\"; // see the calibration sample opmode\n parameters.loggingEnabled = true;\n parameters.loggingTag = \"IMU\";\n // parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator();\n\n // Retrieve and initialize the IMU. We expect the IMU to be attached to an I2C port\n // on a Core Device Interface Module, configured to be a sensor of type \"AdaFruit IMU\",\n // and named \"imu\".\n imu = hardwareMap.get(BNO055IMU.class, \"imu\");\n imu.initialize(parameters);\n\n currentState = MotorState.WAIT_TO_START;\n nextState = MotorState.WAIT_TO_START;\n count = 0;\n composeTelemetry();\n }", "protected Motor getMotorState() { return motorState; }", "public void init(HardwareMap ahwMap) {\n // Save reference to Hardware map\n hwMap = ahwMap;\n\n // Define and Initialize Motors\n leftDriveBack = hwMap.get(DcMotor.class, \"left_drive_back\");\n rightDriveBack = hwMap.get(DcMotor.class, \"right_drive_back\");\n leftDriveFront = hwMap.get(DcMotor.class, \"left_drive_front\");\n rightDriveFront = hwMap.get(DcMotor.class, \"right_drive_front\");\n leftDriveBack.setDirection(DcMotor.Direction.REVERSE);\n rightDriveBack.setDirection(DcMotor.Direction.FORWARD);\n leftDriveFront.setDirection(DcMotor.Direction.REVERSE);\n rightDriveFront.setDirection(DcMotor.Direction.FORWARD);\n\n resetEncoders();\n\n initMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n // Set all motors to zero power\n leftDriveBack.setPower(0);\n rightDriveBack.setPower(0);\n leftDriveFront.setPower(0);\n rightDriveFront.setPower(0);\n\n\n //arm\n arm = hwMap.get(DcMotor.class, \"arm\");\n //wrist = hwMap.get(Servo.class, \"wrist\");\n\n //wrist.setDirection(Servo.Direction.REVERSE);\n //wrist.scaleRange(0, 1);\n //wrist.setPosition(WRIST_DEFAULT_VALUE);\n\n arm.setDirection(DcMotor.Direction.REVERSE);\n arm.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n arm.setPower(0);\n\n //claws\n leftClaw = hwMap.get(Servo.class, \"left_claw\");\n rightClaw = hwMap.get(Servo.class, \"right_claw\");\n this.leftClaw.scaleRange(0, 1);\n this.rightClaw.scaleRange(0, 1);\n\n this.leftClaw.setPosition(LEFT_CLAW_START);\n this.rightClaw.setPosition(RIGHT_CLAW_START);\n\n //jewelkicker\n jewelKicker = hwMap.get(Servo.class, \"kicker\");\n this.jewelKicker.scaleRange(0, 1);\n this.jewelKicker.setPosition(KICKER_UP_VALUE);\n\n }", "private static void configTalonSensors()\n {\n //Left Talon\n frontLeftTalon.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, 5); //set encoder\n frontLeftTalon.setStatusFramePeriod(StatusFrame.Status_2_Feedback0, 5, 0); //Set the update rate\n\n //Right Talon\n frontRightTalon.configRemoteFeedbackFilter(frontLeftTalon.getDeviceID(), RemoteSensorSource.TalonSRX_SelectedSensor, 0, 0); //Config the right talon to look at the left talon as a sensor\n frontRightTalon.configRemoteFeedbackFilter(pigeon.getDeviceID(), RemoteSensorSource.GadgeteerPigeon_Yaw, 1, 0); //Config the right talon to use the navX (over CANifier) as a gyro sensor\n\n //Config the primary sensor of the right talon to be a sum sensor (to average the left/right sides, telling us the overall position/speed of the bot)\n frontRightTalon.configSensorTerm(SensorTerm.Sum0, FeedbackDevice.RemoteSensor0, 0); \n frontRightTalon.configSensorTerm(SensorTerm.Sum1, FeedbackDevice.CTRE_MagEncoder_Relative, 0);\n\n frontRightTalon.configSelectedFeedbackSensor(FeedbackDevice.SensorSum, 0, 0);\n frontRightTalon.configSelectedFeedbackCoefficient(0.5, 0, 0);\n\n // Configure NavX via CANifier or PigeonIMU\n frontRightTalon.configSelectedFeedbackSensor(FeedbackDevice.RemoteSensor1, 1, 0); //Set the secondary sensor of the right talon to be the navX (via CANifier) \n frontRightTalon.configSelectedFeedbackCoefficient((3600.0 / 8192.0), 1, 0);\n }", "public interface EncoderMotor extends Motor {\n double getVelocity();\n double getVelocityRaw();\n double setVelocity(double speed);\n double getDistance();\n void resetDistance();\n @Override\n EncoderMotor setInverted(boolean inverted);\n @Override\n EncoderMotor invert();\n\n void setConfig(EncoderMotorConfig config);\n}", "public void robotInit(){\n\t\tSmartDashboard.putNumber(\"Climber Arm Speed: \", 0.5);\n\t\tSmartDashboard.putNumber(\"Climber Winch Speed: \", 0.25);\n\t}", "public void init(HardwareMap ahwMap) {\n try {\n // Save reference to Hardware map\n hwMap = ahwMap;\n\n // Define and Initialize Motors\n motor1 = hwMap.dcMotor.get(\"motor1\");\n motor2 = hwMap.dcMotor.get(\"motor2\");\n motor3 = hwMap.dcMotor.get(\"motor3\");\n motor4 = hwMap.dcMotor.get(\"motor4\");\n\n pMotor1 = hwMap.dcMotor.get(\"pMotor1\");\n pMotor2 = hwMap.dcMotor.get(\"pMotor2\");\n beMotor = hwMap.dcMotor.get(\"beMotor\");\n fkMotor = hwMap.dcMotor.get(\"fkMotor\");\n\n\n // Set to FORWARD\n motor1.setDirection(DcMotor.Direction.FORWARD);\n motor2.setDirection(DcMotor.Direction.FORWARD);\n motor3.setDirection(DcMotor.Direction.FORWARD);\n motor4.setDirection(DcMotor.Direction.FORWARD);\n\n pMotor1.setDirection(DcMotor.Direction.FORWARD);\n pMotor2.setDirection(DcMotor.Direction.FORWARD);\n beMotor.setDirection(DcMotor.Direction.FORWARD);\n fkMotor.setDirection(DcMotor.Direction.FORWARD);\n\n\n // Set all motors to zero power\n motor1.setPower(0);\n motor2.setPower(0);\n motor3.setPower(0);\n motor4.setPower(0);\n\n pMotor1.setPower(0);\n pMotor2.setPower(0);\n beMotor.setPower(0);\n fkMotor.setPower(0);\n\n\n // Set all motors to run without encoders.\n // only use RUN_USING_ENCODERS in autonomous\n motor1.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n motor2.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n motor3.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n motor4.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n\n pMotor1.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n pMotor2.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n beMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n fkMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n/*\n gyro = (ModernRoboticsI2cGyro) hardwareMap.gyroSensor.get(\"gyro\");\n colorSensor = hardwareMap.colorSensor.get(\"color\");\n rangeSensor = hardwareMap.get(ModernRoboticsI2cRangeSensor.class, \"range\");\n ods = hardwareMap.opticalDistanceSensor.get(\"ods\");\n ods2 = hardwareMap.opticalDistanceSensor.get(\"ods2\");\n*/\n // Define and initialize ALL installed servos.\n //servo1 = hwMap.servo.get(\"servo1\");\n\n runtime.reset();\n\n } catch (Exception e) {\n telemetry.addData(\"runOpMode ERROR\", e.toString());\n telemetry.update();\n }\n\n }", "public Motor(MotorType type)\n {\n gpio = GpioSingleton.getInstance().get();\n \n // initialise instance variables\n if (type == MotorType.LEFT)\n {\n speedPin = gpio.provisionPwmOutputPin(RaspiPin.GPIO_23, \"SPEED\", 0);\n forwardPin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_24, \"FORWARD\", PinState.LOW);\n backwardPin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_25, \"BACKWARD\", PinState.LOW);\n }\n else if (type == MotorType.RIGHT)\n {\n speedPin = gpio.provisionPwmOutputPin(RaspiPin.GPIO_26, \"SPEED\", 0);\n forwardPin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_27, \"FORWARD\", PinState.LOW);\n backwardPin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_28, \"BACKWARD\", PinState.LOW);\n }\n // set shutdown state for this input pin\n speedPin.setShutdownOptions(true);\n forwardPin.setShutdownOptions(true);\n backwardPin.setShutdownOptions(true);\n }", "private static void initConfig() {\n /*\n * Human IO\n */\n {\n /*\n * Constants\n */\n {\n /*\n * Joysticks\n */\n {\n addToConstants(\"joysticks.left\", 0);\n addToConstants(\"joysticks.right\", 1);\n addToConstants(\"joysticks.operator\", 2);\n }\n\n /*\n * Buttons and axis\n */\n {\n }\n }\n }\n\n /*\n * RobotIO\n */\n {\n /*\n * Constants\n */\n {\n /*\n * Kicker\n */\n addToConstantsA(\"kicker.encoder.distPerPulse\", 360.0 / 1024.0);\n }\n }\n\n /*\n * Chassis\n */\n {\n /*\n * Constants\n */\n {\n }\n\n /*\n * Variables\n */\n {\n }\n }\n\n /*\n * Kicker\n */\n {\n /*\n * Constants\n */\n {\n addToConstants(\"kicker.kick.normal\", 1.75);\n addToConstants(\"kicker.kick.timeout\", 0.75);\n\n addToConstants(\"kicker.shaken.voltage\", -0.3316);\n addToConstants(\"kicker.shaken.tolerance\", 3.0);\n\n addToConstants(\"kicker.zero.voltage\", 0.8);\n addToConstants(\"kicker.zero.duration\", 0.75);\n }\n\n /*\n * Variables\n */\n {\n }\n }\n\n /*\n * Gripper\n */\n {\n /*\n * Constants\n */\n {\n addToConstants(\"gripper.collection.voltage\", 0.82);\n addToConstants(\"gripper.ejection.voltage\", -0.45);\n }\n }\n }", "public void init(HardwareMap ahwMap) {\n // Save reference to Hardware map\n hwMap = ahwMap;\n \n // Define and Initialize Motors\n leftMotorFrt = hwMap.get(DcMotor.class, \"LeftMotorFwd\");\n rightMotorFrt = hwMap.get(DcMotor.class, \"RightMotorFwd\");\n //PickupUnit = hwMap.get(DcMotor.class, \"PickupUnit\");\n leftMotorBck = hwMap.get(DcMotor.class, \"LeftMotorBck\");\n rightMotorBck = hwMap.get(DcMotor.class, \"RightMotorBck\");\n foundationHookRight = hwMap.get(Servo.class, \"hookRight\");\n foundationHookLeft = hwMap.get(Servo.class, \"hookLeft\");\n TheClaw = hwMap.get(Servo.class, \"theclaw\");\n foundTouch = hwMap.get(TouchSensor.class, \"foundTouch\");\n intakeRight = hwMap.get(DcMotor.class, \"intakeRight\");\n intakeLeft = hwMap.get(DcMotor.class, \"intakeLeft\");\n \n foundationHookRight.setPosition(0.7);\n foundationHookLeft.setPosition(0.7);\n leftMotorFrt.setDirection(DcMotor.Direction.FORWARD); // Set to REVERSE if using AndyMark motors\n rightMotorFrt.setDirection(DcMotor.Direction.REVERSE);// Set to FORWARD if using AndyMark motors\n leftMotorBck.setDirection(DcMotor.Direction.FORWARD); // Set to REVERSE if using AndyMark motors\n rightMotorBck.setDirection(DcMotor.Direction.REVERSE);// Set to FORWARD if using AndyMark motors\n intakeRight.setDirection(DcMotor.Direction.REVERSE);\n intakeLeft.setDirection(DcMotor.Direction.FORWARD);\n\n // Set all motors to zero power\n leftMotorFrt.setPower(0);\n rightMotorFrt.setPower(0);\n leftMotorBck.setPower(0);\n rightMotorBck.setPower(0);\n //PickupUnit.setPower(0);\n \n leftMotorFrt.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n rightMotorFrt.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n leftMotorBck.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n rightMotorBck.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n //PickupUnit.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n \n // Set all motors to run without encoders.\n // May want to use RUN_USING_ENCODERS if encoders are installed.\n leftMotorFrt.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODERS);\n rightMotorFrt.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODERS);\n leftMotorBck.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODERS);\n rightMotorBck.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODERS);\n //PickupUnit.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODERS);\n \n }", "@Override\n public void init() {\n leftDrive = hardwareMap.get(DcMotor.class, \"left_drive\");\n rightDrive = hardwareMap.get(DcMotor.class, \"right_drive\");\n }", "public void enable() {\n TalonHelper.configNeutralMode(Arrays.asList(armMotor, armMotorSlave), NeutralMode.Brake);\n }", "@Override \n public void init() {\n intakeLeft = hardwareMap.crservo.get(\"intakeLeft\");\n intakeRight = hardwareMap.crservo.get(\"intakeRight\");\n topLeft = hardwareMap.servo.get(\"topLeft\");\n bottomLeft = hardwareMap.servo.get(\"bottomRight\");\n topRight = hardwareMap.servo.get(\"topRight\");\n bottomRight = hardwareMap.servo.get(\"bottomRight\");\n lift = hardwareMap.dcMotor.get(\"lift\");\n }", "@Override\n public void runOpMode () {\n motor1 = hardwareMap.get(DcMotor.class, \"motor1\");\n motor2 = hardwareMap.get(DcMotor.class, \"motor2\");\n\n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.update();\n //Wait for game to start (driver presses PLAY)\n waitForStart();\n\n /*\n the overridden runOpMode method happens with every OpMode using the LinearOpMode type.\n hardwareMap is an object that references the hardware listed above (private variables).\n The hardwareMap.get method matches the name of the device used in the configuration, so\n we would have to change the names (ex. motorTest to Motor 1 or Motor 2 (or something else))\n if not, the opMode won't recognize the device\n\n in the second half of this section, it uses something called telemetry. In the first and\n second lines it sends a message to the driver station saying (\"Status\", \"Initialized\") and\n then it prompts the driver to press start and waits. All linear functions should have a wait\n for start command so that the robot doesn't start executing the commands before the driver\n wants to (or pushes the start button)\n */\n\n //run until end of match (driver presses STOP)\n double tgtpower = 0;\n while (opModeIsActive()) {\n telemetry.addData(\"Left Stick X\", this.gamepad1.left_stick_x);\n telemetry.addData(\"Left Stick Y\", this.gamepad1.left_stick_y);\n telemetry.addData(\"Right Stick X\", this.gamepad1.right_stick_x);\n telemetry.addData(\"Right Stick Y\", this.gamepad1.right_stick_y);\n if (this.gamepad1.left_stick_y < 0){\n tgtpower=-this.gamepad1.left_stick_y;\n motor1.setPower(tgtpower);\n motor2.setPower(-tgtpower);\n }else if (this.gamepad1.left_stick_y > 0){\n tgtpower=this.gamepad1.left_stick_y;\n motor1.setPower(-tgtpower);\n motor2.setPower(tgtpower);\n }else if (this.gamepad1.left_stick_x > 0){\n tgtpower=this.gamepad1.left_stick_x;\n motor1.setPower(tgtpower);\n motor2.setPower(tgtpower);\n }else if (this.gamepad1.left_stick_x < 0){\n tgtpower=-this.gamepad1.left_stick_x;\n motor1.setPower(-tgtpower);\n motor2.setPower(-tgtpower);\n }else{\n motor1.setPower(0);\n motor2.setPower(0);\n }\n telemetry.addData(\"Motor1 Power\", motor1.getPower());\n telemetry.addData(\"Motor2 Power\", motor2.getPower());\n telemetry.addData(\"Status\", \"Running\");\n telemetry.update ();\n\n\n /*\n if (this.gamepad1.right_stick_x == 1){\n //trying to make robot turn right, == 1 may be wrong\n motor2.setPower(-1);\n }\n else if (this.gamepad1.right_stick_x == -1){\n //trying to make robot turn left, == -1 may be wrong\n motor1.setPower(-1);\n }\n else {\n\n }\n */\n\n\n /*\n After the driver presses start,the opMode enters a while loop until the driver presses stop,\n while the loop is running it will continue to send messages of (\"Status\", \"Running\") to the\n driver station\n */\n\n\n }\n }", "public static void hookMotor() {\n\t\thookMotor.rotate(45);\n\t}", "public void init(HardwareMap ahwMap) {\n // Save reference to Hardware map\n hwMap = ahwMap;\n\n // Define and Initialize Motors\n// leftRearMotor = hwMap.dcMotor.get(\"left_rear_drive\");\n// rightRearMotor = hwMap.dcMotor.get(\"right_rear_drive\");\n leftFrontMotor = hwMap.dcMotor.get(\"left_front_drive\");\n rightFrontMotor = hwMap.dcMotor.get(\"right_front_drive\");\n// liftMotor = hwMap.dcMotor.get(\"lift_motor\");\n brushMotor = hwMap.dcMotor.get(\"brush_motor\");\n leftSpinMotor = hwMap.dcMotor.get(\"left_spin_motor\");\n rightSpinMotor = hwMap.dcMotor.get(\"right_spin_motor\");\n tiltMotor = hwMap.dcMotor.get(\"tilt_motor\");\n\n// rangeSensor = hwMap.get(ModernRoboticsI2cRangeSensor.class, \"range sensor\");\n\n //define and initialize servos\n// loadServo = hwMap.servo.get(\"load_servo\");\n// loadServo.setPosition(BEGIN_SERVO);\n pushServo = hwMap.servo.get(\"push_servo\");\n pushServo.setPosition(MID_SERVO);\n leftLiftServo = hwMap.servo.get(\"left_lift_servo\");\n leftLiftServo.setPosition(MID_SERVO);\n rightLiftServo = hwMap.servo.get(\"right_lift_servo\");\n rightLiftServo.setPosition(MID_SERVO);\n\n //define and initialize buttons\n// bottomTouchButton = hwMap.touchSensor.get(\"bottom_touch_button\");\n// topTouchButton = hwMap.touchSensor.get(\"top_touch_button\");\n\n leftSpinMotor.setDirection(DcMotor.Direction.REVERSE);\n leftFrontMotor.setDirection(DcMotor.Direction.REVERSE); // Set to REVERSE if using AndyMark motors\n rightFrontMotor.setDirection(DcMotor.Direction.FORWARD); // Set to FORWARD if using AndyMark motors\n\n // Set all motors to zero power\n// leftRearMotor.setPower(0);\n// rightRearMotor.setPower(0);\n leftFrontMotor.setPower(0);\n rightFrontMotor.setPower(0);\n// liftMotor.setPower(0);\n brushMotor.setPower(0);\n leftSpinMotor.setPower(0);\n rightSpinMotor.setPower(0);\n tiltMotor.setPower(0);\n\n // Set all motors to run without encoders.\n // May want to use RUN_USING_ENCODERS if encoders are installed.\n// leftRearMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n// rightRearMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n leftFrontMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n rightFrontMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n// liftMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n brushMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n leftSpinMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n// rightSpinMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n tiltMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }", "public ArmRobot(int num) {\n\t\tlinks = num;\n\t\tconfig = new Double[2*num+2];\n\t\tint i = 0;\n\t\tfor ( i = 0; i < config.length; i++) {\n\t\t\tconfig[i] = 0.;\n\t\t}\n\t\twidth = 10.;\n\t}", "private void config() {\n\t}", "public void init() {\n robot.init(hardwareMap);\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.liftRotate.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.liftRotate.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n robot.liftUpDown.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n robot.blinkinLedDriver.setPattern(RevBlinkinLedDriver.BlinkinPattern.GREEN);\n\n }", "public void setMotorCurrentLimit() {\r\n final int motorCurrentLimit = 40;\r\n leftMotor_0.setSmartCurrentLimit(motorCurrentLimit);\r\n leftMotor_1.setSmartCurrentLimit(motorCurrentLimit);\r\n leftMotor_2.setSmartCurrentLimit(motorCurrentLimit);\r\n rightMotor_0.setSmartCurrentLimit(motorCurrentLimit);\r\n rightMotor_1.setSmartCurrentLimit(motorCurrentLimit);\r\n rightMotor_2.setSmartCurrentLimit(motorCurrentLimit);\r\n }", "public void init() {\n//\t\tint anglesToEncTicks = (int) ((90 - currentAngle) * encoderTicksPerRev);\n//\t\tarmMotor.setEncPosition(anglesToEncTicks);\n\t\twhile (armMotor.isFwdLimitSwitchClosed() != true) {\n\t\t\tarmMotor.set(.2);\n\t\t}\n\t\tSystem.out.println(\"Calibrated!\");\n\t\tarmMotor.setEncPosition(0);\n\t}", "private static void configureTalons()\n {\n configTalonSensors();\n\n configPIDF(LINEAR_PIDF_SLOT, LINEAR_P, LINEAR_I, LINEAR_D, LINEAR_F);\n\n //Config Front Left Talon\n frontLeftTalon.setSensorPhase(false);\n frontLeftTalon.setInverted(true);\n\n //Config Front Right Talon\n frontRightTalon.setSensorPhase(true);\n frontRightTalon.setInverted(true);\n\n //Config Rear talons\n rearLeftTalon.setInverted(false);\n rearRightTalon.setInverted(true);\n \n rearLeftTalon.follow(frontLeftTalon);\n rearRightTalon.follow(frontRightTalon);\n }", "@Override\n\tprotected void autonomousInit()\n\t{\n\t\tarmTurnMotor.resetSpeedControl();\n\t\tclawArm.resetTargets();\n\t}", "@Override\n public void teleopInit() {\n /* factory default values */\n _talonL1.configFactoryDefault();\n _talonL2.configFactoryDefault();\n _talonR1.configFactoryDefault();\n _talonR2.configFactoryDefault();\n\n /* flip values so robot moves forward when stick-forward/LEDs-green */\n _talonL1.setInverted(true); // <<<<<< Adjust this\n _talonL2.setInverted(true); // <<<<<< Adjust this\n _talonR1.setInverted(true); // <<<<<< Adjust this\n _talonR2.setInverted(true); // <<<<<< Adjust this\n\n\n /*\n * WPI drivetrain classes defaultly assume left and right are opposite. call\n * this so we can apply + to both sides when moving forward. DO NOT CHANGE\n */\n _drive.setRightSideInverted(true);\n }", "@Override\n public void init() {\n /* Initialize the hardware variables.\n * The init() method of the hardware class does all the work here\n */\n robot.init(hardwareMap);\n\n robot.leftDriveMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.rightDriveMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n // Possibly add a delay\n robot.leftDriveMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n robot.rightDriveMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n\n\n // Send telemetry message to signify robot waiting;\n telemetry.addData(\"Say\", \"Hello Driver\"); //\n }", "public void robotInit() {\n // North.registerCommand(\"setSetpoint\", (params) -> ??, [\"Setpoint\"]);\n // North.registerCondition(\"atSetpoint\", elevator::atSetpoint);\n\n //NOTE: init(name, size, logic provider, drive & nav)\n North.init(/*NorthUtils.readText(\"name.txt\")*/ \"lawn chair\", 24/12, 24/12, drive);\n North.default_drive_controller = HoldController.I;\n\n UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();\n camera.setResolution(640, 480);\n }", "@Override\n\n public void runOpMode() {\n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.update();\n\n // Initialize the hardware variables. Note that the strings used here as parameters\n // to 'get' must correspond to the names assigned during the robot configuration\n // step (using the FTC Robot Controller app on the phone).\n // FR = hardwareMap.get(DcMotor.class, \"FR\");\n // FL = hardwareMap.get(DcMotor.class, \"FL\");\n // BR = hardwareMap.get(DcMotor.class, \"BR\");\n //BL = hardwareMap.get(DcMotor.class, \"BL\");\n //yoo are ___\n // Most robots need the motor on one side to be reversed to drive forward\n // Reverse the motor that runs backwards when connected directly to the battery\n/* FR.setDirection(DcMotor.Direction.FORWARD);\n FL.setDirection(DcMotor.Direction.REVERSE);\n BR.setDirection(DcMotor.Direction.FORWARD);\n BL.setDirection(DcMotor.Direction.REVERSE);\n\n */ RevBlinkinLedDriver blinkinLedDriver;\n RevBlinkinLedDriver.BlinkinPattern pattern;\n\n // Wait for the game to start (driver presses PLAY)\n waitForStart();\n\n blinkinLedDriver = this.hardwareMap.get(RevBlinkinLedDriver.class, \"PrettyBoi\");\n blinkinLedDriver.setPattern(RevBlinkinLedDriver.BlinkinPattern.RAINBOW_WITH_GLITTER);\n// runtime.reset();\n\n // run until the end of the match (driver presses STOP)\n while (opModeIsActive()) {\n\n\n\n // Show the elapsed game time and wheel power.\n// telemetry.addData(\"Status\", \"Run Time: \" + runtime.toString());\n// // telemetry.addData(\"Motors\", \"FL (%.2f), FR (%.2f), BL (%.2f), BR (%.2f)\", v1, v2, v3, v4);\n// telemetry.update();\n }\n }", "public void configVelocityControl() {\n leftDrive.configTeleopVelocity();\n rightDrive.configTeleopVelocity();\n }", "private void configureRobot() {\n // Populating robot configuration\n m_robotConfiguration.setMasterUri(ROS_MASTER_URI);\n m_robotConfiguration.setHostname(JAVA_ROS_HOSTNAME);\n m_robotConfiguration.setNodeName(NODE_NAME);\n }", "public interface ArmController {\n\n /**\n * Applies a rotational force to the arm base.\n *\n * @param force The rotational force to apply at the arm base. This is not currently supported.\n * @see ArmBase#setRotationalForce(double)\n * @see <a href=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.83.8883&rep=rep1&type=pdf>Learning to control an octopus arm with gaussian process temporal difference methods</a>\n * @see <a href=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.137.7975&rep=rep1&type=pdf>Dynamic model of the octopus arm: Biomechanics of the octopus reaching movement.</a>\n */\n public void applyRotationForce(double force);\n\n /**\n * Applies a contraction force to the dorsal muscle of segment(i).\n *\n * @param i The index of the segment being activated\n * @param force The contraction force to be applied\n * @see ArmSegment#setDorsalContraction(double)\n * @see Muscle#setContraction(double)\n * @see <a href=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.83.8883&rep=rep1&type=pdf>Learning to control an octopus arm with gaussian process temporal difference methods</a>\n * @see <a href=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.137.7975&rep=rep1&type=pdf>Dynamic model of the octopus arm: Biomechanics of the octopus reaching movement.</a>\n */\n public void contractDorsalMuscle(int i, double force);\n\n /**\n * Applies a contraction force to the transverse muscle of segment(i).\n *\n * @param i The index of the segment being activated.\n * @param force The contraction force to be applied.\n * @see ArmSegment#setTransverseContraction(double)\n * @see Muscle#setContraction(double)\n * @see <a href=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.83.8883&rep=rep1&type=pdf>Learning to control an octopus arm with gaussian process temporal difference methods</a>\n * @see <a href=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.137.7975&rep=rep1&type=pdf>Dynamic model of the octopus arm: Biomechanics of the octopus reaching movement.</a>\n */\n public void contractTransverseMuscle(int i, double force);\n\n /**\n * Applies a contraction force to the ventral muscle of segment(i).\n *\n * @param i The index of the segment being activated.\n * @param force The contraction force to be applied.\n * @see ArmSegment#setVentralContraction(double)\n * @see hyper.experiments.octopusArm.model.Muscle#setContraction(double)\n * @see <a href=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.83.8883&rep=rep1&type=pdf>Learning to control an octopus arm with gaussian process temporal difference methods</a>\n * @see <a href=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.137.7975&rep=rep1&type=pdf>Dynamic model of the octopus arm: Biomechanics of the octopus reaching movement.</a>\n */\n public void contractVentralMuscle(int i, double force);\n\n}", "@Override\n public void init() {\n imu = new IMU(hardwareMap, \"imu\");\n left = hardwareMap.get(DcMotor.class, \"left\");\n right = hardwareMap.get(DcMotor.class, \"right\");\n\n left.setDirection(DcMotorSimple.Direction.FORWARD);\n right.setDirection(DcMotorSimple.Direction.REVERSE);\n }", "static void configure() {\n float weight = (float) (Math.random() * 4000);\n System.out.println(\"Weight: \" + String.format(\"%.2f\", weight) + \"kg\");\n\n if (weight < 2000) {\n logisticsFactory = new RoadLogistics();\n } else {\n logisticsFactory = new SeaLogistics();\n }\n\n }", "@Override\n public void robotInit() {\n m_chooser.setDefaultOption(\"Default Auto\", kDefaultAuto);\n m_chooser.addOption(\"My Auto\", kCustomAuto);\n SmartDashboard.putData(\"Auto choices\", m_chooser);\n leftFrontMotor = new CANSparkMax(10, MotorType.kBrushless);\n leftBackMotor = new CANSparkMax(11, MotorType.kBrushless);\n rightFrontMotor = new CANSparkMax(12, MotorType.kBrushless);\n rightBackMotor = new CANSparkMax(13, MotorType.kBrushless);\n leftFrontMotor.setIdleMode(IdleMode.kCoast);\n leftBackMotor.setIdleMode(IdleMode.kCoast);\n rightFrontMotor.setIdleMode(IdleMode.kCoast);\n rightBackMotor.setIdleMode(IdleMode.kCoast);\n gyro = new ADXRS450_Gyro();\n gyro.calibrate();\n stick = new Joystick(1);\n controller = new XboxController(0);\n origGyro = 0;\n }", "public void init(HardwareMap ahwMap) {\n // Save reference to Hardware map\n hwMap = ahwMap;\n\n // Define and Initialize Motors\n frontLeft = hwMap.get(DcMotor.class, \"front_left\");\n frontRight = hwMap.get(DcMotor.class, \"front_right\");\n backLeft = hwMap.get(DcMotor.class, \"back_left\");\n backRight = hwMap.get(DcMotor.class, \"back_right\");\n flipper = hwMap.get(DcMotor.class, \"flipper\");\n intake = hwMap.get(CRServo.class, \"intake\");\n reelIn = hwMap.get(DcMotor.class, \"reelIn\");\n reelOut = hwMap.get(DcMotor.class, \"reelOut\");\n bucket = hwMap.get(Servo.class, \"bucket\");\n frontLeft.setDirection(DcMotor.Direction.FORWARD);\n frontRight.setDirection(DcMotor.Direction.REVERSE);\n backLeft.setDirection(DcMotor.Direction.REVERSE);\n backRight.setDirection(DcMotor.Direction.FORWARD);\n \n // Set all motors to zero power\n frontLeft.setPower(0);\n frontRight.setPower(0);\n backLeft.setPower(0);\n backRight.setPower(0);\n reelIn.setPower(0);\n reelOut.setPower(0);\n // Set all motors to run without encoders.\n // May want to use RUN_USING_ENCODERS if encoders are installed.\n frontLeft.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n frontRight.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n backLeft.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n backRight.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n flipper.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n}", "public HangerSubsystem() {\n // WRITE CODE BETWEEN THESE LINES -------------------------------------------------------- //\n // TODO: configure and initialize motor (if necessary)\n\n // TODO: configure and initialize sensor (if necessary)\n\n // ^^-----------------------------------------------------------------------------------^^ //\n }", "@Override\n public void runOpMode() {\n motorFL = hardwareMap.get(DcMotor.class, \"motorFL\");\n motorBL = hardwareMap.get(DcMotor.class, \"motorBL\");\n motorFR = hardwareMap.get(DcMotor.class, \"motorFR\");\n motorBR = hardwareMap.get(DcMotor.class, \"motorBR\");\n landerRiser = hardwareMap.get(DcMotor.class, \"lander riser\");\n landerRiser = hardwareMap.get(DcMotor.class, \"lander riser\");\n landerRiser.setDirection(DcMotor.Direction.FORWARD);\n landerRiser.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n markerDrop = hardwareMap.get(Servo.class, \"marker\");\n markerDrop.setDirection(Servo.Direction.FORWARD);\n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.update();\n\n // Wait for the game to start (driver presses PLAY)\n waitForStart();\n runtime.reset();\n\n //Landing & unlatching\n landerRiser.setPower(-1);\n telemetry.addData(\"Status\", \"Descending\");\n telemetry.update();\n sleep(5550);\n landerRiser.setPower(0);\n telemetry.addData(\"Status\",\"Unhooking\");\n telemetry.update();\n move(-0.5, 600, true);\n strafe(-0.4,0.6, 3600, true);\n move(0.5,600,true);\n markerDrop.setPosition(0);\n sleep(1000);\n markerDrop.setPosition(0.5);\n sleep(700);\n markerDrop.setPosition(0);\n strafe(0, -0.5,500,true);\n strafe(0.5, -0.25, 8500, true);\n\n }", "@Override\n public void robotInit() {\n // Instantiate our RobotContainer. This will perform all our button bindings, and put our\n // autonomous chooser on the dashboard.\n m_robotContainer = new RobotContainer();\n \n left_motor_1= new CANSparkMax(2,MotorType.kBrushless);\n left_motor_2=new CANSparkMax(3,MotorType.kBrushless);\n right_motor_1=new CANSparkMax(5,MotorType.kBrushless);\n right_motor_2=new CANSparkMax(6,MotorType.kBrushless);\n ball_collection_motor=new CANSparkMax(4,MotorType.kBrushless);\n left_high_eject=new CANSparkMax(1, MotorType.kBrushless);\n right_high_eject=new CANSparkMax(7,MotorType.kBrushless);\n left_belt=new TalonSRX(9);\n right_belt=new TalonSRX(11);\n left_low_eject=new TalonSRX(8);\n right_low_eject=new TalonSRX(12);\n double_solenoid_1=new DoubleSolenoid(0,1);\n joystick=new Joystick(1);\n servo=new Servo(0);\n if_correted=false;\n xbox_controller=new XboxController(0);\n servo_angle=1;\n eject_speed=0;\n go_speed=0;\n turn_speed=0;\n high_eject_run=false;\n clockwise=false;\n left_motor_1.restoreFactoryDefaults();\n left_motor_2.restoreFactoryDefaults();\n right_motor_1.restoreFactoryDefaults();\n right_motor_2.restoreFactoryDefaults();\n \n left_motor_2.follow(left_motor_1);\n right_motor_1.follow(right_motor_2);\n servo.set(0);\n currentServoAngle = 0;\n factor = 0.01;\n pushed = false;\n //right_high_eject.follow(left_high_eject);\n //right_low_eject.follow(left_low_eject);\n\n }", "@Override\n public void robotInit() {\n SmartDashboard.putBoolean(\"CLIMB\", false);\n SmartDashboard.putNumber(\"servo\", 0);\n // Instantiate our RobotContainer. This will perform all our button bindings, and put our\n // autonomous chooser on the dashboard.\n m_robotContainer = new RobotContainer();\n //coast.\n if (RobotMap.DRIVE_TRAIN_DRAGON_FLY_IS_AVAILABLE)\n getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(false, RobotMap.DRIVE_TRAIN_MIDDLE_WHEEL_PORT);\n\n getRobotContainer().configureButtonBindings();\n getRobotContainer().getTecbotSensors().initializeAllSensors();\n getRobotContainer().getTecbotSensors().getTecbotGyro().reset();\n\n Robot.getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(true, RobotMap.DRIVE_TRAIN_MIDDLE_WHEEL_PORT);\n Robot.getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(true, RobotMap.DRIVE_TRAIN_LEFT_CHASSIS_PORTS);\n Robot.getRobotContainer().getDriveTrain().setCANSparkMaxMotorsState(true, RobotMap.DRIVE_TRAIN_RIGHT_CHASSIS_PORTS);\n\n UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();\n camera.setResolution(640, 480);\n\n m_chooser.addOption(\"Move 3 m\", new SpeedReductionStraight(3, .75, 0));\n m_chooser.addOption(\"Rotate 90 degrees\", new SpeedReductionTurn(90, .5));\n m_chooser.setDefaultOption(\"El chido\", new DR01D3K4());\n m_chooser.addOption(\"Collect, go back and shoot\", new CollectPowerCellsGoBackShoot());\n m_chooser.addOption(\"Transport\", new SequentialCommandGroup(new FrontIntakeSetRaw(.75),\n new TransportationSystemSetRaw(.5)));\n m_chooser.addOption(\"Shoot 3PCs n' Move\", new SHOOT_3_PCs_N_MOVE());\n SmartDashboard.putData(\"Auto Mode\", m_chooser);\n\n //camera.setExposureManual(79);\n\n\n }", "@Override\n\tpublic void robotInit() {\n\t\toi = new OI();\n\t\t\n\t\t// chooser.addObject(\"My Auto\", new MyAutoCommand());\n\t\tSmartDashboard.putData(\"Auto mode\", chooser);\n\t\tSystem.out.println(\"I am here\");\n\t\ttopRight = new CANTalon(1);\n\t\tmiddleRight = new CANTalon(3);\n\t\tbottomRight = new CANTalon(2);\n\t\ttopLeft = new CANTalon(5);\n\t\tmiddleLeft = new CANTalon(6);\n\t\tbottomLeft = new CANTalon(7);\n\t\tclimber = new CANTalon(4);\n\t\tshifter = new DoubleSolenoid(2,3);\n\t\tshifter.set(Value.kForward);\n\t\tbucket= new DoubleSolenoid(0, 1);\n\t\tclimber.reverseOutput(true);\n\t\t//Setting Followers\n\t\t//topRight is Right Side Master (TalonSRX #1)0.062, 0.00062, 0.62)\n\t\t//middleRight.reset();\n//\t\tmiddleRight.setProfile(0);\n//\t\tmiddleRight.setPID( 0.0, 0.0, 0.0);//TODO: make multiple profiles\n\t\t\n//\t\tmiddleRight.setFeedbackDevice(FeedbackDevice.CtreMagEncoder_Absolute);\n//\t\tmiddleRight.setEncPosition(0);\n//\t\tmiddleRight.setAllowableClosedLoopErr(10);\n\t\tmiddleRight.reverseSensor(true);\n//\t\tmiddleRight.configNominalOutputVoltage(+0f, -0f);\n//\t\tmiddleRight.configPeakOutputVoltage(+12f, -12f);\n\t\ttopRight.changeControlMode(TalonControlMode.Follower);\n\t\ttopRight.set(middleRight.getDeviceID());\n\t\ttopRight.reverseOutput(true);\n\t\tbottomRight.changeControlMode(TalonControlMode.Follower); //TalonSRX #3\n\t\tbottomRight.set(middleRight.getDeviceID());\n//\t\tmiddleRight.setProfile(1);\n//\t\tmiddleRight.setPID( 0.0, 0.0, 0.0);\n\t\t//climber is the climber Motor (TalonSRX #4)\n\t\t//TopLeft is Right Side Master (TalonSRX #5)\n\t\t//middleLeft.reset();\n\t\t//middleLeft.setProfile(0);\n//\t\tmiddleLeft.setPID(0.0, 0.00, 0.0);\n//\t\tmiddleLeft.setEncPosition(0);\n//\t\tmiddleLeft.setFeedbackDevice(FeedbackDevice.CtreMagEncoder_Absolute);\n//\t\tmiddleLeft.configNominalOutputVoltage(+0f, -0f);\n//\t\tmiddleLeft.configPeakOutputVoltage(+12f, -12f);\n\t\tmiddleLeft.reverseSensor(false);\n//\t\tmiddleLeft.setAllowableClosedLoopErr(10);\n\t\ttopLeft.changeControlMode(TalonControlMode.Follower); //TalonSRX #6\n\t\ttopLeft.set(middleLeft.getDeviceID());\n\t\ttopLeft.reverseOutput(true);\n\t\tbottomLeft.changeControlMode(TalonControlMode.Follower); //TalonSRX #7\n\t\tbottomLeft.set(middleLeft.getDeviceID());\n//\t\tmiddleLeft.setProfile(1);\n//\t\tmiddleLeft.setPID(0, 0, 0);\n\t\t//Sensors\n\t\timu = new ADIS16448IMU();\n\t\tclimberSubsystem = new ClimberSubsystem();\n\t\tbucketSubsystem = new BucketSubsystem();\n\t\tdriveSubsystem = new DriveSubsystem();\n\t}", "@Override\n\tprotected void initialize() {\n\t\t//hookMotor1.configPeakCurrentDuration(9000, 10000);\n\t\t//hookMotor1.configPeakCurrentLimit(40, 10000);\n\t\t//hookMotor2.configPeakCurrentDuration(9000, 10000);\n\t\t//hookMotor2.configPeakCurrentLimit(40, 10000);\n\t\thookMotor1.enableCurrentLimit(false);\n\t\thookMotor2.enableCurrentLimit(false);\n\n\t\t//first move joint2 forward to release hook\n//\t\tRobot.joint2Cmd = new Joint2Cmd(RobotMap.jointEncoder2.getRaw(), -1647, 1000);\n//\t\tRobot.joint2Cmd.start();\n\t\t\n\t\thookMotor1.set(ControlMode.PercentOutput, -1.0);\n\t\thookMotor2.set(ControlMode.PercentOutput, -1.0);\n\t\tstepCnt = 0;\n\t\tSystem.out.println(\"start climbing\");\n\t}", "public void init(HardwareMap ahwMap) {\n // Save reference to Hardware map\n hwMap = ahwMap;\n\n // Define and Initialize Motors\n leftDrive = hwMap.get(DcMotor.class, \"left_drive\");\n rightDrive = hwMap.get(DcMotor.class, \"right_drive\");\n liftDrive = hwMap.get(DcMotor.class, \"lift_drive\");\n\n markerServo = hwMap.get(Servo.class, \"marker_servo\");\n hookServo = hwMap.get(Servo.class, \"hook_servo\"); //Hook server motor\n// distanceSensor = hardwareMap.get(DistanceSensor.class, \"sensor_color_distance\");\n touchSensor = hardwareMap.get(TouchSensor.class, \"touch_sensor\");\n\n leftDrive.setDirection(DcMotor.Direction.REVERSE); // Set to REVERSE if using AndyMark motors\n rightDrive.setDirection(DcMotor.Direction.FORWARD);// Set to FORWARD if using AndyMark motors\n liftDrive.setDirection(DcMotor.Direction.FORWARD);\n\n // Set all motors to zero power\n leftDrive.setPower(0);\n rightDrive.setPower(0);\n liftDrive.setPower(0);\n\n\n\n }", "public void init(HardwareMap ahwMap) {\n // Save reference to Hardware map\n hwMap = ahwMap;\n\n // Define and Initialize Motors\\\n frontLeft = hwMap.get(DcMotor.class, \"frontLeft\");\n backLeft = hwMap.get(DcMotor.class, \"backLeft\");\n frontRight = hwMap.get(DcMotor.class, \"frontRight\");\n backRight = hwMap.get(DcMotor.class, \"backRight\");\n conveyorBelt = hwMap.get(DcMotor.class, \"conveyorBelt\");\n arm = hwMap.get(DcMotor.class, \"arm\");\n shooter = hwMap.get(DcMotor.class, \"conBeltWheels\");\n platform = hwMap.get(DcMotor.class, \"platform\");\n\n // Set all motors to zero power\n frontLeft.setPower(0);\n backLeft.setPower(0);\n frontRight.setPower(0);\n backRight.setPower(0);\n arm.setPower(0);\n conveyorBelt.setPower(0);\n shooter.setPower(0);\n platform.setPower(0);\n\n\n // sets zeroPowerBehavior\n frontLeft.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n frontRight.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n backLeft.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n backRight.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n arm.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n conveyorBelt.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n shooter.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n platform.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n // Sets motor directions\n frontLeft.setDirection(DcMotor.Direction.REVERSE);\n backLeft.setDirection(DcMotor.Direction.REVERSE);\n frontRight.setDirection(DcMotor.Direction.FORWARD);\n backRight.setDirection(DcMotor.Direction.FORWARD);\n arm.setDirection(DcMotor.Direction.FORWARD);\n conveyorBelt.setDirection(DcMotor.Direction.FORWARD);\n shooter.setDirection(DcMotor.Direction.REVERSE);\n platform.setDirection(DcMotor.Direction.FORWARD);\n\n // sets enconder mode to run with encoder\n frontRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n backRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n frontLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n backLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n arm.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n conveyorBelt.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n shooter.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n platform.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n\n // Define and initialize ALL installed servos.\n claw = hwMap.get(Servo.class, \"claw\");\n intakeWheel1 = hwMap.get(Servo.class, \"intakeWheel1\");\n intakeWheel2 = hwMap.get(Servo.class, \"intakeWheel2\");\n ringBringer = hwMap.get(Servo.class, \"ringBringer\");\n\n //platform.setPosition(SERVO_HOME);\n claw.setPosition(SERVO_HOME);\n intakeWheel1.setPosition(SERVO_HOME);\n intakeWheel2.setPosition(SERVO_HOME);\n ringBringer.setPosition(SERVO_HOME);\n\n }", "@Override\n\tpublic void robotInit() {\n\t\tm_chooser.setDefaultOption(\"Default Auto\", kDefaultAuto);\n\t\tm_chooser.addOption(\"My Auto\", kCustomAuto);\n\t\tSmartDashboard.putData(\"Auto choices\", m_chooser);\n\n\t\tm_frontRight = new PWMVictorSPX(0);\n\t\tm_frontLeft = new PWMVictorSPX(2);\n\t\tm_backRight = new PWMVictorSPX(1);\n\t\tm_backLeft = new PWMVictorSPX(3);\n\n\t\tx_aligning = false;\n\n\t\tJoy = new Joystick(0);\n\t\tmyTimer = new Timer();\n\n\t\tfinal SpeedControllerGroup m_left = new SpeedControllerGroup(m_frontLeft, m_backLeft);\n\t\tfinal SpeedControllerGroup m_right = new SpeedControllerGroup(m_frontRight, m_backRight);\n\n\t\tm_drive = new DifferentialDrive(m_left, m_right);\n\n\t\tdistanceToTarget = 0;\n\n\t\tcounter = new Counter(9);\n\t\tcounter.setMaxPeriod(10.0);\n\t\tcounter.setSemiPeriodMode(true);\n\t\tcounter.reset();\n\t}", "@Override\n\t\t\tprotected void configure() {\n\t\t\t}", "@Override\n public void main() throws InterruptedException {\n this.motorLeft = this.hardwareMap.dcMotor.get(\"motorLeft\");\n this.motorRight = this.hardwareMap.dcMotor.get(\"motorRight\");\n\n motorLeft.setMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);\n motorRight.setMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);\n\n motorRight.setDirection(DcMotor.Direction.REVERSE);\n\n// boolean test = true;\n// while (test) {\n// motorLeft.setPower(1.0);\n// motorRight.setPower(1.0);\n//\n// if (updateGamepads())\n// {\n// if (gamepad1.b)\n// {\n// test = false;\n// }\n// }\n// }\n\n // while (opModeIsActive())\n // gamepad1.a\n while (true)\n {\n if (updateGamepads())\n {\n motorLeft.setPower(gamepad1.left_stick_y);\n motorRight.setPower(gamepad1.right_stick_y);\n\n // move the arm with controller bumpers\n if (gamepad1.right_bumper)\n {\n motorArm.setPower(0.5);\n Thread.sleep(100);\n }\n else if (gamepad1.left_bumper)\n {\n motorArm.setPower(-0.5);\n Thread.sleep(100);\n }\n else\n {\n motorArm.setPower(0);\n }\n }\n\n telemetry.update();\n idle();\n }\n }", "private void sensorInformation(){\n\t\tthis.name = this.paramName;\n\t\tthis.version = this.paramVersion;\n\t\tthis.author = this.paramVersion;\n\t}", "protected void initialize() {\n \t//Robot.getFlywheel().setRunning(!Robot.getFlywheel().running());\n \t//Robot.getElevator().setRunning(!Robot.getElevator().running());\n \tif (run == false)\n \t{\n \t\tRobot.getFlywheel().setRunning(false);\n \t\t//Robot.getIndexer().setRunning(false);\n \t\tRobot.getFlywheel().setSetpoint(0.0);\n \t\tRobot.getFlywheel().disable();\n \t\t//Robot.getIndexer().disable();\n \t\tSystem.out.println(\"not running\");\n \t}\n \telse\n \t{\n \t\tRobot.getFlywheel().initialize();\n \t\tRobot.getFlywheel().enable();\n \t\tRobot.getFlywheel().setRunning(true);\n \t\tdouble m_motorLevel;\n \t\t//m_rpms = SmartDashboard.getNumber(\"FlywheelVelocity\", 1850);\n \t//m_motorLevel = m_rpms / 6750 * 1.35;//6750 = max rpms\n \tm_motorLevel =( m_rpms + 1000) / 6750 *1.1;//6750 = max rpms\n \tRobot.getFlywheel().setSetpoint(m_rpms);\n \tRobot.getFlywheel().setExpectedMotorLevel(m_motorLevel);\n \tSmartDashboard.putNumber(\"FlywheelVelocity\", m_rpms);\n \tSystem.out.println(m_rpms + \" \" + m_motorLevel + \" setpoint: \" + Robot.getFlywheel().getSetpoint());\n \t}\n }", "@Override\n public void init() {\n /* Initialize the hardware variables.\n * The init() method of the hardware class does all the work here\n */\n robot.init(hardwareMap);\n robot.FL.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.FL.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }", "protected AutonomousMode() {\n driveMotions = new Vector();\n auxMotions = new Vector();\n }", "private void getConfigurationInfo(BankFusionEnvironment env) {\n controlDetails = ATMConfigCache.getInstance().getInformation(env);\n if (controlDetails != null) {\n sharedSwitch = controlDetails.isSharedSwitch();\n }\n }", "@Override\n public void robotInit() {\n }", "@Override\n public void robotInit() {\n }", "@Override\n public void robotInit() {\n }", "public void robotInit() {\n ;\n System.out.println(\"robot_init\");\n liftJoystick = new Joystick(2);\n armJoystick = new Joystick(4);\n setEncoder(new Encoder(2, 3));\n getEncoder().setDistancePerPulse(8.0 * 3.14 / 360.0 / 2);\n compressor = new Compressor(1, 1);\n compressor.start();\n // cameraMount = new CameraMount(10,9);\n //File file = new File (\"WALT_output.txt\");\n displayIndex = 1;\n driverScreen = DriverStationLCD.getInstance();\n\n //sensor wiring was switche so I fixed it programming wise\n setLeft(new DigitalInput(12));\n if (getLeft() == null) {\n printToScreen(\"LEFT SENSOR [DigitalInput(12)] IS NULL!!\");\n } else {\n printToScreen(\"LEFT SENSOR [DigitalInput(12)] is initialized\");\n }\n\n middle = new DigitalInput(13);\n if (getMiddle() == null) {\n printToScreen(\"MIDDLE SENSOR [DigitalInput(13)] IS NULL!!\");\n } else {\n printToScreen(\"MIDDLE SENSOR [DigitalInput(13)] is initialized\");\n }\n\n right = new DigitalInput(14);\n if (getRight() == null) {\n printToScreen(\"RIGHT SENSOR [DigitalInput(14)] IS NULL!!\");\n } else {\n printToScreen(\"RIGHT SENSOR [DigitalInput(14)] INITIALIZED\");\n }\n\n demoMode = false;\n myDog = Watchdog.getInstance();\n myDog.setEnabled(true);\n myDog.setExpiration(1);\n joysticks = new TankControls(1, 3);//All channel values arbitrary at this point and may need to be changed.\n // xboxController = new XboxControls(3);//channel value\n //initializes pneumatics\n //int[] solenoidChannels=(4,5);\n int spikeChannel = 1;\n int pressureSwitch = 2;\n //pneumatics=new pneumaticSystem(solenoidChannels,spikeChannel,pressureSwitch, 120);\n\n //Arm constructor\n //currently the arm is controlling the drive motors- arm channels are 3,4\n int liftChannel = 3;\n int armChannel = 4;\n int solenoidChannelWrist = 1;\n int clawSolenoid = 2;\n int armGyroChannel = 2;\n arm = new Arm(liftChannel, armChannel, solenoidChannelWrist,\n clawSolenoid, armGyroChannel);\n //channel for gyro\n int gyroChannel = 1;\n\n //channels for camera initiation\n boolean usingCamera = true;\n int panMotorCamChannel = 9;\n int tiltCamChannel = 8;\n\n //channels for accelerators- may want multiple for multiple directions\n int accSlot = -1;\n\n setSensors(new SensorSet(gyroChannel, accSlot, usingCamera,\n tiltCamChannel, panMotorCamChannel));\n\n setRobotDrive(new TwoMotorDrive(1, 2, demoMode));\n getRobotDrive().setInvertedSide(true);//boolean is true to invert right, false for left\n\n //so that it doesn't return nulls- should not be started before re-creating Why do we initialize it here then?\n driveTask = new WaltLineTrack(false, false, this);\n armTask = arm.getNewGoToHeightInstance(2);\n armTask2 = arm.getNewGoToAngleInstance(135);\n }", "@Override\n\tpublic void configure(List<SensorConfiguration> config) {\n\t\t\n\t}", "public interface RobotMap {\n\t// CAN Device IDs\n\n\tpublic static final int WINCH_TALON = 1;\n\t// winch motors\n\n\tpublic static final int LEFT_ALIGN_TALON = 3;\n\tpublic static final int RIGHT_ALIGN_TALON = 4;\n\t// allignment wheels\n\n\tpublic static final int REAR_RIGHT_TALON = 5;\n\tpublic static final int REAR_LEFT_TALON = 6;\n\tpublic static final int FRONT_RIGHT_TALON = 7;\n\tpublic static final int FRONT_LEFT_TALON = 8;\n\t// drivetrain wheels\n\n\tpublic static final int PCM_MAIN = 9;\n\n\t/******************\n ** PNEUMATICS ** \n ******************/ \n\tpublic static final int FLIPPER_RIGHT = 0;\n\tpublic static final int FLIPPER_LEFT = 1;\n\tpublic static final int ARMS_A = 2;\n\tpublic static final int ARMS_B = 3;\n\t// End Pneumatic Channels\n\n\t/******************\n **PID CONTROLLER** \n ******************/ \n public static final double ABS_TOL = 100;\n public static final double P = .4;\n public static final double I = .01;\n public static final double D = 11;\n public static final double OUT_RANGE_L = -0.8;\n public static final double OUT_RANGE_H = 0.8;\n\n}", "private RelayConfig () {}", "private RightMotor() {\n\t\t// Instantiate left motor class\n\t\tmotor = new Talon(RobotMap.M_RIGHT);\n\t\tencoder = new Encoder(RobotMap.M_RIGHT_ENCODER_CW, RobotMap.M_RIGHT_ENCODER_CCW);\n\t}", "@Override\r\n\tpublic void init() {\n\t\tif (target!=null)\r\n\t\t\ttry{\r\n\t\t\t\twriter.write(target.state.getSpeed()+\"\\t\\t\"+target.state.getRPM()+\"\\t\\t\");\r\n\t\t\t\t//System.out.println(target.state.getRPM());\r\n\t\t\t} catch (Exception e){\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t}", "@Override\n public void runOpMode() {\n try {\n leftfrontDrive = hardwareMap.get(DcMotor.class, \"frontLeft\");\n leftfrontDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n rightfrontDrive = hardwareMap.get(DcMotor.class, \"frontRight\");\n rightfrontDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n leftbackDrive = hardwareMap.get(DcMotor.class, \"backLeft\");\n leftbackDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n leftbackDrive.setDirection(DcMotor.Direction.REVERSE);\n\n rightbackDrive = hardwareMap.get(DcMotor.class, \"backRight\");\n rightbackDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n lift = hardwareMap.get(DcMotor.class, \"Lift\");\n lift.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n lift.setDirection(DcMotor.Direction.REVERSE);\n\n markerArm = hardwareMap.get(Servo.class, \"markerArm\");\n\n armActivator = hardwareMap.get(DcMotor.class, \"armActivator\");\n armActivator.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n } catch (IllegalArgumentException iax) {\n bDebug = true;\n }\n\n BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();\n parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;\n parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;\n parameters.calibrationDataFile = \"BNO055IMUCalibration.json\";\n parameters.loggingEnabled = true;\n parameters.loggingTag = \"IMU\";\n parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator();\n\n imu = hardwareMap.get(BNO055IMU.class, \"imu\");\n imu.initialize(parameters);\n\n waitForStart(); //the rest of the code begins after the play button is pressed\n\n sleep(3000);\n\n drive(0.35, 0.5);\n\n turn(90.0f);\n\n drive(1.8, 0.5);\n\n turn(45.0f);\n\n drive(2.5, -0.5);\n\n sleep(1000);\n\n markerArm.setPosition(1);\n\n sleep(1000);\n\n markerArm.setPosition(0);\n\n sleep(1000);\n\n drive(2.5,.75);\n\n turn(179.0f);\n\n drive(1.5, 1.0);\n\n requestOpModeStop(); //end of autonomous\n }" ]
[ "0.69798523", "0.66987205", "0.66924036", "0.66805744", "0.6640662", "0.6520454", "0.63915104", "0.63336295", "0.62978065", "0.625683", "0.62351525", "0.62297016", "0.6199173", "0.6186821", "0.61863613", "0.61567384", "0.61171794", "0.6108231", "0.6085075", "0.6072812", "0.60587", "0.60447884", "0.60399437", "0.60235375", "0.59961545", "0.59762156", "0.59690547", "0.59657526", "0.59630114", "0.59504044", "0.5946685", "0.59363323", "0.59150773", "0.591055", "0.59007645", "0.5891179", "0.58870226", "0.58824366", "0.58783346", "0.5853138", "0.58505046", "0.5839271", "0.5809928", "0.5802207", "0.5800936", "0.58009344", "0.57981795", "0.5797159", "0.57736236", "0.5749265", "0.5742124", "0.57394373", "0.5719267", "0.5708704", "0.5708314", "0.5696271", "0.56919855", "0.5689633", "0.5683607", "0.5678253", "0.56751925", "0.5667091", "0.5665782", "0.5662973", "0.5657111", "0.56432635", "0.56340337", "0.5617386", "0.5596848", "0.55966705", "0.5572493", "0.5569189", "0.5547274", "0.5532888", "0.55211216", "0.55182695", "0.5502897", "0.5502791", "0.5491371", "0.54786533", "0.54779005", "0.5477213", "0.5471851", "0.5462484", "0.54599386", "0.54532355", "0.54509217", "0.5449477", "0.5448369", "0.5440777", "0.5439514", "0.5439514", "0.5439514", "0.5439221", "0.5424963", "0.5421987", "0.5419736", "0.54195285", "0.541525", "0.5397693" ]
0.71902806
0
This method is intended for lab testing and early development. At competitions, should only be doing servo mode
private static synchronized void runLiftStageFromJoystick(ArmLiftMotorInfo mtrInfo) { //double stage1JoystickReading, double stage2JoystickReading) { double percentOut; synchronized(armStage1.motorLock) { // synchronized(armStage2.motorLock) { //joysticks give negative readings when pushed away from you, but we want that action to run //the motors in their forward direction (postive Percent Output values) double jsRdg = mtrInfo.jsNamedControl.getEnt().getAnalog(); mtrInfo.lastJoystickReading = jsRdg; //squaring makes joysticks easier to use percentOut = -Math.copySign(jsRdg*jsRdg, jsRdg); if(mtrInfo.operatingMode.equals(OperatingModesE.IDLE)) {mtrInfo.operatingMode = OperatingModesE.JOYSTICK;} //check limit switches, encoders, 'useEncoder' flag, etc. and allow/forbid motion accordingly mtrInfo.handleJoystickPercentOut(percentOut); // } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void testServo(){\n\n if (gamepad1.y) {\n servoLeft.setDirection(Servo.Direction.REVERSE);\n servoLeft.setPosition(0.5);\n servoRight.setDirection(Servo.Direction.REVERSE);\n servoRight.setPosition(0.5);\n\n }\n if (gamepad1.x) {\n servoLeft.setDirection(Servo.Direction.FORWARD);\n servoLeft.setPosition(0.1);\n servoRight.setDirection(Servo.Direction.FORWARD);\n servoRight.setPosition(0.1);\n }\n //Should theoretically move the servo back and forth\n\n }", "public void runOpMode() {\n leftBackDrive = hardwareMap.get(DcMotor.class, \"left_back_drive\"); //port 0, hub1\n rightBackDrive = hardwareMap.get(DcMotor.class, \"right_back_drive\"); //port 1, hub1\n leftFrontDrive = hardwareMap.get(DcMotor.class, \"left_front_drive\"); //port 2, hub1\n rightFrontDrive = hardwareMap.get(DcMotor.class, \"right_front_drive\"); //port 3, hub1\n craneExtend = hardwareMap.get(DcMotor.class, \"craneExtend\"); //port 0, hub2\n cranePitch = hardwareMap.get(DcMotor.class, \"cranePitch\"); //port 1, hub2\n craneElevate = hardwareMap.get(DcMotor.class, \"craneElevate\"); //port 2, hub2\n fakeMotor = hardwareMap.get(DcMotor.class, \"fakeMotor\"); //port 2, hub3\n craneGrab = hardwareMap.get(Servo.class, \"craneGrab\"); //port 0, servo\n craneGrabAttitude = hardwareMap.get(Servo.class, \"craneGrabAttitude\"); //port 2, servo\n trayGrab = hardwareMap.get(Servo.class, \"trayGrab\"); //port 1, servo\n flipperLeft = hardwareMap.get(Servo.class, \"flipperLeft\"); //port 3. servo\n flipperRight = hardwareMap.get(Servo.class, \"flipperRight\"); //port 4, servo\n \n //Setting the motor directions\n leftBackDrive.setDirection(DcMotor.Direction.FORWARD);\n rightBackDrive.setDirection(DcMotor.Direction.REVERSE);\n leftFrontDrive.setDirection(DcMotor.Direction.FORWARD);\n rightFrontDrive.setDirection(DcMotor.Direction.REVERSE);\n\n //Initializing variables\n \n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.update(); //Done initalizing\n\n //Wait for the game to start (driver presses PLAY)\n waitForStart();\n runtime.reset();\n\n //run until the end of the match (driver presses STOP)\n while (opModeIsActive()) {\n \n//******************************************************************************\n\n //Drive controls\n if (gamepad1.left_trigger>0 || gamepad1.right_trigger>0) { //Crab\n leftBackDrive.setPower(gamepad1.left_stick_x*0.8);\n rightBackDrive.setPower(-gamepad1.left_stick_x*0.8);\n leftFrontDrive.setPower(-gamepad1.left_stick_x*0.8);\n rightFrontDrive.setPower(gamepad1.left_stick_x*0.8);\n }\n\n else { //Tank\n leftBackDrive.setPower(-gamepad1.left_stick_x);\n rightBackDrive.setPower(-gamepad1.right_stick_x);\n leftFrontDrive.setPower(-gamepad1.left_stick_x);\n rightFrontDrive.setPower(-gamepad1.right_stick_x);\n }\n }\n \n//******************************************************************************\n\n //Crane control\n \n \n//******************************************************************************\n\n //Telemetry display\n telemetry.addData(\"Run Time:\", \"\" + runtime.toString());\n telemetry.addData(\"Motor Power\", \"L (%.2f), R (%.2f)\", gamepad1.left_stick_y, gamepad1.right_stick_y);\n telemetry.update();\n }", "@Override\n public void runOpMode() {\n ringShooterMotor1 = hardwareMap.get(DcMotorEx.class, \"ringShooterMotor1\");\n ringShooterMotor2 = hardwareMap.get(DcMotorEx.class, \"ringShooterMotor2\");\n ringFeederServo = hardwareMap.get(Servo.class, \"ringFeederServo\");\n ringFeederServo.setPosition(0.6); // sets initial position of servo\n\n\n // Wait for the game to start (driver presses PLAY)\n waitForStart();\n\n // runs until the end of the match (driver presses STOP)\n while (opModeIsActive()) {\n\n // here: add telemetry to see motor velocity if you want\n telemetry.addData(\"ring motor velocity\", ringShooterMotor1.getVelocity());\n telemetry.update();\n\n\n // Press right trigger for ring feeder servo\n if (gamepad2.right_trigger == 1) {\n// if (ringShooterMotor1.getVelocity() <= powerShootMotorVelocity){\n ringFeederServo.setPosition(1);\n sleep(300);\n ringFeederServo.setPosition(0.6);\n// }\n }\n\n // press Y for shooter motor for tower goal\n if (gamepad2.y) {\n ringShooterMotor1.setVelocity(towerGoalMotorVelocity);\n ringShooterMotor2.setVelocity(towerGoalMotorVelocity);\n\n }\n\n // press X for shooter motor for powershot\n if (gamepad2.x) {\n ringShooterMotor1.setVelocity(powerShootMotorVelocity);\n ringShooterMotor2.setVelocity(powerShootMotorVelocity);\n\n }\n }\n }", "@Override \n public void runOpMode() \n {\n leftMotors = hardwareMap.get(DcMotor.class, \"left_Motors\");\n rightMotors = hardwareMap.get(DcMotor.class, \"right_Motors\");\n vLiftMotor = hardwareMap.get(DcMotor.class, \"vLift_Motor\"); \n \n leftMotors.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n rightMotors.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n leftMotors.setDirection(DcMotor.Direction.REVERSE);\n rightMotors.setDirection(DcMotor.Direction.FORWARD);\n vLiftMotor.setDirection(DcMotor.Direction.REVERSE);\n vLiftMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n \n waitForStart(); //press play button, actives opMode\n intakePivotServo.setPosition(intakePivotServoPos);\n while (opModeIsActive()) \n { \n drive();\n pivotIntake();\n pivotLift();\n \n }//opModeIsActive \n \n }", "@Override\n public void runOpMode() {\n telemetry.addData(\"Status\", \"Resetting Encoders\"); //\n telemetry.update();\n\n leftFront = hardwareMap.get(DcMotor.class, \"left_front\");\n rightFront = hardwareMap.get(DcMotor.class, \"right_front\");\n leftBack = hardwareMap.get(DcMotor.class, \"left_back\");\n rightBack = hardwareMap.get(DcMotor.class, \"right_back\");\n\n\n leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n leftBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n\n right = hardwareMap.get(Servo.class, \"right\");\n left = hardwareMap.get(Servo.class, \"left\");\n // Most robots need the motor on one side to be reversed to drive forward\n // Reverse the motor that runs backwards when connected directly to the battery\n leftFront.setDirection(DcMotor.Direction.REVERSE);\n rightFront.setDirection(DcMotor.Direction.FORWARD);\n leftBack.setDirection(DcMotor.Direction.REVERSE);\n rightBack.setDirection(DcMotor.Direction.FORWARD);\n\n leftFront.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n leftBack.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n rightFront.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n rightBack.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n digitalTouch = hardwareMap.get(DigitalChannel.class, \"sensor_digital\");\n digitalTouch.setMode(DigitalChannel.Mode.INPUT);\n\n right.setDirection(Servo.Direction.REVERSE);\n\n right.scaleRange(0, 0.25);\n left.scaleRange(0.7, 1);\n\n\n // Wait for the game to start (driver presses PLAY)\n waitForStart();\n\n\n servo(0);\n runtime.reset();\n encoderSideways(0.25, -5, -5, 5);\n // drive until touch sensor pressed\n // activate servos to grab platform\n // drive backwards for a while\n // release servos\n // sideways part\n // remember to do red autonomous for repackage org.firstinspires.ftc.teamcode;\n }", "public void servoOn() throws DeviceException {\n \t\ttry {\n \t\t\tcontroller.caput(svonChannel, 1, 2.0);\n \t\t} catch (Throwable e) {\n \t\t\tthrow new DeviceException(\"failed to turn servos on\", e);\n \t\t}\n \t}", "@Override\n public void runOpMode() {\n leftDrive = hardwareMap.get(DcMotor.class, \"left_drive\");\n rightDrive = hardwareMap.get(DcMotor.class, \"right_drive\");\n intake = hardwareMap.get (DcMotor.class, \"intake\");\n dropServo = hardwareMap.get(Servo.class, \"drop_Servo\");\n leftDrive.setDirection(DcMotor.Direction.REVERSE);\n rightDrive.setDirection(DcMotor.Direction.FORWARD);\n\n dropServo.setPosition(1.0);\n waitForStart();\n dropServo.setPosition(0.6);\n sleep(500);\n VuforiaOrientator();\n encoderSequence(\"dumbDrive\");\n\n\n }", "@Override\n public void runOpMode() throws InterruptedException{\n\n LeftWheel = hardwareMap.dcMotor.get(\"LeftWheel\");\n RightWheel = hardwareMap.dcMotor.get(\"RightWheel\");\n LLAMA = hardwareMap.dcMotor.get(\"LLAMA\");\n RightWheel.setDirection(DcMotor.Direction.REVERSE);\n beaconFlagSensor = hardwareMap.i2cDevice.get(\"color sensor\");\n LeftWheel.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n RightWheel.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n buttonPusher = hardwareMap.servo.get(\"Button Pusher\");\n buttonPusher.setDirection(Servo.Direction.REVERSE);\n\n LeftWheel.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n RightWheel.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n LLAMA.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n\n beaconFlagReader= new I2cDeviceSynchImpl(beaconFlagSensor, I2cAddr.create8bit(0x3c), false);\n beaconFlagReader.engage();\n\n double PUSHER_MIN = 0;\n double PUSHER_MAX = 1;\n buttonPusher.scaleRange(PUSHER_MIN,PUSHER_MAX);\n\n if(beaconFlagLEDState){\n beaconFlagReader.write8(3, 0); //Set the mode of the color sensor using LEDState\n }\n else{\n beaconFlagReader.write8(3, 1); //Set the mode of the color sensor using LEDState\n }\n\n\n waitForStart();\n //Go forward to position to shoot\n long iniForward = 0;\n //Shoot LLAMA\n long shootLLAMA=0 ;\n //Turn towards Wall\n long turnToWall= 0;\n //Approach Wall\n long wallApproach= 0;\n //Correct to prepare for button\n long correctForButton= 0;\n long correctForButton2=0 ;\n //Use sensors to press button\n /** This is sensor*/\n //Go forward\n long toSecondButton= 0;\n //Use Sensors to press button\n /** This is sensor*/\n //turn to center\n\n //charge\n long chargeTime= 0;\n\n //Go forward to position to shoot\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(iniForward);\n\n STOP();\n\n //Shoot LLAMA\n LLAMA.setPower(1);\n\n sleep(shootLLAMA);\nSTOP();\n //Turn towards Wall\n LeftWheel.setPower(-1);\n RightWheel.setPower(1);\n\n sleep(turnToWall);\n\n STOP();\n //Approach Wall\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(wallApproach);\n\n STOP();\n //Correct to prepare for button\n\n LeftWheel.setPower(1);\n RightWheel.setPower(-1);\n\n sleep(correctForButton);\n\n STOP();\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(correctForButton2);\n\n STOP();\n topCache = beaconFlagReader.read(0x04, 1);\n //Use sensors to press button\n if ((topCache[0] & 0xFF) <=4 && (topCache[0] & 0xFF) > 0 &&(topCache[0] & 0xFF) <16) {\n while (((topCache[0] & 0xFF) <=4 && (topCache[0] & 0xFF) > 0 &&\n (topCache[0] & 0xFF) <16) && opModeIsActive()) {\n\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n sleep(100);\n LeftWheel.setPower(0);\n RightWheel.setPower(0);\n topCache = beaconFlagReader.read(0x04, 1);\n\n if ((topCache[0] & 0xFF) >=7 && (topCache[0] & 0xFF) >= 0){\n telemetry.addLine(\"Color Detected, Pressing Button...\");\n telemetry.update();\n buttonPusher.setPosition(PUSHER_MAX);\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(100);\n\n STOP();\n break;\n }\n }\n\n }\n\n else if ((topCache[0] & 0xFF) >=7 && (topCache[0] & 0xFF) >= 0) {\n telemetry.addLine(\"Color Detected, Pressing Button...\");\n telemetry.update();\n buttonPusher.setPosition(PUSHER_MAX);\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(100);\n\n STOP();\n }\n\n //Go forward\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(toSecondButton);\n\n STOP();\n //Use Sensors to press button\n topCache = beaconFlagReader.read(0x04, 1);\n //Use sensors to press button\n if ((topCache[0] & 0xFF) <=4 && (topCache[0] & 0xFF) > 0 &&(topCache[0] & 0xFF) <16) {\n while (((topCache[0] & 0xFF) <=4 && (topCache[0] & 0xFF) > 0 &&\n (topCache[0] & 0xFF) <16) && opModeIsActive()) {\n\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n sleep(100);\n LeftWheel.setPower(0);\n RightWheel.setPower(0);\n topCache = beaconFlagReader.read(0x04, 1);\n\n if ((topCache[0] & 0xFF) >=7 && (topCache[0] & 0xFF) >= 0){\n telemetry.addLine(\"Color Detected, Pressing Button...\");\n telemetry.update();\n buttonPusher.setPosition(PUSHER_MAX);\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(100);\n\n STOP();\n break;\n }\n }\n\n }\n\n else if ((topCache[0] & 0xFF) >=7 && (topCache[0] & 0xFF) >= 0) {\n telemetry.addLine(\"Color Detected, Pressing Button...\");\n telemetry.update();\n buttonPusher.setPosition(PUSHER_MAX);\n\n LeftWheel.setPower(1);\n RightWheel.setPower(1);\n\n sleep(100);\n\n STOP();\n }\n\n //turn to center\n\n\n //charge\n }", "@Override\n public void runOpMode() {\n servo0 = hardwareMap.servo.get(\"servo0\");\n servo1 = hardwareMap.servo.get(\"servo1\");\n digital0 = hardwareMap.digitalChannel.get(\"digital0\");\n motor0 = hardwareMap.dcMotor.get(\"motor0\");\n motor1 = hardwareMap.dcMotor.get(\"motor1\");\n motor0B = hardwareMap.dcMotor.get(\"motor0B\");\n motor2 = hardwareMap.dcMotor.get(\"motor2\");\n blinkin = hardwareMap.get(RevBlinkinLedDriver.class, \"blinkin\");\n motor3 = hardwareMap.dcMotor.get(\"motor3\");\n park_assist = hardwareMap.dcMotor.get(\"motor3B\");\n\n if (digital0.getState()) {\n int_done = true;\n } else {\n int_done = false;\n }\n motor_stuff();\n waitForStart();\n if (opModeIsActive()) {\n while (opModeIsActive()) {\n lancher_position();\n slow_mode();\n drive_robot();\n foundation_grabber(1);\n launcher_drive();\n data_out();\n Pickingupblockled();\n lettingoutblockled();\n Forwardled();\n backwardled();\n Turnleftled();\n Turnrightled();\n Stationaryled();\n }\n }\n }", "@Override\n public void runOpMode() throws InterruptedException {\n super.runOpMode();\n // LeftServo.setPosition(0.4);\n // RightServo.setPosition(0.5);\n\n waitForStart();\n telemetry.addData(\"Angles\", MyDriveTrain.getAngle());\n telemetry.update();\n telemetry.addData(\"Mikum:\", Mikum);\n telemetry.update();\n LF.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);\n RF.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);\n LB.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);\n RB.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);\n\n MyDriveTrain.encoderDrive(0.8, -30, 30, 30, -30, 1);\n MyDriveTrain.Rotate(0,0.1,10);\n// Mikum = MyVuforiaStone.ConceptVuforiaSkyStoneNavigationWebcam();\n// Mikum = 3;\n LF.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n RF.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n LB.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n RB.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n\n if (Mikum > 2) {\n telemetry.addLine(\"you're on the right\");\n telemetry.update();\n MyDriveTrain.encoderDrive(0.8, -84, 84, 84, -84, 1);\n MyIntake.maxIntake();\n MyDriveTrain.encoderDrive(0.8, -25, -25, -25, -25, 2);\n sleep(500);\n// MyDriveTrain.Verification(cubeIn,cubeNotInMM);\n\n MyIntake.ShutDown();\n MyDriveTrain.encoderDrive(0.8, 45, -45, -45, 45, 1);\n MyDriveTrain.Rotate(0,0.1,10);\n MyDriveTrain.encoderDrive(0.8, 100, 100, 100, 100, 2);\n }\n\n else if (Mikum < -2) {\n telemetry.addLine(\"you're on the left\");\n telemetry.update();\n MyDriveTrain.encoderDrive(0.8, 15, 15, 15, 15, 2);\n MyDriveTrain.encoderDrive(0.8, -86, 86, 86, -86, 1);\n MyIntake.maxIntake();\n MyDriveTrain.encoderDrive(0.8, -25, -25, -25, -25, 2);\n sleep(500);\n// MyDriveTrain.Verification(cubeIn,cubeNotInMM);\n\n MyIntake.ShutDown();\n MyDriveTrain.encoderDrive(0.8, 50, -50, -50, 50, 1);\n MyDriveTrain.Rotate(0,0.1,10);\n MyDriveTrain.encoderDrive(1, 85, 85, 85, 85, 2);\n\n\n\n } else {\n telemetry.addLine(\"You are on the center!\");\n telemetry.update();\n MyDriveTrain.encoderDrive(0.8, 30, 30, 30, 30, 2);\n MyDriveTrain.encoderDrive(0.5, -82, 82, 82, -82, 1);\n MyIntake.maxIntake();\n MyDriveTrain.encoderDrive(0.8, -25, -25, -25, -25, 2);\n sleep(500);\n// MyDriveTrain.Verification(cubeIn,cubeNotInMM);\n\n MyIntake.ShutDown();\n MyDriveTrain.encoderDrive(0.8, 45, -45, -45, 45, 1);\n MyDriveTrain.Rotate(0,0.1,10);\n MyDriveTrain.encoderDrive(1, 80, 80, 80, 80, 2);\n\n }\n\n MyDriveTrain.Rotate(0,0.2,10);\n MyIntake.maxIntake();\n sleep(500);\n MyIntake.ShutDown();\n Output.setPosition(OutputDown);\n MyDriveTrain.encoderDrive(1, 130, 130, 130, 130, 2);\n MyDriveTrain.encoderDrive(0.8, -5, 5, 5, -5, 1);\n\n MyDriveTrain.RotateP(90,1,10,0.0108);\n sleep(500);\n MyDriveTrain.encoderDrive(0.2,29,29,29,29,2);\n MyDriveTrain.Rotate(90,0.1,10);\n LeftServo.setPosition(0.15);\n RightServo.setPosition(0.2);\n MyDriveTrain.encoderDrive(0.1,10,10,10,10,2);\n LeftServo.setPosition(LeftServoDown);\n RightServo.setPosition(RightServoDown);\n sleep(500);\n MyDriveTrain.encoderDrive(1,-90,-90,-90,-90,2);\n MyDriveTrain.Rotate(-0,0.5,10);\n MyDriveTrain.encoderDrive(1,40,40,40,40,2);\n\n MyElevator.ElevateWithEncoder(-450, 0.8, 0.5);\n sleep(500);\n Arm.setPosition(1);\n sleep(1500);\n MyElevator.ElevateWithEncoder(0, 0.3, 0.0035);\n sleep(700);\n Output.setPosition(OutputUp);\n sleep(500);\n MyElevator.ElevateWithEncoder(-500, 0.3, 0.5);\n Arm.setPosition(0.135);\n sleep(1000);\n MyElevator.ElevateWithEncoder(0, 0.5, 0.003);\n\n LeftServo.setPosition(LeftServoUp);\n RightServo.setPosition(RightServoUp);\n MyDriveTrain.Rotate(0,0.4,10);\n MyDriveTrain.encoderDrive(0.3,-30,30,30,-30,2);\n ParkingMot.setPosition(ParkingMotIn);\n sleep(500);\n MyDriveTrain.encoderDrive(0.8, -5, 5, 5, -5, 1);\n MyDriveTrain.encoderDrive(0.5,-43,-43, -43,-43,1);\n }", "@Override\n public void testPeriodic() {\n go_speed=-xbox_controller.getRawAxis(1);\n turn_speed=xbox_controller.getRawAxis(4);\n right_motor_2.set(-go_speed+turn_speed);\n left_motor_1.set(go_speed+turn_speed);\n\n while(xbox_controller.getRawButton(2)){\n double x = tx.getDouble(0.0);\n double a = ta.getDouble(0.0);\n if(a >= 1 && a <= 1.7){\n servo.set(0.26);\n if (x > -6 && x < 6){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 6 ){\n right_motor_2.set(0.15);\n left_motor_1.set(0.15);\n }\n else if ( x <= -6 ){\n right_motor_2.set(-0.15);\n left_motor_1.set(-0.15);\n }\n }\n else if(a>=0.8 && a<1){\n servo.set(0.35);\n if (x > -2.3 && x < 2.3){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 2.3 ){\n right_motor_2.set(0.11);\n left_motor_1.set(0.11);\n }\n else if ( x <= -2.3 ){\n right_motor_2.set(-0.11);\n left_motor_1.set(-0.11);\n }\n }\n else if(a>=0.5 && a<0.8){\n servo.set(0.5);\n if (x > -1.7 && x < 1.7){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 1.7 ){\n right_motor_2.set(0.08);\n left_motor_1.set(0.08);\n }\n else if ( x <= -1.7 ){\n right_motor_2.set(-0.08);\n left_motor_1.set(-0.08);\n }\n }\n else if(a>=0.3 && a<0.5){\n servo.set(0.32);\n if (x > -1.2 && x < 1.2){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 1.2 ){\n right_motor_2.set(0.05);\n left_motor_1.set(0.05);\n }\n else if ( x <= -1.2 ){\n right_motor_2.set(-0.05);\n left_motor_1.set(-0.05);\n }\n }\n else{}\n }\n\n if(xbox_controller.getRawAxis(2)!=0){\n ball_collection_motor.set(1);\n }\n else{\n ball_collection_motor.set(0);\n }\n\n while(joystick.getRawButton(5)){\n double a=ta.getDouble(0.0);\n if(a>=1&&a<=1.7){\n servo.set(0.26);\n }\n else if(a>=0.8 && a<1){\n servo.set(0.35);\n }\n else if(a>=0.5 && a<0.8){\n servo.set(0.5);\n }\n else if(a>=0.3 && a<0.5){\n servo.set(0.32);\n }\n else{}\n }\n\n while (joystick.getRawButton(6)) {\n double x = tx.getDouble(0.0);\n if ( x>-1 && x<1 ){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 1 ){\n right_motor_2.set(0.05);\n left_motor_1.set(0.05);\n }\n else if ( x <= -1 ){\n right_motor_2.set(-0.05);\n left_motor_1.set(-0.05);\n }\n else{}\n }\n\n if(xbox_controller.getRawButton(3)){\n System.out.println(currentServoAngle);\n servo.set(currentServoAngle + factor);\n currentServoAngle += factor;\n pushed = true;\n if(currentServoAngle >= 1 || (currentServoAngle <= 0 && pushed == true)){\n factor *= -1;\n } \n }\n \n \n //ball_collection_motor.set(xbox_controller.getRawAxis(2));//xbox rt\n if(xbox_controller.getRawAxis(3)!=0){\n while(xbox_controller.getRawAxis(3)){\n left_low_eject.set(ControlMode.PercentOutput, 1);\n right_low_eject.set(ControlMode.PercentOutput,-1);\n TimeUnit.SECONDS.sleep(0.5);\n left_belt.set(ControlMode.PercentOutput,-0.5);\n right_belt.set(ControlMode.PercentOutput,0.5);\n }\n }\n else{\n left_low_eject.set(ControlMode.PercentOutput,0);\n right_low_eject.set(ControlMode.PercentOutput,0);\n left_belt.set(ControlMode.PercentOutput,0);\n right_belt.set(ControlMode.PercentOutput,0);\n }\n if(xbox_controller.getRawButton(1)){\n double_solenoid_1.set(DoubleSolenoid.Value.kForward);\n }\n else if(xbox_controller.getRawButton(4)){\n double_solenoid_1.set(DoubleSolenoid.Value.kReverse);\n }\n if(xbox_controller.getRawButton(5)){\n right_motor_2.set(-0.1);\n left_motor_1.set(-0.1);\n }\n else if(xbox_controller.getRawButton(6)){\n right_motor_2.set(0.1);\n left_motor_1.set(0.1);\n }\n if(xbox_controller.getRawButton(8)){\n /*\n for(double speed=0;speed<=0.85;speed+=0.000002){\n left_high_eject.set(speed+0.2*(joystick.getRawAxis(3)-control_speed_init));\n } \n */\n if(high_eject_run==false){\n high_eject_run=true;\n eject_speed=0;\n }\n\n }\n\n if(xbox_controller.getRawButton(7)){\n left_high_eject.set(0);\n high_eject_run=false;\n eject_speed=0;\n }\n if(high_eject_run){\n if(eject_speed<=0.85){\n //System.out.println(123);\n eject_speed+=0.001;\n //System.out.println(eject_speed);\n left_high_eject.set(-eject_speed);\n }\n }\n\n \n }", "@Override\n public void runOpMode() {\n telemetry.addData(\"Status\", \"Simple Ready to run\"); //\n telemetry.update();\n telemetry.addData(\"Status\", \"Initialized\");\n\n /**\n * Initializes the library functions\n * Robot hardware and motor functions\n */\n robot = new Robot_1617(hardwareMap);\n motorFunctions = new MotorFunctions(-1, 1, 0, 1, .05);\n\n //servo wheels are flipped in configuration file\n robot.servoLeftWheel.setPosition(.45);\n robot.servoRightWheel.setPosition(.25);\n\n robot.servoLeftArm.setPosition(0);\n robot.servoRightArm.setPosition(0.7);\n\n robot.servoFlyAngle.setPosition(1);\n\n robot.servoElbow.setPosition(0.95);\n robot.servoShoulder.setPosition(0.1);\n\n robot.servoFeed.setPosition(.498);\n\n robot.servoPlaid.setPosition(.85);\n\n telemetry.addData(\"Servos: \", \"Initialized\");\n // Wait for the game to start (driver presses PLAY)\n waitForStart();\n\n sleep(5000);\n robot.motorLift.setPower(0);\n robot.servoFlyAngle.setPosition(0);\n sleep(500);\n robot.motorFlyLeft.setPower(.9);\n robot.motorFlyRight.setPower(1);\n sleep(250);\n robot.motorIntakeElevator.setPower(1);\n robot.servoFeed.setPosition(-1);\n telemetry.addData(\"Status\", \"Shooting\"); //\n telemetry.update();\n sleep(5000);\n robot.motorFlyLeft.setPower(0);\n robot.motorFlyRight.setPower(0);\n// sleep(5000); //no idea why this is here\n robot.motorIntakeElevator.setPower(0);\n robot.servoFeed.setPosition(.1);\n sleep(250);\n\n telemetry.addData(\"Status\", \"Driving\");\n telemetry.update();\n encoderDrive(1.0, 30, 30, 1);\n\n encoderDrive(1.0, 35, 35, 1);\n }", "public void runOpMode() throws InterruptedException {\n leftWheel = hardwareMap.dcMotor.get(\"leftWheel\");\n rightWheel = hardwareMap.dcMotor.get(\"rightWheel\");\n leftArm = hardwareMap.dcMotor.get(\"leftArm\");\n rightArm = hardwareMap.dcMotor.get(\"rightArm\");\n rightDistance = hardwareMap.get(DistanceSensor.class, \"rightDistance\");\n leftColor = hardwareMap.colorSensor.get(\"leftColor\");\n rightWheel.setDirection(DcMotorSimple.Direction.REVERSE);\n count = 21;\n step = 3;\n subStep = 0;\n\n sample_ready = false;\n lander_unlatched = false;\n\n //prepares and resets robot by resetting encoders\n resetDriveEncoders();\n\n //prepares robot for arm movement by setting arm motors to go to a certain position-modifiable by user input (the d-pad)\n// leftArm.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n// rightArm.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n //HSV value array\n\n //Sends color sensor input values to the phone\n waitForStart();\n\n while (opModeIsActive()) {\n telemetry.update();\n\n\n telemetry.addLine()\n .addData(\"step\", step)\n .addData(\"subStep\", subStep)\n .addData(\"count\", count);\n telemetry.addLine()\n .addData(\"RightWheel: \", rightWheel.getCurrentPosition())\n .addData(\"LeftWheel: \", leftWheel.getCurrentPosition())\n .addData(\"TICKS_PER_WHEEL_ROTATION: \", TICKS_PER_WHEEL_ROTATION);\n\n\n//sets the step of where we are in the process to one\n // step = 1;\n//enables the if statement for lander_unlatched\n lander_unlatched = true;\n//moves the robot from the lander to where the samples are\n if (step == 1) {\n// leftWheel.setPower(0.7);\n// rightWheel.setPower(0.5);\n// leftWheel.setTargetPosition(1621);\n// rightWheel.setTargetPosition(820);\n step = 2;\n }\n if (step == 2) {\n// if (hsvValues[0] > 50) {\n// leftWheel.setPower(-0.7);\n// rightWheel.setPower(-0.5);\n// leftWheel.setTargetPosition(1221);\n step = 3;\n }\n// if step 2 is finished, makes the robot turn toward the wall, then drives against the wall.\n if (step == 3) {\n moveToDepot();\n }\n //1150 Target Units == about 1 foot, 96 Units/inch\n//sets the wheel power to 0 to limit movement\n// if (rightWheel.getCurrentPosition() == -rotation) {\n // rightWheel.setPower(0);\n //leftWheel.setPower(0);\n// }\n// if (leftWheel.getCurrentPosition() == 100) {\n// leftWheel.setPower(0);\n// rightWheel.setPower(0);\n// }\n\n sample_ready = true;\n\n// if (sample_ready) {\n//\n }\n }", "public void teleopPeriodic() {\n joystick1X = leftStick.getAxis(Joystick.AxisType.kX);\n joystick1Y = leftStick.getAxis(Joystick.AxisType.kY);\n joystick2X = rightStick.getAxis(Joystick.AxisType.kX);\n joystick2Y = rightStick.getAxis(Joystick.AxisType.kY);\n \n mapped1Y = joystick1Y/2 + 0.5;\n mapped1X = joystick1X/2 + 0.5;\n mapped2X = joystick2X/2 + 0.5;\n mapped2Y = joystick2Y/2 + 0.5;\n \n X1testServo.set(mapped1X);\n Y1testServo.set(mapped1Y);\n X2testServo.set(mapped2X);\n Y2testServo.set(mapped2Y);\n }", "@Override\npublic void teleopPeriodic() {\nm_robotDrive.arcadeDrive(m_stick.getRawAxis(5)* (-0.5), m_stick.getRawAxis(4)*0.5);\n}", "public void commonPeriodic()\n {\n double d1LeftJoystick = driver1.getAxis(driver1.LAxisUD);\n double d1RightJoystick = driver1.getAxis(driver1.RAxisUD);\n\n double d2LeftJoystick = driver2.getAxis(driver2.LAxisUD);\n double d2RightJoystick = driver2.getAxis(driver2.RAxisUD);\n\n // -------------------- DRIVER 1\n\n driveTrain.drive(d1LeftJoystick * speedModifier, d1RightJoystick * speedModifier);\n\n // driver1 controls ramp\n // press start and select together to deploy\n if(driver1.down(driver1.Start) && driver1.down(driver1.Select))\n {\n ramp.deploy();\n hatchArm.fingerGrab();\n }\n else\n {\n ramp.undeploy();\n }\n\n // driver 1 can double speed by holding L2\n //driveTrain.fastSpeed = driver1.down(driver1.L2);\n if(driver1.pressed(driver1.A))\n {\n driveTrain.slowSpeed = !driveTrain.slowSpeed;\n System.out.println(\"Fast speed toggled to: \" + driveTrain.slowSpeed);\n }\n\n //drive straight\n if(driver1.down(driver1.L1))\n {\n driveTrain.set_right_motors(speedModifier);\n }\n if(driver1.down(driver1.R1))\n {\n driveTrain.set_left_motors(speedModifier);\n }\n\n // flip drive orientation\n if(driver1.pressed(driver1.Select))\n {\n driveTrain.flip_orientation();\n \n if(driveTrain.isFacingForward())\n {\n camServForward.setSource(camFront);\n //camServReverse.setSource(camBack);\n // camBack.free();\n // camFront.close();\n // camFront = CameraServer.getInstance().startAutomaticCapture(0);\n // camBack = CameraServer.getInstance().startAutomaticCapture(1);\n }\n else\n {\n camServForward.setSource(camBack);\n //camServReverse.setSource(camFront);\n // camBack.close();\n // camFront.close();\n // camFront = CameraServer.getInstance().startAutomaticCapture(1);\n // camBack = CameraServer.getInstance().startAutomaticCapture(0);\n }\n }\n\n\n // -------------------- DRIVER 2\n\n\n // up is out\n // down is in\n // (when it's negated)\n cargoArm.spinBallMotor(-1 * d2LeftJoystick * 0.9);\n\n // control hatch placement pistons\n if(driver2.pressed(driver2.A))\n {\n hatchArm.pushPistons();\n }\n else if (driver2.released(driver2.A))\n {\n hatchArm.retractPistons();\n }\n\n // open/close hatch grabber arms\n if(driver2.pressed(driver2.B))\n {\n hatchArm.toggleGrabber();\n }\n\n if(driver2.pressed(driver2.Select))\n {\n //cargoArm.toggleArmLock();\n hatchArm.toggleFinger();\n }\n\n // extend/de-extend cargo hand\n if(driver2.pressed(driver2.Start))\n {\n cargoArm.toggleHand();\n }\n\n // button 7: L2\n // button 8: R2\n // L2 will reverse the finger\n // R2 will rotate it forward\n if(driver2.down(driver2.L1))\n {\n hatchArm.rotateFinger(1);\n }\n else\n {\n if(driver2.down(driver2.L2))\n {\n hatchArm.rotateFinger(-1);\n }\n else\n {\n hatchArm.rotateFinger(0);\n }\n }\n\n \n // button 5: L1\n // button 6: R1\n // L1 will move the hatch arm one way\n // R1 will move it the other way\n if(driver2.down(driver2.R1))\n {\n hatchArm.rotateArm(-1 * speedModifier);// * 0.75);\n }\n else\n {\n if(driver2.down(driver2.R2))\n {\n hatchArm.rotateArm(1 * speedModifier);// * 0.75);\n }\n else\n {\n hatchArm.rotateArm(0);\n }\n }\n\n \n // button 1: x\n // button 4: y\n // button 1 will move the ball arm one way\n // button 4 will move it the other way\n if(driver2.down(driver2.X))\n {\n //cargoArm.requestMove(-1 * speedModifier);\n cargoArm.rotateArm(-1);\n //cargoArm.solArmBrake.set(false);\n }\n else\n {\n if(driver2.down(driver2.Y))\n {\n //cargoArm.requestMove(2 * speedModifier);\n cargoArm.rotateArm(1);\n //cargoArm.solArmBrake.set(false);\n }\n else\n {\n //cargoArm.rotateArm(cargoArm.getArmCalculation());\n //cargoArm.solArmBrake.set(true);\n cargoArm.rotateArm(0);\n }\n }\n if(driver2.released(driver2.X) || driver2.released(driver2.Y))\n {\n //cargoArm.setArmTarget(cargoArm.currentPosition());\n //cargoArm.solArmBrake.set(true);\n cargoArm.rotateArm(0);\n }\n\n if(driver2.dpad(driver2.Up))\n {\n cargoArm.setArmUp();\n }\n if(driver2.dpad(driver2.Down))\n {\n cargoArm.setArmDown();\n }\n if(driver2.dpad(driver2.Left))\n {\n cargoArm.setArmMid();\n }\n if(driver2.dpad(driver2.Right))\n {\n cargoArm.setArmLow();\n }\n\n if(driver2.pressed(driver2.LThumb))\n {\n cargoArm.armLockEnabled = !cargoArm.armLockEnabled;\n \n }\n if(driver2.pressed(driver2.RThumb))\n {\n cargoArm.toggleBrake();\n }\n\n\n // allow move-to calculations to occur\n hatchArm.periodic();\n cargoArm.periodic();\n }", "@Override\n public void loop() { \n\n double forward = gamepad1.left_stick_y;\n double turn = gamepad1.right_stick_x;\n double collect = gamepad2.left_trigger - gamepad2.right_trigger;\n double wristPower = gamepad1.left_trigger - gamepad1.right_trigger;\n\n if (forward > 0)\n forward = Math.pow(forward, 2);\n else if (forward < 0)\n forward = -Math.pow(forward, 2);\n\n if (turn > 0)\n turn = Math.pow(turn, 2);\n else if (turn < 0)\n turn = -Math.pow(turn, 2);\n//\n// else if(turn < 0)\n// turn = -Math.pow(turn, 2);\n telemetry.addData(\"Forward Power\", forward);\n telemetry.addData(\"Turn Power\", turn);\n left.setPower(Range.clip(forward - turn, -1, 1));\n right.setPower(Range.clip(forward + turn, -1, 1));\n collection.setPower(0.8 * (Range.clip(collect, -1.0, 1.0)));\n wrist.setPower((Range.clip(wristPower, -1, 1)));\n\n //regular servo code\n// if(gamepad1.x && !wristUp) //wrist up\n// {\n// wrist.setPosition(.9);\n// wristUp = true;\n// }\n// else if(gamepad1.x && wristUp) //wrist down\n// { wrist.setPosition(-.9);\n// wristUp = false;\n// }\n// else if(gamepad1.left_trigger > 0 && wrist.getPosition() <= .95)\n// {\n// wrist.setPosition(wrist.getPosition() + 0.005);\n// }\n// else if(gamepad1.right_trigger > 0 && wrist.getPosition() >= -.95)\n// {\n// wrist.setPosition(wrist.getPosition() - 0.005);\n// }\n\n if (lift.getCurrentPosition() >= 0 || lift.getCurrentPosition() <= 3200 || liftOverride){\n if (gamepad2.left_stick_y > 0.2)\n lift.setPower(-1);\n else if (gamepad2.left_stick_y < -0.2)\n lift.setPower(1);\n else\n lift.setPower(0);\n }\n if(gamepad2.right_bumper && gamepad2.y)\n {\n liftOverride = true;\n }\n else if(liftOverride == true)\n {\n lift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n lift.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n liftOverride = false;\n }\n telemetry.addData(\"bucket posiition\", bucket.getPosition());\n telemetry.update();\n\n if (gamepad2.a) //bucket dump\n {\n bucket.setPosition(0.75);\n } else if (gamepad2.b) //bucket down\n {\n bucket.setPosition(0);\n } else if (gamepad2.x) //endgame\n bucket.setPosition(0.4);\n if (gamepad2.dpad_up && bucket.getPosition() <= 0.9975)\n bucket.setPosition(bucket.getPosition() + .0025);\n else if (gamepad2.dpad_down && bucket.getPosition() >= -0.9975)\n bucket.setPosition(bucket.getPosition() - .0025);\n\n\n //Press to keep bucket up for endgame\n //NOTE: D-Pad will not work unless gamepad2 B is pressed to end the override\n// if(gamepad2.a && bucketOverride == false) {\n// bucket.setPower(-.4);\n// bucketOverride = true;\n// }\n// else if (gamepad2.a && bucketOverride == true)\n// {\n// bucket.setPower(0);\n// bucketOverride = false;\n// }\n\n if (gamepad1.right_bumper) {\n extension.setPower(1);\n } else if (gamepad1.left_bumper) {\n extension.setPower(-1);\n } else extension.setPower(0);\n\n telemetry.update();\n }", "@Override\n public void runOpMode() {\n hw = new RobotHardware(robotName, hardwareMap);\n rd = new RobotDrive(hw);\n rs=new RobotSense(hw, telemetry);\n /*rd.moveDist(RobotDrive.Direction.FORWARD, .5, .3);\n rd.moveDist(RobotDrive.Direction.REVERSE, .5, .3);\n rd.moveDist(RobotDrive.Direction.FORWARD, .5, 1);\n rd.moveDist(RobotDrive.Direction.REVERSE, .5, 1);*/\n telemetry.addData(\"Ready! \", \"Go Flamangos!\"); \n telemetry.update();\n\n //Starting the servos in the correct starting position\n /*hw.armRight.setPosition(1-.3);\n hw.armLeft.setPosition(.3);\n hw.level.setPosition(.3+.05);*/\n hw.f_servoLeft.setPosition(1);\n hw.f_servoRight.setPosition(0.5);\n \n rd.moveArm(hw.startPos());\n waitForStart();\n while (opModeIsActive()) {\n \n /*Starting close to the bridge on the building side\n Move under the bridge and push into the wall*/\n rd.moveDist(RobotDrive.Direction.LEFT,2,.5);\n rd.moveDist(RobotDrive.Direction.FORWARD, 10, .5);\n break;\n }\n }", "@Override\n public void loop() {\n\n double drive = gamepad1.left_stick_y;\n double strafe = gamepad1.left_stick_x;\n double rotate = -gamepad1.right_stick_x;\n\n findRobotPosition(); // Call Vuforia routines, get robot position\n\n // Intake Operator Actions\n if (gamepad1.a || gamepad1.b || gamepad1.x){ // Operator wants to control the intake\n if (gamepad1.a){ // A turns the intake on for bringing in rings\n intakeMotor.setPower(1);\n }\n else if (gamepad1.b) { // B reverses the intake\n intakeMotor.setPower(-1);\n\n } else if (gamepad1.x){ // X stops the intake\n intakeMotor.setPower(0);\n }\n }\n\n // Ring Shooter Operator Actions\n /*if (gamepad1.dpad_up || gamepad1.dpad_down){\n if (gamepad1.dpad_up) {\n if (ringVel <= 170000) {\n ringVel = ringVel + 10000;\n }\n } else if (gamepad1.dpad_down){\n if (ringVel >= 10000){\n ringVel = ringVel - 10000;\n } else{\n ringVel = 0;\n }\n }\n }\n */\n\n if (gamepad1.right_bumper){\n fireServo.setPosition(FIRE_SERVO);\n } else{\n fireServo.setPosition(STANDBY_SERVO);\n }\n if (gamepad1.left_trigger > 0.5){\n ringShooterMotor.setVelocity(ringVel);\n }else {\n ringShooterMotor.setPower(0);\n }\n\n // Wobble Goal acions here\n if (gamepad1.dpad_left || gamepad1.dpad_right || gamepad1.left_bumper){\n if(gamepad1.dpad_left){\n wobbleMotor.setTargetPosition(WOBBLE_GRAB);\n wobbleMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n wobbleMotor.setPower(.4);\n } else if (gamepad1.dpad_right){\n wobbleMotor.setTargetPosition(WOBBLE_CARRY);\n wobbleMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n wobbleMotor.setPower(.4);\n } else if (gamepad1.left_bumper) {\n wobbleMotor.setTargetPosition(WOBBLE_OVER_WALL);\n wobbleMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n wobbleMotor.setPower(.4);\n }\n }\n // Insert operator driving actions here\n if ((targetVisible) && (gamepad1.y)) {\n // Allow the operator to position the robot to shoot a ring if a target is visible\n alignRobotToShoot();\n }\n else {\n moveBot(drive, rotate, strafe, power); //Basic Robot-centric Frame Driving\n }\n\n // Telemetry Section\n //telemetry.addData(\"Ring Velocity\", ringVel);\n //telemetry.addData(\"Actual Velocity\", ringShooterMotor.getVelocity());\n telemetry.addData(\"Ring Motor Encoder\", ringShooterMotor.getCurrentPosition());\n telemetry.addData(\"Wobble Goal Encoder\", wobbleMotor.getCurrentPosition());\n telemetry.update();\n }", "@Override\n public void runOpMode() {\n try {\n leftfrontDrive = hardwareMap.get(DcMotor.class, \"frontLeft\");\n leftfrontDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n rightfrontDrive = hardwareMap.get(DcMotor.class, \"frontRight\");\n rightfrontDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n leftbackDrive = hardwareMap.get(DcMotor.class, \"backLeft\");\n leftbackDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n leftbackDrive.setDirection(DcMotor.Direction.REVERSE);\n\n rightbackDrive = hardwareMap.get(DcMotor.class, \"backRight\");\n rightbackDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n lift = hardwareMap.get(DcMotor.class, \"Lift\");\n lift.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n lift.setDirection(DcMotor.Direction.REVERSE);\n\n markerArm = hardwareMap.get(Servo.class, \"markerArm\");\n\n armActivator = hardwareMap.get(DcMotor.class, \"armActivator\");\n armActivator.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n } catch (IllegalArgumentException iax) {\n bDebug = true;\n }\n\n BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();\n parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;\n parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;\n parameters.calibrationDataFile = \"BNO055IMUCalibration.json\";\n parameters.loggingEnabled = true;\n parameters.loggingTag = \"IMU\";\n parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator();\n\n imu = hardwareMap.get(BNO055IMU.class, \"imu\");\n imu.initialize(parameters);\n\n waitForStart(); //the rest of the code begins after the play button is pressed\n\n sleep(3000);\n\n drive(0.35, 0.5);\n\n turn(90.0f);\n\n drive(1.8, 0.5);\n\n turn(45.0f);\n\n drive(2.5, -0.5);\n\n sleep(1000);\n\n markerArm.setPosition(1);\n\n sleep(1000);\n\n markerArm.setPosition(0);\n\n sleep(1000);\n\n drive(2.5,.75);\n\n turn(179.0f);\n\n drive(1.5, 1.0);\n\n requestOpModeStop(); //end of autonomous\n }", "@Override\n public void init() {\n\n try {\n\n // Get wheel motors\n wheelMotor1 = hardwareMap.dcMotor.get(\"Wheel 1\");\n wheelMotor2 = hardwareMap.dcMotor.get(\"Wheel 2\");\n\n // Initialize wheel motors\n wheelMotor1.setMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);\n wheelMotor2.setMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);\n wheelMotor1.setDirection(DcMotor.Direction.FORWARD);\n wheelMotor2.setDirection(DcMotor.Direction.REVERSE);\n robotDirection = DriveMoveDirection.Forward;\n motion = new Motion(wheelMotor1, wheelMotor2);\n\n // Get hook motor\n motorHook = hardwareMap.dcMotor.get(\"Hook\");\n motorHook.setDirection(DcMotor.Direction.REVERSE);\n\n // Get servos\n servoTapeMeasureUpDown = hardwareMap.servo.get(\"Hook Control\");\n servoClimberDumperArm = hardwareMap.servo.get(\"Climber Dumper Arm\");\n servoDebrisPusher = hardwareMap.servo.get(\"Debris Pusher\");\n servoZipLineLeft = hardwareMap.servo.get(\"Zip Line Left\");\n servoZipLineRight = hardwareMap.servo.get(\"Zip Line Right\");\n servoAllClearRight = hardwareMap.servo.get (\"All Clear Right\");\n servoAllClearLeft = hardwareMap.servo.get (\"All Clear Left\");\n\n setServoPositions();\n }\n catch (Exception ex)\n {\n telemetry.addData(\"error\", ex.getMessage());\n }\n }", "private static RCServo PhidgetMotorMover() {\n\n\t\ttry {\n\t\t\tSystem.out.println(\"Constructing MotorMover\");\n\t\t\tservo = new RCServo();\n\t\t\t// Start listening for motor interaction\n\t\t\tservo.open(2000);\n\t\t} catch (PhidgetException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn servo;\n\t}", "public void init() {\n delayingTimer = new ElapsedTime();\n\n // Define and Initialize Motors and Servos: //\n tailMover = hwMap.dcMotor.get(\"tail_lift\");\n grabberServo = hwMap.servo.get(\"grabber_servo\");\n openGrabber();\n\n // Set Motor and Servo Directions: //\n tailMover.setDirection(DcMotorSimple.Direction.FORWARD);\n\n tailMover.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n tailMover.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n int prevEncoder = tailMover.getCurrentPosition();\n tailMover.setPower(-0.15);\n mainHW.opMode.sleep (300);\n Log.d(\"catbot\", String.format(\"tail lift power %.2f current position %2d prev %2d\", tailMover.getPower(), tailMover.getCurrentPosition(),prevEncoder));\n runtime.reset();\n while((Math.abs(prevEncoder - tailMover.getCurrentPosition()) > 10)&& (runtime.seconds()<3.0)){\n prevEncoder = tailMover.getCurrentPosition();\n mainHW.opMode.sleep(300);\n Log.d(\"catbot\", String.format(\"tail lift power %.2f current position %2d prev %2d\", tailMover.getPower(), tailMover.getCurrentPosition(),prevEncoder));\n }\n tailMover.setPower(0.0);\n // Set Motor and Servo Modes: //\n tailMover.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n\n tailMover.setTargetPosition(0);\n tailMover.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n closeGrabber();\n }", "public void testPeriodic() { \n joystick1X = leftStick.getAxis(Joystick.AxisType.kX);\n joystick1Y = leftStick.getAxis(Joystick.AxisType.kY);\n joystick2X = rightStick.getAxis(Joystick.AxisType.kX);\n joystick2Y = rightStick.getAxis(Joystick.AxisType.kY);\n \n mapped1Y = joystick1Y/2 + 0.5;\n mapped1X = joystick1X/2 + 0.5;\n mapped2X = joystick2X/2 + 0.5;\n mapped2Y = joystick2Y/2 + 0.5;\n \n X1testServo.set(mapped1X);\n Y1testServo.set(mapped1Y);\n X2testServo.set(mapped2X);\n Y2testServo.set(mapped2Y);\n \n \n //System.out.println(\"X Servo Value = \" + XtestServo.get());\n //System.out.println(\"Left Joystick X Value = \" + leftStick.getX());\n //System.out.println(\"Y Servo Value = \" + YtestServo.get());\n //System.out.println(\"Left Joystick Y Value = \" + leftStick.getY());\n \n \n }", "@Override\n public void runOpMode() {\n motorFL = hardwareMap.get(DcMotor.class, \"motorFL\");\n motorBL = hardwareMap.get(DcMotor.class, \"motorBL\");\n motorFR = hardwareMap.get(DcMotor.class, \"motorFR\");\n motorBR = hardwareMap.get(DcMotor.class, \"motorBR\");\n landerRiser = hardwareMap.get(DcMotor.class, \"lander riser\");\n landerRiser = hardwareMap.get(DcMotor.class, \"lander riser\");\n landerRiser.setDirection(DcMotor.Direction.FORWARD);\n landerRiser.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n markerDrop = hardwareMap.get(Servo.class, \"marker\");\n markerDrop.setDirection(Servo.Direction.FORWARD);\n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.update();\n\n // Wait for the game to start (driver presses PLAY)\n waitForStart();\n runtime.reset();\n\n //Landing & unlatching\n landerRiser.setPower(-1);\n telemetry.addData(\"Status\", \"Descending\");\n telemetry.update();\n sleep(5550);\n landerRiser.setPower(0);\n telemetry.addData(\"Status\",\"Unhooking\");\n telemetry.update();\n move(-0.5, 600, true);\n strafe(-0.4,0.6, 3600, true);\n move(0.5,600,true);\n markerDrop.setPosition(0);\n sleep(1000);\n markerDrop.setPosition(0.5);\n sleep(700);\n markerDrop.setPosition(0);\n strafe(0, -0.5,500,true);\n strafe(0.5, -0.25, 8500, true);\n\n }", "public boolean encoderDrive(int encoderDelta, driveStyle drive, double motorPower, double timeout, DcMotor[] motors)\n {\n\n\n switch(drive)\n {\n case FORWARD:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(0, -motorPower, 0)[0]);\n motors[1].setPower(setPower(0, -motorPower, 0)[1]);\n motors[2].setPower(setPower(0, -motorPower, 0)[2]);\n motors[3].setPower(setPower(0, -motorPower, 0)[3]);\n\n while (motors[2].getCurrentPosition() >= (-encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n\n\n }\n\n case BACKWARD:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(0, motorPower, 0)[0]);\n motors[1].setPower(setPower(0, motorPower, 0)[1]);\n motors[2].setPower(setPower(0, motorPower, 0)[2]);\n motors[3].setPower(setPower(0, motorPower, 0)[3]);\n\n while (motors[2].getCurrentPosition() <= (encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case STRAFE_LEFT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n while (motors[2].getCurrentPosition() >= (encoderReadingLB - encoderDelta))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case STRAFE_RIGHT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(motorPower, 0, 0)[3]);\n\n while (motors[2].getCurrentPosition() >= (-encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case FORWARD_LEFT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(-motorPower, -motorPower, 0)[0]);\n motors[1].setPower(setPower(-motorPower, -motorPower, 0)[1]);\n motors[2].setPower(setPower(-motorPower, -motorPower, 0)[2]);\n motors[3].setPower(setPower(-motorPower, -motorPower, 0)[3]);\n\n while (motors[2].getCurrentPosition() <= (encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case FORWARD_RIGHT:\n {\n double encoderReadingRB = motors[1].getCurrentPosition();\n motors[0].setPower(setPower(motorPower, -motorPower, 0)[0]);\n motors[1].setPower(setPower(motorPower, -motorPower, 0)[1]);\n motors[2].setPower(setPower(motorPower, -motorPower, 0)[2]);\n motors[3].setPower(setPower(motorPower, -motorPower, 0)[3]);\n\n while (motors[1].getCurrentPosition() >= (-encoderDelta + encoderReadingRB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case BACKWARD_LEFT:\n {\n double encoderReadingRB = motors[1].getCurrentPosition();\n motors[0].setPower(setPower(-motorPower, motorPower, 0)[0]);\n motors[1].setPower(setPower(-motorPower, motorPower, 0)[1]);\n motors[2].setPower(setPower(-motorPower, motorPower, 0)[2]);\n motors[3].setPower(setPower(-motorPower, motorPower, 0)[3]);\n\n while (motors[1].getCurrentPosition() <= (encoderDelta + encoderReadingRB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case BACKWARD_RIGHT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(motorPower, motorPower, 0)[0]);\n motors[1].setPower(setPower(motorPower, motorPower, 0)[1]);\n motors[2].setPower(setPower(motorPower, motorPower, 0)[2]);\n motors[3].setPower(setPower(motorPower, motorPower, 0)[3]);\n\n while (motors[2].getCurrentPosition() >= (-encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case PIVOT_LEFT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(0, 0, -motorPower)[0]);\n motors[1].setPower(setPower(0, 0, -motorPower)[1]);\n motors[2].setPower(setPower(0, 0, -motorPower)[2]);\n motors[3].setPower(setPower(0, 0, -motorPower)[3]);\n\n while (motors[2].getCurrentPosition() >= (-encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n case PIVOT_RIGHT:\n {\n double encoderReadingLB = motors[2].getCurrentPosition();\n motors[0].setPower(setPower(0, 0, motorPower)[0]);\n motors[1].setPower(setPower(0, 0, motorPower)[1]);\n motors[2].setPower(setPower(0, 0, motorPower)[2]);\n motors[3].setPower(setPower(0, 0, motorPower)[3]);\n\n while (motors[2].getCurrentPosition() <= (encoderDelta + encoderReadingLB))\n {\n\n }\n\n\n motors[0].setPower(setPower(-motorPower, 0, 0)[0]);\n motors[1].setPower(setPower(-motorPower, 0, 0)[1]);\n motors[2].setPower(setPower(-motorPower, 0, 0)[2]);\n motors[3].setPower(setPower(-motorPower, 0, 0)[3]);\n\n break;\n }\n\n\n }\n\n return true;\n }", "@Override\n public void periodic() {\n\t\t// myDrive.\n\n\t\t// System.out.println(Robot.m_oi.getSpeed());\n\t\t// SmartDashboard.putNumber(\"Dial Output: \", Robot.m_oi.getSpeed());\n\n\t\t// //Wheel Speed Limits\n\n\t\t// SmartDashboard.putNumber(\"Front Left Percent\", myDrive.getFLSpeed());\n\t\t// SmartDashboard.putNumber(\"Front Right Percent\", myDrive.getFRSpeed());\n\t\t// SmartDashboard.putNumber(\"Rear Left Percent\", myDrive.getRLSpeed());\n\t\t// SmartDashboard.putNumber(\"Rear Right Percent\", myDrive.getRRSpeed());\n\n\t\t//Test Code for Selecting Calibration Motor \n\t\t//***COMMENT OUT BEFORE REAL GAME USE***\n\t\t// if (Robot.m_oi.getArmDown()) {\n\t\t// \t// System.out.println(\"Front Left Wheel Selected\");\n\t\t// \tWheel = 1;\n\t\t// \tSmartDashboard.putNumber(\"Wheel Selected: \", Wheel);\n\t\t\t\n\t\t// } else if (Robot.m_oi.getArmUp()) {\n\t\t// \t// System.out.println(\"Back Left Wheel Selected\");\n\t\t// \tWheel = 2;\n\t\t// \tSmartDashboard.putNumber(\"Wheel Selected: \", Wheel);\n\t\t\t\n\t\t// } else if (Robot.m_oi.getBallIn()) {\n\t\t// \t// System.out.println(\"Front Right Wheel Selected\");\n\t\t// \tWheel = 3;\n\t\t// \tSmartDashboard.putNumber(\"Wheel Selected: \", Wheel);\n\t\t\t\n\t\t// } else if (Robot.m_oi.getBallOut()) {\n\t\t// \t// System.out.println(\"Back Right Wheel Selected\");\n\t\t// \tWheel = 4;\n\t\t// \tSmartDashboard.putNumber(\"Wheel Selected: \", Wheel);\n\t\t\t\n\t\t// } else if (Robot.m_oi.getBlueButton()) {\n\t\t// \t// System.out.println(\"Back Right Wheel Selected\");\n\t\t// \tWheel = 0;\n\t\t// \tSmartDashboard.putNumber(\"Wheel Selected: \", Wheel);\n\t\t// } \n\n\t\t// if (Wheel == 1) {\n\n\t\t// \tmyDrive.setFLSpeed(Robot.m_oi.getSpeed());\n\n\t\t// } else if (Wheel == 2) {\n\n\t\t// \tmyDrive.setRLSpeed(Robot.m_oi.getSpeed());\n\n\t\t// } else if (Wheel == 3) {\n\n\t\t// \tmyDrive.setFRSpeed(Robot.m_oi.getSpeed());\n\n\t\t// } else if (Wheel == 4) {\n\n\t\t// \tmyDrive.setRRSpeed(Robot.m_oi.getSpeed());\n\n\t\t// }\n\n\t\t// if (Robot.m_oi.getSafety()) {\n\n\t\t// \tspeedLimit = 1.0;\n\t\t// \tstrafeLimit = 1.0;\n\n\t\t// } else {\n\n\t\t// \tspeedLimit = 0.5; \n\t\t// \tstrafeLimit = 0.8;\n\t\t\t\t\n\t\t// }\n\n\n\n\t\t//System.out.print (\"strafeLimit: \" + strafeLimit);\n\t\t//System.out.println(Robot.m_oi.getX() * strafeLimit);\n\n\t\t// myDrive.driveCartesian(\n\t\t// \t(Robot.m_oi.getY() * speedLimit), // set Y speed\n\t\t// \t(Robot.m_oi.getX() * strafeLimit), // set X speed\n\t\t// \t(Robot.m_oi.getRotate() * rotateLimit), // set rotation rate\n\t\t// \t0); // gyro angle \n\t\t\n\t\t//TODO: Rotate robot with vision tracking, set up curve to slow down as target approaches center.\n\t\t// if (Robot.m_oi.getStartButton()) {\n\t\t// \tmyDrive.driveCartesian(\n\t\t// \t\t (0.4), // set Rotation\n\t\t// \t\t (0.0), // set Strafe\n\t\t// \t\t (0.0), // set Forward/Back\n\t\t// \t\t 0);\n\t\t// } else {\n\t\tmyDrive.driveCartesian(\n\t\t\t(Robot.m_oi.getY() * rotateLimit), // set Y speed\n\t\t\t(Robot.m_oi.getX() * strafeLimit), // set X speed\n\t\t\t(Robot.m_oi.getRotate() * speedLimit), // set rotation rate\n\t\t\t0);\n\t\t// }\n\t\t// myDrive.driveCartesian(\n\t\t// \t(Robot.m_oi.getY()), // set Y speed\n\t\t// \t(Robot.m_oi.getX()), // set X speed\n\t\t// \t(Robot.m_oi.getRotate()), // set rotation rate\n\t\t// \t0); \n\n }", "public void runOpMode(){\n JAWLDrive3796 drive = new JAWLDrive3796(hardwareMap.dcMotor.get(\"left_drive\"), hardwareMap.dcMotor.get(\"right_drive\"));\n //Set the drive motors to run without encoders\n drive.setEncoders(false);\n //Create Grabber object\n JAWLGrabber3796 grabber = new JAWLGrabber3796(hardwareMap.servo.get(\"left_arm\"), hardwareMap.servo.get(\"right_arm\"));\n //Create Lift object\n JAWLLift3796 lift = new JAWLLift3796(hardwareMap.dcMotor.get(\"lift_motor\"));\n //Create color arm object\n JAWLColorArm3796 colorArm = new JAWLColorArm3796(hardwareMap.servo.get(\"color_arm\"));\n //Creates color sensor name\n ColorSensor colorSensorTemp = hardwareMap.get(ColorSensor.class, \"color_distance\");\n //Creates distance sensor name\n DistanceSensor distanceSensorTemp = hardwareMap.get(DistanceSensor.class, \"color_distance\");\n //Creates the color-distance sensor object\n JAWLColorSensor3796 colorDistanceSensor = new JAWLColorSensor3796(colorSensorTemp, distanceSensorTemp);\n //Creates the variable that will hold the color of the jewel\n String colorOfBall;\n //Creates relic arm objects\n //TTTTRelicArm3796 relicArm = new TTTTRelicArm3796(hardwareMap.dcMotor.get(\"relic_up_down\"), hardwareMap.dcMotor.get(\"relic_out_in\"), hardwareMap.dcMotor.get(\"relic_grab\"));\n //We never ended up having a relic arm!\n //The lift helper will set the idle power of the motor to a small double, keeping the lift from idly falling down\n boolean liftHelper = false;\n int i = 0;\n\n waitForStart();\n\n colorArm.armUp();\n\n while (opModeIsActive()) {\n //Here is where we define how the controllers should work\n //In theory, no logic retaining to controlling the components should be in here\n\n /*\n * Drive\n */\n\n //The left drive wheel is controlled by the opposite value of the left stick's y value on the first gamepad\n //The right drive is the same way except with the right drive wheel\n drive.leftDrive(-gamepad1.left_stick_y);\n drive.rightDrive(-gamepad1.right_stick_y);\n\n /*\n * Lift\n */\n telemetry.addData(\"Gamepad2 Right Stick Y\", -gamepad2.right_stick_y);\n\n if (-gamepad2.right_stick_y > 0) {\n //First checks to see if the right stick's negative y value is greater then zero.\n lift.moveMotor(-gamepad2.right_stick_y);\n //If it is, it sets the power for the motor to 1, and adds telemetry\n telemetry.addData(\"Lift Power\", 1);\n } else if (-gamepad2.right_stick_y < 0) {\n //Checks if the negative value of the right right stick's y position is less than zero\n lift.moveMotor(-0.1);\n //Sets the power for the motor to -0.1, and adds telemetry\n telemetry.addData(\"Lift Power\", -0.1);\n } else {\n //We check to see if the liftHelper is enabled\n if(liftHelper) {\n lift.moveMotor(0.1466 );\n } else {\n lift.moveMotor(0);\n }\n }\n\n\n\n /*\n * Lift helper control\n */\n\n if(gamepad2.a) {\n if(i == 0) {\n liftHelper = !liftHelper;\n }\n i = 5;\n }\n\n if(i != 0) {\n i--;\n }\n\n telemetry.addData(\"Lift Helper Enabled\", liftHelper);\n\n\n\n /*\n * Grabbers\n */\n if (gamepad2.left_trigger > 0) {\n //Closes the left arm, then displays the position in telemetry\n grabber.leftArmClose();\n double a = grabber.leftPosition();\n //Adds telemetry to display positions of grabbers, mostly for testing, but can be useful later on\n telemetry.addData(\"Left\", a);\n }\n\n if (gamepad2.left_bumper) {\n //Opens the left arm, then displays the position in telemetry\n grabber.leftArmOpen();\n double b = grabber.leftPosition();\n //We made the variables different as to avoid any and all possible errors\n telemetry.addData(\"Left\", b);\n }\n\n if (gamepad2.right_trigger > 0) {\n //Opens the right arm, then displays the position in telemetry\n grabber.rightArmClose();\n double c = grabber.rightPosition();\n telemetry.addData(\"Right\", c);\n }\n\n if (gamepad2.right_bumper) {\n //Closes the right arm, then displays the position in telemetry\n grabber.rightArmOpen();\n double d = grabber.rightPosition();\n telemetry.addData(\"Right\", d);\n }\n\n if (gamepad2.dpad_left){\n //Closes the left arm to a shorter distance\n grabber.leftArmShort();\n }\n\n if(gamepad2.dpad_right){\n //Closes the right arm to a shorter distance\n grabber.rightArmShort();\n\n }\n\n //Update all of our telemetries at once so we can see all of it at the same time\n telemetry.update();\n }\n }", "public void teleopPeriodic() {\n\n \t//NetworkCommAssembly.updateValues();\n \t\n\t\t// both buttons pressed simultaneously, time to cal to ground\n\t\tif (gamepad.getRawButton(FRONT_ARM_GROUND_CAL_BUTTON1) && gamepad.getRawButton(FRONT_ARM_GROUND_CAL_BUTTON2)) {\n\t\t\tprocessGroundCal();\n\t\t}\n\n\t\t// PID CONTROL ONLY\n\t\tdouble armDeltaPos = gamepad.getRawAxis(1);\n\t\tif (Math.abs(armDeltaPos) < ARM_DEADZONE) {\n\t\t\tarmDeltaPos = 0.0f;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tarmDeltaPos *= ARM_POS_MULTIPLIER;\n\t\t\tdouble currPos = testMotor.getPosition();\n\t\t\t\n\t\t\tif (((currPos > SOFT_ENCODER_LIMIT_MAX) && armDeltaPos > 0.0) || ((currPos < SOFT_ENCODER_LIMIT_FLOOR) && armDeltaPos < 0.0)) {\n\t\t\t\tSystem.out.println(\"SOFT ARM LIMIT HIT! Setting armDeltaPos to zero\");\n\t\t\t\tarmDeltaPos = 0.0;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tdouble newPos = currPos + armDeltaPos;\n\t\t\ttestMotor.set(newPos);\n\t\t\tSystem.out.println(\"Setting new front arm pos = \" + newPos);\t\n\t\t}\t\t\n\n \t/*\n\t\tdouble newArmPos = gamepad.getRawAxis(1);\n\t\tif(Math.abs(newArmPos) <= ARM_DEADZONE) {\n\t\t\tnewArmPos = 0.0;\n\t\t}\n\t\tdouble newMotorPos = (newArmPos * ARM_SPEED_MULTIPLIER) + testMotor.getPosition();\n\t\tpositionMoveByCount(newMotorPos);\n\t\tSystem.out.println(\"input = \" + newArmPos + \" target pos = \" + newMotorPos + \" enc pos = \" + testMotor.getPosition());\n \t*/\n \t\n\t\t// PercentVbus test ONLY!!\n \t/*\n\t\tdouble armSpeed = gamepad.getRawAxis(1);\n\t\tif (Math.abs(armSpeed) < ARM_DEADZONE) {\n\t\t\tarmSpeed = 0.0f;\n\t\t}\t\n\t\tarmSpeed *= ARM_MULTIPLIER;\n\t\t\n\t\tdouble pos= testMotor.getPosition();\n\t\tif (((pos > SOFT_ENCODER_LIMIT_1) && armSpeed < 0.0) || ((pos < SOFT_ENCODER_LIMIT_2) && armSpeed > 0.0))\n\t\t\tarmSpeed = 0.0;\n\t\ttestMotor.set(armSpeed);\n\t\t\n\t\tSystem.out.println(\"armSpeed = \" + armSpeed + \" enc pos = \" + testMotor.getPosition());\n\t\t */ \n }", "@Override\n public void runOpMode() throws InterruptedException {\n leftfMotor = hardwareMap.dcMotor.get(\"m0\");\n rightfMotor = hardwareMap.dcMotor.get(\"m1\");\n leftbMotor = hardwareMap.dcMotor.get(\"m2\");\n rightbMotor = hardwareMap.dcMotor.get(\"m3\");\n rPMotor = hardwareMap.dcMotor.get(\"rPMotor\");\n leftClamp = hardwareMap.servo.get(\"left_servo\");\n rightClamp = hardwareMap.servo.get(\"right_servo\");\n rightfMotor.setDirection(DcMotor.Direction.REVERSE);\n rightbMotor.setDirection(DcMotor.Direction.REVERSE);\n\n telemetry.addData(\"Mode\", \"waiting\");\n telemetry.update();\n\n // wait for start button.\n\n\n waitForStart();\n\n leftY = 0;\n rightY = 0;\n leftZ = 0;\n rightZ = 0;\n bumperL = false;\n bumperR = false;\n\n while (opModeIsActive()) {\n\n telemetry.addData(\"left stick y \", gamepad1.left_stick_y);\n telemetry.update();\n leftY = -gamepad1.left_stick_y;\n\n rightY = -gamepad1.right_stick_y;\n\n leftZ = gamepad1.left_trigger;\n rightZ = gamepad1.right_trigger;\n\n bumperL = gamepad1.left_bumper;\n bumperR = gamepad1.right_bumper;\n\n\n leftfMotor.setPower(leftY);\n leftbMotor.setPower(leftY);\n rightfMotor.setPower(rightY);\n rightbMotor.setPower(rightY);\n\n\n if (leftZ > 0) {\n rPMotor.setPower(leftZ/10);\n\n } else if (rightZ > 0) {\n rPMotor.setPower(-rightZ/10);\n\n }\n\n\n telemetry.addData(\"Mode\", \"running\");\n telemetry.addData(\"sticks\", \" left=\" + leftY + \" right=\" + rightY);\n telemetry.addData(\"trig\", \" left=\" + leftZ + \" right=\" + rightZ);\n telemetry.update();\n\n\n if (bumperL) {\n\n clampMove += .01;\n leftClamp.setPosition(-clampMove);\n rightClamp.setPosition(clampMove);\n\n } else if (bumperR) {\n\n clampMove -= .01;\n leftClamp.setPosition(-clampMove);\n rightClamp.setPosition(clampMove);\n\n }\n\n idle();\n\n\n }\n }", "@Override\r\n public void runOpMode() {\n\r\n mtrFL = hardwareMap.dcMotor.get(\"fl_drive\");\r\n mtrFR = hardwareMap.dcMotor.get(\"fr_drive\");\r\n mtrBL = hardwareMap.dcMotor.get(\"bl_drive\");\r\n mtrBR = hardwareMap.dcMotor.get(\"br_drive\");\r\n\r\n\r\n // Set directions for motors.\r\n mtrFL.setDirection(DcMotor.Direction.REVERSE);\r\n mtrFR.setDirection(DcMotor.Direction.FORWARD);\r\n mtrBL.setDirection(DcMotor.Direction.REVERSE);\r\n mtrBR.setDirection(DcMotor.Direction.FORWARD);\r\n\r\n\r\n //zero power behavior\r\n mtrFL.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n mtrFR.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n mtrBL.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n mtrBR.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\r\n\r\n\r\n // Set power for all motors.\r\n mtrFL.setPower(powFL);\r\n mtrFR.setPower(powFR);\r\n mtrBL.setPower(powBL);\r\n mtrBR.setPower(powBR);\r\n\r\n\r\n // Set all motors to run with given mode\r\n mtrFL.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\r\n mtrFR.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\r\n mtrBL.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\r\n mtrBR.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\r\n\r\n waitForStart();\r\n\r\n // run until the end of the match (driver presses STOP)\r\n while (opModeIsActive()) {\r\n g1ch2 = -gamepad1.left_stick_y;\r\n g1ch3 = gamepad1.right_stick_x;\r\n g2ch2 = -gamepad2.left_stick_x;\r\n g2ch4 = -gamepad2.right_stick_x;\r\n g2left = gamepad2.left_trigger;\r\n g2right = gamepad2.right_trigger;\r\n\r\n\r\n powFL = Range.clip(g1ch2 + g1ch3, -1, 1);\r\n powFR = Range.clip(g1ch2 - g1ch3, -1, 1);\r\n powBL = Range.clip(g1ch2 + g1ch3, -1, 1);\r\n powBR = Range.clip(g1ch2 - g1ch3, -1, 1);\r\n\r\n\r\n mtrFL.setPower(powFL);\r\n mtrFR.setPower(powFR);\r\n mtrBL.setPower(powBL);\r\n mtrBR.setPower(powBR);\r\n sleep(50);\r\n }\r\n }", "@Override\n public void runOpMode(){\n motors[0][0] = hardwareMap.dcMotor.get(\"frontLeft\");\n motors[0][1] = hardwareMap.dcMotor.get(\"frontRight\");\n motors[1][0] = hardwareMap.dcMotor.get(\"backLeft\");\n motors[1][1] = hardwareMap.dcMotor.get(\"backRight\");\n // The motors on the left side of the robot need to be in reverse mode\n for(DcMotor[] motor : motors){\n motor[0].setDirection(DcMotor.Direction.REVERSE);\n }\n // Being explicit never hurt anyone, right?\n for(DcMotor[] motor : motors){\n motor[1].setDirection(DcMotor.Direction.FORWARD);\n }\n\n waitForStart();\n\n //Kill ten seconds\n runtime.reset();\n while(runtime.seconds()<10); runtime.reset();\n\n while(runtime.milliseconds()<700){\n // Loop through front and back motors\n for(DcMotor[] motor : motors){\n // Set left motor power\n motor[0].setPower(100);\n // Set right motor power\n motor[1].setPower(100);\n }\n }\n\n while(runtime.milliseconds()<200){\n // Loop through front and back motors\n for(DcMotor[] motor : motors){\n // Set left motor power\n motor[0].setPower(-100);\n // Set right motor power\n motor[1].setPower(-100);\n }\n }\n\n runtime.reset();\n // Loop through front and back motors\n for(DcMotor[] motor : motors){\n // Set left motor power\n motor[0].setPower(0);\n // Set right motor power\n motor[1].setPower(0);\n }\n }", "@Override\n public void runOpMode() {\n RobotMain main = new RobotMain(this,hardwareMap,telemetry);\n\n //initialize controls\n imuTeleOpDualGamepad control = new imuTeleOpDualGamepad(main,gamepad1,gamepad2);\n\n waitForStart();\n\n //Pull the tail back from autonomous\n main.JewelArm.setServo(.65);\n\n //Continually run the control program in the algorithm\n while (opModeIsActive()) control.run();\n }", "private void testRelease()\n {\n if(gamepad1.x) {\n // move to 0 degrees.\n servoLeft.setPosition(0);\n //servoRight.setPosition(0);\n }\n telemetry.addData(\"Servo Left Posit++backInc;ion\", servoLeft.getPosition());\n //telemetry.addData(\"Servo Right Position\", servoRight.getPosition());\n }", "@Override\r\n public void runOpMode() {\n robot.init(hardwareMap);\r\n\r\n telemetry.addData(\"Status\", \"Initialized\");\r\n telemetry.update();\r\n\r\n //Wait for the Pressing of the Start Button\r\n waitForStart();\r\n\r\n // run until the end of the match (driver presses STOP)\r\n while (opModeIsActive()) {\r\n\r\n motorSpeed[0] = driveSpeed(gamepad1.left_stick_x, gamepad1.left_stick_y, gamepad2.left_stick_x)[0];\r\n motorSpeed[1] = driveSpeed(gamepad1.left_stick_x, gamepad1.left_stick_y, gamepad2.left_stick_x)[1];\r\n motorSpeed[2] = driveSpeed(gamepad1.left_stick_x, gamepad1.left_stick_y, gamepad2.left_stick_x)[2];\r\n motorSpeed[3] = driveSpeed(gamepad1.left_stick_x, gamepad1.left_stick_y, gamepad2.left_stick_x)[3];\r\n\r\n robot.drive1.setPower(motorSpeed[0]);\r\n robot.drive1.setPower(motorSpeed[1]);\r\n robot.drive1.setPower(motorSpeed[2]);\r\n robot.drive1.setPower(motorSpeed[3]);\r\n\r\n telemetry.addData(\"Drive 1 Speed\", motorSpeed[0]);\r\n telemetry.addData(\"Drive 2 Speed\", motorSpeed[1]);\r\n telemetry.addData(\"Drive 3 Speed\", motorSpeed[2]);\r\n telemetry.addData(\"Drive 4 Speed\", motorSpeed[3]);\r\n telemetry.update();\r\n\r\n }\r\n }", "@Override\n\tpublic void testPeriodic() {\n\t\tif (testJoystick.getRawButton(3)) {\n\t\t\tsparkMotor1.set(1.0);\n\t\t\tsparkMotor0.set(1.0);\n\t\t\ttestTalon.set(1.0);\n\t\t\t\n\t\t\ttalonMotor10.set(ControlMode.PercentOutput, 1.0);\n\t\t\ttalonMotor11.set(ControlMode.PercentOutput, 1.0);\n\t\t\ttalonMotor12.set(ControlMode.PercentOutput, 1.0);\n\t\t\ttalonMotor13.set(ControlMode.PercentOutput, 1.0);\n\t\t\ttalonMotor14.set(ControlMode.PercentOutput, 1.0);\n\t\t\ttalonMotor15.set(ControlMode.PercentOutput, 1.0);\n\t\t}\n\t\telse if (testJoystick.getRawButton(2)) {\n\t\t\tsparkMotor0.set(-1.0);\n\t\t\tsparkMotor1.set(-1.0);\n\t\t\ttestTalon.set(-1.0);\n\t\t\t\n\t\t\ttalonMotor10.set(ControlMode.PercentOutput, -1.0);\n\t\t\ttalonMotor11.set(ControlMode.PercentOutput, -1.0);\n\t\t\ttalonMotor12.set(ControlMode.PercentOutput, -1.0);\n\t\t\ttalonMotor13.set(ControlMode.PercentOutput, -1.0);\n\t\t\ttalonMotor14.set(ControlMode.PercentOutput, -1.0);\n\t\t\ttalonMotor15.set(ControlMode.PercentOutput, -1.0);\n\t\t}\n\t\telse {\n//\t\t\tsparkMotor0.set(0);\n\t\t\tsparkMotor1.set(0);\n\t\t\ttestTalon.set(0);\n\t\t\t\n\t\t\ttalonMotor10.set(ControlMode.PercentOutput, 0);\n\t\t\ttalonMotor11.set(ControlMode.PercentOutput, 0);\n\t\t\ttalonMotor12.set(ControlMode.PercentOutput, 0);\n\t\t\ttalonMotor13.set(ControlMode.PercentOutput, 0);\n\t\t\ttalonMotor14.set(ControlMode.PercentOutput, 0);\n\t\t\ttalonMotor15.set(ControlMode.PercentOutput, 0);\n\t\t\t\n\t\t\ttestSel.set(Value.kForward);\n\t\t}\n\t\t\n\t\tif (testJoystick.getRawButton(7)) {\n\t\t\ttestSel.set(Value.kForward);\n\t\t\tSystem.out.println(compressor.getCompressorCurrent());\n\t\t}\n\t}", "public void operatorDrive() {\n\n changeMode();\n checkForGearShift();\n\n if (Robot.rightJoystick.getRawButton(1)) {\n currentMode = DriveMode.AUTO;\n\n } else if (Robot.rightJoystick.getRawButton(2)) {\n currentMode = DriveMode.CLIMB;\n } else {\n currentMode = DEFAULT_MODE;\n }\n\n isDeploying = false;\n\n if (currentMode == DriveMode.AUTO) {\n currentMode_s = \"Auto\";\n } else if (currentMode == DriveMode.ARCADE) {\n currentMode_s = \"Arcade\";\n } else {\n currentMode_s = \"Tank\";\n }\n\n double leftY = 0;\n double rightY = 0;\n\n switch (currentMode) {\n\n case AUTO:\n rotateCam(4, Robot.visionTargetInfo.visionPixelX);\n\n // driveFwd(4, .25);\n\n break;\n\n case CLIMB:\n\n climb();\n\n break;\n\n case ARCADE:\n resetAuto();\n double linear = 0;\n double turn = 0;\n\n if (Math.abs(Robot.rightJoystick.getY()) > deadband) {\n linear = -Robot.rightJoystick.getY();\n }\n if (Math.abs(Robot.leftJoystick.getX()) > deadband) {\n turn = Math.pow(Robot.leftJoystick.getX(), 3);\n }\n\n leftY = -linear - turn;\n rightY = linear - turn;\n if (!isShifting) {\n assignMotorPower(rightY, leftY);\n } else {\n\n assignMotorPower(0, 0);\n }\n\n break;\n\n case TANK:\n\n resetAuto();\n if (Math.abs(Robot.rightJoystick.getY()) > deadband) {\n rightY = -Math.pow(Robot.rightJoystick.getY(), 3 / 2);\n }\n if (Math.abs(Robot.leftJoystick.getY()) > deadband) {\n leftY = Math.pow(Robot.leftJoystick.getY(), 3 / 2);\n }\n if (!isShifting) {\n assignMotorPower(rightY, leftY);\n } else {\n\n assignMotorPower(0, 0);\n }\n break;\n\n default:\n break;\n }\n\n updateTelemetry();\n }", "public static void main(String[] args){\n Robot robot = new DifferentialWheels();\n\n // Get the time step of the current world.\n int timeStep = (int) Math.round(robot.getBasicTimeStep());\n\n // Get references to, and enable, all required devices on the robot.\n Lidar lidar = robot.getLidar(\"lms291\");\n lidar.enable(timeStep);\n lidar.enablePointCloud();\n\n GPS gps = robot.getGPS(\"gps\");\n gps.enable(timeStep);\n\n Emitter emitter = robot.getEmitter(\"emitter\");\n emitter.setChannel(0);\n\n Compass compass = robot.getCompass(\"compass\");\n compass.enable(timeStep);\n\n Motor frontLeft = robot.getMotor(\"front_left_wheel\");\n frontLeft.setPosition(Double.POSITIVE_INFINITY);\n Motor frontRight = robot.getMotor(\"front_right_wheel\");\n frontRight.setPosition(Double.POSITIVE_INFINITY);\n Motor backLeft = robot.getMotor(\"back_left_wheel\");\n backLeft.setPosition(Double.POSITIVE_INFINITY);\n Motor backRight = robot.getMotor(\"back_right_wheel\");\n backRight.setPosition(Double.POSITIVE_INFINITY);\n\n TestTurnPB turnPBController = new TestTurnPB(gps, compass, emitter, frontLeft, frontRight, backLeft, backRight);\n System.out.println(\"current param : \" + turnPBController.toString());\n\n //Initialise Start and Goal Coordinates\n robot.step(timeStep);\n turnPBController.updateObstacleReadings(lidar.getPointCloud());\n turnPBController.isRunning = true;\n turnPBController.initMetrics();\n turnPBController.initPositions();\n //potBugController.initAlgorithm();\n turnPBController.runInit();\n\n //Iteration Count\n int itCount = 0;\n\n while (robot.step(timeStep*100) != -1) {\n //Check max iteration\n //while (itCount<DEFAULT_MAX_ITERATION_COUNT){\n //Update Turn Angles\n turnPBController.updateAngles();\n\n //Update Sensor Information\n turnPBController.updateObstacleReadings(lidar.getPointCloud());\n\n //Check if goal is reached and terminate as appropriate\n if (turnPBController.isGoalReached()){\n turnPBController.isRunning = false;\n turnPBController.setRobotSpeed(0,0);\n turnPBController.terminatePotBug();\n System.out.println(\"Goal Reached Successfully!\");\n }\n\n if(!turnPBController.isGoalReached() && turnPBController.isRunning){\n //Check for goal direction on forwards semi-circle\n if (!turnPBController.isObstruction()){\n\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_GOAL);\n //Move 'freely' to the next sample point, towards goal\n turnPBController.updateMetrics();\n\n } else {\n\n if (turnPBController.isClearToLeave()){\n\n if (turnPBController.isProgressAttained() &&\n turnPBController.isClearToLeave()){\n\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_GOAL);\n turnPBController.updateMetrics();\n\n }\n } else {\n\n if (turnPBController.hitPoint == null){\n\n turnPBController.setHitPoint();\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_CONTOUR);\n turnPBController.updateMetrics();\n\n } else {\n\n // engaged mode\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_ALONG_CONTOUR);\n turnPBController.updateMetrics();\n\n }\n }\n }\n }\n //}\n }\n }", "public void servoOff() throws DeviceException {\n \t\ttry {\n \t\t\tcontroller.caput(svonChannel, 0, 2.0);\n \t\t} catch (Throwable e) {\n \t\t\tthrow new DeviceException(\"failed to turn servos on\", e);\n \t\t}\n \t}", "@Override\n public void robotPeriodic() {\n\n enabledCompr = pressBoy.enabled();\n //pressureSwitch = pressBoy.getPressureSwitchValue();\n currentCompr = pressBoy.getCompressorCurrent();\n //SmartDashboard.putBoolean(\"Pneumatics Loop Enable\", closedLoopCont);\n SmartDashboard.putBoolean(\"Compressor Status\", enabledCompr);\n //SmartDashboard.putBoolean(\"Pressure Switch\", pressureSwitch);\n SmartDashboard.putNumber(\"Compressor Current\", currentCompr);\n }", "public void teleopPeriodic() {\r\n //Driving\r\n if (driveChooser.getSelected().equals(\"tank\")){\r\n if (joystickChooser.getSelected().equals(\"two\")){\r\n drive.tankDrive(leftJoystick.getY(), rightJoystick.getY());\r\n } \r\n else {\r\n drive.tankDrive(manipulator.getY(), manipulator.getThrottle());\r\n }\r\n }\r\n if (driveChooser.getSelected().equals(\"arcade1\")){\r\n if (joystickChooser.getSelected().equals(\"two\")){\r\n drive.arcadeDrive(leftJoystick.getY(), leftJoystick.getX());\r\n } \r\n else {\r\n drive.arcadeDrive(manipulator.getY(), manipulator.getX());\r\n }\r\n }\r\n if (driveChooser.getSelected().equals(\"arcade2\")){\r\n if (joystickChooser.getSelected().equals(\"two\")){\r\n drive.arcadeDrive(leftJoystick.getY(), rightJoystick.getX());\r\n }\r\n else{\r\n drive.arcadeDrive(manipulator.getY(), manipulator.getTwist());\r\n }\r\n }\r\n \r\n //Shooting\r\n if (shootButton1.get()||shootButton2.get()){\r\n frontShooter.set(-1);\r\n backShooter.set(1);\r\n }\r\n else{\r\n frontShooter.set(0);\r\n backShooter.set(0); \r\n }\r\n if (transportButton1.get()||transportButton2.get()){\r\n transport.set(-1);\r\n }\r\n else{\r\n transport.set(0); \r\n }\r\n \r\n //Intake\r\n if (intakeButton1.get()||intakeButton2.get()){\r\n //intakeA.set(-1);BROKEN\r\n intakeB.set(-1);\r\n }\r\n else{\r\n intakeA.set(0);\r\n intakeB.set(0); \r\n }\r\n \r\n //Turret\r\n if (toggleTurretButton.get()){\r\n turret.set(leftJoystick.getX());\r\n }\r\n else{\r\n turret.set(manipulator.getX());\r\n }\r\n }", "public void runOpMode() {\n robot.init(hardwareMap);\n\n // Send telemetry message to signify robot waiting;\n telemetry.addData(\"Status\", \"Resetting Encoders\"); //\n telemetry.update();\n\n robot.leftMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.rightMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n idle();\n\n robot.leftMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.rightMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n // Send telemetry message to indicate successful Encoder reset\n telemetry.addData(\"Path0\", \"Starting at %7d :%7d\",\n robot.leftMotor.getCurrentPosition(),\n robot.rightMotor.getCurrentPosition());\n telemetry.addData(\"Gyro Heading:\", \"%.4f\", getHeading());\n telemetry.update();\n\n int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(\"cameraMonitorViewId\", \"id\", hardwareMap.appContext.getPackageName());\n\n VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId);\n\n parameters.vuforiaLicenseKey = \"Adiq0Gb/////AAAAme76+E2WhUFamptVVqcYOs8rfAWw8b48caeMVM89dEw04s+/mRV9TqcNvLkSArWax6t5dAy9ISStJNcnGfxwxfoHQIRwFTqw9i8eNoRrlu+8X2oPIAh5RKOZZnGNM6zNOveXjb2bu8yJTQ1cMCdiydnQ/Vh1mSlku+cAsNlmfcL0b69Mt2K4AsBiBppIesOQ3JDcS3g60JeaW9p+VepTG1pLPazmeBTBBGVx471G7sYfkTO0c/W6hyw61qmR+y7GJwn/ECMmXZhhHkNJCmJQy3tgAeJMdKHp62RJqYg5ZLW0FsIh7cOPRkNjpC0GmMCMn8AbtfadVZDwn+MPiF02ZbthQN1N+NEUtURP0BWB1CmA\";\n\n\n parameters.cameraDirection = VuforiaLocalizer.CameraDirection.FRONT;\n this.vuforia = ClassFactory.createVuforiaLocalizer(parameters);\n\n VuforiaTrackables relicTrackables = this.vuforia.loadTrackablesFromAsset(\"RelicVuMark\");\n VuforiaTrackable relicTemplate = relicTrackables.get(0);\n relicTemplate.setName(\"relicVuMarkTemplate\"); // can help in debugging; otherwise not necessary\n\n telemetry.addData(\">\", \"Press Play to start\");\n telemetry.update();\n\n\n\n // Wait for the game to start (driver presses PLAY)\n waitForStart();\n relicTrackables.activate();\n\n //while (opModeIsActive()) {\n\n /**\n * See if any of the instances of {@link relicTemplate} are currently visible.\n * {@link RelicRecoveryVuMark} is an enum which can have the following values:\n * UNKNOWN, LEFT, CENTER, and RIGHT. When a VuMark is visible, something other than\n * UNKNOWN will be returned by {@link RelicRecoveryVuMark#from(VuforiaTrackable)}.\n */\n RelicRecoveryVuMark vuMark = RelicRecoveryVuMark.from(relicTemplate);\n while (vuMark == RelicRecoveryVuMark.UNKNOWN) {\n vuMark = RelicRecoveryVuMark.from(relicTemplate);\n /* Found an instance of the template. In the actual game, you will probably\n * loop until this condition occurs, then move on to act accordingly depending\n * on which VuMark was visible. */\n }\n telemetry.addData(\"VuMark\", \"%s visible\", vuMark);\n telemetry.update();\n sleep(550);\n\n //switch (vuMark) {\n // case LEFT: //RelicRecoveryVuMark vuMark = RelicRecoveryVuMark.LEFT;\n // coLumn = 2;\n // case CENTER:// RelicRecoveryVuMark vuMark = RelicRecoveryVuMark.CENTER;\n // coLumn = 1;\n // case RIGHT:// RelicRecoveryVuMark vuMark = RelicRecoveryVuMark.RIGHT;\n // coLumn = 0;\n //}\n if ( vuMark == RelicRecoveryVuMark.LEFT) {\n coLumn = 2;\n }\n else if(vuMark == RelicRecoveryVuMark.RIGHT){\n coLumn = 0;\n }\n else if(vuMark == RelicRecoveryVuMark.CENTER){\n coLumn = 1;\n }\n\n\n telemetry.addData(\"coLumn\", \"%s visible\", coLumn);\n telemetry.update();\n sleep(550);\n\n\n\n//if jewej is red 1 if jewel is blue 2\n\n // if(jewel == 1) {\n // gyroturn(-10, TURN_SPEED, -TURN_SPEED); //encoderDrive(TURN_SPEED, TURN_SPEED, turndistance[1], -turndistance[1], 5.0);\n //gyroturn(-2, -TURN_SPEED, TURN_SPEED); //encoderDrive(TURN_SPEED, TURN_SPEED, turndistance[1], -turndistance[1], 5.0);\n //}\n //else if(jewel == 2){\n // gyroturn(10, -TURN_SPEED, TURN_SPEED); //encoderDrive(TURN_SPEED, TURN_SPEED, turndistance[1], -turndistance[1], 5.0);\n // gyroturn(-2, TURN_SPEED, -TURN_SPEED); //encoderDrive(TURN_SPEED, TURN_SPEED, turndistance[1], -turndistance[1], 5.0);\n //}\n encoderDrive(DRIVE_SPEED, DRIVE_SPEED, disandTurn[0][coLumn], disandTurn[0][coLumn], 5.0); // S1: Forward 24 Inches with 5 Sec timeout shoot ball\n\n gyroturn(disandTurn[1][coLumn], TURN_SPEED, -TURN_SPEED); //encoderDrive(TURN_SPEED, TURN_SPEED, turndistance[0], -turndistance[0], 5.0);\n\n encoderDrive(DRIVE_SPEED, DRIVE_SPEED, disandTurn[2][coLumn], disandTurn[2][coLumn], 5.0); // S3: Forward 43.3 iNCHES\n\n gyroturn(disandTurn[3][coLumn], TURN_SPEED, -TURN_SPEED); //encoderDrive(TURN_SPEED, TURN_SPEED, turndistance[1], -turndistance[1], 5.0);\n\n encoderDrive(DRIVE_SPEED, DRIVE_SPEED, disandTurn[4][coLumn], disandTurn[4][coLumn], 5.0);// S5: Forward 12 Inches with 4 Sec timeout\n\n gyroturn(disandTurn[5][coLumn], TURN_SPEED, -TURN_SPEED); //encoderDrive(TURN_SPEED, TURN_SPEED, turndistance[1], -turndistance[1], 5.0);\n\n encoderDrive(DRIVE_SPEED, DRIVE_SPEED, disandTurn[6][coLumn], disandTurn[6][coLumn], 5.0);// S5: Forward 12 Inches with 4 Sec timeout\n\n\n Outake();\n encoderDrive(DRIVE_SPEED, DRIVE_SPEED, disandTurn[7][coLumn], disandTurn[7][coLumn], 5.0);// S6: Forward 48 inches with 4 Sec timeout\n }", "@Override\n public void main() throws InterruptedException {\n this.motorLeft = this.hardwareMap.dcMotor.get(\"motorLeft\");\n this.motorRight = this.hardwareMap.dcMotor.get(\"motorRight\");\n\n motorLeft.setMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);\n motorRight.setMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);\n\n motorRight.setDirection(DcMotor.Direction.REVERSE);\n\n// boolean test = true;\n// while (test) {\n// motorLeft.setPower(1.0);\n// motorRight.setPower(1.0);\n//\n// if (updateGamepads())\n// {\n// if (gamepad1.b)\n// {\n// test = false;\n// }\n// }\n// }\n\n // while (opModeIsActive())\n // gamepad1.a\n while (true)\n {\n if (updateGamepads())\n {\n motorLeft.setPower(gamepad1.left_stick_y);\n motorRight.setPower(gamepad1.right_stick_y);\n\n // move the arm with controller bumpers\n if (gamepad1.right_bumper)\n {\n motorArm.setPower(0.5);\n Thread.sleep(100);\n }\n else if (gamepad1.left_bumper)\n {\n motorArm.setPower(-0.5);\n Thread.sleep(100);\n }\n else\n {\n motorArm.setPower(0);\n }\n }\n\n telemetry.update();\n idle();\n }\n }", "public void operatorControl() {\n \tdouble ctrlThresh = .2; \n \tdouble minPower = .05; \n \tdouble maxPower = .75; \n \tdouble recip = (1 - ctrlThresh); \n \tdouble mult = (maxPower - minPower); \n \tdouble right; \n \tdouble strafe; \n \tdouble rotate; \n \tdouble rightAxis; \n \tdouble strafeAxis; \n \tdouble rotateAxis; \n \t// \tboolean leftLeft; \n \t// \tboolean leftRight; \n \tdouble rightDir; \n \tdouble strafeDir; \n \tdouble rotateDir; \n \tdouble rightPower; \n \tdouble rotatePower; \n \tdouble strafePower; \n \t\n \tint winchCount;\n \tboolean winchDirection;\n \n \t// \tdouble frontLeftPower; \n \t// \tdouble frontRightPower; \n \t// \tdouble backLeftPower; \n \t// \tdouble backRightPower; \n \n \t//myRobot.setSafetyEnabled(true); \n \t\n \tAccelerometer test = new BuiltInAccelerometer();\n \t\n \twhile (isOperatorControl() && isEnabled()) { \n \t\t// ACCEL TEST CODE\n// \t\tSystem.out.println(test.getX() + \", \" + test.getY() + \", \" + test.getZ());\n \t\t// END ACCEL TEST CODE\n \n \t\t// ********** BEGIN DRIVING CODE ********** \n \t\t// Code for driving using omniwheels and two wheels for strafing \n \t\t// Diagram for the wheels of the robot below. \n \n \t\t// L S R \n \t\t// /--------------------------\\ \n \t\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\t// ||------------------------|| \n \t\t// \\--------------------------/ \n \t\t// \n \t\t// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ \n \n \t\tctrlThresh = .2; // the point at which we want to sense joystick action \n \t\trecip = 1-ctrlThresh; \t\t // = 0.8 \n \n \t\trightAxis = rightStick.getRawAxis(1);\t\t\t\t// right joystick, y (up/down) axis\n \t\t\n \t\t//System.out.println(\"\"+rightAxis);\n \t\tstrafeAxis = rightStick.getRawAxis(0);\t\t\t\t// right joystick, x (left/right) axis; this is \n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// arbitrary and could have been the left stick\n \t\trotateAxis = rightStick.getRawAxis(4);\t\t\t\t\t// left joystick, y axis\n \n \t\trightDir = rightAxis/Math.abs(rightAxis);\t\t\t// forward or backward (+1 or -1)\n \t\tstrafeDir = strafeAxis/Math.abs(strafeAxis); \t// \t\t\t'' \n \t\trotateDir = rotateAxis/Math.abs(rotateAxis); // \t\t\t'' \n \n \t\tright = 0; // right input formatted for range of detected values [0.2,1] \n \t\trotate = 0; // left input formatted \n \t\tstrafe = 0; // strafe input formatted \n \n \t\tif(Math.abs(rightAxis) > ctrlThresh) \t// user moved stick beyond threshold \n \t\t{right = (rightAxis-ctrlThresh*rightDir)/recip;} // format right: scale back, set direction, proportion it \n \t\tif(Math.abs(strafeAxis) > ctrlThresh) \n \t\t{strafe = (strafeAxis-ctrlThresh*strafeDir)/recip;} // format left... \n \t\tif(Math.abs(rotateAxis) > ctrlThresh) \n \t\t{rotate = (rotateAxis-ctrlThresh*rotateDir)/recip;}\t\t// format strafe... \n \n \n \t\trightDir = right/Math.abs(right); \n \t\trightPower = (Math.abs(right*mult) + minPower) * rightDir; \t\t// re-proportion for power's range, strip direction,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// and then add back threshold and direction. \n \t\trotateDir = rotate/Math.abs(rotate); \n \t\trotatePower = (Math.abs(rotate*mult) + minPower) * rotateDir;\t\t\t// \t\t'' \n \n \t\tstrafeDir = strafe/Math.abs(strafe); \n \t\tstrafePower = (Math.abs(strafe*mult) + minPower) * strafeDir;\t// \t\t'' \n \n \t\tif(Math.abs(rightPower)>0.2){\n \t\t\tfrontRight.set(rightPower);\t\t\t\t\t\t// set all the motors with the powers we \n \t\t\tbackRight.set(rightPower);\t\t\t\t\t\t/// calculated above : drive! \n \t\t\tfrontLeft.set(-1*rightPower); \n \t\t\tbackLeft.set(-1*rightPower);\n \t\t}\n \t\telse{\n \t\t\tfrontRight.set(rotatePower);\n \t\t\tbackRight.set(rotatePower);\n \t\t\tfrontLeft.set(rotatePower);\n \t\t\tbackLeft.set(rotatePower);\n \t\t}\n \t\t\n// \t\tfrontStrafe.set(strafePower); \n// \t\tbackStrafe.set(-1*strafePower); \n \n// \t\tmyRobot.tankDrive(leftStick, rightStick); \n \t\t \n \t\t// ********** END OF DRIVING CODE ********** \n \t\t//======================================================================= \n \t\t// ************ BEGIN WINCH CODE *********** \n \t\t// We need to code the winch to help raise and lower the elevator \n \t\t// This is just one option between the winch and the lead screw. \n \t\t \n \t\t\n \t\t//second winch test\n \t\t/*\n \t\twinchCount = winchEncoder.get();\t\t\t\t// get the pulse count from the encoder\n \t \tSystem.out.println(\"Count: \"+ winchCount);\t\t// print the pulse count \n \t \tif(winchCount<240){\n \t \t\t\n \t \t\twinchCim1.set(.1);\n \t \t\twinchCim2.set(.1);\n \t \t}\n \t \telse{\n \t \t\twinchCim1.set(0);\n \t \t\twinchCim2.set(0);\n \t \t\t\n \t \t}\n \t if(rightStick.getRawButton(5)) \n { \n\t\t\t winchEncoder.reset();// reset the pulse count\n\t\t\t winchCount = 0;\n\t\t\t winchCim1.set(0);\n\t\t\t winchCim2.set(0);\n\t\t\t \n } */ //end of second winch test \n \t \t\n \t\t\n \t\t if(rightStick.getRawButton(5)) \n { \n \t\t\t //winchEncoder.reset();// reset the pulse count\n \tSystem.out.println(\"A\");\n \t winchCim1.set(.5); \t// set winchCim1 to 0.5 power (upwards) \n \t winchCim2.set(.5); \t\t\t\t\t\t\t// set winchCim2 to 0.5 power\n \t\t\t \n } \n \t\telse if(rightStick.getRawButton(4))\n \t\t{\n \t\t\tSystem.out.println(\"B\");\n \t\t\t//winchEncoder.reset();\t\t\t\t\t\t\t// reset the pulse count\n \t \twinchCim1.set(-.3); // set winchCim1 to -0.5 power (downwards) \n \t \twinchCim2.set(-.3);\t \t\t\t\t\t\t\t// set winchCim2 to -0.5 power\n \t\t}\n \n \t \telse// if(rightStick.getRawButton(2)) \n { \n \t winchCim1.set(0); \t\t\t\t\t\t\t// set winchCim1 to 0 power (off/stop) \n \t winchCim2.set(0);\t\t\t\t\t\t\t\t// set winchCim2 to 0 pwoer (off/stop)\n// \t winchCount = winchEncoder.get();\t\t\t\t// get the pulse count from the encoder\n// \t System.out.println(\"Count: \"+ winchCount);\t\t// print the pulse count \n } \n \n \t\t// ********** END OF WINCH CODE ********** \n \t\t//======================================================================= \n \t\t \n \t\t \n \t\tTimer.delay(0.005);\t\t// wait for a motor update time \n } \n }", "@Override\n\n public void runOpMode() {\n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.update();\n\n // Initialize the hardware variables. Note that the strings used here as parameters\n // to 'get' must correspond to the names assigned during the robot configuration\n // step (using the FTC Robot Controller app on the phone).\n // FR = hardwareMap.get(DcMotor.class, \"FR\");\n // FL = hardwareMap.get(DcMotor.class, \"FL\");\n // BR = hardwareMap.get(DcMotor.class, \"BR\");\n //BL = hardwareMap.get(DcMotor.class, \"BL\");\n //yoo are ___\n // Most robots need the motor on one side to be reversed to drive forward\n // Reverse the motor that runs backwards when connected directly to the battery\n/* FR.setDirection(DcMotor.Direction.FORWARD);\n FL.setDirection(DcMotor.Direction.REVERSE);\n BR.setDirection(DcMotor.Direction.FORWARD);\n BL.setDirection(DcMotor.Direction.REVERSE);\n\n */ RevBlinkinLedDriver blinkinLedDriver;\n RevBlinkinLedDriver.BlinkinPattern pattern;\n\n // Wait for the game to start (driver presses PLAY)\n waitForStart();\n\n blinkinLedDriver = this.hardwareMap.get(RevBlinkinLedDriver.class, \"PrettyBoi\");\n blinkinLedDriver.setPattern(RevBlinkinLedDriver.BlinkinPattern.RAINBOW_WITH_GLITTER);\n// runtime.reset();\n\n // run until the end of the match (driver presses STOP)\n while (opModeIsActive()) {\n\n\n\n // Show the elapsed game time and wheel power.\n// telemetry.addData(\"Status\", \"Run Time: \" + runtime.toString());\n// // telemetry.addData(\"Motors\", \"FL (%.2f), FR (%.2f), BL (%.2f), BR (%.2f)\", v1, v2, v3, v4);\n// telemetry.update();\n }\n }", "@Override\n public void runOpMode() {\n\n robot.init(hardwareMap);\n robot.MotorRightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.MotorLeftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.MotorRightFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.MotorLeftFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n /** Wait for the game to begin */\n while (!isStarted()) {\n telemetry.addData(\"angle\", \"0\");\n telemetry.update();\n }\n\n\n }", "public void teleopPeriodic() {\n\t\t// resetAndDisable();\n\t\tupdateDashboard();\n\t\tLogitechJoystick.controllers();\n\t\tDrivetrain.arcadeDrive();\n\t\tShooterAngleMotor.angleShooter();\n\t\tBallShooter.shootBalls();\n\t\tSonicSensor.updateSensors();\n\t\t\n\t\t//if(LogitechJoystick.rightBumper2)\n\t\t\t//{\n\t\t\t\t//LowBar.makeArmStable();\n\t\t\t//}\n\n\t}", "public Shooter() {\n servo.set(ShooterConstants.Servo_Down);\n \n \n }", "@Override\n public void robotPeriodic() {\n }", "@Override\n public void robotPeriodic() {\n }", "@Override\n public void robotPeriodic() {\n }", "@Override\n public void robotPeriodic() {\n }", "@Override\n public void robotPeriodic() {\n }", "@Override\n public void robotPeriodic() {\n }", "CameraServoMount(){\r\n\t\tpan_servo = new Servo(PAN_SERVO_PORT);\r\n\t\ttilt_servo = new Servo(TILT_SERVO_PORT);\r\n\t\tsetCameraPos(startupPos);\r\n\t\t\r\n\t}", "@Override\n public void teleopPeriodic() {\n Scheduler.getInstance().run();\n // ros_string = workingSerialCom.read();\n // yavuz = workingSerialCom.StringConverter(ros_string, 2);\n // Inverse.Inverse(yavuz);\n\n // JoystickDrive.execute();\n\n\n\n // ros_string = workingSerialCom.read();\n // alt_yurur = workingSerialCom.StringConverter(ros_string, 1);\n // robot_kol = workingSerialCom.StringConverter(ros_string, 2);\n Full.Full(yavuz);\n \n }", "@Override\n public void runOpMode() {\n float strafeRight;\n float strafeLeft;\n\n frontRight = hardwareMap.dcMotor.get(\"frontRight\");\n backRight = hardwareMap.dcMotor.get(\"backRight\");\n frontLeft = hardwareMap.dcMotor.get(\"frontLeft\");\n backLeft = hardwareMap.dcMotor.get(\"backLeft\");\n flipper = hardwareMap.crservo.get(\"flipper\");\n\n // Put initialization blocks here.\n frontRight.setDirection(DcMotorSimple.Direction.REVERSE);\n backRight.setDirection(DcMotorSimple.Direction.REVERSE);\n waitForStart();\n while (opModeIsActive()) {\n // Power to drive\n frontRight.setPower(gamepad1.right_stick_y * 0.5);\n frontRight.setPower(gamepad1.right_stick_y * 0.75);\n backRight.setPower(gamepad1.right_stick_y * 0.75);\n frontLeft.setPower(gamepad1.left_stick_y * 0.75);\n backLeft.setPower(gamepad1.left_stick_y * 0.75);\n flipper.setPower(gamepad2.left_stick_y);\n // Strafing code\n strafeRight = gamepad1.right_trigger;\n strafeLeft = gamepad1.left_trigger;\n if (strafeRight != 0) {\n frontLeft.setPower(-(strafeRight * 0.8));\n frontRight.setPower(strafeRight * 0.8);\n backLeft.setPower(strafeRight * 0.8);\n backRight.setPower(-(strafeRight * 0.8));\n } else if (strafeLeft != 0) {\n frontLeft.setPower(strafeLeft * 0.8);\n frontRight.setPower(-(strafeLeft * 0.8));\n backLeft.setPower(-(strafeLeft * 0.8));\n backRight.setPower(strafeLeft * 0.8);\n }\n // Creep\n if (gamepad1.dpad_up) {\n frontRight.setPower(-0.4);\n backRight.setPower(-0.4);\n frontLeft.setPower(-0.4);\n backLeft.setPower(-0.4);\n } else if (gamepad1.dpad_down) {\n frontRight.setPower(0.4);\n backRight.setPower(0.4);\n frontLeft.setPower(0.4);\n backLeft.setPower(0.4);\n } else if (gamepad1.dpad_right) {\n frontRight.setPower(-0.4);\n backRight.setPower(-0.4);\n } else if (gamepad1.dpad_left) {\n frontLeft.setPower(-0.4);\n backLeft.setPower(-0.4);\n }\n if (gamepad1.x) {\n frontLeft.setPower(1);\n backLeft.setPower(1);\n frontRight.setPower(1);\n backRight.setPower(1);\n sleep(200);\n frontRight.setPower(1);\n backRight.setPower(1);\n frontLeft.setPower(-1);\n backLeft.setPower(-1);\n sleep(700);\n }\n telemetry.update();\n }\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n// if (oi.driveStick.getRawButton(4)) {\n// System.out.println(\"Left Encoder Distance: \" + RobotMap.leftDriveEncoder.getDistance());\n// System.out.println(\"RightEncoder Distance: \" + RobotMap.rightDriveEncoder.getDistance());\n// }\n\n }", "@Override\n public void loop() {\n rightArm.setTargetPosition((int)(.125* TICKS_PER_WHEEL_ROTATION*8));\n leftArm.setTargetPosition((int)(.125* TICKS_PER_WHEEL_ROTATION*8));\nrightArm.setPower(.6);\nleftArm.setPower(.6);\nif(runtime.seconds()>4&& stage==-1){\n stage++;\n}\n// telemetry.addData(\"IsAligned\" , detector.getAligned()); // Is the bot aligned with the gold mineral?\n// telemetry.addData(\"X Pos\" , detector.getXPosition()); // Gold X position.\n\n //Point screenpos = detector.getScreenPosition();\n if(stage==0) {\n Rect bestRect = detector.getFoundRect();\n\n double xPos = bestRect.x + (bestRect.width / 2);\n\n if (xPos < alignXMax && xPos > alignXMin) {\n aligned = true;\n } else {\n aligned = false;\n }\n telemetry.addData(\"aligned \", aligned);\n\n telemetry.addData(\"xpos \", xPos);\n telemetry.addData(\"amax \", alignXMax);\n telemetry.addData(\"amin \", alignXMin);\n if(!(xPos>0)){\n rightWheel.setPower(0);\n leftWheel.setPower(0);\n telemetry.addLine(\"not detected\");\n }\n else if (xPos > alignXMax) {\n double power = ((xPos - alignXMax) / scale) * .3 + .4;\n rightWheel.setPower(power);\n leftWheel.setPower(-power);\n telemetry.addData(\"powL: \", power);\n telemetry.addLine(\"turning left\");\n runtime.reset();\n } else if (xPos < alignXMin) {\n double power = ((alignXMin - xPos) / scale) * .3 + .4;\n rightWheel.setPower(-power);\n leftWheel.setPower(power);\n telemetry.addData(\"powR: \", power);\n telemetry.addLine(\"turning right\");\n runtime.reset();\n } else {\n rightWheel.setPower(0);\n leftWheel.setPower(0);\n telemetry.addLine(\"found\");\n telemetry.addData(\"secks: \", runtime.seconds());\n if(runtime.seconds()>.1){\n runtime.reset();\n stage++;\n resetDriveEncoders();\n }\n }\n\n\n }\n else if (stage==1){\n rightWheel.setTargetPosition(-3*TICKS_PER_WHEEL_ROTATION);\n leftWheel.setTargetPosition(-3*TICKS_PER_WHEEL_ROTATION);\n leftWheel.setPower(.5);\n rightWheel.setPower(.5);\n if(runtime.seconds()>5){\n rightWheel.setPower(0);\n leftWheel.setPower(0);\n }\n\n }\n\n\n telemetry.addData(\"stage: \", stage);\n telemetry.update();\n }", "@Override //when init is pressed\n public void runOpMode(){\n robot.initMotors(hardwareMap);\n robot.initServos(hardwareMap);\n robot.useEncoders(false);\n\n waitForStart();\n runtime.reset();\n\n double speedSet = 5;//robot starts with speed 5 due to 40 ratio motors being op\n double reduction = 7.5;//fine rotation for precise stacking. higher value = slower rotation using triggers\n double maxPower = 0;\n\n boolean forks = false;\n\n while (opModeIsActive()) {\n double LX = gamepad1.left_stick_x, LY = gamepad1.left_stick_y, rotate = gamepad1.right_stick_x;\n\n //bumpers set speed of robot\n if(gamepad1.right_bumper)\n speedSet += 0.0005;\n else if(gamepad1.left_bumper)\n speedSet -= 0.0005;\n\n speedSet = Range.clip(speedSet, 1, 10);//makes sure speed is limited at 10.\n\n if(!gamepad1.right_bumper && !gamepad1.left_bumper)//makes sure speed does not round every refresh. otherwise, speed won't be able to change\n speedSet = Math.round(speedSet);\n\n if(gamepad1.a) {\n forks = !forks;\n sleep(50);\n }\n\n if(forks) {\n robot.setForks(DOWN);\n }\n else if(earthIsFlat) {\n robot.setForks(UP);\n }\n\n //Holonomic Vector Math\n robot.drive(LX, LY, rotate);\n\n telemetry.addData(\"Drive\", \"Holonomic\");\n\n if(forks)\n telemetry.addData(\"Forks\", \"DOWN\");\n else\n telemetry.addData(\"Forks\", \"UP\");\n\n telemetry.addData(\"speedSet\", \"%.2f\", speedSet);\n telemetry.update();\n }\n }", "public void loop() {\n\n double driveMult = gamepad1.left_bumper ? 0.5 : (gamepad1.right_bumper ? 0.2 : 1.0);\n\n double x = gamepad1.left_stick_x;\n double y = gamepad1.left_stick_y;\n\n switch (state) {\n case DRIVE:\n left.setPower(driveMult * (y - x));\n right.setPower(driveMult * (y + x));\n break;\n case REVERSE:\n left.setPower(driveMult * -(y + x));\n right.setPower(driveMult * -(y - x));\n break;\n case TANK:\n left.setPower(driveMult * gamepad1.left_stick_y);\n right.setPower(driveMult * gamepad1.right_stick_y);\n break;\n }\n\n if (gamepad1.dpad_up) {\n state = State.DRIVE;\n } else if (gamepad1.dpad_down) {\n state = State.REVERSE;\n } else if (gamepad1.dpad_left) {\n state = State.TANK;\n }\n\n // AUX CONTROLS\n\n double auxMult = gamepad2.left_bumper ? 0.5 : (gamepad2.right_bumper ? 0.2 : 1.0);\n\n rack.setPower(auxMult * ((gamepad2.dpad_up ? 1 : 0) + (gamepad2.dpad_down ? -1 : 0)));\n\n // extend.setPower(auxMult * gamepad2.left_stick_y);\n slurp.setPower(auxMult * gamepad2.right_stick_y);\n\n\n// if (gamepad2.a) {\n// rack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n// rack.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n// }\n\n // TELEMETRY\n\n telemetry.addData(\"Drive Mode: \", state);\n telemetry.addData(\"Rack Encoder: \", rack.getCurrentPosition());\n telemetry.addData(\"G2 RS Y: \", gamepad2.right_stick_y);\n }", "@Override\n public void loop() { //Starts this loop after you press the START Button\n /**\n * Functional control of up down lift with no limit switches Meet 0 ready\n */\n double liftposition = robot.liftUpDown.getCurrentPosition();\n double liftrotposition = robot.liftRotate.getCurrentPosition();\n telemetry.addData(\"Lift Position\",\"%5.2f\",liftposition);\n telemetry.addData(\"LiftRot Position\", \"%5.2f\", liftrotposition);\n // telemetry.addData(\"Block Stack\", BlockStack);\n telemetry.update();\n\n/**Main drive controls\n * Driver 1\n */\n\n/**\n * Drag servos\n */\n if (gamepad1.a){ //release\n robot.drag1.setPosition(0);\n robot.drag2.setPosition(1);\n } else if (gamepad1.b){//grab\n robot.drag1.setPosition(1);\n robot.drag2.setPosition(0);\n }\n\n/**Mast and Lift controls\n *\n *\n * Driver Two\n *\n *\n*/\n\n/**\n * Need controls to\n * Maybe predetermined locations based on number of pushes of a button.\n */\n\n /**\n * Functional arm rotation with limit switches and encoder limits. Meet 2 ready\n */\n\n //Twists lift up after verifying that rotate up limit switch is not engaged and that step count is less than 5400\n if ( gamepad2.dpad_up && robot.rotateup.getState() == true){\n robot.liftRotate.setPower(1.0);\n }\n else if (gamepad2.dpad_down && robot.rotatedown.getState() == true){ //Twists lift down\n robot.liftRotate.setPower(-1.0);\n }\n //required or lift rotate motor continues to run in last direction (breaks the motor shaft)\n else robot.liftRotate.setPower(0);\n\n /**\n * claw controls a= open b= close\n * FUNCTIONAL Meet 2 ready\n */\n if (gamepad2.a){\n robot.claw1.setPosition(0);\n robot.claw2.setPosition(1);\n } else if (gamepad2.b){\n robot.claw1.setPosition(1);\n robot.claw2.setPosition(0);\n }\n\n /**\n * Lift controls with limit switches and encoder position Meet 2 ready\n * right_trigger = lift\n * left_trigger = down\n */\n\n if ( gamepad2.right_trigger>= 0.2 && robot.liftup.getState()) {\n triggerpress=true;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.liftUpDown.setPower(.9);\n robot.liftRotate.setPower(.15);\n }\n if (gamepad2.left_trigger>=0.2){\n triggerpress=true;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.liftUpDown.setPower(-0.9);\n robot.liftRotate.setPower(-0.15);\n }\n if (gamepad2.left_trigger<.2 && gamepad2.right_trigger<.2 && triggerpress ){\n robot.liftUpDown.setPower(0);\n robot.liftRotate.setPower(0);\n triggerpress=false;\n }\n\n int x;\n int y;\n double motorDelayTime;\n //Necessary Debounce to keep bumper from being seen as multiple touches\n/* motorDelayTime=.1;\n if (robot.liftUpDown.getCurrentPosition()<50){\n BlockStack =0;\n }\n //skips servos unless runtime is greater than 20 ms.\n if( runtime.time() > motorDelayTime ) {\n //Need to move 5.5 inches on position 2, subsequent blocks will only need to move up 4 inches.\n x = robot.liftUpDown.getCurrentPosition();\n y= robot.liftRotate.getCurrentPosition();\n if (gamepad2.right_bumper ) {\n\n BlockStack= BlockStack + 1;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.liftUpDown.setTargetPosition(x + robot.floorheight);\n robot.liftUpDown.setPower(.9);\n robot.liftRotate.setTargetPosition(y + robot.floorheightrotate);\n robot.liftRotate.setPower(.1);\n bumperpress=true;\n\n //don't want to drive the cable too far loose checks that we can move a full block down\n } else if (gamepad2.left_bumper && x >= robot.floorheight ) {\n BlockStack= BlockStack - 1;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.liftUpDown.setTargetPosition(x - robot.floorheight);\n robot.liftUpDown.setPower(-.5);\n}\n\n runtime.reset();\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }*/\n\n /**\n * Limit switch tests that reset the encoders Meet 1 ready\n * * liftdown also allows the X button to work\n * * rotatedown also allows the Y button to work\n */\n\n if (robot.rotatedown.getState() == false) {\n robot.liftRotate.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.liftRotate.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }\n }", "@Override\n public void init() {\n telemetry.addData(\"Status\", \"Initializing\"); //display on the drivers phone that its working\n\n FLM = hardwareMap.get(DcMotor.class, \"FLM\"); //Go into the config and get the device named \"FLM\" and assign it to FLM\n FRM = hardwareMap.get(DcMotor.class, \"FRM\"); //device name doesn't have to be the same as the variable name\n BLM = hardwareMap.get(DcMotor.class, \"BLM\"); //DcMotor.class because that is what the object is\n BRM = hardwareMap.get(DcMotor.class, \"BRM\");\n\n BigSuck = hardwareMap.get(DcMotor.class, \"BigSUCK\");\n SmallSuck = hardwareMap.get(DcMotor.class, \"SmallSUCK\");\n SmallSuck.setDirection(DcMotor.Direction.REVERSE);\n \n UpLift = hardwareMap.get(DcMotor.class, \"LIFT\");\n UpLift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n UpLift.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n //Make it so we don't have to add flip the sign of the power we are setting to half the motors\n //FRM.setDirection(DcMotor.Direction.REVERSE); //Run the right side of the robot backwards\n FLM.setDirection(DcMotor.Direction.REVERSE);\n BRM.setDirection(DcMotor.Direction.REVERSE); //the right motors are facing differently than the left handed ones\n\n FLM.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n FRM.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n BLM.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n BRM.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n DragArm = hardwareMap.servo.get(\"drag_arm\");\n DragArm.setDirection(Servo.Direction.REVERSE);\n DragArm.setPosition(DragArmRestPosition);\n\n LiftGrab = hardwareMap.servo.get(\"GRAB\");\n LiftGrab.setPosition(LiftGrabRestPosition);\n\n LiftSwivel = hardwareMap.servo.get(\"SWIVEL\");\n LiftSwivel.setPosition(LiftSwivelRestPosition);\n\n Push = hardwareMap.get(Servo.class, \"PUSH\");\n Push.setDirection(Servo.Direction.FORWARD);\n Push.setPosition(PushRestPosition);\n\n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.update();\n }", "@Override\n public void runOpMode() throws InterruptedException {\n distanceSensorInRange = false;\n myGlyphLift = new glyphLift(hardwareMap.dcMotor.get(\"glyph_lift\"));\n myColorSensorArm = new colorSensorArm(hardwareMap.servo.get(\"color_sensor_arm\"),hardwareMap.colorSensor.get(\"sensor_color\"), hardwareMap.servo.get(\"color_sensor_arm_rotate\"));\n myMechDrive = new mechDriveAuto(hardwareMap.dcMotor.get(\"front_left_motor\"), hardwareMap.dcMotor.get(\"front_right_motor\"), hardwareMap.dcMotor.get(\"rear_left_motor\"), hardwareMap.dcMotor.get(\"rear_right_motor\"));\n myGlyphArms = new glyphArms(hardwareMap.servo.get(\"top_left_glyph_arm\"), hardwareMap.servo.get(\"bottom_left_glyph_arm\"), hardwareMap.servo.get(\"top_left_glyph_arm\"), hardwareMap.servo.get(\"bottom_right_glyph_arm\"));\n myBoardArm = new boardArm(hardwareMap.dcMotor.get(\"board_arm\"));\n myRevColorDistanceSensor = new revColorDistanceSensor(hardwareMap.get(ColorSensor.class, \"rev_sensor_color_distance\"), hardwareMap.get(DistanceSensor.class, \"rev_sensor_color_distance\"));\n\n\n myColorSensorArm.colorSensorArmUpSlow();\n myColorSensorArm.colorRotateResting();\n //myGlyphArms.openRaisedGlyphArms(); //ensures robot is wihin 18\" by 18\" parameters\n\n int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(\"cameraMonitorViewId\", \"id\", hardwareMap.appContext.getPackageName());\n VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId);\n parameters.vuforiaLicenseKey = \"ASmjss3/////AAAAGQGMjs1d6UMZvrjQPX7J14B0s7kN+rWOyxwitoTy9i0qV7D+YGPfPeeoe/RgJjgMLabjIyRXYmDFLlJYTJvG9ez4GQSI4L8BgkCZkUWpAguRsP8Ah/i6dXIz/vVR/VZxVTR5ItyCovcRY+SPz3CP1tNag253qwl7E900NaEfFh6v/DalkEDppFevUDOB/WuLZmHu53M+xx7E3x35VW86glGKnxDLzcd9wS1wK5QhfbPOExe97azxVOVER8zNNF7LP7B+Qeticfs3O9pGXzI8lj3zClut/7aDVwZ10IPVk4oma6CO8FM5UtNLSb3sicoKV5QGiNmxbbOlnPxz9qD38UAHshq2/y0ZjI/a8oT+doCr\";\n parameters.cameraDirection = VuforiaLocalizer.CameraDirection.BACK;\n this.vuforia = ClassFactory.createVuforiaLocalizer(parameters);\n VuforiaTrackables relicTrackables = this.vuforia.loadTrackablesFromAsset(\"RelicVuMark\");\n VuforiaTrackable relicTemplate = relicTrackables.get(0);\n relicTemplate.setName(\"relicVuMarkTemplate\"); // can help in debugging; otherwise not necessary\n\n waitForStart();\n\n relicTrackables.activate();\n\n while (opModeIsActive()) {\n myGlyphArms.closeGlyphArms();\n sleep(2000);\n myMechDrive.vuforiaLeft(myGlyphArms);\n sleep(1000);\n requestOpModeStop();\n }\n }", "@Override\n\tpublic void teleopPeriodic() {\n\t\tupdate();\n\t\t\n\t\t//dashboard outputs\n\t\tdashboardOutput();\n\t\t\n\t\t\n\t\t\n\t\tif (tankDriveBool) {\n\t\t\ttankDrive();\n\t\t} \n\t\telse {\n\t\t\ttankDrive();\n\t\t}\n\t\tif (buttonA) {\n\t\t\ttest = true;\n\t\t\twhile (test) {\n\t\t\t\tcalibrate(10);\n\t\t\t\ttest = false;\n\t\t\t}\n\t\t}\n\t\tif (buttonY) {\n\t\t\tclimbMode = !climbMode;\n\t\t\tcontroller.setRumble(Joystick.RumbleType.kRightRumble, 0.5);\n\t\t\tcontroller.setRumble(Joystick.RumbleType.kLeftRumble, 0.5);\n\t\t\tTimer.delay(0.5);\n\t\t\tcontroller.setRumble(Joystick.RumbleType.kRightRumble, 0);\n\t\t\tcontroller.setRumble(Joystick.RumbleType.kLeftRumble, 0);\n\t\t}\n\t\tverticalMovement();\n\t\tgrab();\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tSmartDashboard.putString(\"DT Current Command\", \" \");\n\t\tSmartDashboard.putString(\"SHOOTER Current Command\", \" \");\n\t\tSmartDashboard.putString(\"SHOOTERPIVOT Current Command\", \" \");\n\t\tSmartDashboard.putString(\"INTAKE Current Command\", \" \");\n\t\t\n\t\tScheduler.getInstance().run();\n//\t\t\n//\t\tRobot.drivetrain.leftLED.set(true);\n//\t\tRobot.drivetrain.rightLED.set(false);\n\n\t\tif(!autoAiming) {\n\t\t\tnew DriveForwardRotate(correctForDeadZone(oi.driver.getForward()), correctForDeadZone(oi.driver.getRotation())).start();\n\t\t}\n\t\t//new DriveForwardRotate(oi.driver.getForward(), oi.driver.getRotation()).start();\n\t\t\n\t\tif(oi.autoAim() && !prevStateAutoAim){\n\t\t\t//new SetPivotPosition(PivotPID.AUTO_CAMERA_AIM_POSITION).start(\n//\t\t\tnew AutoAim().start();\n\t\t\tnew AutoAim(TurnConstants.AIM_VELOCITY).start(); //this is a press and hold button 3 on joystick\n\t\t\t\n\t\t}\n\t\t\n\t\tif (readyToShoot && oi.operator.shootBallFlywheels() && oi.operator.shoot()){\n//\t\t\tSystem.out.println(\"SHOOT THE SHOOTER -- ready to shoot\");\n\t\t\tnew ShootTheShooter().start();\n\t\t}\n\t\t\n\t\t\n\t\t//INTAKE ------2 button\n\t\tif (oi.operator.intakeUp() && !prevStateIntakeUp){\n\t\t\tnew SetIntakePosition(IntakeSubsystem.UP).start();\n\t\t}\n\t\tif (oi.operator.intakeDeploy() && !prevStateIntakeDeployed){\n\t\t\tnew SetIntakePosition(!IntakeSubsystem.UP).start();\n\t\t}\n\t\t\n\t\t//CAMERA PISTON\n\t\t\n\t\t//move up\n\t\tif (oi.driver.isCameraUpPressed()){\n\t\t\tnew SetCameraPiston(CameraSubsystem.CAM_UP).start();\n\t\t}\n\t\telse{\n\t\t\tnew SetCameraPiston(!CameraSubsystem.CAM_UP).start();\n\t\t}\n\t\t\n//\t\tif (oi.driver.isCameraUpPressed() && !prevStateCameraUp){\n//\t\t\tnew SetCameraPiston(cameraUp ? !CameraSubsystem.CAM_UP : CameraSubsystem.CAM_UP).start();\n//\t\t\tcameraUp = !cameraUp;\n//\t\t}\n//\t\telse{\n//\t\t\tnew SetCameraPiston(cameraUp ? CameraSubsystem.CAM_UP : !CameraSubsystem.CAM_UP).start();\n//\t\t}\n\t\t\n\t\t\n\t\tif (oi.operator.isSemiAutonomousIntakePressed() && !prevStateSemiAutoIntake){\n\t\t\tnew SemiAutoLoadBall().start();\n\t\t}\n//\t\t\n\t\t\n\t\t//pivot state\n//\t\tif (oi.operator.pivotShootState() && !prevStatePivotUp){\n//\t\t\tnew SetPivotState(ShooterPivotSubsystem.PivotPID.FAR_SHOOT_STATE).start();\n//\t\t}\n//\t\telse if(oi.operator.resetPivot() && !prevStateResetButton) {\n//\t\t\t new ResetPivot().start();\n//\t\t}\n//\t\telse if (oi.operator.pivotStoreState() && !prevStatePivotMiddle){\n//\t\t\tnew SetPivotState(ShooterPivotSubsystem.PivotPID.STORING_STATE).start();\n//\t\t}\n\t\t\n\t\t//PIVOT\n\t\t\n\t\t//if going up\n\t\tif (oi.operator.pivotCloseShot() && !prevStatePivotCloseShot){\n\t\t\tnew SetPivotState(ShooterPivotSubsystem.PivotPID.CLOSE_SHOOT_STATE).start();\t\t\n\t\t}\n\t\t//if going down\n\t\telse if(oi.operator.pivotFarShot() && !prevStatePivotFarShot) {\n\t\t\tnew SetPivotState(ShooterPivotSubsystem.PivotPID.FAR_SHOOT_STATE).start();\n\t\t}\n\t\telse if (oi.operator.pivotStoreState()&& !prevStateStore){\n\t\t\tnew SetPivotState(ShooterPivotSubsystem.PivotPID.STORING_STATE).start();\n\t\t}\n\t\telse if (oi.operator.pivotReset() && !prevStateResetSafety){\n\t\t\tnew ResetPivot().start();\n\t\t}\n\t\telse if (oi.driver.isDefenseShot() && prevStateDefenseShot){\n\t\t\tnew SetPivotPosition(ShooterPivotSubsystem.PivotPID.ANTI_DEFENSE_POSITION).start();\n\t\t}\n\t\n\t\t\n\t\tif (!semiAutoIsRunning){\n//\t\t\n\t\t\t//intake purging/running\n\t\t\tif(oi.operator.purgeIntake()) {\n\t\t\t\t//new SetIntakeSpeed(IntakeSubsystem.FORWARD_ROLLER_PURGE_SPEED, IntakeSubsystem.CENTERING_MODULE_PURGE_SPEED).start(); \n\t\t\t\tnew RunAllRollers(ShooterSubsystem.OUT, !ShooterSubsystem.UNTIL_IR).start();\n\t\t\t\tallIntakeRunning = true;\n\t\t\t} else if (oi.operator.runIntake()) {\n\t\t\t\t//new SetIntakeSpeed(IntakeSubsystem.FORWARD_ROLLER_INTAKE_SPEED, IntakeSubsystem.CENTERING_MODULE_INTAKE_SPEED).start();\n\t\t\t\tnew RunAllRollers(ShooterSubsystem.IN, ShooterSubsystem.UNTIL_IR).start();\n//\t\t\t\tnew SemiAutoLoadBall().start();\n\t\t\t\tallIntakeRunning = true;\n\t\t\t} else {\n\t\t\t\t//just the intakes off here to avoid conflicts\n\t\t\t\tnew SetIntakeSpeed(IntakeSubsystem.INTAKE_OFF_SPEED, IntakeSubsystem.INTAKE_OFF_SPEED).start();\n\t\t\t\t//new EndSemiAuto(true).start();\n\t\t\t\t//new RunAllRollers(ShooterSubsystem.OFF, !ShooterSubsystem.UNTIL_IR).start();\n\t\t\t\tallIntakeRunning = false;\n\t\t\t}\n\t\t\t\n\t\t\t//flywheel control\n\t\t\tif (!allIntakeRunning){\n//\t\t\t\tif(oi.operator.loadBallFlywheels()){\n//\t\t\t\t\tnew SetFlywheels(ShooterSubsystem.FLYWHEEL_INTAKE_POWER, -ShooterSubsystem.FLYWHEEL_INTAKE_POWER).start();;\n//\t\t\t\t\tflywheelShootRunning = true;\n//\t\t\t\t} else \n\t\t\t\tif(oi.operator.shootBallFlywheels()) {\n\t\t\t\t\t//new SetFlywheels(0.7, -0.7).start();\n\t\t\t\t\tnew BangBangFlywheels(true).start();\n\t\t\t\t\tflywheelShootRunning = true;\n\t\t\t\t} else {\n\t\t\t\t\t//new SetFlywheels(0, 0).start();//BangBangFlywheels(false).start();\n\t\t\t\t\tflywheelShootRunning = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n//\t\t\tif(oi.operator.shoot()){\n//\t\t\t\tnew ShooterSet(DoubleSolenoid.Value.kForward).start();\n//\t\t\t} else {\n//\t\t\t\tnew ShooterSet(DoubleSolenoid.Value.kReverse).start();\n//\t\t\t}\n//\t\t\t\n\t\t\tif (!allIntakeRunning && !flywheelShootRunning){\n\t\t\t\tnew SetFlywheels(0, 0).start();\n\t\t\t}\n\t\t\t\n\t\t\t//DEFENSE STATE\n\t\t\tif (oi.operator.isDefenseState() && !prevStateDefenseMode){\n\t\t\t\tnew SetDefenseMode().start();\n\t\t\t}\n\t\t}\n\t\t//tells us if bang bang works\n\t\treadyToShoot = ((Math.abs(shooter.getRightFlywheelRPM() - ShooterSubsystem.flywheelTargetRPM) < ShooterSubsystem.flywheelTolerance)\n\t\t\t\t&& (Math.abs(shooter.getLeftFlywheelRPM() - ShooterSubsystem.flywheelTargetRPM) < ShooterSubsystem.flywheelTolerance));\n\t\t\n\t\t\n\t\tif (oi.operator.isManualFirePiston() && !prevStateManualFirePiston){\n//\t\t\tSystem.out.println(\"SHOOT THE SHOOTER -- manual\");\n\t\t\tnew ShootTheShooter().start();\n\t\t}\n\t\t\n\t\t\n\t\tif(oi.driver.isDrivetrainHighGearButtonPressed()){\n\t\t\tdrivetrain.shift(DrivetrainSubsystem.HIGH_GEAR);\n\t\t\tcurrentGear = DrivetrainSubsystem.HIGH_GEAR;\n\t\t} else {\n\t\t\tdrivetrain.shift(!DrivetrainSubsystem.HIGH_GEAR);\n\t\t\tcurrentGear = !DrivetrainSubsystem.HIGH_GEAR;\n\t\t}\n\t\t\n\t\tisManualPressed = oi.operator.isManualOverrideOperator();\n\t\t\n\t\tif (!shooterPIDIsRunning){\n\t\t\tif(isManualPressed) {\n\t\t\t\tdouble pivotPower = oi.operator.getManualPower()/2.0;\n\t\t\t\t//shooterPivot.engageBrake(false);\n\t\t\t\tif (pivotPower > 0 && shooterPivot.pastMax() || pivotPower < 0 && shooterPivot.lowerLimitsTriggered()){\n\t\t\t\t\tpivotPower = 0;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tnew SetPivotPower(pivotPower).start();\n\t\t\t}\n\t\t\telse{\n\t\t\t\tnew SetPivotPower(0).start();\n\t\t\t}\n\t\t}\n\t\t\n//\t\tSystem.out.println(\"Left: \" + Robot.drivetrain.motors[2].get() + \", Right: \" + (-Robot.drivetrain.motors[0].get()));\n//\t\tSystem.out.println(\"Left V: \" + Robot.drivetrain.leftEncoder.getRate() + \", Right V: \" + Robot.drivetrain.rightEncoder.getRate());\n//\t\tSystem.out.println(\"Accel z: \" + Robot.drivetrain.accel.getZ());\n\t\t\n\t\t\n\t\t//PREV STATES\n\t\tprevStateIntakeUp = oi.operator.intakeUp();\n\t\tprevStateIntakeDeployed = oi.operator.intakeDeploy();\n\t\tprevStateDriveShifter = oi.driver.isDrivetrainHighGearButtonPressed();\n\t\tprevStateShootButton = oi.operator.shoot();\n\t\t\n\t\tprevStatePivotCloseShot = oi.operator.pivotCloseShot();\n\t\tprevStatePivotFarShot = oi.operator.pivotFarShot();\n\t\tprevStateStore = oi.operator.pivotStoreState();\n\t\tprevStateResetSafety = oi.operator.pivotReset();\n\t\t\n\t\tprevStateSemiAutoIntake = oi.operator.isSemiAutonomousIntakePressed();\n\t\tprevStateDefenseMode = oi.operator.isDefenseState();\n\t\t\n\t\tprevStateManualFirePiston = oi.operator.isManualFirePiston();\n\t\tprevStateCameraUp = oi.driver.isCameraUpPressed();\n\t\tprevStateAutoAim = oi.autoAim();\n\t\tprevStateDefenseShot = oi.driver.isDefenseShot();\n\n\t\t\n\t\t//********updating subsystem*******//\n\t\t\n\t\t//shooter hal effect counter\n\t\t//shooterPivot.updateHalEffect();\n\t\t\n\t\t//update the flywheel speed constants\n\t\tshooter.updateShooterConstants();\n\t\t\n\t\t\n\t\t//brake\n\t\tif (!isManualPressed){ //if manual override isn't running\n\t\t\tif (!shooterPIDIsRunning && shooterPivot.motorLeft.get() < DEAD_ZONE_TOLERANCE && shooterPivot.motorRight.get() < DEAD_ZONE_TOLERANCE){\n\t\t\t\t\n\t\t\t\tif (pivotTimer.get() > MIN_STOPPED_TIME){\n\t\t\t\t\tnew EngageBrakes().start();\n\t\t\t\t}\n\t\t\t\t//if motor is 0 for the first time, start the timer\n\t\t\t\tif (!prevStateMotorPowerIs0){\n\t\t\t\t\tpivotTimer.reset();\n\t\t\t\t\tpivotTimer.start();\n\t\t\t\t}\n\t\t\t\t//keep this at the end\n\t\t\t\tprevStateMotorPowerIs0 = true;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tshooterPivot.engageBrake(false);\n\t\t\t\t//keep this at the end\n\t\t\t\tpivotTimer.reset();\n\t\t\t\tprevStateMotorPowerIs0 = false;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tshooterPivot.engageBrake(false);\n\t\t\tpivotTimer.reset();\n\t\t}\n\t\t//System.out.println(shooterPivot.motorLeft.get());\n\t\t\n\t\t//LOGGING AND DASHBOARD\n\t\tlogAndDashboard();\n\t}", "protected void initializeServos() {\n servoJewelArm.setPosition(JEWEL_ARM_IN);\n servoJewelFlicker.setPosition(JEWEL_FLICKER_START);\n servoGlyphSingleTop.setPosition(GLYPH_GRIPPER_SINGLE_TOP_OPEN);\n servoGlyphSingleBot.setPosition(GLYPH_GRIPPER_SINGLE_BOT_OPEN);\n servoRelicHand.setPosition(RELIC_HAND_CLOSED);\n servoRelicArm.setPosition(RELIC_ARM_START);\n servoGlyphSpinner.setPosition(SPINNER_SINGLE_TOP);\n servoJewelGate.setPosition(JEWEL_GATE_CLOSED);\n }", "@Override\n public void runOpMode () {\n motor1 = hardwareMap.get(DcMotor.class, \"motor1\");\n motor2 = hardwareMap.get(DcMotor.class, \"motor2\");\n\n telemetry.addData(\"Status\", \"Initialized\");\n telemetry.update();\n //Wait for game to start (driver presses PLAY)\n waitForStart();\n\n /*\n the overridden runOpMode method happens with every OpMode using the LinearOpMode type.\n hardwareMap is an object that references the hardware listed above (private variables).\n The hardwareMap.get method matches the name of the device used in the configuration, so\n we would have to change the names (ex. motorTest to Motor 1 or Motor 2 (or something else))\n if not, the opMode won't recognize the device\n\n in the second half of this section, it uses something called telemetry. In the first and\n second lines it sends a message to the driver station saying (\"Status\", \"Initialized\") and\n then it prompts the driver to press start and waits. All linear functions should have a wait\n for start command so that the robot doesn't start executing the commands before the driver\n wants to (or pushes the start button)\n */\n\n //run until end of match (driver presses STOP)\n double tgtpower = 0;\n while (opModeIsActive()) {\n telemetry.addData(\"Left Stick X\", this.gamepad1.left_stick_x);\n telemetry.addData(\"Left Stick Y\", this.gamepad1.left_stick_y);\n telemetry.addData(\"Right Stick X\", this.gamepad1.right_stick_x);\n telemetry.addData(\"Right Stick Y\", this.gamepad1.right_stick_y);\n if (this.gamepad1.left_stick_y < 0){\n tgtpower=-this.gamepad1.left_stick_y;\n motor1.setPower(tgtpower);\n motor2.setPower(-tgtpower);\n }else if (this.gamepad1.left_stick_y > 0){\n tgtpower=this.gamepad1.left_stick_y;\n motor1.setPower(-tgtpower);\n motor2.setPower(tgtpower);\n }else if (this.gamepad1.left_stick_x > 0){\n tgtpower=this.gamepad1.left_stick_x;\n motor1.setPower(tgtpower);\n motor2.setPower(tgtpower);\n }else if (this.gamepad1.left_stick_x < 0){\n tgtpower=-this.gamepad1.left_stick_x;\n motor1.setPower(-tgtpower);\n motor2.setPower(-tgtpower);\n }else{\n motor1.setPower(0);\n motor2.setPower(0);\n }\n telemetry.addData(\"Motor1 Power\", motor1.getPower());\n telemetry.addData(\"Motor2 Power\", motor2.getPower());\n telemetry.addData(\"Status\", \"Running\");\n telemetry.update ();\n\n\n /*\n if (this.gamepad1.right_stick_x == 1){\n //trying to make robot turn right, == 1 may be wrong\n motor2.setPower(-1);\n }\n else if (this.gamepad1.right_stick_x == -1){\n //trying to make robot turn left, == -1 may be wrong\n motor1.setPower(-1);\n }\n else {\n\n }\n */\n\n\n /*\n After the driver presses start,the opMode enters a while loop until the driver presses stop,\n while the loop is running it will continue to send messages of (\"Status\", \"Running\") to the\n driver station\n */\n\n\n }\n }", "@Override\n public void teleopPeriodic() {\n\t\t/* xbox processing */\n\t\tdouble leftYstick = xbox.getY(Hand.kLeft);\n\t\tboolean buttonA = xbox.getAButton();\n boolean buttonB = xbox.getBButton();\n boolean buttonX = xbox.getXButton();\n boolean buttonY = xbox.getYButton();\n\n\t\t/* Get Talon/Victor's current output percentage */\n\t\tdouble motorOutput = elevator.getMotorOutputPercent();\n\n\t\t/* Deadband gamepad */\n\t\tif (Math.abs(leftYstick) < 0.10) {\n\t\t\t/* Within 10% of zero */\n\t\t\tleftYstick = 0;\n }\n\n\t\t/* Prepare line to print */\n\t\t_sb.append(\"\\tout:\"); _sb.append((int) (motorOutput * 100)); _sb.append(\"%\"); // Percent\n\t\t_sb.append(\"\\tpos:\"); _sb.append(elevator.getSelectedSensorPosition(0)); _sb.append(\"u\"); // Native units\n\n\t\t/**\n\t\t * When button 1 is pressed, perform Position Closed Loop to selected position,\n\t\t * indicated by Joystick position x10, [-10, 10] rotations\n\t\t */\n\t\t//if (!_lastButton1 && buttonA) {\n if (buttonB) {\n\t\t\t/* Position Closed Loop */\n\t\t\t/* 10 Rotations * 4096 u/rev in either direction */\n\t\t\ttargetPositionRotations = 5000; // 2* 4096; //leftYstick * 10.0 * 4096;\n\t\t\televator.set(ControlMode.Position, targetPositionRotations);\n\t\t}\n if (buttonX) {\n\t\t\t/* Position Closed Loop */\n\t\t\t/* 10 Rotations * 4096 u/rev in either direction */\n\t\t\ttargetPositionRotations = 3000; //2* 4096; //leftYstick * 10.0 * 4096;\n\t\t\televator.set(ControlMode.Position, -targetPositionRotations);\n\t\t}\n\n\t\t/* When button 2 is held, just straight drive */\n\t\tif (buttonA) {\n /* Percent Output */\n\t\t elevator.set(ControlMode.PercentOutput, leftYstick);\n }\n \n if (buttonY) {\n elevator.setSelectedSensorPosition(0); // reset to zero\n elevator.getSensorCollection().setQuadraturePosition(0, 10);\n elevator.set(ControlMode.PercentOutput, 0);\n }\n// else{\n //}\n\n\t\t/* If Talon is in position closed-loop, print some more info */\n\t\tif (elevator.getControlMode() == ControlMode.Position) {\n /* Append more signals to print when in speed mode. */\n\t\t\t_sb.append(\"\\terr:\"); _sb.append(elevator.getClosedLoopError(0)); _sb.append(\"u\");\t// Native Units\n\t\t\t_sb.append(\"\\ttrg:\"); _sb.append(targetPositionRotations); _sb.append(\"u\");\t// Native Units\n\t\t}\n\n\t\t/**\n\t\t * Print every ten loops, printing too much too fast is generally bad\n\t\t * for performance.\n\t\t */\n\t\tif (++_loops >= 10) {\n\t\t\t_loops = 0;\n\t\t\tSystem.out.println(_sb.toString());\n\t\t}\n\n\t\t/* Reset built string for next loop */\n\t\t_sb.setLength(0);\n\t\t\n\t\t/* Save button state for on press detect */\n\t\t//_lastButton1 = buttonA;\n }", "private void encoderDrive(double speed,\n double leftInches, double rightInches,\n double timeoutS) {\n int newLeftFrontTarget;\n int newLeftBackTarget;\n int newRightFrontTarget;\n int newRightBackTarget;\n\n // Ensure that the opmode is still active\n if (opModeIsActive()) {\n\n robot.resetWheelEncoders();\n\n // Determine new target position, and pass to motor controller\n newLeftFrontTarget = robot.leftFront.getCurrentPosition() + (int) (leftInches * TICKS_PER_INCH);\n newLeftBackTarget = robot.leftBack.getCurrentPosition() + (int) (leftInches * TICKS_PER_INCH);\n newRightFrontTarget = robot.rightFront.getCurrentPosition() + (int) (rightInches * TICKS_PER_INCH);\n newRightBackTarget = robot.rightBack.getCurrentPosition() + (int) (rightInches * TICKS_PER_INCH);\n robot.leftFront.setTargetPosition(newLeftFrontTarget);\n robot.leftBack.setTargetPosition(newLeftBackTarget);\n robot.rightFront.setTargetPosition(newRightFrontTarget);\n robot.rightBack.setTargetPosition(newRightBackTarget);\n\n // Turn On RUN_TO_POSITION\n robot.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n\n // reset the timeout time and start motion.\n encoderTime.reset();\n robot.driveForward(Math.abs(speed));\n\n // wait for motors to not be busy\n while (opModeIsActive() &&\n (encoderTime.seconds() < timeoutS) &&\n (robot.leftFront.isBusy() && robot.leftBack.isBusy() && robot.rightFront.isBusy() && robot.rightBack.isBusy())) {\n\n // Display it for the driver.\n telemetry.addData(\"Goal Position\", \"%7d :%7d :%7d :%7d\", newLeftFrontTarget, newLeftBackTarget, newRightFrontTarget, newRightBackTarget);\n telemetry.addData(\"Current Position\", \"%7d :%7d :%7d :%7d\",\n robot.leftFront.getCurrentPosition(),\n robot.leftBack.getCurrentPosition(),\n robot.rightFront.getCurrentPosition(),\n robot.rightBack.getCurrentPosition());\n telemetry.update();\n }\n\n // Stop all motion;\n robot.stopDriving();\n\n // Turn off RUN_TO_POSITION\n robot.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n sleep(100); // optional pause after each move\n }\n }", "@Override\n public void teleopPeriodic() {\n double triggerVal = \n (m_driverController.getTriggerAxis(Hand.kRight)\n - m_driverController.getTriggerAxis(Hand.kLeft))\n * RobotMap.DRIVING_SPEED;\n\n double stick = \n (m_driverController.getX(Hand.kLeft))\n * RobotMap.TURNING_RATE;\n \n m_driveTrain.tankDrive(triggerVal + stick, triggerVal - stick);\n\n if(m_driverController.getAButton()){\n m_shooter.arcadeDrive(RobotMap.SHOOTER_SPEED, 0.0);\n }\n \n else{\n m_shooter.arcadeDrive(0.0, 0.0);\n }\n \n }", "@Override\n\tpublic void teleopPeriodic() {\n\t\tif (state.equals(\"teleop\")) {\n\t\t\tlastState = \"teleop\";\n\t\t}\n\t\tstate = \"teleop\";\n\n\t\tif (lastState.equals(\"auton\")) {\n\t\t\tNetworkTables.getControlsTable().putBoolean(\"auton\", false);\n\t\t\t\n\t\t\t//Changes the control Mode back to PercentVbus\n\t\t\t//Should only run once - first interation of teleop\n\t\t\t//And ends auton if running\n\t\t\tif(autonomousCommand != null){\n\t\t\t\tautonomousCommand.cancel();\n\t\t\t}\n\t\t\tActuators.getLeftDriveMotor().changeControlMode(TalonControlMode.PercentVbus);\n\t\t\tActuators.getLeftDriveMotor().set(Constants.MOTOR_STOP);\n\t\t\tActuators.getRightDriveMotor().changeControlMode(TalonControlMode.PercentVbus);\n\t\t\tActuators.getRightDriveMotor().set(Constants.MOTOR_STOP);\n\t\t}\n\n//\t\tNetworkTables.putStream(Gamepad.primary.getX() || Gamepad.secondary.getX());\n\t\t/*\n\t\t * Primary Controllers Controls\n\t\t */\n\t\t// TODO: confirm right trigger forward, left trigger reverse\n\t\t// Drive controls\n\t\tDrive.drive(-Gamepad.primary.getLeftX(), Gamepad.primary.getTriggers()); \n\t\tDrive.shift(Gamepad.primary.getA(), Gamepad.primary.getY()); // shifting with A low gear and Y high gear\n\t\tDrive.shiftToggle(Gamepad.primary.getLB());\n\t\tDrive.crab(Gamepad.primary.getDPadLeft(), Gamepad.primary.getDPadRight());\n\t\t\n//\t\tif (Gamepad.primary.getDPadLeft()){\n//\t\t\tDrive.goingLeft = true;\n//\t\t\tDrive.crab();\t\t\n//\t\t}else if( Gamepad.primary.getDPadRight()){\n//\t\t\tDrive.goingLeft = false;\n//\t\t\tDrive.crab();\t\t\t\n//\t\t}else if (Drive.crabState > 0){\n//\t\t\tDrive.crab();\n//\t\t}\n\n\t\t\n\t\t// Climb controls\n\t\tClimb.climbStopPrimary(Gamepad.primary.getDPadUp()); // runs climbStop using left on the DPad - Primary\n\t\t// Climb.climbSafetyTogglePrimary(Gamepad.primary.getBack()); //toggles safety if pressed 3 times\n\n\t\t// Gear controls\n\t\tScore.dispenseGear(Gamepad.primary.getB() || Gamepad.secondary.getDPadUp());\n\n\t\t/*\n\t\t * Secondary Controllers Controls\n\t\t */\n\t\t// Intake controls\n\t\tIntake.intake(Gamepad.secondary.getRightButton()); // runs intake with clicking in the Right Joystick on second controller\n\t\tIntake.intakeSpeed(Gamepad.secondary.getRightY()); // Override Y Button\n\t\tIntake.intakeDirection(Gamepad.secondary.getRightX()); // Override Y Button\n\t\tIntake.intakeJam(Gamepad.secondary.getLB()); // Runs the unjamming procedure for a max of 3 seconds per press\n\t\t// Intake.intakeSafety(Gamepad.secondary.getStart()); //Have to press 3 times to toggle the safety\n\t\tIntake.intakeIn(Gamepad.secondary.getA(), Gamepad.secondary.getB(), Gamepad.secondary.getX()); // Toggles Intake running into the robot at full speed\n\t\tIntake.intakeRun(Gamepad.secondary.getRB()); // Runs all stuff for intake in(conveyor and intake motor)\n//\t\tIntake.intakeOut(Gamepad.secondary.getB());\n\t\t// Climb controls\n\t\tClimb.climbStopSecondary(Gamepad.secondary.getDPadRight()); // runs climbStop using left on the DPad - Secondary\n\t\tClimb.climbStartSecondary(Gamepad.secondary.getDPadLeft()); // runs climbStart using right on the DPad Secondary\n\t\tClimb.climbSafetyToggleSecondary(Gamepad.secondary.getBack()); // Have to press 3 times to toggle the safety\n\n\t\t// Gear controls\n\t\t// Score.gearLock(Gamepad.secondary.getStart(),\n\t\t// Gamepad.secondary.getBack());\n\n\t\t// Outtake Controls\n\t\t// Score.outtakeToggle(Gamepad.secondary.getLB());\n\n\t\t// Conveyor Controls\n\n\t\tScore.conveyor(Gamepad.secondary.getLeftButton()); // runs conveyor with clicking in the Left Joystick on second controller\n\t\tScore.conveyorSpeed(Gamepad.secondary.getLeftY());\n\t\tScore.conveyorDirection(Gamepad.secondary.getLeftX());\n\t\tScore.conveyorIn(Gamepad.secondary.getY());\n\n\t\t// Sweeper\n\t\t// Sweeper.sweeperMotion(Gamepad.secondary.getTriggers());\n\n\t\tDash.driveMode();\n\n\t\tSmartDashboard.putString(\"Controls Table\", NetworkTables.getControlsTable().getKeys().toString());\n\t\tSmartDashboard.putString(\"Stream\", NetworkTables.getControlsTable().getString(\"stream\", \"nothing\"));\n\n\t}", "protected void ratCrewInit() {\n\n // Init motor state machine.\n motorTurnType = \"none\";\n motorTurnDestination = 0.0f;\n motorTurnAngleToGo = 0.0f;\n motorTurnAngleAdjustedToGo = 0.0f;\n isDriving = false;\n driveLeftStart = 0;\n driveRightStart = 0;\n driveLeftTarget = 0;\n driveRightTarget = 0;\n driveRightSpeed = 0.0f;\n driveLeftSpeed = 0.0f;\n driveAngleOffset = 0.0f;\n driveAngleCorrection = 0.0f;\n\n // TODO: push into initMotor function\n if (doMotors) {\n // Initialize Motors, finding them through the hardware map.\n leftDrive = hardwareMap.get(DcMotor.class, \"motorLeft\");\n rightDrive = hardwareMap.get(DcMotor.class, \"motorRight\");\n leftDrive.setDirection(DcMotor.Direction.REVERSE);\n rightDrive.setDirection(DcMotor.Direction.FORWARD);\n\n // initialize the encoder\n leftDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n rightDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n leftDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n rightDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n leftDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n rightDrive.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n\n // Set all motors to zero power.\n leftDrive.setPower(0);\n rightDrive.setPower(0);\n\n gate = hardwareMap.get(Servo.class, \"Gate\");\n gate.setPosition(1.0);\n }\n initGyroscope();\n\n if (doVuforia){\n initVuforia();\n initTfod();\n\n if (tfod != null) {\n tfod.activate();\n\n // The TensorFlow software will scale the input images from the camera to a lower resolution.\n // This can result in lower detection accuracy at longer distances (> 55cm or 22\").\n // If your target is at distance greater than 50 cm (20\") you can adjust the magnification value\n // to artificially zoom in to the center of image. For best results, the \"aspectRatio\" argument\n // should be set to the value of the images used to create the TensorFlow Object Detection model\n // (typically 1.78 or 16/9).\n\n // Uncomment the following line if you want to adjust the magnification and/or the aspect ratio of the input images.\n tfod.setZoom(2.5, 1.78);\n }\n }\n\n // Init run state.\n madeTheRun = false;\n startTime = 0;\n telemetry.addData(\"Init\", \"motors=%b, gyro=%b, vuforia=%b\", doMotors, doGyro, doVuforia);\n telemetry.update();\n }", "public void encoderDrive(double speed,\r\n double leftInches, \r\n double rightInches,\r\n String name) \r\n {\n int newLeftTarget = robot.leftDrive.getCurrentPosition() + (int)(leftInches * COUNTS_PER_INCH);\r\n int newRightTarget = robot.rightDrive.getCurrentPosition() + (int)(rightInches * COUNTS_PER_INCH);\r\n robot.leftDrive.setTargetPosition(newLeftTarget);\r\n robot.rightDrive.setTargetPosition(newRightTarget);\r\n\r\n // Turn On RUN_TO_POSITION\r\n robot.leftDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\r\n robot.rightDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);\r\n\r\n // reset the timeout time and start motion.\r\n ElapsedTime localTimer = new ElapsedTime();\r\n localTimer.reset();\r\n robot.leftDrive.setPower(Math.abs(speed));\r\n robot.rightDrive.setPower(Math.abs(speed));\r\n\r\n // keep looping while we are still active, and there is time left, and both motors are running.\r\n // Note: We use (isBusy() && isBusy()) in the loop test, which means that when EITHER motor hits\r\n // its target position, the motion will stop. This is \"safer\" in the event that the robot will\r\n // always end the motion as soon as possible.\r\n // However, if you require that BOTH motors have finished their moves before the robot continues\r\n // onto the next step, use (isBusy() || isBusy()) in the loop test.\r\n while (localTimer.seconds() < EncoderDrive_Timeout_Second \r\n && (robot.leftDrive.isBusy() || robot.rightDrive.isBusy())) {\r\n\r\n // Display it for the driver.\r\n telemetry.addData(\"\", \"%s @ %s\", name, localTimer.toString());\r\n telemetry.addData(\"To\", \"%7d :%7d\", newLeftTarget, newRightTarget);\r\n telemetry.addData(\"At\", \"%7d :%7d\",\r\n robot.leftDrive.getCurrentPosition(),\r\n robot.rightDrive.getCurrentPosition());\r\n telemetry.update();\r\n idle();\r\n }\r\n\r\n // Stop all motion;\r\n robot.leftDrive.setPower(0);\r\n robot.rightDrive.setPower(0);\r\n\r\n // Turn off RUN_TO_POSITION\r\n robot.leftDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\r\n robot.rightDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\r\n }", "@Override\n public void robotPeriodic() {\n // m_driveTrain.run(gulce);\n\n\n\n // workingSerialCom.StringConverter(ros_string, 2);\n // RoboticArm.run( workingSerialCom.StringConverter(ros_string, 2));\n }", "@Override\n public void runOpMode() throws InterruptedException {\n float hsvValues[] = {0F, 0F, 0F};\n\n // values is a reference to the hsvValues array.\n final float values[] = hsvValues;\n\n\n double LPower = 0.2;\n double RPower = 0.2;\n\n // Send telemetry message to signify robot waiting;\n cdim = hardwareMap.deviceInterfaceModule.get(\"dim\");\n\n\n // get a reference to our ColorSensor object.\n //sensorRGB1 = hardwareMap.colorSensor.get(\"beaconColor\");\n\n //Resetting encoders\n LFMotor = hardwareMap.dcMotor.get(\"FR\");\n LBMotor = hardwareMap.dcMotor.get(\"BR\");\n RFMotor = hardwareMap.dcMotor.get(\"FL\");\n RBMotor = hardwareMap.dcMotor.get(\"BL\");\n NOM = hardwareMap.dcMotor.get(\"NOM\");\n door = hardwareMap.servo.get(\"door\");\n Elevator = hardwareMap.dcMotor.get(\"Elevator\");\n // Conveyor = hardwareMap.dcMotor.get(\"Conveyor\");\n Launch = hardwareMap.dcMotor.get(\"Launch\");\n\n\n NOM.setDirection(DcMotor.Direction.REVERSE);\n //Conveyor.setDirection(DcMotor.Direction.REVERSE);\n\n telemetry.addData(\"Status\", \"Resetting Encoders\");\n telemetry.update();\n\n //servo = hardwareMap.servo.get(\"buttonPusher\");\n\n LFMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n RFMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n LBMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n RBMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n idle();\n\n LFMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n RFMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n LBMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n RBMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n // Send telemetry message to indicate successful Encoder reset\n telemetry.addData(\"Path0\", \"Starting at %7d :%7d\",\n RFMotor.getCurrentPosition(),\n RBMotor.getCurrentPosition(),\n RBMotor.getCurrentPosition(),\n LFMotor.getCurrentPosition());\n telemetry.update();\n //servo.setPosition(.67);\n\n\n // Wait for the game to start (driver presses PLAY)\n waitForStart();\n\n // Step through each leg of the path,verse movement is obtained by s\n // Note: Reetting a negative distance (not speed)\n\n //sleep(14000);\n\n sleep(5000);\n encoderDrive(DRIVE_SPEED_FAST, 10.0, -10.0, 10.0, -10.0, 5.0); //drive forward\n door.setPosition(.3 );\n\n LBMotor.setPower(0);\n RFMotor.setPower(0);\n RBMotor.setPower(0);\n sleep(1500);\n\n double start = getRuntime();\n\n\n // servo.setPosition(.28);\n while ((getRuntime() - start) < 2) {\n Launch.setPower(.6);\n }\n Launch.setPower(0);\n start = getRuntime();\n while ((getRuntime() - start) < 2) {\n door.setPosition(.85);\n Elevator.setPower(-1);\n }\n\n start = getRuntime();\n while ((getRuntime() - start) < 2.05) {\n Launch.setPower(.6);\n }\n Elevator.setPower(0);\n Launch.setPower(0);\n //servo.setPosition(.67);\n\n encoderDrive(TURN_SPEED, .65, .65, .65, .65 , 4.0);\n encoderDrive(DRIVE_SPEED_FAST, 3, -3, 3, -3, 5.0); //drive forward\n LFMotor.setPower(0);\n LBMotor.setPower(0);\n RFMotor.setPower(0);\n RBMotor.setPower(0);\n sleep(1500);\n\n\n }", "public static void driveMode(){\n\n\t\tSmartDashboard.putBoolean(\"Is Climbing:\", TalonDio.climbEncodDio(Actuators.getClimbMotor()));\n\t\tSmartDashboard.putBoolean(\"Is Driving:\", TalonDio.driveEncodDio(Actuators.getLeftDriveMotor(), Actuators.getRightDriveMotor()));\n\t\tSmartDashboard.putBoolean(\"Is Intake Disabled:\", Intake.intakeDisabled);\n\t\tSmartDashboard.putNumber(\"motorSpeed\", Intake.intakeMotorSpeed);\n\t\tSmartDashboard.putNumber(\"conveyorMotorSpeed\", Score.conveyorMotorSpeed);\n\t\tSmartDashboard.putBoolean(\"Intake Motor Inverted?:\", Actuators.getFuelIntakeMotor().getInverted());\n\t\tSmartDashboard.putBoolean(\"Is Climbing Motor Stalling:\", TalonDio.CIMStall(Actuators.getClimbMotor()));\n\n\t\t\n\n\t\tSmartDashboard.putBoolean(\"Is Climbing:\", TalonDio.climbEncodDio(Actuators.getClimbMotor()));\n\t\tSmartDashboard.putBoolean(\"Is Driving:\", TalonDio.driveEncodDio(Actuators.getLeftDriveMotor(), Actuators.getRightDriveMotor()));\n\t\tSmartDashboard.putBoolean(\"Is Climbing Motor Stalling:\", TalonDio.CIMStall(Actuators.getClimbMotor()));\n\t\tSmartDashboard.putNumber(\"Total Current Draw:\", SensorsDio.PDPCurrent(Sensors.getPowerDistro()));\n\n\t\n\t//TODO: Add Gear Vibrations for both controllers\n\t//Vibration Feedback\n\t\t//Sets the Secondary to vibrate if climbing motor is going to stall\n\t\tVibrations.climbStallVibrate(Constants.MAX_RUMBLE);\t\n\t\t//If within the second of TIME_RUMBLE then both controllers are set to HALF_RUMBLE\n\t\tVibrations.timeLeftVibrate(Constants.HALF_RUMBLE, Constants.TIME_RUMBLE);\t\n\t\t\n\t}", "@Override\n public void teleopPeriodic() {\n Scheduler.getInstance().run();\n SmartDashboard.putNumber(\"right encoder\", drive.getRightEncoder());\n SmartDashboard.putNumber(\"left encoder\", drive.getLeftEncoder());\n \n PixyCamBlock centerBlock = PixyCam2.GetCentermostBlock();\n boolean targetInRange = false ;\n \n if(centerBlock == null)\n {\n targetInRange = false;\n SmartDashboard.putString(\"center block data \", \"null\"); \n }\n else if(centerBlock.yCenter < 200)\n {\n targetInRange = true;\n String out = \"Center Block, X: \"+centerBlock.xCenter + \" Y: \"+centerBlock.yCenter;\n SmartDashboard.putString(\"center block data \", out); \n }\n\n String targetValue = Boolean.toString(targetInRange);\n SmartDashboard.putString(\"target good?\", targetValue);\n \n \n SmartDashboard.putBoolean(\"isFlipped\", flipped);\n }", "@Override\n public void runOpMode() throws InterruptedException {\n robot = new OptimizedRobot(gamepad1, gamepad2, telemetry, hardwareMap);\n\n // Grab our controller 1 using robot.getController1()\n\n controller1 = robot.getController1();\n\n // Grab our our encoders using robot.getEncoder() there are TWO of them\n // Use xEncoder and yEncoder for the names!\n\n xEncoder = robot.getEncoder(\"XEncoder\");\n yEncoder = robot.getEncoder(\"YEncoder\");\n\n // Reverse the direction of our left encoder using encoder.setDirection()\n\n xEncoder.setDirection(Encoder.Direction.REVERSE);\n\n\n // Waiting for the play button to be pressed\n waitForStart();\n\n robot.log(\"Instructions\", \"Your job is the move the robot \"+DISTANCE_TO_TRAVEL+\" forward and right for each trial!\");\n\n for(int i = 0; i < NUM_SAMPLES; i++) {\n robot.addLog(\"Prompt\", \"Trial #\"+(i+1)+\" of \"+NUM_SAMPLES);\n robot.addLog(\"Prompt\", \"Set up your robot on its start position and press A to start the tuning!\");\n robot.pushLog();\n\n while(!controller1.getBool(OptimizedController.Key.A)) {\n }\n\n prevX = xEncoder.getCurrentPosition();\n prevY = yEncoder.getCurrentPosition();\n\n robot.addLog(\"Running\", \"Drag your robot forward \"+DISTANCE_TO_TRAVEL+\" inches and \"+DISTANCE_TO_TRAVEL+\" inches to the right!\");\n robot.addLog(\"Running\", \"Try to keep the robot straight the entire time--try using a line on the floor for reference.\");\n robot.addLog(\"Instructions\", \"Press B when you have finished moving the robot!\");\n robot.pushLog();\n\n while(!controller1.getBool(OptimizedController.Key.B)) {\n estimatedX = xEncoder.getCurrentPosition() - prevX;\n estimatedY = yEncoder.getCurrentPosition() - prevY;\n }\n\n xTraveled[i] = estimatedX;\n yTraveled[i] = estimatedY;\n }\n\n\n double xCoefficient = 0;\n double yCoefficient = 0;\n\n for(int num : xTraveled) {\n xCoefficient += (TICKS_PER_REV * (DISTANCE_TO_TRAVEL / (2 * Math.PI * ODOMETRY_WHEEL_RADIUS))) / num;\n }\n\n for(int num : yTraveled) {\n yCoefficient += (TICKS_PER_REV * (DISTANCE_TO_TRAVEL / (2 * Math.PI * ODOMETRY_WHEEL_RADIUS))) / num;\n }\n\n xCoefficient /= NUM_SAMPLES;\n yCoefficient /= NUM_SAMPLES;\n\n robot.addLog(\"xEncoder Coefficient = \", Math.abs(xCoefficient));\n robot.addLog(\"yEncoder Coefficient = \", Math.abs(yCoefficient));\n robot.pushLog();\n\n while(opModeIsActive()) {\n }\n }", "@Override\n public void runOpMode() {\n RobotOmniWheels5 myRobot = new RobotOmniWheels5(hardwareMap);\n\n // Put initialization blocks here.\n waitForStart();\n\n //code will continue to run until you hit stop in the app\n while(opModeIsActive()) {\n\n double leftStickYValue = gamepad1.left_stick_y;\n if (leftStickYValue < -.1) {\n //Set the robotspeed to the stick value\n //As Stick Y value is negative when pressed up, use negative in front\n myRobot.setRobotSpeed(-leftStickYValue);\n myRobot.move();\n } else {\n if (leftStickYValue > .1){\n //Set the robotspeed to the stick value\n //As Stick Y value is positive when pressed down, use negative in front to move back\n myRobot.setRobotSpeed(-leftStickYValue);\n myRobot.move();\n }\n else {\n myRobot.stopMoving();\n }\n }\n }\n }", "@Override\n public void runOpMode() throws InterruptedException {\n hMap(hardwareMap);\n ElapsedTime time = new ElapsedTime();\n\n\n\n markerDeploy.setPosition(0.25);\n latch.setPosition(0.25);\n rightBoxRotate.setPosition(.345);\n leftBoxRotate.setPosition(.655);\n\n\n /** Wait for the game to begin */\n telemetry.addData(\">\", \"Press Play to start tracking\");\n telemetry.update();\n waitForStart();\n\n rightBoxRotate.setPosition(0.15);\n leftBoxRotate.setPosition(0.85);\n\n motorArmLeft.setPower(0.5);\n motorArmRight.setPower(-0.5);\n Thread.sleep(1100);\n motorArmLeft.setPower(0);\n motorArmRight.setPower(0);\n\n\n Thread.sleep(100);\n\n\n // moveTo(0.4,20);\n\n\n // Thread.sleep(1000);\n\n\n rightBoxRotate.setPosition(.345);\n leftBoxRotate.setPosition(.655);\n\n Thread.sleep(100);\n\n motorArmLeft.setPower(0.5);\n motorArmRight.setPower(-0.5);\n Thread.sleep(1150);\n motorArmLeft.setPower(0);\n motorArmRight.setPower(0);\n\n Thread.sleep(250);\n\n setMotors(-0.4,-0.4);\n Thread.sleep(250);\n setMotors(0,0);\n\n Thread.sleep(250);\n\n motorArmLeft.setPower(0.5);\n motorArmRight.setPower(-0.5);\n Thread.sleep(475);\n motorArmLeft.setPower(0);\n motorArmRight.setPower(0);\n //up\n //servo init position\n Thread.sleep(250);\n\n motorArmLeft.setPower(-0.5);\n motorArmRight.setPower(0.5);\n Thread.sleep(200);\n motorArmLeft.setPower(0);\n motorArmRight.setPower(0);\n\n Thread.sleep(100);\n\n moveTo(0.4,200);\n\n// Thread.sleep(100);\n\n// rightBoxRotate.setPosition(0.15);\n// leftBoxRotate.setPosition(0.85);\n\n Thread.sleep(100);\n manip.setPower(1);\n }", "@Override\r\n public void teleopPeriodic() {\n if (m_stick.getRawButton(12)){\r\n TestCompressor.setClosedLoopControl(true);\r\n System.out.println(\"??\");\r\n } \r\n if (m_stick.getRawButton(11)) {\r\n TestCompressor.setClosedLoopControl(false);\r\n }\r\n //// fireCannon(Solenoid_1, m_stick, 8);\r\n //// fireCannon(Solenoid_2, m_stick, 10);\r\n //// fireCannon(Solenoid_3, m_stick, 12);\r\n //// fireCannon(Solenoid_4, m_stick, 7);\r\n //// fireCannon(Solenoid_5, m_stick, 9);\r\n //// fireCannon(Solenoid_6, m_stick, 11);\r\n\r\n // Logic to control trigering is inside\r\n // DO: Move the logic out here, makes more sense. \r\n fireTrio(topSolonoids, m_stick, 5);\r\n fireTrio(bottomSolonoids, m_stick, 6);\r\n\r\n // Make robit go\r\n double[] movementList = adjustJoystickInput(-m_stick.getY(), m_stick.getX(), m_stick.getThrottle());\r\n m_myRobot.arcadeDrive(movementList[0], movementList[1]);\r\n //System.out.println(m_gyro.getAngle());\r\n }", "@Override\n public void loop() {\n // Setup a variable for each drive wheel to save power level for telemetry\n double leftDrivePower;\n double rightDrivePower;\n double driveMultiplier;\n double slowMultiplier;\n double fastMultiplier;\n double BASE_DRIVE_SPEED = 0.6;\n double elevPower;\n double armPower;\n boolean lowerLimitPressed;\n boolean upperLimitPressed;\n\n\n\n\n // Tank Mode uses one stick to control each wheel.\n // - This requires no math, but it is hard to drive forward slowly and keep straight.\n armPower = -gamepad2.right_stick_x * 0.3;\n\n lowerLimitPressed = !lowerLimit.getState();\n upperLimitPressed = !upperLimit.getState();\n\n if((lowerLimitPressed && -gamepad2.left_stick_y < 0) || (upperLimitPressed && -gamepad2.left_stick_y > 0)){\n elevPower = 0;\n }\n else {\n elevPower = -gamepad2.left_stick_y * 1;\n }\n\n if (gamepad2.left_bumper){\n hookPosDeg = HOOK_UP;\n }\n else if (gamepad2.left_trigger > 0){\n hookPosDeg = HOOK_DOWN;\n }\n\n if (gamepad2.right_bumper){\n clawPosDeg = CLAW_OPEN;\n }\n else if (gamepad2.right_trigger > 0){\n clawPosDeg = CLAW_CLOSED;\n }\n\n if (gamepad1.left_trigger > 0){\n slowMultiplier = 0.10;\n }\n else\n slowMultiplier = 0;\n\n if (gamepad1.right_trigger > 0){\n fastMultiplier = 0.30;\n }\n else\n fastMultiplier = 0;\n\n driveMultiplier = BASE_DRIVE_SPEED + slowMultiplier + fastMultiplier;\n leftDrivePower = -gamepad1.left_stick_y * driveMultiplier;\n rightDrivePower = -gamepad1.right_stick_y * driveMultiplier;\n\n // Send power to actuators\n leftDrive.setPower(leftDrivePower);\n rightDrive.setPower(rightDrivePower);\n elev.setPower(elevPower);\n// arm.setTargetPosition(armTarget);\n// arm.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n arm.setPower(armPower);\n hookPos = map(hookPosDeg, HOOK_MIN_POS_DEG, HOOK_MAX_POS_DEG, HOOK_MIN_POS, HOOK_MAX_POS);\n clawPos = map(clawPosDeg, CLAW_MIN_POS_DEG, CLAW_MAX_POS_DEG, CLAW_MIN_POS, CLAW_MAX_POS);\n hook.setPosition(hookPos);\n claw.setPosition(clawPos);\n\n // Show the elapsed game time and wheel power.\n telemetry.addData(\"Status\", \"Run Time: \" + runtime.toString());\n telemetry.addData(\"Drive\", \"left (%.2f), right (%.2f)\", leftDrivePower, rightDrivePower);\n telemetry.addData( \"Elev\", \"power (%.2f)\", elevPower);\n telemetry.addData(\"Limit\", \"lower (%b), upper (%b)\", lowerLimitPressed, upperLimitPressed);\n telemetry.addData(\"Arm Enc\", arm.getCurrentPosition());\n\n }", "public void teleopPeriodic() {\n \t//getInstance().run();;\n \t//RobotMap.robotDrive1.arcadeDrive(oi.stickRight); //This line drives the robot using the values of the joystick and the motor controllers selected above\n \tScheduler.getInstance().run();\n\t\n }", "public SiLabsC8051F320_USBIO_ServoController() {\r\n interfaceNumber=0;\r\n if(UsbIoUtilities.usbIoIsAvailable){\r\n pnp=new PnPNotify(this);\r\n pnp.enablePnPNotification(GUID);\r\n }\r\n Runtime.getRuntime().addShutdownHook(new Thread(){\r\n @Override\r\n public void run(){\r\n if(isOpen()){\r\n close();\r\n }\r\n }\r\n });\r\n servoQueue=new ArrayBlockingQueue<ServoCommand>(SERVO_QUEUE_LENGTH);\r\n }", "public void teleopPeriodic() \n {\n // NIVision.Rect rect = new NIVision.Rect(10, 10, 100, 100);\n /*\n NIVision.IMAQdxGrab(session, frame, 1);\n //NIVision.imaqDrawShapeOnImage(frame, frame, rect,\n // DrawMode.DRAW_VALUE, ShapeMode.SHAPE_OVAL, 0.0f);\n */\n \n //cam.getImage(frame);\n //camServer.setImage(frame);\n \n //CameraServer.getInstance().setImage(frame);\n \n if(verticalLift.limitSwitchHit())\n verticalLift.resetEnc();\n \n Scheduler.getInstance().run();\n }", "@Override\n public void robotInit() {\n myRobot = new DifferentialDrive(leftfrontmotor, rightfrontmotor);\n leftrearmotor.follow(leftfrontmotor);\n rightrearmotor.follow(rightfrontmotor);\n leftfrontmotor.setInverted(true); // <<<<<< Adjust this until robot drives forward when stick is forward\n\t\trightfrontmotor.setInverted(true); // <<<<<< Adjust this until robot drives forward when stick is forward\n\t\tleftrearmotor.setInverted(InvertType.FollowMaster);\n rightrearmotor.setInverted(InvertType.FollowMaster);\n \n CameraServer.getInstance().startAutomaticCapture();\n\n \n\n comp.setClosedLoopControl(true);\n \n\n /* Set up Dashboard widgets */\n SmartDashboard.putNumber(\"L Stick\", gamepad.getRawAxis(1));\n\t\tSmartDashboard.putNumber(\"R Stick\", gamepad.getRawAxis(5));\n\t\tSmartDashboard.putBoolean(\"Back Button\", gamepad.getRawButton(5));\n\t\tSmartDashboard.putBoolean(\"Fwd Button\", gamepad.getRawButton(6));\n\t\t\n SmartDashboard.putNumber(\"LF\", pdp.getCurrent(leftfrontmotorid));\n\t\tSmartDashboard.putNumber(\"LR\", pdp.getCurrent(leftrearmotorid));\n\t\tSmartDashboard.putNumber(\"RF\", pdp.getCurrent(rightfrontmotorid));\n\t\tSmartDashboard.putNumber(\"RR\", pdp.getCurrent(rightrearmotorid));\n SmartDashboard.putNumber(\"Total\", pdp.getCurrent(0) + pdp.getCurrent(1) + pdp.getCurrent(2) + pdp.getCurrent(3) + pdp.getCurrent(4) + pdp.getCurrent(5) + pdp.getCurrent(6) + pdp.getCurrent(7) + pdp.getCurrent(8) + pdp.getCurrent(9) + pdp.getCurrent(10) + pdp.getCurrent(11) + pdp.getCurrent(12) + pdp.getCurrent(13) + pdp.getCurrent(14) + pdp.getCurrent(15));\n }", "public static void main(String[] args) throws Exception{\n\t\t\r\n\t\tint turnChk = 0;\r\n\t\tTouchSensor touch = new TouchSensor(SensorPort.S1);\r\n\t\tLightSensor light = new LightSensor(SensorPort.S3);\r\n\t\tUltrasonicSensor UltraSonic = new UltrasonicSensor(SensorPort.S4);\r\n\t\t\r\n\t\tMotor.A.setSpeed(300);\r\n\t\tMotor.B.setSpeed(300);\r\n\t\t\r\n\t\twaitForLoudSound();\r\n\t\tMotor.A.forward();\r\n\t\tMotor.B.forward();\r\n\t\tThread.sleep(5000);\r\n\t\t\r\n\t\twhile(true){\r\n\t\t\tUltraSonic = new UltrasonicSensor(SensorPort.S4);\r\n\t\t\t\r\n\t\t\tLCD.drawString(\"START\", 0, 0);\r\n\t\t\t//LCD.drawString(\"turnChk\", 0, 1);\r\n\t\t\t//LCD.drawInt(turnChk, 9, 1);\r\n\t\t\tif(UltraSonic.getDistance() < 35\r\n\t\t\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t){\r\n\t\t\t\tif(turnChk < 4){\r\n\t\t\t\t\tMotor.B.stop();\r\n\t\t\t\t\tMotor.A.rotate(320);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tturnChk++;\r\n\t\t\t}else{\r\n\t\t\t\tMotor.A.forward();\r\n\t\t\t\tMotor.B.forward();\r\n\t\t\t}\r\n\t\t}\r\n\t\tMotor.A.stop();\r\n\t\tMotor.B.stop();\r\n\t\tLCD.drawString(\"FIRST POINT\", 0, 0);\r\n\t\tThread.sleep(3000);\r\n\t\tMotor.B.rotate(360);\r\n\t\t\r\n\t\twhile(!touch.isPressed()){\r\n\t\t\tMotor.A.forward();\r\n\t\t\tMotor.B.forward();\r\n\t\t}\r\n\t\tMotor.A.stop();\r\n\t\tMotor.B.stop();\r\n\t\tLCD.drawString(\"NOT FOUND \", 0, 0);\r\n\t\tThread.sleep(3000);\r\n\t\t\r\n\t\twhile(light.getNormalizedLightValue()>400){\r\n\t\t\tMotor.A.backward();\r\n\t\t\tMotor.B.backward();\r\n\t\t}\r\n\t\tMotor.B.stop();\r\n\t\tMotor.A.rotate(380);\r\n\t\tLCD.drawString(\"GO ON \", 0, 0);\r\n\t\tThread.sleep(3000);\r\n\t\tturnChk = 0;\r\n\t\twhile(true){\r\n\t\t\tUltraSonic = new UltrasonicSensor(SensorPort.S4);\r\n\t\t\tLCD.drawString(\"GO ON \", 0, 0);\r\n\t\t\t\r\n\t\t\tif(UltraSonic.getDistance()<30){\r\n\t\t\t\tif(turnChk == 0){\r\n\t\t\t\t\tMotor.A.stop();\r\n\t\t\t\t\tMotor.B.rotate(360);\r\n\t\t\t\t\tturnChk = 1;\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tMotor.A.stop();\r\n\t\t\t\t\tMotor.B.stop();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tMotor.A.forward();\r\n\t\t\t\tMotor.B.forward();\r\n\t\t\t}\t\r\n\t\t}\r\n\t\tLCD.drawString(\"FOUND \", 0, 0);\r\n\t\tThread.sleep(5000);\r\n\t\tSystem.exit(0);\r\n\t}", "private void configVelocityControl() {\n //config remote sensors\n //sets the sensor to be a quad encoder, sets our feedback device to be that sensor\n m_masterMotor.configSelectedFeedbackSensor(TalonSRXFeedbackDevice.CTRE_MagEncoder_Relative, RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //zero the encoders on every init\n zeroEncoder();\n\n //sets whether our motor is inverted\n //this is currently false but can be switched based on testing\n m_masterMotor.setInverted(RobotMap.LAUNCHER_MASTER_INVERTED);\n m_masterMotor.setSensorPhase(RobotMap.LAUNCHER_MASTER_INVERTED);\n\n //this sets how often we pull data from our sensor\n m_masterMotor.setStatusFramePeriod(StatusFrame.Status_2_Feedback0, RobotMap.LAUNCHER_FEEDBACK_PERIOD_MS, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //this configs the deadband for the PID output. Any output with an absolute value less than this will be treated as zero\n m_masterMotor.configNeutralDeadband(0, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //this sets the peak output for our motor controller.\n m_masterMotor.configPeakOutputForward(RobotMap.LAUNCHER_PID_PEAK_OUTPUT, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n //this does the same thing but for the reverse direction\n m_masterMotor.configPeakOutputReverse(0, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n \n //sets the period of the velocity sample\n //effectively this defines the amount of time used to calculate the velocity\n m_masterMotor.configVelocityMeasurementPeriod(RobotMap.VELOCITY_MEASUREMENT_PERIOD, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //Sets the number of samples used in the rolling average for calculating velocity\n m_masterMotor.configVelocityMeasurementWindow(RobotMap.LAUNCHER_VELOCITY_MEASUREMENT_WINDOW, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n \n //set p, i, d, f values\n //the zero is the PID slot, in this case it is zero for the primary PID\n //the launcher has no auxillary or turning PID control\n m_masterMotor.config_kP(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_P);\n m_masterMotor.config_kI(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_I);\n m_masterMotor.config_kD(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_D);\n m_masterMotor.config_kF(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_F);\n\n //this sets the acceptable amount of Integral error, where if the absolute accumulated error exceeds this ammount, it resets to zero\n //this is designed to prevent the PID from going crazy if we move too far from our target\n m_masterMotor.config_IntegralZone(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_I_ZONE, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //sets the max output of the motor specifically within closed loop control\n m_masterMotor.configClosedLoopPeakOutput(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_PID_PEAK_OUTPUT, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //this configures an allowable error in closed loop control\n //any error less than this is treated as zero.\n m_masterMotor.configAllowableClosedloopError(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_ACCEPTABLE_ERROR, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //configures the period for closed loop calculations in MS \n //should be increased if the can bus is haveing issues\n m_masterMotor.configClosedLoopPeriod(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_CLOSED_LOOP_PERIOD_MS, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //configures ramp speed\n m_masterMotor.configOpenloopRamp(RobotMap.LAUNCHER_OPEN_LOOP_RAMP_TIME_S);\n m_masterMotor.configClosedloopRamp(0);\n\n //sets our closed loop control to use our primary PID slot\n m_masterMotor.selectProfileSlot(RobotMap.PID_PRIMARY_SLOT, 0);\n }", "public void toCollectPos()throws InterruptedException{\n motorShoulder.setTargetPosition(-90);\r\n motorElbow.setTargetPosition(141);\r\n motorShoulder.setPower(SLOW_POWER);\r\n motorElbow.setPower(SLOW_POWER);\r\n sleep(1000);\r\n\r\n servoBucket.setPosition(0.28);\r\n\r\n motorShoulder.setTargetPosition(-440);\r\n motorElbow.setTargetPosition(280);\r\n motorShoulder.setPower(SLOW_POWER);\r\n motorElbow.setPower(SLOW_POWER);\r\n sleep(1000);\r\n\r\n motorShoulder.setTargetPosition(-500);\r\n motorShoulder.setPower(SLOW_POWER);\r\n }", "void setMotorsMode(DcMotor.RunMode runMode);", "@Override\n public void robotInit() {\n m_oi = new OI();\n m_chooser.setDefaultOption(\"Default Auto\", new ExampleCommand());\n // chooser.addOption(\"My Auto\", new MyAutoCommand());\n SmartDashboard.putData(\"Auto mode\", m_chooser);\n\n Comp = new Compressor();\n\n //ClimbBack = new DoubleSolenoid(PCM_COMP_24V, 0, 1);\n //ClimbFront = new DoubleSolenoid(PCM_COMP_24V, 2, 3);\n LegFrontL = new VictorSPX(30);\n LegFrontR = new Spark(9);\n LegBackL = new VictorSPX(31);\n LegBackR = new VictorSPX(32);\n\n BackFootMover = new VictorSP(1);\n FrontFootMover = new Spark(2);\n //FeetMovers = new SpeedControllerGroup(BackFootMoverFootMover);\n\n MainRight = new CANSparkMax(9, MotorType.kBrushless);\n AltRight = new CANSparkMax(10, MotorType.kBrushless);\n MainLeft = new CANSparkMax(11, MotorType.kBrushless);\n AltLeft = new CANSparkMax(12, MotorType.kBrushless);\n\n MainRight.setIdleMode(IdleMode.kCoast);\n AltRight.setIdleMode(IdleMode.kCoast);\n MainLeft.setIdleMode(IdleMode.kCoast);\n AltLeft.setIdleMode(IdleMode.kCoast);\n\n AltLeft.follow(MainLeft);\n AltRight.follow(MainRight);\n\n Drive = new DifferentialDrive(MainLeft, MainRight);\n\n Lifter = new TalonSRX(6);\n Lifter.setNeutralMode(NeutralMode.Brake);\n Lifter.enableCurrentLimit(false);\n /*Lifter.configContinuousCurrentLimit(40);\n Lifter.configPeakCurrentLimit(50);\n Lifter.configPeakCurrentDuration(1500);*/\n //Lifter.configReverseSoftLimitEnable(true);\n //Lifter.configReverseSoftLimitThreshold(-27000);\n //Lifter.configForwardLimitSwitchSource(LimitSwitchSource.FeedbackConnector, LimitSwitchNormal.NormallyOpen);\n //Lifter.configClearPositionOnLimitF(true, 0);\n Lifter.selectProfileSlot(0, 0);\n LiftSetpoint = 0;\n\n LiftFollower = new TalonSRX(5);\n LiftFollower.follow(Lifter);\n LiftFollower.setNeutralMode(NeutralMode.Brake);\n\n ArmExtender = new Solenoid(0);\n ArmOpener = new Solenoid(1);\n ArmGrippers = new Spark(0);\n\n HatchSwitch0 = new DigitalInput(0);\n HatchSwitch1 = new DigitalInput(1);\n\n Accel = new BuiltInAccelerometer(Range.k2G);\n\n //Diagnostics = new DiagnosticsLogger();\n // Uncomment this line to enable diagnostics. Warning: this may\n // cause the robot to be slower than it is supposed to be because of lag.\n //Diagnostics.start();\n\n xbox = new XboxController(0);\n joystick = new Joystick(1);\n \n LiftRamp = new SRamp();\n SpeedRamp = new SRamp();\n\n NetworkTableInstance nt = NetworkTableInstance.getDefault();\n\n VisionTable = nt.getTable(\"ChickenVision\");\n TapeDetectedEntry = VisionTable.getEntry(\"tapeDetected\");\n TapePitchEntry = VisionTable.getEntry(\"tapePitch\");\n TapeYawEntry = VisionTable.getEntry(\"tapeYaw\");\n\n LedTable = nt.getTable(\"LedInfo\");\n LedScript = LedTable.getEntry(\"CurrentScript\");\n LedScriptArgument = LedTable.getEntry(\"ScriptArgument\");\n LedArmsClosed = LedTable.getEntry(\"ArmsClosed\");\n\n UsbCamera cam = CameraServer.getInstance().startAutomaticCapture();\n cam.setPixelFormat(PixelFormat.kMJPEG);\n cam.setResolution(320, 240);\n cam.setFPS(15);\n \n\n LedScript.setString(\"ColorWaves\");\n LedScriptArgument.setString(\"\");\n\n limits = new DigitalInput[8];\n\n for (int i = 0; i < limits.length; i++) {\n limits[i] = new DigitalInput(i + 2);\n }\n }", "public void teleopPeriodic() {\n \t//driveTrain.setInputSpeed(xbox.getAxisLeftY(), xbox.getAxisRightY());\n \t\n \tdriveTrain.print();\n \t\n \t// funcao PID\n \tif (xbox.getButtonX()) {\n\t\t\tbotaoapertado = true;\n\t\t} else if (xbox.getButtonY()) {\n\t\t\tbotaoapertado = false;\n\t\t\tdriveTrain.start();\n\t\t\tdriveTrain.setSetPoint(0, 0);\n\t\t}\n \tif (botaoapertado) {\n \t\tdriveTrain.setSetPoint(100, 100);\n\t\t}\n \t\n }", "@Override\n\tpublic void robotPeriodic() {\n\t}", "@Override\n\tpublic void robotPeriodic() {\n\t}", "@Override\n public void teleopPeriodic() {\n double y = -xbox.getRawAxis(0) * 0.7D * (1.0D + Math.max(0, xbox.getRawAxis(4)) * 1.4285714D);\n double rawSpeed = xbox.getRawAxis(2) - xbox.getRawAxis(3);\n\n if (SAFETY_MODE) {\n y *= 0.75D;\n\n if (xbox.getBumper(Hand.kLeft) && joystick.getRawButton(7)) {\n if (safetyCount > 0) {\n safetyCount--;\n SmartDashboard.putNumber(\"Safety Count\", safetyCount);\n\n if (safetyCount == 0) {\n safetyTripped = false;\n clearAllButtonStates();\n SmartDashboard.putBoolean(\"Safety Tripped\", safetyTripped);\n }\n } else {\n safetyTripped = false;\n }\n } else {\n safetyTripped = true;\n safetyCount = MAX_SAFETY_COUNT;\n SmartDashboard.putNumber(\"Safety Count\", safetyCount);\n SmartDashboard.putBoolean(\"Safety Tripped\", safetyTripped);\n }\n } else {\n safetyTripped = false;\n }\n\n // Climb Speed\n if (xbox.getRawButton(6)) {\n rawSpeed = -0.3D;\n }\n\n // Super slow mode\n if (xbox.getAButton() || SAFETY_MODE) {\n SpeedRamp.Setpoint = rawSpeed * 0.45D;\n } else {\n SpeedRamp.Setpoint = rawSpeed * 0.8D * (1.0D + Math.max(0, xbox.getRawAxis(4)) * 0.25);\n }\n\n SpeedRamp.update();\n\n boolean seesTape = TapeDetectedEntry.getBoolean(false);\n \n if (seesTape && !safetyTripped) {\n final double ADJUST_CONST = 0.13281734;\n //double tapePitch = TapePitchEntry.getNumber(0).doubleValue();\n double tapeYaw = TapeYawEntry.getNumber(0).doubleValue();\n final double TARGET_YAW = 0;//PitchYawAdjuster.GetYawFromPitch(tapePitch);\n\n //SmartDashboard.putNumber(\"tapePitch\", tapePitch);\n //SmartDashboard.putNumber(\"tapeYaw\", tapeYaw);\n \n double diff = tapeYaw - ADJUST_CONST;\n \n String s = \"\";\n\n if (diff > 0) {\n s = \"<-- (\" + diff + \")\";\n } else if (diff < 0) {\n s = \"--> (\" + diff + \")\";\n }\n\n if (/*xbox.getRawButton(5) This is now taken for the safety button*/false) {\n final double MAX_AFFECT = 0.4;\n if (diff > MAX_AFFECT) {\n diff = MAX_AFFECT;\n } else if (diff < -MAX_AFFECT) {\n diff = -MAX_AFFECT;\n }\n\n y -= diff;\n }\n\n SmartDashboard.putString(\"TapeDir\", s);\n } else {\n SmartDashboard.putString(\"TapeDir\", \"X\");\n }\n\n if (xbox.getRawButtonPressed(7)) {\n Lifter.setSelectedSensorPosition(0);\n LiftSetpoint = 0;\n LiftRamp.Setpoint = 0;\n LiftRamp.setOutput(0);\n }\n\n //Scheduler.getInstance().run();\n // Cargo ship is(n't anymore) -13120\n\n // The fine adjustment has nothing to do with hammers.\n // Don't try to use a hammer on the roboRIO. Ever.\n final int FINE_ADJUSTMENT_AMOUNT = -500;\n\n if (!safetyTripped) {\n if (joystick.getPOV() == 0) {\n if (!joyPOV0PressedLast) {\n joyPOV0PressedLast = true;\n if (LiftSetpoint - FINE_ADJUSTMENT_AMOUNT <= 0)\n LiftSetpoint -= FINE_ADJUSTMENT_AMOUNT;\n }\n } else {\n joyPOV0PressedLast = false;\n\n if (joystick.getPOV() == 180) {\n if (!joyPOV180PressedLast) {\n joyPOV180PressedLast = true;\n LiftSetpoint += FINE_ADJUSTMENT_AMOUNT;\n }\n } else {\n joyPOV180PressedLast = false;\n }\n }\n\n Drive.arcadeDrive(SpeedRamp.getOutput(), y);\n\n if (joystick.getRawButtonPressed(11)) {\n LiftSetpoint = HATCH_BOTTOM;\n } else if (joystick.getRawButtonPressed(9)) {\n LiftSetpoint = HATCH_MIDDLE;\n //} else if (joystick.getRawButtonPressed(7)) {\n // This button is now used for safety mode LiftSetpoint = HATCH_TOP;\n // and also for grab-hatch-on-impact mode\n } else if (joystick.getRawButtonPressed(12)) {\n LiftSetpoint = CARGO_BOTTOM;\n } else if (joystick.getRawButtonPressed(10)) {\n LiftSetpoint = CARGO_MIDDLE;\n //} else if (joystick.getRawButtonPressed(8)) {\n //LiftSetpoint = CARGO_TOP;\n } else if (joystick.getRawButtonPressed(1)) {\n LiftSetpoint = CARGO_FLOOR;\n }\n\n double liftY = -joystick.getRawAxis(1);\n final double deadband = 0.15;\n\n if (Math.abs(liftY) > deadband) {\n double change = (liftY < 0 ? liftY + 0.15 : liftY - 0.15) * 200;//(int)liftEntry.getDouble(0);//\n \n if (change > 100) {\n change = 100;\n } else if (change < -100) {\n change = -100;\n }\n\n LiftRamp.setOutput(LiftRamp.getOutput() + change);\n LiftRamp.Setpoint += change;\n LiftSetpoint = (int)LiftRamp.Setpoint;\n }\n\n if (LiftSetpoint < LIMIT_UP) {\n LiftSetpoint = LIMIT_UP;\n }\n } else {\n Drive.arcadeDrive(0, 0);\n }\n \n LiftRamp.Setpoint = LiftSetpoint;\n SmartDashboard.putNumber(\"LiftSetpoint\", LiftRamp.Setpoint);\n //SmartDashboard.putNumber(\"LiftEncoderPos\", Lifter.getSelectedSensorPosition());\n SmartDashboard.putNumber(\"LiftOutput\", LiftRamp.getOutput());\n LiftRamp.update();\n\n Lifter.set(ControlMode.Position, LiftRamp.getOutput());\n //Lifter.set(ControlMode.PercentOutput, -joystick.getRawAxis(1));\n\n if (!safetyTripped) {\n if (joystick.getRawButtonPressed(4)) {\n ArmsClosed = !ArmsClosed;\n } else if (!SAFETY_MODE) {\n // This is the same as the joystick safety button, so it only works outside\n // safety mode, and why would it be needed in safety mode anyway?\n // It should be disabled in safety mode anyway to make sure we don't\n // accidently attack someone's fingers at a Demo.\n\n // Holding joystick button 7 makes the limit switches on the hatch mechanism\n // active, so when the hatch contacts the switches, the mechanism automatically\n // grabs the hatch.\n // HatchSwitch0 does not have to be inverted. It's complicated.\n if (joystick.getRawButton(7) && (HatchSwitch0.get() || !HatchSwitch1.get())) {\n ArmsClosed = false;\n }\n }\n\n if (joystick.getRawButtonPressed(3)) {\n ArmsExtended = !ArmsExtended;\n }\n }\n\n ArmExtender.set(ArmsExtended);\n ArmOpener.set(ArmsClosed);\n\n //Diagnostics.writeDouble(\"DriveX\", x);\n //Diagnostics.writeDouble(\"DriveY\", y);\n\n // X = out, Y = in\n\n final double GRAB_SPEED;\n\n if (SAFETY_MODE) {\n GRAB_SPEED = 0.8D;\n } else {\n GRAB_SPEED = 1D; // TODO at one point we had this 0.8, is that what it's supposed to be?\n }\n \n if (!safetyTripped) {\n ArmGrippers.set(/*xbox.getXButton() || */joystick.getRawButton(6) ? -GRAB_SPEED : /*xbox.getYButton() ||*/ joystick.getRawButton(5) ? GRAB_SPEED : 0);\n } else {\n ArmGrippers.set(0);\n }\n\n\n // === Climbing stuff ===\n\n boolean climbSafety = /*joystick.getRawButton(2) &&*/ !safetyTripped;\n \n // Have to check all of these every update to make sure it was pressed\n // between now and the last update\n boolean retractFront = xbox.getYButton/*Pressed*/();\n boolean retractBack = xbox.getXButton/*Pressed*/();\n boolean climbBoth = xbox.getRawButton/*Pressed*/(8);\n\n final double CLIMB_SPEED = 1;\n final double RETRACT_SPEED = 0.75;\n final double HOLD_SPEED = 0.3;\n // If you multiply the hold by this, you get the climb value.\n // Avoids having to thing + or minus so many times.\n final double HOLD_CLIMB_MULTIPLIER = CLIMB_SPEED / HOLD_SPEED;\n\n // Left is negative, right is positive\n double xOff = Math.round((Accel.getX() - ZeroX) * 10) / 10D;\n // Forward is negative, backwards is positive\n double zOff = Math.round((Accel.getZ() - ZeroZ) * 10) / 10D;\n\n\n SmartDashboard.putNumber(\"X\", xOff);\n SmartDashboard.putNumber(\"Z\", zOff);\n\n\n if (climbSafety || IsHoldingBack || IsHoldingFront) {\n if (climbBoth) {\n IsHoldingBack = true;\n IsHoldingFront = true;\n\n \n double SpeedFR = CLIMB_SPEED;\n double SpeedFL = -CLIMB_SPEED;\n double SpeedBR = -CLIMB_SPEED;\n double SpeedBL = CLIMB_SPEED;\n\n final double SLOW_MULT = 0.3;\n\n if (xOff < 0 || zOff < 0) {\n SpeedBR *= SLOW_MULT;\n }\n\n if (xOff < 0 || zOff > 0) {\n SpeedFR *= SLOW_MULT;\n }\n\n if (xOff > 0 || zOff < 0) {\n SpeedBL *= SLOW_MULT;\n }\n\n if (xOff > 0 || zOff > 0) {\n SpeedFL *= SLOW_MULT;\n }\n \n LegFrontR.set(SpeedFR);\n LegFrontL.set(ControlMode.PercentOutput, SpeedFL);\n LegBackR.set(ControlMode.PercentOutput, SpeedBR);\n LegBackL.set(ControlMode.PercentOutput, SpeedBL);\n\n } else {\n if (retractBack) {\n IsHoldingBack = false;\n LegBackR.set(ControlMode.PercentOutput, RETRACT_SPEED);\n LegBackL.set(ControlMode.PercentOutput, -RETRACT_SPEED);\n } else if (IsHoldingBack) {\n double rightSpeed = -HOLD_SPEED;\n double leftSpeed = HOLD_SPEED;\n int pov = xbox.getPOV();\n\n // Front right leg\n if (pov >= 0 && pov <= 90) {\n\n }\n\n LegBackR.set(ControlMode.PercentOutput, -HOLD_SPEED);\n LegBackL.set(ControlMode.PercentOutput, HOLD_SPEED);\n } else {\n LegBackR.set(ControlMode.PercentOutput, 0);\n LegBackL.set(ControlMode.PercentOutput, 0);\n }\n\n if (retractFront) {\n IsHoldingFront = false;\n LegFrontR.set(-RETRACT_SPEED);\n LegFrontL.set(ControlMode.PercentOutput, RETRACT_SPEED);\n } else if (IsHoldingFront) {\n double rightSpeed = HOLD_SPEED;\n double leftSpeed = -HOLD_SPEED;\n int pov = xbox.getPOV();\n\n // Front right leg\n if (pov >= 0 && pov <= 90) {\n rightSpeed *= HOLD_CLIMB_MULTIPLIER;\n }\n\n LegFrontR.set(rightSpeed);\n LegFrontL.set(ControlMode.PercentOutput, leftSpeed);\n } else {\n LegFrontR.set(0);\n LegFrontL.set(ControlMode.PercentOutput, 0);\n }\n }\n } else {\n LegBackR.set(ControlMode.PercentOutput, 0);\n LegBackL.set(ControlMode.PercentOutput, 0);\n LegFrontR.set(0);\n LegFrontL.set(ControlMode.PercentOutput, 0);\n }\n \n double footSpeed = Math.max(-1.0, Math.min(rawSpeed * 3, 1.0F));\n\n if (IsHoldingBack) {\n // Drive back feet\n BackFootMover.set(footSpeed);\n } else {\n BackFootMover.set(0);\n }\n\n if (IsHoldingFront) {\n // Drive front feet\n FrontFootMover.set(footSpeed);\n } else {\n FrontFootMover.set(0);\n }\n\n // Publish values to dashboard for LEDs\n LedArmsClosed.setBoolean(ArmsClosed);\n }", "public void runOpMode() throws InterruptedException {\n robot.init(hardwareMap);\n BNO055IMU.Parameters parameters1 = new BNO055IMU.Parameters();\n parameters1.angleUnit = BNO055IMU.AngleUnit.DEGREES;\n imu = hardwareMap.get(BNO055IMU.class, \"imu\");\n imu.initialize(parameters1);\n int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(\"cameraMonitorViewId\", \"id\", hardwareMap.appContext.getPackageName());\n robot.arm.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.arm.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n //P.S. if you're using the latest version of easyopencv, you might need to change the next line to the following:\n phoneCam = OpenCvCameraFactory.getInstance().createInternalCamera(OpenCvInternalCamera.CameraDirection.BACK, cameraMonitorViewId);\n //phoneCam = new OpenCvInternalCamera(OpenCvInternalCamera.CameraDirection.BACK, cameraMonitorViewId);//remove this\n\n phoneCam.openCameraDevice();//open camera\n phoneCam.setPipeline(new StageSwitchingPipeline());//different stages\n phoneCam.startStreaming(rows, cols, OpenCvCameraRotation.SIDEWAYS_LEFT);//display on RC\n //width, height\n //width = height in this case, because camera is in portrait mode.\n\n runtime.reset();\n while (!isStarted()) {\n for (int i = 0; i <= 7; i++) {\n telemetry.addData(\"Values\", vals[i]);\n }\n for (int i = 0; i <= 7; i++) {\n totals = totals + vals[i];\n }\n totals = totals / 255;\n telemetry.addData(\"total\", totals);\n\n telemetry.addData(\"Height\", rows);\n telemetry.addData(\"Width\", cols);\n\n telemetry.update();\n sleep(100);\n\n if (totals >= 4) {\n StartAngle = 30;\n StartDistance = 105;\n StartBack = -40;\n ReturnAngle = 28;\n ReturnDistance = -85;\n drop2 = 112;\n mid = 0;\n backup2 = -33;\n } else if (totals <= 0) {\n StartAngle = 55;\n StartDistance= 85;\n StartBack = -5;\n ReturnAngle = 38;\n ReturnDistance = -60;\n drop2 = 65;\n mid = -2;\n backup2 = -31;\n } else {\n StartAngle = 17;\n StartDistance = 75;\n StartBack = -20;\n ReturnAngle = 22;\n ReturnDistance = -49;\n drop2 = 95;\n mid = -18;\n backup2 = -41;\n }\n totals = 0;\n }\n\n\n\n gyroDrive(DRIVE_SPEED,6,0,30,0);\n gyroDrive(DRIVE_SPEED,36,-45,30,0);\n gyroDrive(DRIVE_SPEED,StartDistance,StartAngle,30,0);\n\n //robot.arm.setTargetPosition(-450);\n //robot.arm.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n /*robot.arm.setPower(-.1);\n //robot.arm.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n gyroHold(DRIVE_SPEED,0,2);\n robot.claw.setPosition(0);\n robot.arm.setPower(.05);\n gyroHold(DRIVE_SPEED,0,1);\n gyroDrive(DRIVE_SPEED,-10,0,5,0);\n gyroTurn(TURN_SPEED,90);\n gyroDrive(DRIVE_SPEED,-20,90,5,0);\n\n */\n gyroTurn(TURN_SPEED,ReturnAngle);\n robot.LWheel.setPower(-.9);\n robot.RWheel.setPower(-.9);\n gyroDrive(DRIVE_SPEED, ReturnDistance,ReturnAngle, 30,0);\n gyroHold(TURN_SPEED,3,1);\n robot.lock.setPosition(1);\n robot.RTrack.setPosition(1);\n robot.LTrack.setPosition(0);\n gyroHold(TURN_SPEED,0,2);\n gyroHold(TURN_SPEED,-3,2);\n robot.LWheel.setPower(0);\n robot.RWheel.setPower(0);\n robot.RTrack.setPosition(.5);\n robot.LTrack.setPosition(.5);\n gyroTurn(TURN_SPEED,ReturnAngle);\n gyroDrive(DRIVE_SPEED, backup2, ReturnAngle, 30,0);\n\n gyroTurn(TURN_SPEED,90);\n gyroDrive(DRIVE_SPEED,52,80,5,0);\n gyroTurn(TURN_SPEED,65);\n gyroDrive(DRIVE_SPEED,drop2,2 + mid,10,0);\n robot.RDrop.setPosition(.23);\n robot.LDrop.setPosition(.23);\n gyroDrive(DRIVE_SPEED,StartBack,0,5,0);\n robot.arm.setPower(-.2);\n\n gyroHold(TURN_SPEED,0,1.7);\n robot.arm.setPower(0);\n }", "@Override\n public void robotPeriodic() {\n /*count++;\n\n if (count < 0) {\n count = 0;\n }\n\n int scriptIdx = count / SCRIPT_LENGTH;\n\n String[] script = LED_SCRIPTS[scriptIdx % (LED_SCRIPTS.length)];\n\n LedScript.setString(script[0]);\n \n if (script.length > 1) {\n LedScriptArgument.setString(script[1]);\n }*/\n\n // Hatch 0 has to be inverted because it is normally closed\n //SmartDashboard.putBoolean(\"HatchSwitch0\", !HatchSwitch0.get());\n //SmartDashboard.putBoolean(\"HatchSwitch1\", HatchSwitch1.get());\n\n //for (int i = 0; i < limits.length; i++) {\n // SmartDashboard.putBoolean(\"Switch\" + (i + 2), limits[i].get());\n //}\n\n\n final int MAX_TEMP = 100;\n if (MainLeft.getMotorTemperature() >= MAX_TEMP || AltLeft.getMotorTemperature() >= MAX_TEMP) {\n xbox.setRumble(RumbleType.kLeftRumble, 0.5);\n } else {\n xbox.setRumble(RumbleType.kLeftRumble, 0);\n }\n \n if (MainRight.getMotorTemperature() >= MAX_TEMP || AltRight.getMotorTemperature() >= MAX_TEMP) {\n xbox.setRumble(RumbleType.kRightRumble, 0.5);\n } else {\n xbox.setRumble(RumbleType.kRightRumble, 0);\n }\n\n //SmartDashboard.putNumber(\"DaTa\", NetworkTableInstance.getDefault().getTable(\"VisionTable\").getEntry(\"THIS IS A RANDOM NUMBER\").getNumber(-1).doubleValue());\n //SmartDashboard.putNumber(\"LiftSetpoint\", LiftSetpoint);\n //SmartDashboard.putNumber(\"LiftEncoderPos\", Lifter.getSelectedSensorPosition());\n //SmartDashboard.putNumber(\"LiftVoltageOut\", Lifter.getMotorOutputVoltage());\n //SmartDashboard.putNumber(\"LiftCurrentOut\", Lifter.getOutputCurrent());\n //SmartDashboard.putString(\"ControlMode\", Lifter.getControlMode().toString());\n //SmartDashboard.putNumber(\"ClosedLoopError\", Lifter.getClosedLoopError());\n //SmartDashboard.putNumber(\"LiftRampOutput\", liftRamp.getOutput());\n\n /*Diagnostics.writeDouble(\"DrivePosLeft\", MainLeft.getEncoder().getPosition());\n Diagnostics.writeDouble(\"DrivePosRight\", MainRight.getEncoder().getPosition());\n Diagnostics.writeDouble(\"DrivePosLeftAlt\", AltLeft.getEncoder().getPosition());\n Diagnostics.writeDouble(\"DrivePosRightAlt\", AltRight.getEncoder().getPosition());\n Diagnostics.writeDouble(\"LiftVoltageOut\", Lifter.getMotorOutputVoltage());\n Diagnostics.writeDouble(\"LiftCurrentOut\", Lifter.getOutputCurrent());\n Diagnostics.writeInteger(\"LiftEncoderPos\", Lifter.getSelectedSensorPosition());\n Diagnostics.writeInteger(\"LiftSetpoint\", LiftSetpoint);\n Diagnostics.writeInteger(\"LiftRampOutput\", liftRamp.getOutput());\n \n Diagnostics.timestamp();*/\n }", "@Override\n public void loop() {\n double left;\n double right;\n\n // // Run wheels in tank mode (note: The joystick goes negative when pushed forwards, so negate it)\n left = -gamepad1.left_stick_y;\n right = -gamepad1.right_stick_y;\n \n // double Target = 0;\n // robot.rightBack.setTargetPosition((int)Target);\n // robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n rightFront.setPower(left);\n rightBack.setPower(right);\n // robot.rightDrive.setPower(right);\n\n // // Use gamepad left & right Bumpers to open and close the claw\n // if (gamepad1.right_bumper)\n // clawOffset += CLAW_SPEED;\n // else if (gamepad1.left_bumper)\n // clawOffset -= CLAW_SPEED;\n\n // // Move both servos to new position. Assume servos are mirror image of each other.\n // clawOffset = Range.clip(clawOffset, -0.5, 0.5);\n // robot.leftClaw.setPosition(robot.MID_SERVO + clawOffset);\n // robot.rightClaw.setPosition(robot.MID_SERVO - clawOffset);\n\n // Use gamepad buttons to move the arm up (Y) and down (A)\n // if (gamepad1.y)\n // armPosition += ARM_SPEED;\n \n // if (gamepad1.a)\n // armPosition -= ARM_SPEED;\n \n // armPosition = Range.clip(armPosition, robot.ARM_MIN_RANGE, robot.ARM_MAX_RANGE); \n \n\n // // Send telemetry message to signify robot running;\n // telemetry.addData(\"arm\", \"%.2f\", armPosition);\n // telemetry.addData(\"left\", \"%.2f\", left);\n // telemetry.addData(\"right\", \"%.2f\", right);\n }", "@Override\n public void robotPeriodic() {\n double high = m_filter.calculate(m_photoHigh.getValue());// * kValueToInches;\n double low = m_filter.calculate(m_photoLow.getValue()); //* kValueToInches;\n if (low<=6){\n BallPresent = true;\n //stop motor if ultrasonic sensor median falls below 6 inches indicating a ball is blocking the sensor\n m_RightMotor.set(ControlMode.PercentOutput, 0);\n } else {\n BallPresent = false;\n //stop motor if ultrasonic sensor median falls below 6 inches indicating a ball is blocking the sensor\n m_RightMotor.set(ControlMode.PercentOutput, 0.5);\n }\n /*Shuffleboard.getTab(\"Shooter\").add(\"Ball Present\", BallPresent)\n .withWidget(BuiltInWidgets.kBooleanBox)\n .withPosition(0, 0)\n .withSize(1, 1)\n .withProperties(Map.of(\"colorWhenTrue\",\"green\",\"colorWhenFalse\",\"black\"));*/\n SmartDashboard.putNumber(\"High\", high);\n SmartDashboard.putNumber(\"Low\", low); \n /*Shuffleboard.getTab(\"Shooter\").add(\"Ultrasonic 1\", currentDistance)\n .withWidget(BuiltInWidgets.kGraph)\n .withPosition(0, 2)\n .withSize(4, 4);*/\n // convert distance error to a motor speed\n //double currentSpeed = (kHoldDistance - currentDistance) * kP;\n\n // drive robot\n //m_robotDrive.arcadeDrive(currentSpeed, 0);\n }", "@Override\r\n public void setServoValue(int servo, float value){\r\n checkServoCommandThread();\r\n // the message consists of\r\n // msg header: the command code (1 byte)\r\n // servo to control, 1 byte\r\n // servo PWM PCA capture-compare register value, 2 bytes, this encodes the LOW time of the PWM output\r\n // \t\t\t\tthis is send MSB, then LSB (big endian)\r\n ServoCommand cmd=new ServoCommand();\r\n cmd.bytes=new byte[4];\r\n cmd.bytes[0]=CMD_SET_SERVO;\r\n cmd.bytes[1]=(byte)getServo(servo);\r\n byte[] b=pwmValue(value);\r\n cmd.bytes[2]=b[0];\r\n cmd.bytes[3]=b[1];\r\n submitCommand(cmd);\r\n lastServoValues[getServo(servo)]=value;\r\n }" ]
[ "0.743026", "0.73775274", "0.708388", "0.6975977", "0.6942941", "0.6879603", "0.6764882", "0.67510366", "0.6736705", "0.671679", "0.6714396", "0.66752166", "0.66585267", "0.6608525", "0.6603873", "0.65940636", "0.6579222", "0.6524517", "0.6517894", "0.65100765", "0.65047956", "0.649411", "0.6492814", "0.6483173", "0.64462626", "0.6445458", "0.6417836", "0.64152694", "0.63924813", "0.63853395", "0.6362473", "0.63576233", "0.635733", "0.63483465", "0.63477504", "0.6347674", "0.63420373", "0.63391757", "0.63375545", "0.6336388", "0.63254786", "0.6305319", "0.63029546", "0.63019377", "0.6295856", "0.62842345", "0.6282001", "0.62737983", "0.6272264", "0.6272264", "0.6272264", "0.6272264", "0.6272264", "0.6272264", "0.6269943", "0.62621206", "0.6258812", "0.6256712", "0.6249379", "0.62321836", "0.62318885", "0.6230909", "0.6218396", "0.6204345", "0.61939144", "0.6189837", "0.6186474", "0.6184245", "0.6170492", "0.6168606", "0.61682105", "0.61600816", "0.61505955", "0.6149707", "0.61398643", "0.61376196", "0.61362755", "0.61235046", "0.61190265", "0.61171806", "0.6116186", "0.61112165", "0.6105964", "0.610275", "0.60914725", "0.6087559", "0.6078256", "0.6076663", "0.6076477", "0.60738385", "0.60569704", "0.6055786", "0.6050356", "0.6045667", "0.6045667", "0.6034317", "0.60238355", "0.6014022", "0.6009503", "0.6002661", "0.5993535" ]
0.0
-1
use the joysticks on the xbox controller to nudge the setpoints up or down from their official servo settings. Use the nudgeThrottle parm to keep "nudges" from being too drastic.
private static synchronized void nudgeServo(ArmLiftMotorInfo mtrInfo, double encoderAdjustmentRatio) { synchronized(armStage1.motorLock) { // synchronized(armStage2.motorLock) { //CONFIG ME int nudgeAmt = 0; //use squaring to make the joysticks easier to use double jsReadingRaw = mtrInfo.jsNamedControl.getEnt().getAnalog(); double jsReading = Math.copySign(jsReadingRaw*jsReadingRaw, jsReadingRaw); // //could square again if necessary.... // //don't need copySign for cubing.... // double jsReading = (jsReadingRaw*jsReadingRaw*jsReadingRaw); //cube for even easier joystick control if(mtrInfo.nudgeThrottle--==0) { nudgeAmt = -(int)(jsReading * encoderAdjustmentRatio);// / 25); if(nudgeAmt != 0) { P.println(PrtYn.Y, "Arm SERVO nudgeAmt=" + nudgeAmt + " for JSrdg % 5.1f"); } mtrInfo.nudgeThrottle = ArmLiftMotorInfo.DEFAULT_NUDGE_THROTTLE; } if( mtrInfo.operatingMode.equals(OperatingModesE.SERVO)) { mtrInfo.nudgeServoSetpoint(nudgeAmt); } // } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void loop() {\n float left = -gamepad1.left_stick_y;\n float right = -gamepad1.right_stick_y;\n // clip the right/left values so that the values never exceed +/- 1\n right = Range.clip(right, -1, 1);\n left = Range.clip(left, -1, 1);\n\n // scale the joystick value to make it easier to control\n // the robot more precisely at slower speeds.\n right = (float)scaleInput(right);\n left = (float)scaleInput(left);\n\n // write the values to the motors\n if (motor1!=null) {\n motor1.setPower(right);\n }\n if (motor2!=null) {\n motor2.setPower(left);\n }\n if (motor3!=null) {\n motor3.setPower(right);\n }\n if (motor4!=null) {\n motor4.setPower(left);\n }\n\n if (gamepad1.right_bumper && motor5Timer + 150 < timer) {\n motor5Forward = !motor5Forward;\n motor5Backward = false;\n motor5Timer = timer;\n } else if (gamepad1.left_bumper && motor5Timer + 150 < timer) {\n motor5Forward = false;\n motor5Backward = !motor5Backward;\n motor5Timer = timer;\n }\n if (motor5!=null) {\n if (gamepad1.dpad_left)\n {\n motor5Forward = false;\n motor5.setPower(1);\n }\n else if (gamepad1.dpad_right)\n {\n motor5Backward = false;\n motor5.setPower(-1);\n }\n else if (motor5Forward)\n {\n motor5.setPower(1);\n }\n else if (motor5Backward)\n {\n motor5.setPower(-1);\n }\n else\n {\n motor5.setPower(0);\n }\n }\n if (motor6!=null) {\n if (gamepad1.dpad_up)\n {\n motor6.setPower(1);\n }\n else if (gamepad1.dpad_down)\n {\n motor6.setPower(-1);\n }\n else\n {\n motor6.setPower(0);\n }\n\n\n }\n if (motor7!=null) {\n if (gamepad1.dpad_left)\n {\n motor7.setPower(1);\n }\n else if (gamepad1.dpad_right)\n {\n motor7.setPower(-1);\n }\n else\n {\n motor7.setPower(0);\n }\n }\n if (motor8!=null) {\n if (gamepad1.dpad_up)\n {\n motor8.setPower(1);\n }\n if (gamepad1.dpad_down)\n {\n motor8.setPower(-1);\n }\n else\n {\n motor8.setPower(0);\n }\n }\n if (timer == 0) {\n servo1pos=0.5;\n servo2pos=0.5;\n servo3pos=0.5;\n servo4pos=0.5;\n servo5pos=0.5;\n servo6pos=0.5;\n }\n timer++;\n\n if (servo1!=null){\n if (gamepad1.right_bumper) {\n servo1pos += 0.01;\n }\n if (gamepad1.left_bumper) {\n servo1pos -= 0.01;\n }\n servo1pos = Range.clip(servo1pos, 0.00, 1.0);\n\n servo1.setPosition(servo1pos);\n }\n if (servo2!=null){\n if (gamepad1.x) {\n servo2pos += 0.01;\n }\n if (gamepad1.y) {\n servo2pos -= 0.01;\n }\n servo2pos = Range.clip(servo2pos, 0.00, 1.0);\n\n servo2.setPosition(servo2pos);\n }\n if (servo3!=null){\n if (gamepad1.a) {\n servo3pos += 0.01;\n }\n if (gamepad1.b) {\n servo3pos -= 0.01;\n }\n servo3pos = Range.clip(servo3pos, 0.00, 1.0);\n\n servo3.setPosition(servo3pos);\n }\n if (servo4!=null){\n if (gamepad1.right_bumper) {\n servo4pos -= 0.01;\n }\n if (gamepad1.left_bumper) {\n servo4pos += 0.01;\n }\n servo4pos = Range.clip(servo4pos, 0.00, 1.0);\n\n servo4.setPosition(servo4pos);\n }\n if (servo5!=null){\n if (gamepad1.x) {\n servo5pos -= 0.01;\n }\n if (gamepad1.y) {\n servo5pos += 0.01;\n }\n servo5pos = Range.clip(servo5pos, 0.00, 1.0);\n\n servo5.setPosition(servo5pos);\n }\n if (servo6!=null){\n if (gamepad1.a) {\n servo6pos -= 0.01;\n }\n if (gamepad1.b) {\n servo6pos += 0.01;\n }\n servo6pos = Range.clip(servo6pos, 0.00, 1.0);\n\n servo6.setPosition(servo6pos);\n }\n if (servo1!=null){\n telemetry.addData(\"servoBumpers\", servo1.getPosition());}\n if (servo2!=null){\n telemetry.addData(\"servoX/Y\", servo2.getPosition());}\n if (servo3!=null){\n telemetry.addData(\"servoA/B\", servo3.getPosition());}\n if (servo4!=null){\n telemetry.addData(\"servoBumpers-\", servo4.getPosition());}\n if (servo5!=null){\n telemetry.addData(\"servoX/Y-\", servo5.getPosition());}\n if (servo6!=null){\n telemetry.addData(\"servoA/B-\", servo6.getPosition());}\n if (motor1 != null) {\n telemetry.addData(\"Motor1\", motor1.getCurrentPosition());\n }\n }", "@Override\n public void loop() { \n\n double forward = gamepad1.left_stick_y;\n double turn = gamepad1.right_stick_x;\n double collect = gamepad2.left_trigger - gamepad2.right_trigger;\n double wristPower = gamepad1.left_trigger - gamepad1.right_trigger;\n\n if (forward > 0)\n forward = Math.pow(forward, 2);\n else if (forward < 0)\n forward = -Math.pow(forward, 2);\n\n if (turn > 0)\n turn = Math.pow(turn, 2);\n else if (turn < 0)\n turn = -Math.pow(turn, 2);\n//\n// else if(turn < 0)\n// turn = -Math.pow(turn, 2);\n telemetry.addData(\"Forward Power\", forward);\n telemetry.addData(\"Turn Power\", turn);\n left.setPower(Range.clip(forward - turn, -1, 1));\n right.setPower(Range.clip(forward + turn, -1, 1));\n collection.setPower(0.8 * (Range.clip(collect, -1.0, 1.0)));\n wrist.setPower((Range.clip(wristPower, -1, 1)));\n\n //regular servo code\n// if(gamepad1.x && !wristUp) //wrist up\n// {\n// wrist.setPosition(.9);\n// wristUp = true;\n// }\n// else if(gamepad1.x && wristUp) //wrist down\n// { wrist.setPosition(-.9);\n// wristUp = false;\n// }\n// else if(gamepad1.left_trigger > 0 && wrist.getPosition() <= .95)\n// {\n// wrist.setPosition(wrist.getPosition() + 0.005);\n// }\n// else if(gamepad1.right_trigger > 0 && wrist.getPosition() >= -.95)\n// {\n// wrist.setPosition(wrist.getPosition() - 0.005);\n// }\n\n if (lift.getCurrentPosition() >= 0 || lift.getCurrentPosition() <= 3200 || liftOverride){\n if (gamepad2.left_stick_y > 0.2)\n lift.setPower(-1);\n else if (gamepad2.left_stick_y < -0.2)\n lift.setPower(1);\n else\n lift.setPower(0);\n }\n if(gamepad2.right_bumper && gamepad2.y)\n {\n liftOverride = true;\n }\n else if(liftOverride == true)\n {\n lift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n lift.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n liftOverride = false;\n }\n telemetry.addData(\"bucket posiition\", bucket.getPosition());\n telemetry.update();\n\n if (gamepad2.a) //bucket dump\n {\n bucket.setPosition(0.75);\n } else if (gamepad2.b) //bucket down\n {\n bucket.setPosition(0);\n } else if (gamepad2.x) //endgame\n bucket.setPosition(0.4);\n if (gamepad2.dpad_up && bucket.getPosition() <= 0.9975)\n bucket.setPosition(bucket.getPosition() + .0025);\n else if (gamepad2.dpad_down && bucket.getPosition() >= -0.9975)\n bucket.setPosition(bucket.getPosition() - .0025);\n\n\n //Press to keep bucket up for endgame\n //NOTE: D-Pad will not work unless gamepad2 B is pressed to end the override\n// if(gamepad2.a && bucketOverride == false) {\n// bucket.setPower(-.4);\n// bucketOverride = true;\n// }\n// else if (gamepad2.a && bucketOverride == true)\n// {\n// bucket.setPower(0);\n// bucketOverride = false;\n// }\n\n if (gamepad1.right_bumper) {\n extension.setPower(1);\n } else if (gamepad1.left_bumper) {\n extension.setPower(-1);\n } else extension.setPower(0);\n\n telemetry.update();\n }", "private void visionDrive(double throttle) {\n if(limelight.isValidTarget()) {\n// DriverStation.reportWarning(\"\"+SmartDashboard.getNumber(\"Vision P\", Constants.visionDriveP),false);\n// visionDrive.setP(SmartDashboard.getNumber(\"Vision P\", Constants.visionDriveP));\n// visionDrive.setI(SmartDashboard.getNumber(\"Vision I\", Constants.visionDriveI));\n// visionDrive.setD(SmartDashboard.getNumber(\"Vision D\", Constants.visionDriveD));\n// visionDrive.setMaxIOutput(.225);\n double error = limelight.getCenter().x;\n double output = Constants.outsideP * -error;\n if(Math.abs(error) < 4) {\n// SmartDashboard.putString(\"In PID?\", \"PID\");\n output = visionDrive.getOutput(error);\n left.set(ControlMode.PercentOutput, throttle - output);\n right.set(ControlMode.PercentOutput, throttle + output);\n// SmartDashboard.putNumber(\"PID Output\", output);\n }\n else if(Math.abs(error) < 7 && Math.abs(error) > 2){\n double val = .2;\n if (error < 0){\n// SmartDashboard.putString(\"In PID?\", \"1\");\n left.set(ControlMode.PercentOutput, -val);\n right.set(ControlMode.PercentOutput, val);\n }\n else if (error > 0){\n// SmartDashboard.putString(\"In PID?\", \"2\");\n left.set(ControlMode.PercentOutput, val);\n right.set(ControlMode.PercentOutput, -val);\n }\n }\n else if (error < 0){\n// SmartDashboard.putString(\"In PID?\", \"3\");\n left.set(ControlMode.PercentOutput, -.25);\n right.set(ControlMode.PercentOutput, .25);\n }\n else if (error > 0){\n// SmartDashboard.putString(\"In PID?\", \"4\");\n left.set(ControlMode.PercentOutput, .25);\n right.set(ControlMode.PercentOutput, -.25);\n }\n\n SmartDashboard.putNumber(\"Error\", error);\n } else {\n visionDrive.reset();\n setOutput(0, 0);\n }\n }", "void driveStick(float x, float y) {\n speed = (Math.abs(x) > Math.abs(y) ? Math.abs(x) : Math.abs(y)) / 1.5;\n\n telemetry.addData(\"y\", y);\n telemetry.addData(\"x\", x);\n\n //One program to combine 8 directions of motion on one joystick using ranges of x and y values\n if (y > .10) {\n drive(\"left\");\n } else if (y < -.10) {\n drive(\"right\");\n } else if (x > .10) {\n drive(\"down\");\n } else if (x < -.10) {\n drive(\"up\");\n } else {\n drive(\"stop\");\n }\n\n\n }", "public void activateUncontrolledMoves() {\n new Thread(new Runnable() {\n @Override\n public void run() {\n actualPoint = new Point();\n actualPoint.x = 0;\n actualPoint.y = 0;\n final int maxX = wheel.getBounds().width(); //This represent the max X possible coord on the wheel\n final int maxY = wheel.getBounds().height();\n int timeBtwnMvmnts = 5000; //Time between each new movement\n while (true) {\n\n try {\n Thread.sleep(timeBtwnMvmnts);//Waiting for the next movement\n } catch (InterruptedException e) {\n\n }\n if (isUncontrolledActivated) { //If is activated continue\n double userCurrentSnap = USER_CURRENT_BREATH_RATE; //Snapshot to the current BR\n\n //Getting the percent of excess according to the max ideal breathing rate and the max posible rate (20)\n //Consider 6-8, MAX_IDEAL_BREATH_RATE (8) will be the max\n double referenceDistance = MAX_BREATH_RATE - MAX_IDEAL_BREATH_RATE;\n double myRateExcess = userCurrentSnap - MAX_IDEAL_BREATH_RATE;\n double relationPreferedActual = myRateExcess / referenceDistance;\n double percentOfExcess = relationPreferedActual * 100;\n\n Random r = new Random();\n\n //Probability of appearance of each special move\n if (percentOfExcess <= 40 && percentOfExcess > 10) { //A little error margin to make it easier. Nets to be 10% excess\n //Boost, stop, roll , inverted. probabilities (70,16,10,4)\n int diceRolled = r.nextInt(100); //This works as the \"probability\"\n if (diceRolled < 4) {// 4% inverted\n /*Enable inverted controlling. Determine how much time is this going to last.\n Not more than the time between each movement.*/\n final int duration = new Random().nextInt(timeBtwnMvmnts - 1000) + 1000;\n invertControls(duration);\n } else if (diceRolled >= 4 && diceRolled < 14) { // 10% roll\n uncRoll(maxX, maxY);\n } else if (diceRolled >= 14 && diceRolled < 30) { // 16% stop\n uncStop();\n } else if (diceRolled >= 30 && diceRolled < 100) { // 70% boost\n int whichBoost = new Random().nextInt(1);\n if (whichBoost == 0)\n uncBackwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n else\n uncForwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n }\n timeBtwnMvmnts = 8000;\n } else if (percentOfExcess <= 60 && percentOfExcess > 10) {\n //Boost, stop, roll , inverted. probabilities (45,30,15,10)\n int diceRolled = r.nextInt(100);\n if (diceRolled < 10) {// 10% inverted\n final int duration = new Random().nextInt(timeBtwnMvmnts - 1000) + 1000;\n invertControls(duration);\n } else if (diceRolled >= 10 && diceRolled < 25) { // 15% roll\n uncRoll(maxX, maxY);\n } else if (diceRolled >= 25 && diceRolled < 55) { // 30% stop\n uncStop();\n } else if (diceRolled >= 55 && diceRolled < 100) { // 45% boost\n int whichBoost = new Random().nextInt(1);\n if (whichBoost == 0)\n uncBackwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n else\n uncForwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n }\n timeBtwnMvmnts = 6700;\n } else if (percentOfExcess > 10) {//Percent > 60\n //Boost, stop, roll , inverted. probabilities (5,10,25,60)\n int diceRolled = r.nextInt(100);\n if (diceRolled < 60) {// 60% inverted\n final int duration = new Random().nextInt(timeBtwnMvmnts - 1000) + 1000;\n invertControls(duration);\n } else if (diceRolled >= 60 && diceRolled < 85) { // 25% roll\n uncRoll(maxX, maxY);\n } else if (diceRolled >= 85 && diceRolled < 95) { // 10% stop\n uncStop();\n } else if (diceRolled >= 95 && diceRolled < 100) { // 5% boost\n int whichBoost = new Random().nextInt(1);\n if (whichBoost == 0)\n uncBackwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n else\n uncForwardBoost(actualPoint.x, actualPoint.y, maxX, maxY);\n }\n timeBtwnMvmnts = 5000;\n }\n\n } else {\n break;\n }\n }\n }\n }).start();\n }", "public void uncForwardBoost(final int x, final int y, final int maxX, final int maxY) {\n /* First, determine in which quadrant is the puck.\n Remember, here with the driver there is no negative values to the drive coords\n */\n new Thread(new Runnable() {\n @Override\n public void run() {\n int count = 0;\n int centerX = maxX / 2;\n int centerY = maxY / 2;\n int finalX = 0, finalY = 0;\n int time = 1;\n if (ACTUAL_DIFICULTY == EASY)\n time = 1;\n if (ACTUAL_DIFICULTY == MEDIUM)\n time = 2;\n if (ACTUAL_DIFICULTY == HARD)\n time = 3;\n\n if (x >= centerX && y < centerY) {//Quadrant 1. x btw 130 and 300. y btw 0 and 130\n finalX = maxX;\n finalY = 0;\n } else if (x < centerX && y < centerY) { //Quadrant 2.\n finalX = 0;\n finalY = 0;\n } else if (x < centerX && y >= centerY) { //Quadrant 3.\n finalX = 0;\n finalY = maxY;\n } else if (x >= centerX && y >= centerY) { //Quadrant 4.\n finalX = maxX;\n finalY = maxY;\n }\n while (count < time) {//Time of boost\n\n drive_control.stopDriving();\n drive_control.setSpeedScale(MAX_SCALED_SPEED);\n drive_control.startDriving(getContext(), DriveControl.JOY_STICK);\n drive_control.driveJoyStick(finalX, finalY);\n try {\n Thread.sleep(100);\n } catch (InterruptedException e) {\n }\n count++;\n }\n restoreValues();\n }\n }).start();\n }", "@Override\n public void teleopPeriodic() {\n double pi4 = (double)Math.PI/4;\n/*\n double deadzoneX = 0.1;\n double multiplierX = 1/deadzoneX;\n double deadzoneY = 0.1;\n double multiplierY = 1/deadzoneY;\n\n double maxSpeed = stick.getThrottle() * 1f;\nstick.getX()/Math.abs(stick.getX())\n double stickX;\n if (Math.abs(stick.getX())< deadzoneX){\n stickX = 0;\n }\n\n else {\n stickX = ((stick.getMagnitude() * Math.sin(stick.getDirectionRadians())) - deadzoneX)*multiplierX;\n }\n\n \n double stickY;\n if (Math.abs(stick.getY())< deadzoneY){\n stickY = 0;\n }\n\n else {\n stickY = (stick.getMagnitude() * Math.cos(stick.getDirectionRadians()) - deadzoneY)*multiplierY;\n }\n \n\n double stickTwist = stick.getTwist();\n\n double leftFrontForwardsPower = -stickY;\n double rightFrontForwardsPower = stickY;\n double leftBackForwardsPower = -stickY;\n double rightBackForwardsPower = stickY;\n\n double leftFrontSidePower = -stickX;\n double rightFrontSidePower = -stickX;\n double leftBackSidePower = +stickX;\n double rightBackSidePower = stickX;\n\n double leftFrontRotatePower = -stickTwist;\n double rightFrontRotatePower = -stickTwist;\n double leftBackRotatePower = -stickTwist;\n double rightBackRotatePower = -stickTwist;\n\n */\n\n /* get gyro from robot\n set gyro tto original gyro\n void()\n\n get X for joystick\n get Y for Joystick\n\n get gyro for robot\n\n if X = 0\n then Joystick angle pi/2\n else\n then Joystick angle = arctan(Y/X)\n\n newGyro = original gyro - gyro\n\n xfinal = cos(newGyro+joystickangle) * absolute(sqrt(x^2+y^2))\n yfinal = sin(newGyro+joystickangle) * absolute(sqrt(x^2+y^2))\n*/\n\n//Xbox COntroller\n \n double maxSpeed = stick.getThrottle() * 0.2f;\n double maxRot = 1f;\n\n double controllerX = -controller.getX(Hand.kRight);\n double controllerY = controller.getY(Hand.kRight);\n double joyAngle;\n boolean gyroRestart = controller.getAButtonPressed();\n\n if (gyroRestart){\n gyro.reset();\n origGyro = Math.toRadians(gyro.getAngle());\n }\n\n double mainGyro = Math.toRadians(gyro.getAngle());\n/*\n if (controllerX == 0 && controllerY > 0){\n joyAngle = (3*Math.PI)/2;\n }\n\n \n if (controllerX == 0 && controllerY < 0){\n joyAngle = Math.PI/2;\n }\n\n else{\n joyAngle = Math.atan(controllerY/controllerX);\n }\n\n if (controllerX > 0 && controllerY < 0){\n joyAngle = Math.abs(joyAngle + Math.toRadians(180));\n }\n if (controllerX > 0 && controllerY > 0){\n joyAngle -= Math.toRadians(180);\n }\n / * if (controllerX < 0 && controllerY > 0){\n joyAngle -= Math.toRadians(270);\n }* /\n*/\n joyAngle = Math.atan2(controllerY, controllerX);\n\n double newGyro = origGyro - mainGyro;\n //double newGyro = 0;\n\n double controllerTurn = -controller.getX(Hand.kLeft)*maxRot;\n\n double magnitude = Math.abs(Math.sqrt(Math.pow(controllerX,2) + Math.pow(controllerY, 2)));\n\n double xFinal = Math.cos(newGyro + joyAngle) * magnitude;\n double yFinal = Math.sin(newGyro + joyAngle) * magnitude;\n\n\n /* \n double leftFrontForwardsPower = -controllerY;\n double rightFrontForwardsPower = controllerY;\n double leftBackForwardsPower = -controllerY;\n double rightBackForwardsPower = controllerY;\n\n double leftFrontSidePower = -controllerX;\n double rightFrontSidePower = -controllerX;\n double leftBackSidePower = controllerX;\n double rightBackSidePower = controllerX;\n*/\n \n double leftFrontForwardsPower = -yFinal;\n double rightFrontForwardsPower = yFinal;\n double leftBackForwardsPower = -yFinal;\n double rightBackForwardsPower = yFinal;\n\n double leftFrontSidePower = -xFinal;\n double rightFrontSidePower = -xFinal;\n double leftBackSidePower = xFinal;\n double rightBackSidePower = xFinal;\n \n double leftFrontRotatePower = -controllerTurn;\n double rightFrontRotatePower = -controllerTurn;\n double leftBackRotatePower = -controllerTurn;\n double rightBackRotatePower = -controllerTurn;\n\n double forwardsWeight = 1;\n double sideWeight = 1;\n double rotateWeight = 1;\n\n double leftFrontPower = leftFrontForwardsPower * forwardsWeight + leftFrontSidePower * sideWeight + leftFrontRotatePower * rotateWeight;\n double rightFrontPower = rightFrontForwardsPower * forwardsWeight + rightFrontSidePower * sideWeight + rightFrontRotatePower * rotateWeight;\n double leftBackPower = leftBackForwardsPower * forwardsWeight + leftBackSidePower * sideWeight + leftBackRotatePower * rotateWeight;\n double rightBackPower = rightBackForwardsPower * forwardsWeight + rightBackSidePower * sideWeight + rightBackRotatePower * rotateWeight;\n\n leftFrontPower *= maxSpeed;\n rightFrontPower *= maxSpeed;\n leftBackPower *= maxSpeed;\n rightBackPower *= maxSpeed;\n\n\n double largest = Math.max( \n Math.max( Math.abs( leftFrontPower),\n Math.abs(rightFrontPower)),\n Math.max( Math.abs( leftBackPower), \n Math.abs( rightBackPower)));\n\n if (largest > 1) {\n leftFrontPower /= largest;\n rightFrontPower /= largest;\n leftBackPower /= largest;\n rightBackPower /= largest;\n }\n \n \n leftFrontMotor.set(leftFrontPower);\n rightFrontMotor.set(rightFrontPower); \n leftBackMotor.set(leftBackPower);\n rightBackMotor.set(rightBackPower);\n\n SmartDashboard.putNumber(\"Main Gyro\", mainGyro);\n SmartDashboard.putNumber(\"Original Gyro\", origGyro);\n SmartDashboard.putNumber(\"New Gyro\", newGyro);\n SmartDashboard.putNumber(\"Controller X\", controllerX);\n SmartDashboard.putNumber(\"Controller Y\", controllerY);\n SmartDashboard.putNumber(\"Magnitude \", magnitude);\n SmartDashboard.putNumber(\"Largest\", largest);\n SmartDashboard.putNumber(\"Joystick Angle\", Math.toDegrees(joyAngle));\n SmartDashboard.putNumber(\"X final\", xFinal);\n SmartDashboard.putNumber(\"Y final\", yFinal);\n SmartDashboard.putNumber(\"Left Front Power\", leftFrontPower);\n SmartDashboard.putNumber(\"Right Front Power\", rightFrontPower);\n SmartDashboard.putNumber(\"Left Back Power\", leftBackPower);\n SmartDashboard.putNumber(\"Right Back Power\", rightBackPower);\n }", "@Override\n public void teleopPeriodic() {\n double y = -xbox.getRawAxis(0) * 0.7D * (1.0D + Math.max(0, xbox.getRawAxis(4)) * 1.4285714D);\n double rawSpeed = xbox.getRawAxis(2) - xbox.getRawAxis(3);\n\n if (SAFETY_MODE) {\n y *= 0.75D;\n\n if (xbox.getBumper(Hand.kLeft) && joystick.getRawButton(7)) {\n if (safetyCount > 0) {\n safetyCount--;\n SmartDashboard.putNumber(\"Safety Count\", safetyCount);\n\n if (safetyCount == 0) {\n safetyTripped = false;\n clearAllButtonStates();\n SmartDashboard.putBoolean(\"Safety Tripped\", safetyTripped);\n }\n } else {\n safetyTripped = false;\n }\n } else {\n safetyTripped = true;\n safetyCount = MAX_SAFETY_COUNT;\n SmartDashboard.putNumber(\"Safety Count\", safetyCount);\n SmartDashboard.putBoolean(\"Safety Tripped\", safetyTripped);\n }\n } else {\n safetyTripped = false;\n }\n\n // Climb Speed\n if (xbox.getRawButton(6)) {\n rawSpeed = -0.3D;\n }\n\n // Super slow mode\n if (xbox.getAButton() || SAFETY_MODE) {\n SpeedRamp.Setpoint = rawSpeed * 0.45D;\n } else {\n SpeedRamp.Setpoint = rawSpeed * 0.8D * (1.0D + Math.max(0, xbox.getRawAxis(4)) * 0.25);\n }\n\n SpeedRamp.update();\n\n boolean seesTape = TapeDetectedEntry.getBoolean(false);\n \n if (seesTape && !safetyTripped) {\n final double ADJUST_CONST = 0.13281734;\n //double tapePitch = TapePitchEntry.getNumber(0).doubleValue();\n double tapeYaw = TapeYawEntry.getNumber(0).doubleValue();\n final double TARGET_YAW = 0;//PitchYawAdjuster.GetYawFromPitch(tapePitch);\n\n //SmartDashboard.putNumber(\"tapePitch\", tapePitch);\n //SmartDashboard.putNumber(\"tapeYaw\", tapeYaw);\n \n double diff = tapeYaw - ADJUST_CONST;\n \n String s = \"\";\n\n if (diff > 0) {\n s = \"<-- (\" + diff + \")\";\n } else if (diff < 0) {\n s = \"--> (\" + diff + \")\";\n }\n\n if (/*xbox.getRawButton(5) This is now taken for the safety button*/false) {\n final double MAX_AFFECT = 0.4;\n if (diff > MAX_AFFECT) {\n diff = MAX_AFFECT;\n } else if (diff < -MAX_AFFECT) {\n diff = -MAX_AFFECT;\n }\n\n y -= diff;\n }\n\n SmartDashboard.putString(\"TapeDir\", s);\n } else {\n SmartDashboard.putString(\"TapeDir\", \"X\");\n }\n\n if (xbox.getRawButtonPressed(7)) {\n Lifter.setSelectedSensorPosition(0);\n LiftSetpoint = 0;\n LiftRamp.Setpoint = 0;\n LiftRamp.setOutput(0);\n }\n\n //Scheduler.getInstance().run();\n // Cargo ship is(n't anymore) -13120\n\n // The fine adjustment has nothing to do with hammers.\n // Don't try to use a hammer on the roboRIO. Ever.\n final int FINE_ADJUSTMENT_AMOUNT = -500;\n\n if (!safetyTripped) {\n if (joystick.getPOV() == 0) {\n if (!joyPOV0PressedLast) {\n joyPOV0PressedLast = true;\n if (LiftSetpoint - FINE_ADJUSTMENT_AMOUNT <= 0)\n LiftSetpoint -= FINE_ADJUSTMENT_AMOUNT;\n }\n } else {\n joyPOV0PressedLast = false;\n\n if (joystick.getPOV() == 180) {\n if (!joyPOV180PressedLast) {\n joyPOV180PressedLast = true;\n LiftSetpoint += FINE_ADJUSTMENT_AMOUNT;\n }\n } else {\n joyPOV180PressedLast = false;\n }\n }\n\n Drive.arcadeDrive(SpeedRamp.getOutput(), y);\n\n if (joystick.getRawButtonPressed(11)) {\n LiftSetpoint = HATCH_BOTTOM;\n } else if (joystick.getRawButtonPressed(9)) {\n LiftSetpoint = HATCH_MIDDLE;\n //} else if (joystick.getRawButtonPressed(7)) {\n // This button is now used for safety mode LiftSetpoint = HATCH_TOP;\n // and also for grab-hatch-on-impact mode\n } else if (joystick.getRawButtonPressed(12)) {\n LiftSetpoint = CARGO_BOTTOM;\n } else if (joystick.getRawButtonPressed(10)) {\n LiftSetpoint = CARGO_MIDDLE;\n //} else if (joystick.getRawButtonPressed(8)) {\n //LiftSetpoint = CARGO_TOP;\n } else if (joystick.getRawButtonPressed(1)) {\n LiftSetpoint = CARGO_FLOOR;\n }\n\n double liftY = -joystick.getRawAxis(1);\n final double deadband = 0.15;\n\n if (Math.abs(liftY) > deadband) {\n double change = (liftY < 0 ? liftY + 0.15 : liftY - 0.15) * 200;//(int)liftEntry.getDouble(0);//\n \n if (change > 100) {\n change = 100;\n } else if (change < -100) {\n change = -100;\n }\n\n LiftRamp.setOutput(LiftRamp.getOutput() + change);\n LiftRamp.Setpoint += change;\n LiftSetpoint = (int)LiftRamp.Setpoint;\n }\n\n if (LiftSetpoint < LIMIT_UP) {\n LiftSetpoint = LIMIT_UP;\n }\n } else {\n Drive.arcadeDrive(0, 0);\n }\n \n LiftRamp.Setpoint = LiftSetpoint;\n SmartDashboard.putNumber(\"LiftSetpoint\", LiftRamp.Setpoint);\n //SmartDashboard.putNumber(\"LiftEncoderPos\", Lifter.getSelectedSensorPosition());\n SmartDashboard.putNumber(\"LiftOutput\", LiftRamp.getOutput());\n LiftRamp.update();\n\n Lifter.set(ControlMode.Position, LiftRamp.getOutput());\n //Lifter.set(ControlMode.PercentOutput, -joystick.getRawAxis(1));\n\n if (!safetyTripped) {\n if (joystick.getRawButtonPressed(4)) {\n ArmsClosed = !ArmsClosed;\n } else if (!SAFETY_MODE) {\n // This is the same as the joystick safety button, so it only works outside\n // safety mode, and why would it be needed in safety mode anyway?\n // It should be disabled in safety mode anyway to make sure we don't\n // accidently attack someone's fingers at a Demo.\n\n // Holding joystick button 7 makes the limit switches on the hatch mechanism\n // active, so when the hatch contacts the switches, the mechanism automatically\n // grabs the hatch.\n // HatchSwitch0 does not have to be inverted. It's complicated.\n if (joystick.getRawButton(7) && (HatchSwitch0.get() || !HatchSwitch1.get())) {\n ArmsClosed = false;\n }\n }\n\n if (joystick.getRawButtonPressed(3)) {\n ArmsExtended = !ArmsExtended;\n }\n }\n\n ArmExtender.set(ArmsExtended);\n ArmOpener.set(ArmsClosed);\n\n //Diagnostics.writeDouble(\"DriveX\", x);\n //Diagnostics.writeDouble(\"DriveY\", y);\n\n // X = out, Y = in\n\n final double GRAB_SPEED;\n\n if (SAFETY_MODE) {\n GRAB_SPEED = 0.8D;\n } else {\n GRAB_SPEED = 1D; // TODO at one point we had this 0.8, is that what it's supposed to be?\n }\n \n if (!safetyTripped) {\n ArmGrippers.set(/*xbox.getXButton() || */joystick.getRawButton(6) ? -GRAB_SPEED : /*xbox.getYButton() ||*/ joystick.getRawButton(5) ? GRAB_SPEED : 0);\n } else {\n ArmGrippers.set(0);\n }\n\n\n // === Climbing stuff ===\n\n boolean climbSafety = /*joystick.getRawButton(2) &&*/ !safetyTripped;\n \n // Have to check all of these every update to make sure it was pressed\n // between now and the last update\n boolean retractFront = xbox.getYButton/*Pressed*/();\n boolean retractBack = xbox.getXButton/*Pressed*/();\n boolean climbBoth = xbox.getRawButton/*Pressed*/(8);\n\n final double CLIMB_SPEED = 1;\n final double RETRACT_SPEED = 0.75;\n final double HOLD_SPEED = 0.3;\n // If you multiply the hold by this, you get the climb value.\n // Avoids having to thing + or minus so many times.\n final double HOLD_CLIMB_MULTIPLIER = CLIMB_SPEED / HOLD_SPEED;\n\n // Left is negative, right is positive\n double xOff = Math.round((Accel.getX() - ZeroX) * 10) / 10D;\n // Forward is negative, backwards is positive\n double zOff = Math.round((Accel.getZ() - ZeroZ) * 10) / 10D;\n\n\n SmartDashboard.putNumber(\"X\", xOff);\n SmartDashboard.putNumber(\"Z\", zOff);\n\n\n if (climbSafety || IsHoldingBack || IsHoldingFront) {\n if (climbBoth) {\n IsHoldingBack = true;\n IsHoldingFront = true;\n\n \n double SpeedFR = CLIMB_SPEED;\n double SpeedFL = -CLIMB_SPEED;\n double SpeedBR = -CLIMB_SPEED;\n double SpeedBL = CLIMB_SPEED;\n\n final double SLOW_MULT = 0.3;\n\n if (xOff < 0 || zOff < 0) {\n SpeedBR *= SLOW_MULT;\n }\n\n if (xOff < 0 || zOff > 0) {\n SpeedFR *= SLOW_MULT;\n }\n\n if (xOff > 0 || zOff < 0) {\n SpeedBL *= SLOW_MULT;\n }\n\n if (xOff > 0 || zOff > 0) {\n SpeedFL *= SLOW_MULT;\n }\n \n LegFrontR.set(SpeedFR);\n LegFrontL.set(ControlMode.PercentOutput, SpeedFL);\n LegBackR.set(ControlMode.PercentOutput, SpeedBR);\n LegBackL.set(ControlMode.PercentOutput, SpeedBL);\n\n } else {\n if (retractBack) {\n IsHoldingBack = false;\n LegBackR.set(ControlMode.PercentOutput, RETRACT_SPEED);\n LegBackL.set(ControlMode.PercentOutput, -RETRACT_SPEED);\n } else if (IsHoldingBack) {\n double rightSpeed = -HOLD_SPEED;\n double leftSpeed = HOLD_SPEED;\n int pov = xbox.getPOV();\n\n // Front right leg\n if (pov >= 0 && pov <= 90) {\n\n }\n\n LegBackR.set(ControlMode.PercentOutput, -HOLD_SPEED);\n LegBackL.set(ControlMode.PercentOutput, HOLD_SPEED);\n } else {\n LegBackR.set(ControlMode.PercentOutput, 0);\n LegBackL.set(ControlMode.PercentOutput, 0);\n }\n\n if (retractFront) {\n IsHoldingFront = false;\n LegFrontR.set(-RETRACT_SPEED);\n LegFrontL.set(ControlMode.PercentOutput, RETRACT_SPEED);\n } else if (IsHoldingFront) {\n double rightSpeed = HOLD_SPEED;\n double leftSpeed = -HOLD_SPEED;\n int pov = xbox.getPOV();\n\n // Front right leg\n if (pov >= 0 && pov <= 90) {\n rightSpeed *= HOLD_CLIMB_MULTIPLIER;\n }\n\n LegFrontR.set(rightSpeed);\n LegFrontL.set(ControlMode.PercentOutput, leftSpeed);\n } else {\n LegFrontR.set(0);\n LegFrontL.set(ControlMode.PercentOutput, 0);\n }\n }\n } else {\n LegBackR.set(ControlMode.PercentOutput, 0);\n LegBackL.set(ControlMode.PercentOutput, 0);\n LegFrontR.set(0);\n LegFrontL.set(ControlMode.PercentOutput, 0);\n }\n \n double footSpeed = Math.max(-1.0, Math.min(rawSpeed * 3, 1.0F));\n\n if (IsHoldingBack) {\n // Drive back feet\n BackFootMover.set(footSpeed);\n } else {\n BackFootMover.set(0);\n }\n\n if (IsHoldingFront) {\n // Drive front feet\n FrontFootMover.set(footSpeed);\n } else {\n FrontFootMover.set(0);\n }\n\n // Publish values to dashboard for LEDs\n LedArmsClosed.setBoolean(ArmsClosed);\n }", "@Override\n public void loop() {\n double left;\n double right;\n\n // Run wheels in tank mode (note: The joystick goes negative when pushed forwards, so negate it)\n if(!reverseMode)\n {\n left = -gamepad1.left_stick_y;\n right = -gamepad1.right_stick_y;\n }\n else\n {\n left = gamepad1.right_stick_y;\n right = gamepad1.left_stick_y;\n }\n\n targetSpeedLeft = left * driveSpeed;\n targetSpeedRight = right * driveSpeed;\n\n currentLiftSpeed = 0.0;\n if(gamepad1.left_trigger >= 0.1) {\n currentLiftSpeed = -LIFT_MAX_DOWN_SPEED;\n }\n if(gamepad1.right_trigger >= 0.1) {\n currentLiftSpeed = LIFT_MAX_DOWN_SPEED;\n }\n //if(gamepad2.left_trigger) {\n // currentLiftSpeed = -gamepad2.left_bumper * LIFT_MAX_DOWN_SPEED;\n //}\n //if(gamepad2.right_trigger) {\n // currentLiftSpeed = gamepad2.right_bumper * LIFT_MAX_UP_SPEED;\n //}\n/*\n currentSpeedArm = 0.0;\n if(gamepad1.left_trigger) {\n currentSpeedArm = -gamepad1.left_bumper * ARM_MAX_DOWN_SPEED;\n }\n if(gamepad1.right_trigger) {\n currentSpeedArm = gamepad1.right_bumper * ARM_MAX_UP_SPEED;\n }\n\n /*\n // limit acceleration by only allowing MAX_ACCEL power change per UPDATE_TIME\n if(runtime.seconds() > UPDATE_TIME)\n {\n runtime.reset();\n \n if( ((currentSpeedLeft >= 0.0) && (targetSpeedLeft >= 0.0)) ||\n ((currentSpeedLeft <= 0.0) && (targetSpeedLeft <= 0.0)))\n {\n if(Math.abs(currentSpeedLeft) > Math.abs(targetSpeedLeft)) \n {\n currentSpeedLeft = targetSpeedLeft;\n }\n else \n {\n if (currentSpeedLeft != targetSpeedLeft) {\n if (Math.abs(targetSpeedLeft - currentSpeedLeft) <= MAX_ACCEL)\n currentSpeedLeft = targetSpeedLeft;\n else {\n if (currentSpeedLeft < targetSpeedLeft)\n currentSpeedLeft += MAX_ACCEL;\n else\n currentSpeedLeft -= MAX_ACCEL;\n }\n }\n }\n\n }\n else \n {\n currentSpeedLeft = 0.0;\n }\n\n if( ((currentSpeedRight >= 0.0) && (targetSpeedRight >= 0.0)) ||\n ((currentSpeedRight <= 0.0) && (targetSpeedRight <= 0.0)))\n {\n if(Math.abs(currentSpeedRight) > Math.abs(targetSpeedRight))\n {\n currentSpeedRight = targetSpeedRight;\n }\n else\n {\n if (currentSpeedRight != targetSpeedRight) {\n if (Math.abs(targetSpeedRight - currentSpeedRight) <= MAX_ACCEL)\n currentSpeedRight = targetSpeedRight;\n else {\n if (currentSpeedRight < targetSpeedRight)\n currentSpeedRight += MAX_ACCEL;\n else\n currentSpeedRight -= MAX_ACCEL;\n }\n }\n }\n\n }\n else\n {\n currentSpeedRight = 0.0;\n }\n\n }\n */\n\n // replace acceleration limit because no longer needed\n currentSpeedLeft = targetSpeedLeft;\n currentSpeedRight = targetSpeedRight;\n\n robot.leftDriveMotor.setPower(currentSpeedLeft);\n robot.rightDriveMotor.setPower(currentSpeedRight);\n // robot.armMotor.setPower(currentSpeedArm);\n robot.liftMotor.setPower(currentLiftSpeed);\n\n\n if(gamepad1.a)\n {\n if (!aButtonHeld)\n {\n aButtonHeld = true;\n if (servoOpen) {\n servoOpen = false;\n robot.leftGrabServo.setPosition(LEFT_SERVO_CLOSED);\n robot.rightGrabServo.setPosition(RIGHT_SERVO_CLOSED);\n }\n else {\n servoOpen = true;\n robot.leftGrabServo.setPosition(LEFT_SERVO_OPEN);\n robot.rightGrabServo.setPosition(RIGHT_SERVO_OPEN);\n }\n }\n }\n else {\n aButtonHeld = false;\n }\n/*\n if(gamepad1.b)\n {\n if (!bButtonHeld)\n {\n bButtonHeld = true;\n reverseMode = !reverseMode;\n }\n }\n else\n {\n bButtonHeld = false;\n }\n\n*/\n if(gamepad1.y)\n {\n if (!yButtonHeld)\n {\n yButtonHeld = true;\n\n if(driveSpeed == MAX_SPEED) {\n driveSpeed = 0.3 * MAX_SPEED;\n slowMode = true;\n }\n else\n {\n driveSpeed = MAX_SPEED;\n slowMode = false;\n }\n }\n }\n else\n {\n yButtonHeld = false;\n }\n\n\n if(gamepad1.x)\n {\n if(!xButtonHeld)\n {\n xButtonHeld = true;\n\n if(servoUp){\n servoUp=false;\n robot.leftDragServo.setPosition(LEFT_DOWN);\n }\n else\n {\n servoUp=true;\n robot.leftDragServo.setPosition(LEFT_UP);\n }\n }\n }\n else\n {\n xButtonHeld = false;\n }\n\n telemetry.addData(\"reverse\", reverseMode);\n\n // telemetry.addData(\"currentLeft\", currentSpeedLeft);\n // telemetry.addData(\"currentRight\", currentSpeedRight);\n // telemetry.addData(\"currentArm\", currentSpeedArm);\n // telemetry.addData(\"currentLift\", currentLiftSpeed);\n telemetry.addData(\"encoderLeft\", robot.leftDriveMotor.getCurrentPosition());\n telemetry.addData(\"encoderRight\", robot.rightDriveMotor.getCurrentPosition());\n // telemetry.addData(\"reverseMode\", reverseMode);\n telemetry.addData(\"slowMode\", slowMode);\n telemetry.addData(\"Drag Servo\", robot.leftDragServo.getPosition());\n telemetry.addData(\"Touch Sensor\", robot.rearTouch.getState());\n }", "@Override\n public void loop() {\n\n double drive = gamepad1.left_stick_y;\n double strafe = gamepad1.left_stick_x;\n double rotate = -gamepad1.right_stick_x;\n\n findRobotPosition(); // Call Vuforia routines, get robot position\n\n // Intake Operator Actions\n if (gamepad1.a || gamepad1.b || gamepad1.x){ // Operator wants to control the intake\n if (gamepad1.a){ // A turns the intake on for bringing in rings\n intakeMotor.setPower(1);\n }\n else if (gamepad1.b) { // B reverses the intake\n intakeMotor.setPower(-1);\n\n } else if (gamepad1.x){ // X stops the intake\n intakeMotor.setPower(0);\n }\n }\n\n // Ring Shooter Operator Actions\n /*if (gamepad1.dpad_up || gamepad1.dpad_down){\n if (gamepad1.dpad_up) {\n if (ringVel <= 170000) {\n ringVel = ringVel + 10000;\n }\n } else if (gamepad1.dpad_down){\n if (ringVel >= 10000){\n ringVel = ringVel - 10000;\n } else{\n ringVel = 0;\n }\n }\n }\n */\n\n if (gamepad1.right_bumper){\n fireServo.setPosition(FIRE_SERVO);\n } else{\n fireServo.setPosition(STANDBY_SERVO);\n }\n if (gamepad1.left_trigger > 0.5){\n ringShooterMotor.setVelocity(ringVel);\n }else {\n ringShooterMotor.setPower(0);\n }\n\n // Wobble Goal acions here\n if (gamepad1.dpad_left || gamepad1.dpad_right || gamepad1.left_bumper){\n if(gamepad1.dpad_left){\n wobbleMotor.setTargetPosition(WOBBLE_GRAB);\n wobbleMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n wobbleMotor.setPower(.4);\n } else if (gamepad1.dpad_right){\n wobbleMotor.setTargetPosition(WOBBLE_CARRY);\n wobbleMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n wobbleMotor.setPower(.4);\n } else if (gamepad1.left_bumper) {\n wobbleMotor.setTargetPosition(WOBBLE_OVER_WALL);\n wobbleMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n wobbleMotor.setPower(.4);\n }\n }\n // Insert operator driving actions here\n if ((targetVisible) && (gamepad1.y)) {\n // Allow the operator to position the robot to shoot a ring if a target is visible\n alignRobotToShoot();\n }\n else {\n moveBot(drive, rotate, strafe, power); //Basic Robot-centric Frame Driving\n }\n\n // Telemetry Section\n //telemetry.addData(\"Ring Velocity\", ringVel);\n //telemetry.addData(\"Actual Velocity\", ringShooterMotor.getVelocity());\n telemetry.addData(\"Ring Motor Encoder\", ringShooterMotor.getCurrentPosition());\n telemetry.addData(\"Wobble Goal Encoder\", wobbleMotor.getCurrentPosition());\n telemetry.update();\n }", "public static void main(String[] args){\n Robot robot = new DifferentialWheels();\n\n // Get the time step of the current world.\n int timeStep = (int) Math.round(robot.getBasicTimeStep());\n\n // Get references to, and enable, all required devices on the robot.\n Lidar lidar = robot.getLidar(\"lms291\");\n lidar.enable(timeStep);\n lidar.enablePointCloud();\n\n GPS gps = robot.getGPS(\"gps\");\n gps.enable(timeStep);\n\n Emitter emitter = robot.getEmitter(\"emitter\");\n emitter.setChannel(0);\n\n Compass compass = robot.getCompass(\"compass\");\n compass.enable(timeStep);\n\n Motor frontLeft = robot.getMotor(\"front_left_wheel\");\n frontLeft.setPosition(Double.POSITIVE_INFINITY);\n Motor frontRight = robot.getMotor(\"front_right_wheel\");\n frontRight.setPosition(Double.POSITIVE_INFINITY);\n Motor backLeft = robot.getMotor(\"back_left_wheel\");\n backLeft.setPosition(Double.POSITIVE_INFINITY);\n Motor backRight = robot.getMotor(\"back_right_wheel\");\n backRight.setPosition(Double.POSITIVE_INFINITY);\n\n TestTurnPB turnPBController = new TestTurnPB(gps, compass, emitter, frontLeft, frontRight, backLeft, backRight);\n System.out.println(\"current param : \" + turnPBController.toString());\n\n //Initialise Start and Goal Coordinates\n robot.step(timeStep);\n turnPBController.updateObstacleReadings(lidar.getPointCloud());\n turnPBController.isRunning = true;\n turnPBController.initMetrics();\n turnPBController.initPositions();\n //potBugController.initAlgorithm();\n turnPBController.runInit();\n\n //Iteration Count\n int itCount = 0;\n\n while (robot.step(timeStep*100) != -1) {\n //Check max iteration\n //while (itCount<DEFAULT_MAX_ITERATION_COUNT){\n //Update Turn Angles\n turnPBController.updateAngles();\n\n //Update Sensor Information\n turnPBController.updateObstacleReadings(lidar.getPointCloud());\n\n //Check if goal is reached and terminate as appropriate\n if (turnPBController.isGoalReached()){\n turnPBController.isRunning = false;\n turnPBController.setRobotSpeed(0,0);\n turnPBController.terminatePotBug();\n System.out.println(\"Goal Reached Successfully!\");\n }\n\n if(!turnPBController.isGoalReached() && turnPBController.isRunning){\n //Check for goal direction on forwards semi-circle\n if (!turnPBController.isObstruction()){\n\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_GOAL);\n //Move 'freely' to the next sample point, towards goal\n turnPBController.updateMetrics();\n\n } else {\n\n if (turnPBController.isClearToLeave()){\n\n if (turnPBController.isProgressAttained() &&\n turnPBController.isClearToLeave()){\n\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_GOAL);\n turnPBController.updateMetrics();\n\n }\n } else {\n\n if (turnPBController.hitPoint == null){\n\n turnPBController.setHitPoint();\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_TOWARDS_CONTOUR);\n turnPBController.updateMetrics();\n\n } else {\n\n // engaged mode\n turnPBController.setDriveMode(DEFAULT_DRIVE_MODE_ALONG_CONTOUR);\n turnPBController.updateMetrics();\n\n }\n }\n }\n }\n //}\n }\n }", "@Override\n public void testPeriodic() {\n go_speed=-xbox_controller.getRawAxis(1);\n turn_speed=xbox_controller.getRawAxis(4);\n right_motor_2.set(-go_speed+turn_speed);\n left_motor_1.set(go_speed+turn_speed);\n\n while(xbox_controller.getRawButton(2)){\n double x = tx.getDouble(0.0);\n double a = ta.getDouble(0.0);\n if(a >= 1 && a <= 1.7){\n servo.set(0.26);\n if (x > -6 && x < 6){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 6 ){\n right_motor_2.set(0.15);\n left_motor_1.set(0.15);\n }\n else if ( x <= -6 ){\n right_motor_2.set(-0.15);\n left_motor_1.set(-0.15);\n }\n }\n else if(a>=0.8 && a<1){\n servo.set(0.35);\n if (x > -2.3 && x < 2.3){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 2.3 ){\n right_motor_2.set(0.11);\n left_motor_1.set(0.11);\n }\n else if ( x <= -2.3 ){\n right_motor_2.set(-0.11);\n left_motor_1.set(-0.11);\n }\n }\n else if(a>=0.5 && a<0.8){\n servo.set(0.5);\n if (x > -1.7 && x < 1.7){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 1.7 ){\n right_motor_2.set(0.08);\n left_motor_1.set(0.08);\n }\n else if ( x <= -1.7 ){\n right_motor_2.set(-0.08);\n left_motor_1.set(-0.08);\n }\n }\n else if(a>=0.3 && a<0.5){\n servo.set(0.32);\n if (x > -1.2 && x < 1.2){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 1.2 ){\n right_motor_2.set(0.05);\n left_motor_1.set(0.05);\n }\n else if ( x <= -1.2 ){\n right_motor_2.set(-0.05);\n left_motor_1.set(-0.05);\n }\n }\n else{}\n }\n\n if(xbox_controller.getRawAxis(2)!=0){\n ball_collection_motor.set(1);\n }\n else{\n ball_collection_motor.set(0);\n }\n\n while(joystick.getRawButton(5)){\n double a=ta.getDouble(0.0);\n if(a>=1&&a<=1.7){\n servo.set(0.26);\n }\n else if(a>=0.8 && a<1){\n servo.set(0.35);\n }\n else if(a>=0.5 && a<0.8){\n servo.set(0.5);\n }\n else if(a>=0.3 && a<0.5){\n servo.set(0.32);\n }\n else{}\n }\n\n while (joystick.getRawButton(6)) {\n double x = tx.getDouble(0.0);\n if ( x>-1 && x<1 ){\n right_motor_2.set(0);\n left_motor_1.set(0);\n if_correted=true;\n break;\n } \n else if ( x >= 1 ){\n right_motor_2.set(0.05);\n left_motor_1.set(0.05);\n }\n else if ( x <= -1 ){\n right_motor_2.set(-0.05);\n left_motor_1.set(-0.05);\n }\n else{}\n }\n\n if(xbox_controller.getRawButton(3)){\n System.out.println(currentServoAngle);\n servo.set(currentServoAngle + factor);\n currentServoAngle += factor;\n pushed = true;\n if(currentServoAngle >= 1 || (currentServoAngle <= 0 && pushed == true)){\n factor *= -1;\n } \n }\n \n \n //ball_collection_motor.set(xbox_controller.getRawAxis(2));//xbox rt\n if(xbox_controller.getRawAxis(3)!=0){\n while(xbox_controller.getRawAxis(3)){\n left_low_eject.set(ControlMode.PercentOutput, 1);\n right_low_eject.set(ControlMode.PercentOutput,-1);\n TimeUnit.SECONDS.sleep(0.5);\n left_belt.set(ControlMode.PercentOutput,-0.5);\n right_belt.set(ControlMode.PercentOutput,0.5);\n }\n }\n else{\n left_low_eject.set(ControlMode.PercentOutput,0);\n right_low_eject.set(ControlMode.PercentOutput,0);\n left_belt.set(ControlMode.PercentOutput,0);\n right_belt.set(ControlMode.PercentOutput,0);\n }\n if(xbox_controller.getRawButton(1)){\n double_solenoid_1.set(DoubleSolenoid.Value.kForward);\n }\n else if(xbox_controller.getRawButton(4)){\n double_solenoid_1.set(DoubleSolenoid.Value.kReverse);\n }\n if(xbox_controller.getRawButton(5)){\n right_motor_2.set(-0.1);\n left_motor_1.set(-0.1);\n }\n else if(xbox_controller.getRawButton(6)){\n right_motor_2.set(0.1);\n left_motor_1.set(0.1);\n }\n if(xbox_controller.getRawButton(8)){\n /*\n for(double speed=0;speed<=0.85;speed+=0.000002){\n left_high_eject.set(speed+0.2*(joystick.getRawAxis(3)-control_speed_init));\n } \n */\n if(high_eject_run==false){\n high_eject_run=true;\n eject_speed=0;\n }\n\n }\n\n if(xbox_controller.getRawButton(7)){\n left_high_eject.set(0);\n high_eject_run=false;\n eject_speed=0;\n }\n if(high_eject_run){\n if(eject_speed<=0.85){\n //System.out.println(123);\n eject_speed+=0.001;\n //System.out.println(eject_speed);\n left_high_eject.set(-eject_speed);\n }\n }\n\n \n }", "private void testServo(){\n\n if (gamepad1.y) {\n servoLeft.setDirection(Servo.Direction.REVERSE);\n servoLeft.setPosition(0.5);\n servoRight.setDirection(Servo.Direction.REVERSE);\n servoRight.setPosition(0.5);\n\n }\n if (gamepad1.x) {\n servoLeft.setDirection(Servo.Direction.FORWARD);\n servoLeft.setPosition(0.1);\n servoRight.setDirection(Servo.Direction.FORWARD);\n servoRight.setPosition(0.1);\n }\n //Should theoretically move the servo back and forth\n\n }", "@Override\n public void loop(){\n speedBT.ifPress(gamepad1.x);\n speedMode = speedBT.getMode() ? 0.8 : 0.5;\n speedBT.update(gamepad1.x);\n\n // Gets the speed, strafe, and turn of the robot and accounts for stick drifting\n double speed = gamepad1.left_stick_y;\n double strafe = -gamepad1.left_stick_x;\n double turn = gamepad1.right_stick_x;\n if (Math.abs(turn) < 0.2) {\n turn = 0;\n }\n if (Math.abs(strafe) < 0.2) {\n strafe = 0;\n }\n if (Math.abs(speed) < 0.2) {\n speed = 0;\n }\n\n // Drives in the inputted direction.\n MecanumDrive.Motor.Vector2D vector = new MecanumDrive.Motor.Vector2D(strafe, speed);\n drive.move(speedMode, vector, turn);\n\n // If not driving, check for turning in place or pure strafing\n if (turn == 0 && strafe == 0 && speed == 0) {\n if (gamepad1.left_bumper) {\n drive.strafeLeftWithPower(speedMode);\n } else if (gamepad1.right_bumper) {\n drive.strafeRightWithPower(speedMode);\n } else if (gamepad1.left_trigger > 0.2f) {\n drive.turnInPlace(gamepad1.left_trigger, false);\n } else if (gamepad1.right_trigger > 0.2f) {\n drive.turnInPlace(gamepad1.right_trigger, true);\n }\n }\n\n // Activate and deactivate pivot flywheels (toggles)\n flywheelBT.ifRelease(gamepad1.y);\n flywheelBT.update(gamepad1.y);\n\n // Determines if the flywheels spin, spin in reverse, or freeze\n if (flywheelBT.getMode()) {\n intake.spin();\n } else if (gamepad1.b) {\n intake.spinReverse();\n } else {\n intake.stopSpinning();\n }\n\n // Gets the elevator's movement inputs and accounts for stick drifting\n double elevatorHeight = -gamepad2.left_stick_y;\n double clawDistance = gamepad2.right_stick_y;\n if (Math.abs(elevatorHeight) < 0.2) {\n elevatorHeight = 0;\n }\n if (Math.abs(clawDistance) < 0.2) {\n clawDistance = 0;\n }\n\n // Moves the elevators and controls the claw and tray pullers\n elevatorOuttake.moveElevators(elevatorHeight, clawDistance);\n try {\n if (gamepad2.dpad_up) {\n elevatorOuttake2.grab();\n telemetry.addData(\"gamepad 2-up Pressed \", true);\n //elevatorOuttake.grabClamp();\n } else if (gamepad2.dpad_down) {\n elevatorOuttake2.release();\n telemetry.addData(\"gamepad2-down Pressed\", true);\n Thread.sleep(250);\n elevatorOuttake2.stop();\n }\n }\n catch (InterruptedException e){\n throw new RuntimeException(e);\n }\n\n // Raise or lower the tray pullers\n if(gamepad1.dpad_down){\n trayPuller.down();\n }\n if(gamepad1.dpad_up){\n trayPuller.up();\n }\n\n // Telemetry data\n telemetry.addData(\"Speed Mode\", speedBT.getMode() ? \"Fast\" : \"Slow\");\n telemetry.addData(\"Speed\", speed);\n telemetry.addData(\"Strafe\", strafe);\n telemetry.addData(\"Turn\", turn);\n telemetry.addData(\"Elevator Height\", elevatorHeight);\n telemetry.addData(\"Claw Distance\", clawDistance);\n telemetry.addData(\"Vertical Elevator Encoder\", elevatorOuttake.getVerticalEncoder());\n telemetry.addData(\"Horizontal Elevator Encoder\", elevatorOuttake.getHorizontalEncoder());\n }", "public void loop() {\n\n double driveMult = gamepad1.left_bumper ? 0.5 : (gamepad1.right_bumper ? 0.2 : 1.0);\n\n double x = gamepad1.left_stick_x;\n double y = gamepad1.left_stick_y;\n\n switch (state) {\n case DRIVE:\n left.setPower(driveMult * (y - x));\n right.setPower(driveMult * (y + x));\n break;\n case REVERSE:\n left.setPower(driveMult * -(y + x));\n right.setPower(driveMult * -(y - x));\n break;\n case TANK:\n left.setPower(driveMult * gamepad1.left_stick_y);\n right.setPower(driveMult * gamepad1.right_stick_y);\n break;\n }\n\n if (gamepad1.dpad_up) {\n state = State.DRIVE;\n } else if (gamepad1.dpad_down) {\n state = State.REVERSE;\n } else if (gamepad1.dpad_left) {\n state = State.TANK;\n }\n\n // AUX CONTROLS\n\n double auxMult = gamepad2.left_bumper ? 0.5 : (gamepad2.right_bumper ? 0.2 : 1.0);\n\n rack.setPower(auxMult * ((gamepad2.dpad_up ? 1 : 0) + (gamepad2.dpad_down ? -1 : 0)));\n\n // extend.setPower(auxMult * gamepad2.left_stick_y);\n slurp.setPower(auxMult * gamepad2.right_stick_y);\n\n\n// if (gamepad2.a) {\n// rack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n// rack.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);\n// }\n\n // TELEMETRY\n\n telemetry.addData(\"Drive Mode: \", state);\n telemetry.addData(\"Rack Encoder: \", rack.getCurrentPosition());\n telemetry.addData(\"G2 RS Y: \", gamepad2.right_stick_y);\n }", "public void updateController() {\n\t\tjoystickLXAxis = controller.getRawAxis(portJoystickLXAxis);\t\t//returns a value [-1,1]\n\t\tjoystickLYAxis = controller.getRawAxis(portJoystickLYAxis);\t\t//returns a value [-1,1]\n\t\tjoystickLPress = controller.getRawButton(portJoystickLPress);\t//returns a value {0,1}\n\t\t\n\t\t//right joystick update\n\t\tjoystickRXAxis = controller.getRawAxis(portJoystickRXAxis);\t\t//returns a value [-1,1]\n\t\tjoystickRYAxis = controller.getRawAxis(portJoystickRYAxis);\t\t//returns a value [-1,1]\n\t\tjoystickRPress = controller.getRawButton(portJoystickRPress);\t//returns a value {0,1}\n\t\t\n\t\t//trigger updates\n\t\ttriggerL = controller.getRawAxis(portTriggerL);\t\t//returns a value [0,1]\n\t\ttriggerR = controller.getRawAxis(portTriggerR);\t\t//returns a value [0,1]\n\t\t\n\t\t//bumper updates\n\t\tbumperL = controller.getRawButton(portBumperL);\t\t//returns a value {0,1}\n\t\tbumperR = controller.getRawButton(portBumperR);\t\t//returns a value {0,1}\n\t\t\n\t\t//button updates\n\t\tbuttonX = controller.getRawButton(portButtonX);\t\t//returns a value {0,1}\n\t\tbuttonY = controller.getRawButton(portButtonY);\t\t//returns a value {0,1}\n\t\tbuttonA = controller.getRawButton(portButtonA);\t\t//returns a value {0,1}\n\t\tbuttonB = controller.getRawButton(portButtonB);\t\t//returns a value {0,1}\n\t\t\n\t\tbuttonBack = controller.getRawButton(portButtonBack);\t//returns a value {0,1}\n\t\tbuttonStart = controller.getRawButton(portButtonStart);\t//returns a value {0,1}\n\t\t\n\t\t//toggle checks\n\t\ttankDriveBool = checkButton(buttonX, tankDriveBool, portButtonX);\t\t//toggles boolean if button is pressed\n\t\tfastBool = checkButton(buttonB, fastBool, portButtonB);\t\t\t\t\t//toggles boolean if button is pressed\n\t\t\n\t\t\n\t\t//d-pad/POV updates\n\t\tdPad = controller.getPOV(portDPad);\t\t//returns a value {-1,0,45,90,135,180,225,270,315}\n\n\t\t//d-pad/POV turns\n\t\tif (dPad != -1) {\n\t\t\tdPad = 360 - dPad; //Converts the clockwise dPad rotation into a Gyro-readable counterclockwise rotation.\n\t\t\trotateTo(dPad);\n\t\t}\n\t\t\n\t\tjoystickDeadZone();\n\t}", "@Override\n public void loop() {\n// double left;\n robot.colorDrop.setPosition(0.45);\n\n double Righty, Lefty, sideRight, sideLeft;\n double phaseUp;\n double phaseDown;\n boolean straffeL,straffeR,straffeL2,straffeR2;\n double turnR,turnL;\n double Righty2, Lefty2, sideRight2, sideLeft2;\n double phaseUp2;\n double phaseDown2;\n\n // Run wheels in tank mode (note: The joystick goes negative when pushed forwards, so negate it)\n Lefty = gamepad1.right_stick_y;\n Righty = gamepad1.left_stick_y;\n sideRight= gamepad1.left_stick_x;\n sideLeft=gamepad1.right_stick_x;\n phaseUp = gamepad2.right_trigger;\n phaseDown = gamepad2.left_trigger;\n straffeL = gamepad1.right_bumper;\n straffeR = gamepad1.left_bumper;\n straffeL2 = gamepad2.right_bumper;\n straffeR2 = gamepad2.left_bumper;\n //turnL = gamepad1.left_trigger;\n //turnR= gamepad1.left_trigger;\n\n Lefty2 = gamepad1.right_stick_y;\n Righty2 = gamepad1.left_stick_y;\n sideRight2= gamepad1.left_stick_x;\n sideLeft2=gamepad1.right_stick_x;\n //phaseUp2 = gamepad1.right_trigger;\n //phaseDown2 = gamepad1.left_trigger;\n\n\n\n\n if(sideRight!=0&&sideLeft<0) {\n robot.leftFrontDrive.setPower(sideLeft);\n robot.rightFrontDrive.setPower(sideLeft);\n robot.leftRearDrive.setPower(sideLeft * -1);\n robot.rightRearDrive.setPower(sideLeft);\n }\n else if(sideRight!=0&&sideLeft>0)\n {\n robot.leftFrontDrive.setPower(sideLeft);\n robot.rightFrontDrive.setPower(sideLeft*-1);\n robot.leftRearDrive.setPower(sideLeft);\n robot.rightRearDrive.setPower(sideLeft);\n }\n else if(sideLeft!=0)\n {\n robot.leftFrontDrive.setPower(sideLeft);\n robot.rightFrontDrive.setPower(sideLeft*-1);\n robot.leftRearDrive.setPower(sideLeft*-1);\n robot.rightRearDrive.setPower(sideLeft);\n\n }\n else if(Righty<0&&sideRight<0)\n {\n robot.leftFrontDrive.setPower(-.5);\n robot.rightFrontDrive.setPower(-.9);\n robot.leftRearDrive.setPower(-.5);\n robot.rightRearDrive.setPower(-.9);\n }\n else if(Righty<0&&sideRight>0) {\n robot.leftFrontDrive.setPower(-.9);\n robot.rightFrontDrive.setPower(-.5);\n robot.leftRearDrive.setPower(-.9);\n robot.rightRearDrive.setPower(-.5);\n }\n else if(Righty==0&&sideRight!=0)\n {\n robot.leftFrontDrive.setPower(sideRight*-.7);\n robot.rightFrontDrive.setPower(sideRight*.7);\n robot.leftRearDrive.setPower(sideRight*-.7);\n robot.rightRearDrive.setPower(sideRight*.7);\n }\n else if(Righty<0&&sideRight==0)\n {\n robot.leftFrontDrive.setPower(Righty);\n robot.rightFrontDrive.setPower(Righty);\n robot.leftRearDrive.setPower(Righty);\n robot.rightRearDrive.setPower(Righty);\n\n }\n else if(Righty>0)\n {\n robot.leftFrontDrive.setPower(Righty);\n robot.rightFrontDrive.setPower(Righty);\n robot.leftRearDrive.setPower(Righty);\n robot.rightRearDrive.setPower(Righty);\n\n }\n else if(Lefty!=0&&sideLeft==0)\n {\n robot.leftFrontDrive.setPower(Lefty);\n robot.rightFrontDrive.setPower(Lefty);\n robot.leftRearDrive.setPower(Lefty);\n robot.rightRearDrive.setPower(Lefty);\n }\n else if(straffeL==true||straffeL2==true)\n {\n robot.leftFrontDrive.setPower(.2);\n robot.rightFrontDrive.setPower(-.2);\n robot.leftRearDrive.setPower(-.2);\n robot.rightRearDrive.setPower(.2);\n }\n\n else if(straffeR==true||straffeR2==true)\n {\n robot.leftFrontDrive.setPower(-.2);\n robot.rightFrontDrive.setPower(.2);\n robot.leftRearDrive.setPower(.2);\n robot.rightRearDrive.setPower(-.2);\n }\n else\n {\n robot.leftFrontDrive.setPower(0);\n robot.rightFrontDrive.setPower(0);\n robot.leftRearDrive.setPower(0);\n robot.rightRearDrive.setPower(0);\n\n }\n\n\n ///player 1\n if ((phaseDown >0)) {\n robot.leftStageOne.setPower(1);\n robot.rightStageOne.setPower(1);\n }\n\n else if ((phaseUp >0)) {\n robot.leftStageOne.setPower(-1);\n robot.rightStageOne.setPower(-1);\n }\n\n else {\n robot.rightStageOne.setPower(0);\n robot.leftStageOne.setPower(0);\n }\n\n/*\n if (gamepad1.y){\n robot.leftStageTwo.setPosition(1);\n robot.rightStageTwo.setPosition(0.1);\n }\n if(gamepad1.x)\n {\n robot.leftStageTwo.setPosition(.4);\n robot.rightStageTwo.setPosition(.7);\n }\n if (gamepad1.a){\n robot.leftStageTwo.setPosition(0.12);\n robot.rightStageTwo.setPosition(.98);\n }\n */\n if(gamepad1.a) {\n robot.align.setPosition(.57);\n }\n if(gamepad1.x)\n {\n robot.align.setPosition(0.95);\n }\n if (gamepad1.b){\n robot.colorDrop.setPosition(.35);\n }\n\n\n\n\n if (gamepad2.a){\n // robot.leftStageTwo.setPosition(1);\n // robot.rightStageTwo.setPosition(0.1);\n }\n if(gamepad2.x)\n {\n // robot.leftStageTwo.setPosition(.4);\n // robot.rightStageTwo.setPosition(.7);\n }\n if (gamepad2.y){//lift up\n // robot.leftStageTwo.setPosition(0.12);\n //robot.rightStageTwo.setPosition(.98);\n }\n if (gamepad2.b){\n robot.colorDrop.setPosition(.35);\n }\n\n\n\n\n\n\n /*\n if (gamepad1.right_bumper == true){\n // robot.leftBumper.setPosition(robot.leftBumper.getPosition()+.05);\n sleep(2000);\n }\n else if (gamepad1.left_bumper == true){\n /// robot.leftBumper.setPosition(robot.leftBumper.getPosition()-.05);\n\n }\n else{\n ///robot.leftBumper.setPosition(robot.leftBumper.getPosition());\n }\n */\n /*\n\n */\n // if (gamepad2.dpad_down){\n // robot.relicServo.setPosition(robot.relicServo.getPosition()+.025);\n // }\n //else if(gamepad2.dpad_up){\n // robot.relicServo.setPosition(robot.relicServo.getPosition()-.025);\n // }\n // else{\n // robot.relicServo.setPosition(robot.relicServo.getPosition());\n //}\n\n// if (gamepad2.dpad_left){\n // robot.relicDropperServo.setPosition(robot.relicDropperServo.getPosition()+.025);\n // }\n // else if (gamepad2.dpad_right){\n // robot.relicDropperServo.setPosition(robot.relicDropperServo.getPosition()-.025);\n // }\n // else {\n // robot.relicDropperServo.setPosition(robot.relicDropperServo.getPosition());\n //}\n // if (gamepad2.left_trigger>5){\n // robot.relicMotor.setPower(.5);\n // }\n //else if (gamepad2.left_bumper){\n // robot.relicMotor.setPower(-.5);\n //}\n //else{\n // robot.relicMotor.setPower(0);\n // }\n\n // Send telemetry message to signify robot running;\n // telemetry.addData(\"claw\", \"Offset = %.2f\", clawOffset);\n // telemetry.addData(\"sideright\", \"%.2f\", sideRight);\n // telemetry.addData(\"right\", \"%.2f\", Left);\n // telemetry.addData(\"sideright\", \"%.2f\", sideRight);\n // telemetry.addData(\"left\", \"%.2f\", sideLeft);\n/*\n //distance = robot.sensorDistance.getDistance(DistanceUnit.CM);\n // send the info back to driver station using telemetry function.\n telemetry.addData(\"Distance (cm)\",\n String.format(Locale.US, \"%.02f\", robot.sensorDistance.getDistance(DistanceUnit.CM)));\n telemetry.addData(\"Alpha\", robot.sensorColor.alpha());\n telemetry.addData(\"Red \", robot.sensorColor.red());\n telemetry.addData(\"Green\", robot.sensorColor.green());\n telemetry.addData(\"Blue \", robot.sensorColor.blue());\n */\n telemetry.addData(\"phaseUp \", phaseUp);\n telemetry.addData(\"sideRight \", sideRight);\n // telemetry.addData(\"right bumper: \", robot.rightBumper.getPosition());\n // telemetry.addData(\"left bumper: \", robot.leftBumper.getPosition());\n telemetry.update();\n }", "public AutoBounce(DriveTrain driveTrain) {\n // Add your commands in the addCommands() call, e.g.\n // addCommands(new FooCommand(), new BarCommand());\n addCommands(\n new BounceP1(driveTrain),\n new BounceP2(driveTrain),\n new BounceP3(driveTrain).withTimeout(0.9),\n new BounceP4(driveTrain),\n new BounceP5(driveTrain).withTimeout(0.8),\n new BounceP6(driveTrain).withTimeout(1.25),\n new BounceP7(driveTrain),\n new BounceP8(driveTrain).withTimeout(0.95),\n new BounceP9(driveTrain)\n );\n }", "@Override\n public void loop() {\n // Setup a variable for each drive wheel to save power level for telemetry\n double leftDrivePower;\n double rightDrivePower;\n double driveMultiplier;\n double slowMultiplier;\n double fastMultiplier;\n double BASE_DRIVE_SPEED = 0.6;\n double elevPower;\n double armPower;\n boolean lowerLimitPressed;\n boolean upperLimitPressed;\n\n\n\n\n // Tank Mode uses one stick to control each wheel.\n // - This requires no math, but it is hard to drive forward slowly and keep straight.\n armPower = -gamepad2.right_stick_x * 0.3;\n\n lowerLimitPressed = !lowerLimit.getState();\n upperLimitPressed = !upperLimit.getState();\n\n if((lowerLimitPressed && -gamepad2.left_stick_y < 0) || (upperLimitPressed && -gamepad2.left_stick_y > 0)){\n elevPower = 0;\n }\n else {\n elevPower = -gamepad2.left_stick_y * 1;\n }\n\n if (gamepad2.left_bumper){\n hookPosDeg = HOOK_UP;\n }\n else if (gamepad2.left_trigger > 0){\n hookPosDeg = HOOK_DOWN;\n }\n\n if (gamepad2.right_bumper){\n clawPosDeg = CLAW_OPEN;\n }\n else if (gamepad2.right_trigger > 0){\n clawPosDeg = CLAW_CLOSED;\n }\n\n if (gamepad1.left_trigger > 0){\n slowMultiplier = 0.10;\n }\n else\n slowMultiplier = 0;\n\n if (gamepad1.right_trigger > 0){\n fastMultiplier = 0.30;\n }\n else\n fastMultiplier = 0;\n\n driveMultiplier = BASE_DRIVE_SPEED + slowMultiplier + fastMultiplier;\n leftDrivePower = -gamepad1.left_stick_y * driveMultiplier;\n rightDrivePower = -gamepad1.right_stick_y * driveMultiplier;\n\n // Send power to actuators\n leftDrive.setPower(leftDrivePower);\n rightDrive.setPower(rightDrivePower);\n elev.setPower(elevPower);\n// arm.setTargetPosition(armTarget);\n// arm.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n arm.setPower(armPower);\n hookPos = map(hookPosDeg, HOOK_MIN_POS_DEG, HOOK_MAX_POS_DEG, HOOK_MIN_POS, HOOK_MAX_POS);\n clawPos = map(clawPosDeg, CLAW_MIN_POS_DEG, CLAW_MAX_POS_DEG, CLAW_MIN_POS, CLAW_MAX_POS);\n hook.setPosition(hookPos);\n claw.setPosition(clawPos);\n\n // Show the elapsed game time and wheel power.\n telemetry.addData(\"Status\", \"Run Time: \" + runtime.toString());\n telemetry.addData(\"Drive\", \"left (%.2f), right (%.2f)\", leftDrivePower, rightDrivePower);\n telemetry.addData( \"Elev\", \"power (%.2f)\", elevPower);\n telemetry.addData(\"Limit\", \"lower (%b), upper (%b)\", lowerLimitPressed, upperLimitPressed);\n telemetry.addData(\"Arm Enc\", arm.getCurrentPosition());\n\n }", "public void liftArm(){armLifty.set(-drivePad.getThrottle());}", "public void strafe(double speed, boolean angle, double inches, double timeout){\n int newLeftTarget;\n int newRightTarget;\n int newLeftBottomTarget;\n int newRightBottomTarget;\n if (opModeIsActive()) {\n if (angle) {\n //strafe right\n // Determine new target position, and pass to motor controller\n newLeftTarget = robot.leftFrontMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n newLeftBottomTarget = robot.leftBackMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n newRightTarget = robot.rightFrontMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n newRightBottomTarget = robot.rightBackMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n robot.leftFrontMotor.setTargetPosition(newLeftTarget);\n robot.leftBackMotor.setTargetPosition(newLeftBottomTarget);\n robot.rightFrontMotor.setTargetPosition(newRightTarget);\n robot.rightBackMotor.setTargetPosition(newRightBottomTarget);\n\n // Turn On RUN_TO_POSITION\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // reset the timeout time and start motion.\n runtime.reset();\n robot.leftFrontMotor.setPower(Math.abs(speed));\n robot.rightFrontMotor.setPower(Math.abs(speed));\n robot.leftBackMotor.setPower(Math.abs(speed));\n robot.rightBackMotor.setPower(Math.abs(speed));\n\n // keep looping while we are still active, and there is time left, and both motors are running.\n // Note: We use (isBusy() && isBusy()) in the loop test, which means that when EITHER motor hits\n // its target position, the motion will stop. This is \"safer\" in the event that the robot will\n // always end the motion as soon as possible.\n // However, if you require that BOTH motors have finished their moves before the robot continues\n // onto the next step, use (isBusy() || isBusy()) in the loop test.\n\n while (opModeIsActive() &&\n (runtime.seconds() < timeout) &&\n (robot.leftFrontMotor.isBusy() && robot.rightFrontMotor.isBusy())) {\n\n // Display it for the driver.\n telemetry.addData(\"Path1\", \"Running to %7d :%7d\", newLeftTarget, newRightTarget);\n telemetry.addData(\"Path2\", \"Running at %7d :%7d\",\n robot.leftFrontMotor.getCurrentPosition(),\n robot.rightFrontMotor.getCurrentPosition(), robot.leftBackMotor.getCurrentPosition(), robot.rightBackMotor.getCurrentPosition());\n telemetry.update();\n }\n // Stop all motion;\n robot.rightFrontMotor.setPower(0);\n robot.rightBackMotor.setPower(0);\n robot.leftFrontMotor.setPower(0);\n robot.leftBackMotor.setPower(0);\n\n // Turn off RUN_TO_POSITION\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n\n } else if (!angle) {\n //strafe left\n // Determine new target position, and pass to motor controller\n newLeftTarget = robot.leftFrontMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n newLeftBottomTarget = robot.leftBackMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n newRightTarget = robot.rightFrontMotor.getCurrentPosition() + (int)(Math.abs(inches) * COUNTS_PER_INCH);\n newRightBottomTarget = robot.rightBackMotor.getCurrentPosition() + (int)(-Math.abs(inches) * COUNTS_PER_INCH);\n robot.leftFrontMotor.setTargetPosition(newLeftTarget);\n robot.leftBackMotor.setTargetPosition(newLeftBottomTarget);\n robot.rightFrontMotor.setTargetPosition(newRightTarget);\n robot.rightBackMotor.setTargetPosition(newRightBottomTarget);\n\n // Turn On RUN_TO_POSITION\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n // reset the timeout time and start motion.\n runtime.reset();\n robot.leftFrontMotor.setPower(Math.abs(speed));\n robot.rightFrontMotor.setPower(Math.abs(speed));\n robot.leftBackMotor.setPower(Math.abs(speed));\n robot.rightBackMotor.setPower(Math.abs(speed));\n\n // keep looping while we are still active, and there is time left, and both motors are running.\n // Note: We use (isBusy() && isBusy()) in the loop test, which means that when EITHER motor hits\n // its target position, the motion will stop. This is \"safer\" in the event that the robot will\n // always end the motion as soon as possible.\n // However, if you require that BOTH motors have finished their moves before the robot continues\n // onto the next step, use (isBusy() || isBusy()) in the loop test.\n\n while (opModeIsActive() &&\n (runtime.seconds() < timeout) &&\n (robot.leftFrontMotor.isBusy() && robot.rightFrontMotor.isBusy())) {\n\n // Display it for the driver.\n telemetry.addData(\"Path1\", \"Running to %7d :%7d\", newLeftTarget, newRightTarget);\n telemetry.addData(\"Path2\", \"Running at %7d :%7d\",\n robot.leftFrontMotor.getCurrentPosition(),\n robot.rightFrontMotor.getCurrentPosition(), robot.leftBackMotor.getCurrentPosition(), robot.rightBackMotor.getCurrentPosition());\n telemetry.update();\n }\n // Stop all motion;\n robot.rightFrontMotor.setPower(0);\n robot.rightBackMotor.setPower(0);\n robot.leftFrontMotor.setPower(0);\n robot.leftBackMotor.setPower(0);\n\n // Turn off RUN_TO_POSITION\n robot.rightFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.rightBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.leftBackMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }\n }\n }", "public void move(Joystick joystick)\n {\n double joystickY = joystick.getRawAxis(OIConstants.ELEVATOR_JOYSTICK_Y);\n\n if (Math.abs(joystickY) > OIConstants.ELEVATOR_JOYSTICK_DEADZONE)\n {\n Robot.elevator.setTarget((int)(Robot.elevator.getTarget() + joystickY * Constants.ELEVATOR_SPEED_NORMAL));\n }\n else\n {\n Robot.elevator.setTarget(Robot.elevator.getTarget());\n }\n\n // if the limit switch for level 1 is hit then rumble the controller\n if (!Robot.elevator.isLevel1LimitClosed())\n {\n Robot.oi.mechJoystick.setRumble(RumbleType.kLeftRumble, 0.5);\n Robot.oi.mechJoystick.setRumble(RumbleType.kRightRumble, 0.5);\n }\n else\n {\n Robot.oi.mechJoystick.setRumble(RumbleType.kLeftRumble, 0);\n Robot.oi.mechJoystick.setRumble(RumbleType.kRightRumble, 0);\n }\n }", "public void testPeriodic() { \n joystick1X = leftStick.getAxis(Joystick.AxisType.kX);\n joystick1Y = leftStick.getAxis(Joystick.AxisType.kY);\n joystick2X = rightStick.getAxis(Joystick.AxisType.kX);\n joystick2Y = rightStick.getAxis(Joystick.AxisType.kY);\n \n mapped1Y = joystick1Y/2 + 0.5;\n mapped1X = joystick1X/2 + 0.5;\n mapped2X = joystick2X/2 + 0.5;\n mapped2Y = joystick2Y/2 + 0.5;\n \n X1testServo.set(mapped1X);\n Y1testServo.set(mapped1Y);\n X2testServo.set(mapped2X);\n Y2testServo.set(mapped2Y);\n \n \n //System.out.println(\"X Servo Value = \" + XtestServo.get());\n //System.out.println(\"Left Joystick X Value = \" + leftStick.getX());\n //System.out.println(\"Y Servo Value = \" + YtestServo.get());\n //System.out.println(\"Left Joystick Y Value = \" + leftStick.getY());\n \n \n }", "public void up() {\n double speed = RobotContainer.m_BlackBox.getPotValueScaled(Constants.OIConstants.kControlBoxPotY, 0.0, 1.0);\n m_hook.set(speed);\n SmartDashboard.putNumber(\"forward speed\", speed);\n }", "public void autonomous() {\n robot.drive(0.5); //Drives in a square\n Timer.delay(0.5);\n robot.tankDrive(0.5, -0.5);\n Timer.delay(0.25);\n robot.drive(0.5);\n Timer.delay(0.5);\n robot.tankDrive(0.5, -0.5);\n Timer.delay(0.25);\n robot.drive(0.5);\n Timer.delay(0.5);\n robot.tankDrive(0.5, -0.5);\n Timer.delay(0.25);\n robot.drive(0.5);\n Timer.delay(0.5);\n robot.tankDrive(0.5, -0.5);\n Timer.delay(0.25);\n }", "@Override\r\n public void loop() {\r\n double G1rightStickY = Math.pow(gamepad1.right_stick_y, 3);\r\n double G1leftStickY = Math.pow(gamepad1.left_stick_y, 3);\r\n boolean G1rightBumper = gamepad1.right_bumper; //strafe right\r\n boolean G1leftBumper = gamepad1.left_bumper; //strafe left\r\n //Methods methods = new Methods();\r\n double G2rightStickY=-gamepad2.right_stick_y;\r\n double G2leftStickY=-gamepad2.left_stick_y;\r\n boolean G2rightBumper=gamepad2.right_bumper;\r\n boolean G2leftBumper=gamepad2.left_bumper;\r\n\r\n\r\n\r\n\r\n\r\n\r\n //Right Strafe\r\n if (G1leftBumper)\r\n {\r\n robot.leftFrontMotor.setPower(-1);\r\n robot.rightFrontMotor.setPower(-1);\r\n robot.leftBackMotor.setPower(1);\r\n robot.rightBackMotor.setPower(1);\r\n }\r\n //Left Strafe\r\n else if (G1rightBumper)\r\n {\r\n robot.leftFrontMotor.setPower(1);\r\n robot.rightFrontMotor.setPower(1);\r\n robot.leftBackMotor.setPower(-1);\r\n robot.rightBackMotor.setPower(-1);\r\n }\r\n\r\n //Forward and Backward\r\n else\r\n {\r\n robot.leftFrontMotor.setPower(-G1leftStickY);\r\n robot.leftBackMotor.setPower(-G1leftStickY);\r\n robot.rightFrontMotor.setPower(G1rightStickY);\r\n robot.rightBackMotor.setPower(G1rightStickY);\r\n }\r\n\r\n if(gamepad2.a){\r\n robot.lift.setPower(1);\r\n\r\n } else if(gamepad2.y){\r\n robot.lift.setPower(-1);\r\n\r\n }else {\r\n robot.lift.setPower(0);\r\n }\r\n\r\n\r\n if (gamepad2.left_bumper){\r\n robot.claw.setPosition(1);\r\n\r\n\r\n }\r\n\r\n if (gamepad2.right_bumper){\r\n robot.claw.setPosition(0);\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n // Use gamepad buttons to move the arm up (Y) and down (A)\r\n //if (gamepad2.y)\r\n // robot.lift.setPower(robot.ARM_UP_POWER);\r\n //else if (gamepad2.a)\r\n // robot.lift.setPower(robot.ARM_DOWN_POWER);\r\n //else\r\n // robot.lift.setPower(0.0);\r\n\r\n // Send telemetry message to signify robot running;\r\n //telemetry.addData(\"claw\", \"Offset = %.2f\", clawOffset);\r\n //telemetry.addData(\"left\", \"%.2f\", left);\r\n //telemetry.addData(\"right\", \"%.2f\", right);\r\n }", "@Override\n public void robotPeriodic() {\n /*count++;\n\n if (count < 0) {\n count = 0;\n }\n\n int scriptIdx = count / SCRIPT_LENGTH;\n\n String[] script = LED_SCRIPTS[scriptIdx % (LED_SCRIPTS.length)];\n\n LedScript.setString(script[0]);\n \n if (script.length > 1) {\n LedScriptArgument.setString(script[1]);\n }*/\n\n // Hatch 0 has to be inverted because it is normally closed\n //SmartDashboard.putBoolean(\"HatchSwitch0\", !HatchSwitch0.get());\n //SmartDashboard.putBoolean(\"HatchSwitch1\", HatchSwitch1.get());\n\n //for (int i = 0; i < limits.length; i++) {\n // SmartDashboard.putBoolean(\"Switch\" + (i + 2), limits[i].get());\n //}\n\n\n final int MAX_TEMP = 100;\n if (MainLeft.getMotorTemperature() >= MAX_TEMP || AltLeft.getMotorTemperature() >= MAX_TEMP) {\n xbox.setRumble(RumbleType.kLeftRumble, 0.5);\n } else {\n xbox.setRumble(RumbleType.kLeftRumble, 0);\n }\n \n if (MainRight.getMotorTemperature() >= MAX_TEMP || AltRight.getMotorTemperature() >= MAX_TEMP) {\n xbox.setRumble(RumbleType.kRightRumble, 0.5);\n } else {\n xbox.setRumble(RumbleType.kRightRumble, 0);\n }\n\n //SmartDashboard.putNumber(\"DaTa\", NetworkTableInstance.getDefault().getTable(\"VisionTable\").getEntry(\"THIS IS A RANDOM NUMBER\").getNumber(-1).doubleValue());\n //SmartDashboard.putNumber(\"LiftSetpoint\", LiftSetpoint);\n //SmartDashboard.putNumber(\"LiftEncoderPos\", Lifter.getSelectedSensorPosition());\n //SmartDashboard.putNumber(\"LiftVoltageOut\", Lifter.getMotorOutputVoltage());\n //SmartDashboard.putNumber(\"LiftCurrentOut\", Lifter.getOutputCurrent());\n //SmartDashboard.putString(\"ControlMode\", Lifter.getControlMode().toString());\n //SmartDashboard.putNumber(\"ClosedLoopError\", Lifter.getClosedLoopError());\n //SmartDashboard.putNumber(\"LiftRampOutput\", liftRamp.getOutput());\n\n /*Diagnostics.writeDouble(\"DrivePosLeft\", MainLeft.getEncoder().getPosition());\n Diagnostics.writeDouble(\"DrivePosRight\", MainRight.getEncoder().getPosition());\n Diagnostics.writeDouble(\"DrivePosLeftAlt\", AltLeft.getEncoder().getPosition());\n Diagnostics.writeDouble(\"DrivePosRightAlt\", AltRight.getEncoder().getPosition());\n Diagnostics.writeDouble(\"LiftVoltageOut\", Lifter.getMotorOutputVoltage());\n Diagnostics.writeDouble(\"LiftCurrentOut\", Lifter.getOutputCurrent());\n Diagnostics.writeInteger(\"LiftEncoderPos\", Lifter.getSelectedSensorPosition());\n Diagnostics.writeInteger(\"LiftSetpoint\", LiftSetpoint);\n Diagnostics.writeInteger(\"LiftRampOutput\", liftRamp.getOutput());\n \n Diagnostics.timestamp();*/\n }", "@Override\n public void loop() {\n telemetry.addData(\"Status\", \"Running\"); //inform the driver\n\n //Calculate the power to set to each motor\n\n //left side you subtract right_stick_x\n double FrontLeftVal = (gamepad1.left_stick_y - gamepad1.left_stick_x - gamepad1.right_stick_x) * Power; //front subtract left_stick_x\n double BackLeftVal = (gamepad1.left_stick_y + gamepad1.left_stick_x - gamepad1.right_stick_x) * Power; //back subtract left_stick_x\n\n //right side you add right_stick_x\n double FrontRightVal = (gamepad1.left_stick_y + gamepad1.left_stick_x + gamepad1.right_stick_x) * Power; //front add left_stick_x\n double BackRightVal = (gamepad1.left_stick_y - gamepad1.left_stick_x + gamepad1.right_stick_x) * Power; //back subtract left_stick_x\n\n FLM.setPower(FrontLeftVal); //set the power to the motor\n FRM.setPower(FrontRightVal);\n BLM.setPower(BackLeftVal);\n BRM.setPower(BackRightVal);\n\n if (gamepad1.y) {\n if (!YPressed1) {\n YPressed1 = true;\n if (DragArm.getPosition() < DragArmDownPosition) {\n DragArm.setPosition(DragArmDownPosition);\n } else {\n DragArm.setPosition(DragArmRestPosition);\n }\n }\n } else if (YPressed1) YPressed1 = false;\n\n if (gamepad2.a) {\n SetLiftPosition(Position1Inches);\n } else if (gamepad2.b) {\n SetLiftPosition(Position2Inches);\n } else if (gamepad2.y) {\n SetLiftPosition(Position3Inches);\n } else if (gamepad2.left_bumper) {\n if (UpLift.getCurrentPosition() >= Position1Inches * UpInchesToTicks) {\n SetLiftPosition(UpLift.getCurrentPosition() - 756);\n } else {\n SetLiftPosition(Position0Inches);\n }\n } else {\n UpLift.setPower(0);\n }\n\n if (gamepad2.left_trigger == 1) {\n if (!LeftTrigger2) {\n LeftTrigger2= true;\n if (LiftGrab.getPosition() != LiftGrabGrabPosition)\n LiftGrab.setPosition(LiftGrabGrabPosition);\n else LiftGrab.setPosition(LiftGrabRestPosition);\n }\n } else if (LeftTrigger2) LeftTrigger2= false;\n\n if (gamepad2.right_trigger == 1) {\n if (!RightTrigger2) {\n RightTrigger2 = true;\n if (UpLift.getCurrentPosition() > Position2Inches) {\n if (LiftSwivel.getPosition() != LiftSwivelRestPosition)\n LiftSwivel.setPosition(LiftSwivelRestPosition);\n else LiftSwivel.setPosition(LiftSwivelOutPosition);\n }\n }\n } else if (RightTrigger2) RightTrigger2 = false;\n\n if (gamepad1.b) {\n if (!BPressed1) {\n BPressed1 = true;\n if (BigSuck.getPower() == BigSuckPower) {\n SmallSuck.setPower(0);\n BigSuck.setPower(0);\n\n DragArm.setPosition(DragArmRestPosition);\n } else {\n BigSuck.setPower(BigSuckPower);\n SmallSuck.setPower(SmallSuckPower);\n DragArm.setPosition(DragArmUpPosition);\n }\n }\n } else if (BPressed1) BPressed1 = false;\n\n if (gamepad1.x) {\n if (!XPressed1) {\n XPressed1 = true;\n if (BigSuck.getPower() == -BigSuckPower) {\n BigSuck.setPower(0);\n SmallSuck.setPower(0);\n } else {\n BigSuck.setPower(-BigSuckPower);\n SmallSuck.setPower(-SmallSuckPower);\n }\n }\n } else if (XPressed1) XPressed1 = false;\n\n if (gamepad1.a) {\n if (!A1) {\n A1 = true;\n if (Push.getPosition() == PushRestPosition) {\n Push.setPosition(PushPushPosition);\n } else {\n Push.setPosition(PushRestPosition);\n }\n }\n } else if (A1) A1 = false;\n\n telemetry.addData(\"Up Position\", UpLift.getCurrentPosition());\n telemetry.update(); //update the telemetry\n }", "@Override\n public void loop() {\n // Controller 1\n double leftStick;\n double rightStick;\n double leftTrigger;\n double rightTrigger;\n boolean g1xSlowSwitch = false;\n\n // Controller 2\n double leftStick2;\n\n // CONTROLLER 1: Assign variables to stick and trigger\n\n // leftstick, rightstick, lefttrigger, righttrigger without numbers is for controller one\n if(!g1xSlowSwitch) {\n leftStick = gamepad1.left_stick_y * .25;\n rightStick = gamepad1.right_stick_y * .25;\n leftTrigger = gamepad1.left_trigger * .25;\n rightTrigger = gamepad1.right_trigger * .25;\n } else {\n leftStick = gamepad1.left_stick_y * .15;\n rightStick = gamepad1.right_stick_y * .15;\n leftTrigger = gamepad1.left_trigger * .15;\n rightTrigger = gamepad1.right_trigger * .15;\n }\n\n // SLOW-DOWN TOGGLE with 'x'\n if(gamepad1.x) {\n g1xSlowSwitch = !g1xSlowSwitch;\n }\n\n // CONTROLLER 2: Assign variables to stick, triggers, and button\n leftStick2 = gamepad2.left_stick_y;\n\n // display statements\n telemetry.addData(\"LEFT STICK VALUE: \",leftStick);\n telemetry.addData(\"RIGHT STICK VALUE: \",rightStick);\n telemetry.addData(\"LEFT TRIGGER POWER: \",leftTrigger);\n telemetry.addData(\"RIGHT TRIGGER POWER: \",rightTrigger);\n\n telemetry.addData(\"LEFT STICK 2 VALUE: \",leftStick2);\n telemetry.addData(\"GRIPPER BUTTON STATUS: \", gamepad2.a);\n\n // If the triggers are being pushed\n if(leftTrigger > 0 || rightTrigger > 0) {\n if (leftTrigger > 0) {\n robot.frontLeft.setPower(leftTrigger);\n robot.backLeft.setPower(-leftTrigger);\n robot.frontRight.setPower(-leftTrigger);\n robot.backRight.setPower(leftTrigger);\n } else if (rightTrigger > 0) {\n robot.frontLeft.setPower(-rightTrigger);\n robot.backLeft.setPower(rightTrigger);\n robot.frontRight.setPower(rightTrigger);\n robot.backRight.setPower(-rightTrigger);\n }\n } else {\n // movement with sticks\n robot.frontLeft.setPower(leftStick);\n robot.backLeft.setPower(leftStick);\n robot.backRight.setPower(rightStick);\n robot.frontRight.setPower(rightStick);\n }\n\n //Controller 2 Code:\n //If left stick is being moved\n if (leftStick2 != 0 ){\n robot.lift.setPower(leftStick2*.25);\n // If left stick is not being moved\n } else if(leftStick2 == 0) {\n robot.lift.setPower(0);\n\n // Claw toggle logic\n // BUTTON A\n if (gamepad2.a == true) {\n robot.clawLeft.setPosition(1);\n robot.clawRight.setPosition(1);\n } else if (gamepad2.b == true) {\n robot.clawLeft.setPosition(0);\n robot.clawRight.setPosition(0);\n } else if (gamepad2.a == false && gamepad2.b == false) {\n robot.clawLeft.setPosition(0.5);\n robot.clawRight.setPosition(0.5);\n }\n }\n }", "@Override\n public void loop() { //Starts this loop after you press the START Button\n /**\n * Functional control of up down lift with no limit switches Meet 0 ready\n */\n double liftposition = robot.liftUpDown.getCurrentPosition();\n double liftrotposition = robot.liftRotate.getCurrentPosition();\n telemetry.addData(\"Lift Position\",\"%5.2f\",liftposition);\n telemetry.addData(\"LiftRot Position\", \"%5.2f\", liftrotposition);\n // telemetry.addData(\"Block Stack\", BlockStack);\n telemetry.update();\n\n/**Main drive controls\n * Driver 1\n */\n\n/**\n * Drag servos\n */\n if (gamepad1.a){ //release\n robot.drag1.setPosition(0);\n robot.drag2.setPosition(1);\n } else if (gamepad1.b){//grab\n robot.drag1.setPosition(1);\n robot.drag2.setPosition(0);\n }\n\n/**Mast and Lift controls\n *\n *\n * Driver Two\n *\n *\n*/\n\n/**\n * Need controls to\n * Maybe predetermined locations based on number of pushes of a button.\n */\n\n /**\n * Functional arm rotation with limit switches and encoder limits. Meet 2 ready\n */\n\n //Twists lift up after verifying that rotate up limit switch is not engaged and that step count is less than 5400\n if ( gamepad2.dpad_up && robot.rotateup.getState() == true){\n robot.liftRotate.setPower(1.0);\n }\n else if (gamepad2.dpad_down && robot.rotatedown.getState() == true){ //Twists lift down\n robot.liftRotate.setPower(-1.0);\n }\n //required or lift rotate motor continues to run in last direction (breaks the motor shaft)\n else robot.liftRotate.setPower(0);\n\n /**\n * claw controls a= open b= close\n * FUNCTIONAL Meet 2 ready\n */\n if (gamepad2.a){\n robot.claw1.setPosition(0);\n robot.claw2.setPosition(1);\n } else if (gamepad2.b){\n robot.claw1.setPosition(1);\n robot.claw2.setPosition(0);\n }\n\n /**\n * Lift controls with limit switches and encoder position Meet 2 ready\n * right_trigger = lift\n * left_trigger = down\n */\n\n if ( gamepad2.right_trigger>= 0.2 && robot.liftup.getState()) {\n triggerpress=true;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.liftUpDown.setPower(.9);\n robot.liftRotate.setPower(.15);\n }\n if (gamepad2.left_trigger>=0.2){\n triggerpress=true;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n robot.liftUpDown.setPower(-0.9);\n robot.liftRotate.setPower(-0.15);\n }\n if (gamepad2.left_trigger<.2 && gamepad2.right_trigger<.2 && triggerpress ){\n robot.liftUpDown.setPower(0);\n robot.liftRotate.setPower(0);\n triggerpress=false;\n }\n\n int x;\n int y;\n double motorDelayTime;\n //Necessary Debounce to keep bumper from being seen as multiple touches\n/* motorDelayTime=.1;\n if (robot.liftUpDown.getCurrentPosition()<50){\n BlockStack =0;\n }\n //skips servos unless runtime is greater than 20 ms.\n if( runtime.time() > motorDelayTime ) {\n //Need to move 5.5 inches on position 2, subsequent blocks will only need to move up 4 inches.\n x = robot.liftUpDown.getCurrentPosition();\n y= robot.liftRotate.getCurrentPosition();\n if (gamepad2.right_bumper ) {\n\n BlockStack= BlockStack + 1;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.liftUpDown.setTargetPosition(x + robot.floorheight);\n robot.liftUpDown.setPower(.9);\n robot.liftRotate.setTargetPosition(y + robot.floorheightrotate);\n robot.liftRotate.setPower(.1);\n bumperpress=true;\n\n //don't want to drive the cable too far loose checks that we can move a full block down\n } else if (gamepad2.left_bumper && x >= robot.floorheight ) {\n BlockStack= BlockStack - 1;\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n robot.liftUpDown.setTargetPosition(x - robot.floorheight);\n robot.liftUpDown.setPower(-.5);\n}\n\n runtime.reset();\n robot.liftUpDown.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }*/\n\n /**\n * Limit switch tests that reset the encoders Meet 1 ready\n * * liftdown also allows the X button to work\n * * rotatedown also allows the Y button to work\n */\n\n if (robot.rotatedown.getState() == false) {\n robot.liftRotate.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);\n robot.liftRotate.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\n }\n }", "public void operatorControl() {\n \tdouble ctrlThresh = .2; \n \tdouble minPower = .05; \n \tdouble maxPower = .75; \n \tdouble recip = (1 - ctrlThresh); \n \tdouble mult = (maxPower - minPower); \n \tdouble right; \n \tdouble strafe; \n \tdouble rotate; \n \tdouble rightAxis; \n \tdouble strafeAxis; \n \tdouble rotateAxis; \n \t// \tboolean leftLeft; \n \t// \tboolean leftRight; \n \tdouble rightDir; \n \tdouble strafeDir; \n \tdouble rotateDir; \n \tdouble rightPower; \n \tdouble rotatePower; \n \tdouble strafePower; \n \t\n \tint winchCount;\n \tboolean winchDirection;\n \n \t// \tdouble frontLeftPower; \n \t// \tdouble frontRightPower; \n \t// \tdouble backLeftPower; \n \t// \tdouble backRightPower; \n \n \t//myRobot.setSafetyEnabled(true); \n \t\n \tAccelerometer test = new BuiltInAccelerometer();\n \t\n \twhile (isOperatorControl() && isEnabled()) { \n \t\t// ACCEL TEST CODE\n// \t\tSystem.out.println(test.getX() + \", \" + test.getY() + \", \" + test.getZ());\n \t\t// END ACCEL TEST CODE\n \n \t\t// ********** BEGIN DRIVING CODE ********** \n \t\t// Code for driving using omniwheels and two wheels for strafing \n \t\t// Diagram for the wheels of the robot below. \n \n \t\t// L S R \n \t\t// /--------------------------\\ \n \t\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\t// ||------------------------|| \n \t\t// \\--------------------------/ \n \t\t// \n \t\t// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ \n \n \t\tctrlThresh = .2; // the point at which we want to sense joystick action \n \t\trecip = 1-ctrlThresh; \t\t // = 0.8 \n \n \t\trightAxis = rightStick.getRawAxis(1);\t\t\t\t// right joystick, y (up/down) axis\n \t\t\n \t\t//System.out.println(\"\"+rightAxis);\n \t\tstrafeAxis = rightStick.getRawAxis(0);\t\t\t\t// right joystick, x (left/right) axis; this is \n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// arbitrary and could have been the left stick\n \t\trotateAxis = rightStick.getRawAxis(4);\t\t\t\t\t// left joystick, y axis\n \n \t\trightDir = rightAxis/Math.abs(rightAxis);\t\t\t// forward or backward (+1 or -1)\n \t\tstrafeDir = strafeAxis/Math.abs(strafeAxis); \t// \t\t\t'' \n \t\trotateDir = rotateAxis/Math.abs(rotateAxis); // \t\t\t'' \n \n \t\tright = 0; // right input formatted for range of detected values [0.2,1] \n \t\trotate = 0; // left input formatted \n \t\tstrafe = 0; // strafe input formatted \n \n \t\tif(Math.abs(rightAxis) > ctrlThresh) \t// user moved stick beyond threshold \n \t\t{right = (rightAxis-ctrlThresh*rightDir)/recip;} // format right: scale back, set direction, proportion it \n \t\tif(Math.abs(strafeAxis) > ctrlThresh) \n \t\t{strafe = (strafeAxis-ctrlThresh*strafeDir)/recip;} // format left... \n \t\tif(Math.abs(rotateAxis) > ctrlThresh) \n \t\t{rotate = (rotateAxis-ctrlThresh*rotateDir)/recip;}\t\t// format strafe... \n \n \n \t\trightDir = right/Math.abs(right); \n \t\trightPower = (Math.abs(right*mult) + minPower) * rightDir; \t\t// re-proportion for power's range, strip direction,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/// and then add back threshold and direction. \n \t\trotateDir = rotate/Math.abs(rotate); \n \t\trotatePower = (Math.abs(rotate*mult) + minPower) * rotateDir;\t\t\t// \t\t'' \n \n \t\tstrafeDir = strafe/Math.abs(strafe); \n \t\tstrafePower = (Math.abs(strafe*mult) + minPower) * strafeDir;\t// \t\t'' \n \n \t\tif(Math.abs(rightPower)>0.2){\n \t\t\tfrontRight.set(rightPower);\t\t\t\t\t\t// set all the motors with the powers we \n \t\t\tbackRight.set(rightPower);\t\t\t\t\t\t/// calculated above : drive! \n \t\t\tfrontLeft.set(-1*rightPower); \n \t\t\tbackLeft.set(-1*rightPower);\n \t\t}\n \t\telse{\n \t\t\tfrontRight.set(rotatePower);\n \t\t\tbackRight.set(rotatePower);\n \t\t\tfrontLeft.set(rotatePower);\n \t\t\tbackLeft.set(rotatePower);\n \t\t}\n \t\t\n// \t\tfrontStrafe.set(strafePower); \n// \t\tbackStrafe.set(-1*strafePower); \n \n// \t\tmyRobot.tankDrive(leftStick, rightStick); \n \t\t \n \t\t// ********** END OF DRIVING CODE ********** \n \t\t//======================================================================= \n \t\t// ************ BEGIN WINCH CODE *********** \n \t\t// We need to code the winch to help raise and lower the elevator \n \t\t// This is just one option between the winch and the lead screw. \n \t\t \n \t\t\n \t\t//second winch test\n \t\t/*\n \t\twinchCount = winchEncoder.get();\t\t\t\t// get the pulse count from the encoder\n \t \tSystem.out.println(\"Count: \"+ winchCount);\t\t// print the pulse count \n \t \tif(winchCount<240){\n \t \t\t\n \t \t\twinchCim1.set(.1);\n \t \t\twinchCim2.set(.1);\n \t \t}\n \t \telse{\n \t \t\twinchCim1.set(0);\n \t \t\twinchCim2.set(0);\n \t \t\t\n \t \t}\n \t if(rightStick.getRawButton(5)) \n { \n\t\t\t winchEncoder.reset();// reset the pulse count\n\t\t\t winchCount = 0;\n\t\t\t winchCim1.set(0);\n\t\t\t winchCim2.set(0);\n\t\t\t \n } */ //end of second winch test \n \t \t\n \t\t\n \t\t if(rightStick.getRawButton(5)) \n { \n \t\t\t //winchEncoder.reset();// reset the pulse count\n \tSystem.out.println(\"A\");\n \t winchCim1.set(.5); \t// set winchCim1 to 0.5 power (upwards) \n \t winchCim2.set(.5); \t\t\t\t\t\t\t// set winchCim2 to 0.5 power\n \t\t\t \n } \n \t\telse if(rightStick.getRawButton(4))\n \t\t{\n \t\t\tSystem.out.println(\"B\");\n \t\t\t//winchEncoder.reset();\t\t\t\t\t\t\t// reset the pulse count\n \t \twinchCim1.set(-.3); // set winchCim1 to -0.5 power (downwards) \n \t \twinchCim2.set(-.3);\t \t\t\t\t\t\t\t// set winchCim2 to -0.5 power\n \t\t}\n \n \t \telse// if(rightStick.getRawButton(2)) \n { \n \t winchCim1.set(0); \t\t\t\t\t\t\t// set winchCim1 to 0 power (off/stop) \n \t winchCim2.set(0);\t\t\t\t\t\t\t\t// set winchCim2 to 0 pwoer (off/stop)\n// \t winchCount = winchEncoder.get();\t\t\t\t// get the pulse count from the encoder\n// \t System.out.println(\"Count: \"+ winchCount);\t\t// print the pulse count \n } \n \n \t\t// ********** END OF WINCH CODE ********** \n \t\t//======================================================================= \n \t\t \n \t\t \n \t\tTimer.delay(0.005);\t\t// wait for a motor update time \n } \n }", "@Override\n public void loop() {\n\n if (gamepad1.a && pow >= .01){\n pow -= .01;\n }\n\n if (gamepad1.b && pow <= .99){\n pow += .01;\n }\n robot.shooter.setPower(pow);\n\n telemetry.addData(\"Current Shooter Speed: \", pow);\n telemetry.update();\n\n //The following code should be for a normal drivetrain.\n\n robot.drive360(gamepad1.left_stick_x, -gamepad1.left_stick_y, gamepad1.right_stick_x);\n\n if (gamepad1.dpad_down && pow2 >= .01){\n pow2 -= .01;\n }\n\n if (gamepad1.dpad_up && pow2 <= .99){\n pow2 += .01;\n }\n\n //End normal drivetrain, the rest of this code is for varying the intake speed.\n\n if (gamepad1.right_bumper){\n robot.intake.setPower(pow2);\n }\n else if (gamepad1.left_bumper) {\n robot.intake.setPower(pow2 * -1);\n }\n else {\n robot.intake.setPower(0);\n }\n\n telemetry.addData(\"Current Intake Speed: \", pow2);\n telemetry.update();\n\n }", "public void uncBackwardBoost(final int x, final int y, final int maxX, final int maxY) {\n new Thread(new Runnable() {\n @Override\n public void run() {\n int count = 0;\n int centerX = maxX / 2;\n int centerY = maxY / 2;\n int finalX = 0, finalY = 0;\n int time = 3;\n if (ACTUAL_DIFICULTY == EASY)\n time = 3;\n if (ACTUAL_DIFICULTY == MEDIUM)\n time = 4;\n if (ACTUAL_DIFICULTY == HARD)\n time = 6;\n\n if (x >= centerX && y < centerY) {//Quadrant 1. x btw 155 and 310. y btw 0 and 155\n //Go to 3\n finalX = 0;\n finalY = maxY;\n } else if (x < centerX && y < centerY) { //Quadrant 2.\n //Go to 4\n finalX = maxX;\n finalY = maxY;\n } else if (x < centerX && y >= centerY) { //Quadrant 3.\n //Go to 1\n finalX = maxX;\n finalY = 0;\n } else if (x >= centerX && y >= centerY) { //Quadrant 4.\n //Go to 2\n finalX = 0;\n finalY = 0;\n }\n while (count < time) {\n\n drive_control.stopDriving();\n drive_control.setSpeedScale(MAX_SCALED_SPEED);\n drive_control.startDriving(getContext(), DriveControl.JOY_STICK);\n drive_control.driveJoyStick(finalX, finalY);\n try {\n Thread.sleep(100);\n } catch (InterruptedException e) {\n }\n count++;\n }\n restoreValues();\n }\n }).start();\n }", "@Override\n public void loop() {\n double left;\n double right;\n\n // // Run wheels in tank mode (note: The joystick goes negative when pushed forwards, so negate it)\n left = -gamepad1.left_stick_y;\n right = -gamepad1.right_stick_y;\n \n // double Target = 0;\n // robot.rightBack.setTargetPosition((int)Target);\n // robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);\n\n rightFront.setPower(left);\n rightBack.setPower(right);\n // robot.rightDrive.setPower(right);\n\n // // Use gamepad left & right Bumpers to open and close the claw\n // if (gamepad1.right_bumper)\n // clawOffset += CLAW_SPEED;\n // else if (gamepad1.left_bumper)\n // clawOffset -= CLAW_SPEED;\n\n // // Move both servos to new position. Assume servos are mirror image of each other.\n // clawOffset = Range.clip(clawOffset, -0.5, 0.5);\n // robot.leftClaw.setPosition(robot.MID_SERVO + clawOffset);\n // robot.rightClaw.setPosition(robot.MID_SERVO - clawOffset);\n\n // Use gamepad buttons to move the arm up (Y) and down (A)\n // if (gamepad1.y)\n // armPosition += ARM_SPEED;\n \n // if (gamepad1.a)\n // armPosition -= ARM_SPEED;\n \n // armPosition = Range.clip(armPosition, robot.ARM_MIN_RANGE, robot.ARM_MAX_RANGE); \n \n\n // // Send telemetry message to signify robot running;\n // telemetry.addData(\"arm\", \"%.2f\", armPosition);\n // telemetry.addData(\"left\", \"%.2f\", left);\n // telemetry.addData(\"right\", \"%.2f\", right);\n }", "@Override\n public void execute() {\n //How does one pass the joystick value here? There has to be a better way.\n driveTrainSubsystem.drive(1.0);\n\n\n //control pneumatics\n DoubleSolenoid doubleSolenoid = new DoubleSolenoid(1, 2);\n\n for(int i =0; i < 30000; i++) {\n doubleSolenoid.set(Value.kForward);\n System.out.println(\"Solenoid forward\");\n }\n\n for(int i =0; i < 30000; i++) {\n doubleSolenoid.set(Value.kReverse);\n System.out.println(\"Solenoid backward\");\n }\n\n\n System.out.println(\"Solenoid off\");\n doubleSolenoid.set(Value.kReverse);\n\n }", "private void configVelocityControl() {\n //config remote sensors\n //sets the sensor to be a quad encoder, sets our feedback device to be that sensor\n m_masterMotor.configSelectedFeedbackSensor(TalonSRXFeedbackDevice.CTRE_MagEncoder_Relative, RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //zero the encoders on every init\n zeroEncoder();\n\n //sets whether our motor is inverted\n //this is currently false but can be switched based on testing\n m_masterMotor.setInverted(RobotMap.LAUNCHER_MASTER_INVERTED);\n m_masterMotor.setSensorPhase(RobotMap.LAUNCHER_MASTER_INVERTED);\n\n //this sets how often we pull data from our sensor\n m_masterMotor.setStatusFramePeriod(StatusFrame.Status_2_Feedback0, RobotMap.LAUNCHER_FEEDBACK_PERIOD_MS, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //this configs the deadband for the PID output. Any output with an absolute value less than this will be treated as zero\n m_masterMotor.configNeutralDeadband(0, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //this sets the peak output for our motor controller.\n m_masterMotor.configPeakOutputForward(RobotMap.LAUNCHER_PID_PEAK_OUTPUT, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n //this does the same thing but for the reverse direction\n m_masterMotor.configPeakOutputReverse(0, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n \n //sets the period of the velocity sample\n //effectively this defines the amount of time used to calculate the velocity\n m_masterMotor.configVelocityMeasurementPeriod(RobotMap.VELOCITY_MEASUREMENT_PERIOD, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //Sets the number of samples used in the rolling average for calculating velocity\n m_masterMotor.configVelocityMeasurementWindow(RobotMap.LAUNCHER_VELOCITY_MEASUREMENT_WINDOW, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n \n //set p, i, d, f values\n //the zero is the PID slot, in this case it is zero for the primary PID\n //the launcher has no auxillary or turning PID control\n m_masterMotor.config_kP(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_P);\n m_masterMotor.config_kI(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_I);\n m_masterMotor.config_kD(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_D);\n m_masterMotor.config_kF(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_F);\n\n //this sets the acceptable amount of Integral error, where if the absolute accumulated error exceeds this ammount, it resets to zero\n //this is designed to prevent the PID from going crazy if we move too far from our target\n m_masterMotor.config_IntegralZone(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_I_ZONE, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //sets the max output of the motor specifically within closed loop control\n m_masterMotor.configClosedLoopPeakOutput(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_PID_PEAK_OUTPUT, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //this configures an allowable error in closed loop control\n //any error less than this is treated as zero.\n m_masterMotor.configAllowableClosedloopError(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_ACCEPTABLE_ERROR, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //configures the period for closed loop calculations in MS \n //should be increased if the can bus is haveing issues\n m_masterMotor.configClosedLoopPeriod(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_CLOSED_LOOP_PERIOD_MS, RobotMap.LAUNCHER_CONFIG_TIMEOUT_MS);\n\n //configures ramp speed\n m_masterMotor.configOpenloopRamp(RobotMap.LAUNCHER_OPEN_LOOP_RAMP_TIME_S);\n m_masterMotor.configClosedloopRamp(0);\n\n //sets our closed loop control to use our primary PID slot\n m_masterMotor.selectProfileSlot(RobotMap.PID_PRIMARY_SLOT, 0);\n }", "private static synchronized void runLiftStageFromJoystick(ArmLiftMotorInfo mtrInfo) { //double stage1JoystickReading, double stage2JoystickReading) {\r\n\t\t\tdouble percentOut;\r\n\t\t\tsynchronized(armStage1.motorLock) {\r\n//\t\t\t\tsynchronized(armStage2.motorLock) {\t\t\t\t\t\r\n\t\t\t\t\t//joysticks give negative readings when pushed away from you, but we want that action to run\r\n\t\t\t\t\t//the motors in their forward direction (postive Percent Output values)\r\n\t\t\t\t\tdouble jsRdg = mtrInfo.jsNamedControl.getEnt().getAnalog();\r\n\t\t\t\t\tmtrInfo.lastJoystickReading = jsRdg;\r\n\t\t\t\t\t//squaring makes joysticks easier to use\r\n\t\t\t\t\tpercentOut = -Math.copySign(jsRdg*jsRdg, jsRdg);\r\n\t\t\t\t\tif(mtrInfo.operatingMode.equals(OperatingModesE.IDLE)) {mtrInfo.operatingMode = OperatingModesE.JOYSTICK;}\r\n\t\t\t\t\t\r\n\t\t\t\t\t//check limit switches, encoders, 'useEncoder' flag, etc. and allow/forbid motion accordingly\r\n\t\t\t\t\tmtrInfo.handleJoystickPercentOut(percentOut);\r\n\t\t\t\t\t\r\n//\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "@Override\n public void teleopPeriodic() {\n\t\t/* xbox processing */\n\t\tdouble leftYstick = xbox.getY(Hand.kLeft);\n\t\tboolean buttonA = xbox.getAButton();\n boolean buttonB = xbox.getBButton();\n boolean buttonX = xbox.getXButton();\n boolean buttonY = xbox.getYButton();\n\n\t\t/* Get Talon/Victor's current output percentage */\n\t\tdouble motorOutput = elevator.getMotorOutputPercent();\n\n\t\t/* Deadband gamepad */\n\t\tif (Math.abs(leftYstick) < 0.10) {\n\t\t\t/* Within 10% of zero */\n\t\t\tleftYstick = 0;\n }\n\n\t\t/* Prepare line to print */\n\t\t_sb.append(\"\\tout:\"); _sb.append((int) (motorOutput * 100)); _sb.append(\"%\"); // Percent\n\t\t_sb.append(\"\\tpos:\"); _sb.append(elevator.getSelectedSensorPosition(0)); _sb.append(\"u\"); // Native units\n\n\t\t/**\n\t\t * When button 1 is pressed, perform Position Closed Loop to selected position,\n\t\t * indicated by Joystick position x10, [-10, 10] rotations\n\t\t */\n\t\t//if (!_lastButton1 && buttonA) {\n if (buttonB) {\n\t\t\t/* Position Closed Loop */\n\t\t\t/* 10 Rotations * 4096 u/rev in either direction */\n\t\t\ttargetPositionRotations = 5000; // 2* 4096; //leftYstick * 10.0 * 4096;\n\t\t\televator.set(ControlMode.Position, targetPositionRotations);\n\t\t}\n if (buttonX) {\n\t\t\t/* Position Closed Loop */\n\t\t\t/* 10 Rotations * 4096 u/rev in either direction */\n\t\t\ttargetPositionRotations = 3000; //2* 4096; //leftYstick * 10.0 * 4096;\n\t\t\televator.set(ControlMode.Position, -targetPositionRotations);\n\t\t}\n\n\t\t/* When button 2 is held, just straight drive */\n\t\tif (buttonA) {\n /* Percent Output */\n\t\t elevator.set(ControlMode.PercentOutput, leftYstick);\n }\n \n if (buttonY) {\n elevator.setSelectedSensorPosition(0); // reset to zero\n elevator.getSensorCollection().setQuadraturePosition(0, 10);\n elevator.set(ControlMode.PercentOutput, 0);\n }\n// else{\n //}\n\n\t\t/* If Talon is in position closed-loop, print some more info */\n\t\tif (elevator.getControlMode() == ControlMode.Position) {\n /* Append more signals to print when in speed mode. */\n\t\t\t_sb.append(\"\\terr:\"); _sb.append(elevator.getClosedLoopError(0)); _sb.append(\"u\");\t// Native Units\n\t\t\t_sb.append(\"\\ttrg:\"); _sb.append(targetPositionRotations); _sb.append(\"u\");\t// Native Units\n\t\t}\n\n\t\t/**\n\t\t * Print every ten loops, printing too much too fast is generally bad\n\t\t * for performance.\n\t\t */\n\t\tif (++_loops >= 10) {\n\t\t\t_loops = 0;\n\t\t\tSystem.out.println(_sb.toString());\n\t\t}\n\n\t\t/* Reset built string for next loop */\n\t\t_sb.setLength(0);\n\t\t\n\t\t/* Save button state for on press detect */\n\t\t//_lastButton1 = buttonA;\n }", "public void teleopPeriodic() {\n joystick1X = leftStick.getAxis(Joystick.AxisType.kX);\n joystick1Y = leftStick.getAxis(Joystick.AxisType.kY);\n joystick2X = rightStick.getAxis(Joystick.AxisType.kX);\n joystick2Y = rightStick.getAxis(Joystick.AxisType.kY);\n \n mapped1Y = joystick1Y/2 + 0.5;\n mapped1X = joystick1X/2 + 0.5;\n mapped2X = joystick2X/2 + 0.5;\n mapped2Y = joystick2Y/2 + 0.5;\n \n X1testServo.set(mapped1X);\n Y1testServo.set(mapped1Y);\n X2testServo.set(mapped2X);\n Y2testServo.set(mapped2Y);\n }", "public void snakeUp(){\r\n\t\tspeedUp();\r\n\t\tpoints += 100;\r\n\t}", "public static void main(String[] args) throws InterruptedException {\n // Create a gamepad\n JInputJoystick gamepad = new JInputJoystick(Controller.Type.STICK, Controller.Type.GAMEPAD);\n\n // Check if a gamepad was found.\n if (!gamepad.isControllerConnected()){\n Logger.info(\"No gamepad controller found!\");\n System.exit(1);\n }\n\n // Instantiate hardware\n// Servo.Trim trim = new Servo.Trim(1.5f, 1.5f, 1.3f, 1.7f); // For slow parallax 360 rotation servos\n Servo.Trim trim = new Servo.Trim(1.5f, 1.5f, 1.28f, 1.72f);\n try (Servo leftWheelServo = new Servo(leftWheelPin, trim.getMaxPulseWidthMs(), 50, trim);\n Servo rightWheelServo = new Servo(rightWheelPin, trim.getMinPulseWidthMs(), 50, trim)) {\n leftWheelServo.setInverted(true);\n\n // Set up communication with servo feedback encoders\n DigisparkFeedbackEncoder digisparkFeedbackEncoder = new DigisparkFeedbackEncoder();\n ParallaxHallEffectFeedbackSensor leftWheelFeedbackSensor = \n new ParallaxHallEffectFeedbackSensor(digisparkFeedbackEncoder, ParallaxHallEffectFeedbackSensor.WheelSide.LEFT);\n ParallaxHallEffectFeedbackSensor rightWheelFeedbackSensor = \n new ParallaxHallEffectFeedbackSensor(digisparkFeedbackEncoder, ParallaxHallEffectFeedbackSensor.WheelSide.RIGHT);\n\n // Set up the operator interface so we can get joystick feedback\n OperatorInterface operatorInterface = new OperatorInterface(gamepad);\n\n // Start the command scheduler\n SchedulerTask schedulerTask = new SchedulerTask(Scheduler.getInstance());\n schedulerTask.start();\n Logger.info(\"Robot command scheduler started.\");\n\n // Instantiate subsystems\n DriveTrain driveTrain = new DriveTrain(\n trim, \n leftWheelServo, \n rightWheelServo, \n digisparkFeedbackEncoder,\n leftWheelFeedbackSensor, \n rightWheelFeedbackSensor, \n operatorInterface);\n\n while (true) {\n Thread.sleep(100);\n }\n }\n }", "@Override\n\tpublic void testPeriodic(){\n\t\t//Testing xbox buttons, joysticks and triggers\n\t\tOI.refreshAll();\n//\t\t//System.out.println(\"Left Y = \" + xbox.LeftStick.Y);\n//\t\t//System.out.println(\"Right Y = \" + xbox.RightStick.Y);\n//\t\t\n//\t\t\n//\t\tfinal double cpr = 360.0;\n//\t\tfinal double encoder_angular_distance_per_pulse = 2.0*Math.PI / cpr;\n//\t\tfinal double wheel_radius = 2.5; // .564 in (18T 5mm pitch)\n//\t\tfinal double encLinearDistancePerPulse = wheel_radius * encoder_angular_distance_per_pulse; //2.0 * Math.PI / cpr;\n//\t\t\n//\t\tSystem.out.println(enc.getRaw()*encLinearDistancePerPulse);\n//\t\t\n\t\t\n\t\t//System.out.println(gyro.getAngle(MPU6050.Axis.X));\n\n\t //PNEUMATICS\n\t //c.setClosedLoopControl(true);\n\t //c.setClosedLoopControl(false);\n\t}", "@Override\n public void loop() {\n rightArm.setTargetPosition((int)(.125* TICKS_PER_WHEEL_ROTATION*8));\n leftArm.setTargetPosition((int)(.125* TICKS_PER_WHEEL_ROTATION*8));\nrightArm.setPower(.6);\nleftArm.setPower(.6);\nif(runtime.seconds()>4&& stage==-1){\n stage++;\n}\n// telemetry.addData(\"IsAligned\" , detector.getAligned()); // Is the bot aligned with the gold mineral?\n// telemetry.addData(\"X Pos\" , detector.getXPosition()); // Gold X position.\n\n //Point screenpos = detector.getScreenPosition();\n if(stage==0) {\n Rect bestRect = detector.getFoundRect();\n\n double xPos = bestRect.x + (bestRect.width / 2);\n\n if (xPos < alignXMax && xPos > alignXMin) {\n aligned = true;\n } else {\n aligned = false;\n }\n telemetry.addData(\"aligned \", aligned);\n\n telemetry.addData(\"xpos \", xPos);\n telemetry.addData(\"amax \", alignXMax);\n telemetry.addData(\"amin \", alignXMin);\n if(!(xPos>0)){\n rightWheel.setPower(0);\n leftWheel.setPower(0);\n telemetry.addLine(\"not detected\");\n }\n else if (xPos > alignXMax) {\n double power = ((xPos - alignXMax) / scale) * .3 + .4;\n rightWheel.setPower(power);\n leftWheel.setPower(-power);\n telemetry.addData(\"powL: \", power);\n telemetry.addLine(\"turning left\");\n runtime.reset();\n } else if (xPos < alignXMin) {\n double power = ((alignXMin - xPos) / scale) * .3 + .4;\n rightWheel.setPower(-power);\n leftWheel.setPower(power);\n telemetry.addData(\"powR: \", power);\n telemetry.addLine(\"turning right\");\n runtime.reset();\n } else {\n rightWheel.setPower(0);\n leftWheel.setPower(0);\n telemetry.addLine(\"found\");\n telemetry.addData(\"secks: \", runtime.seconds());\n if(runtime.seconds()>.1){\n runtime.reset();\n stage++;\n resetDriveEncoders();\n }\n }\n\n\n }\n else if (stage==1){\n rightWheel.setTargetPosition(-3*TICKS_PER_WHEEL_ROTATION);\n leftWheel.setTargetPosition(-3*TICKS_PER_WHEEL_ROTATION);\n leftWheel.setPower(.5);\n rightWheel.setPower(.5);\n if(runtime.seconds()>5){\n rightWheel.setPower(0);\n leftWheel.setPower(0);\n }\n\n }\n\n\n telemetry.addData(\"stage: \", stage);\n telemetry.update();\n }", "private void setZeroPowerBrakes() {\n //Initialize Mecanum Wheel DC Motor Behavior\n robot2.DriveRightFront.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n robot2.DriveRightRear.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n robot2.DriveLeftFront.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n robot2.DriveLeftRear.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);\n }", "@Override\n\tpublic void testPeriodic() {\n\t\tif (testJoystick.getRawButton(3)) {\n\t\t\tsparkMotor1.set(1.0);\n\t\t\tsparkMotor0.set(1.0);\n\t\t\ttestTalon.set(1.0);\n\t\t\t\n\t\t\ttalonMotor10.set(ControlMode.PercentOutput, 1.0);\n\t\t\ttalonMotor11.set(ControlMode.PercentOutput, 1.0);\n\t\t\ttalonMotor12.set(ControlMode.PercentOutput, 1.0);\n\t\t\ttalonMotor13.set(ControlMode.PercentOutput, 1.0);\n\t\t\ttalonMotor14.set(ControlMode.PercentOutput, 1.0);\n\t\t\ttalonMotor15.set(ControlMode.PercentOutput, 1.0);\n\t\t}\n\t\telse if (testJoystick.getRawButton(2)) {\n\t\t\tsparkMotor0.set(-1.0);\n\t\t\tsparkMotor1.set(-1.0);\n\t\t\ttestTalon.set(-1.0);\n\t\t\t\n\t\t\ttalonMotor10.set(ControlMode.PercentOutput, -1.0);\n\t\t\ttalonMotor11.set(ControlMode.PercentOutput, -1.0);\n\t\t\ttalonMotor12.set(ControlMode.PercentOutput, -1.0);\n\t\t\ttalonMotor13.set(ControlMode.PercentOutput, -1.0);\n\t\t\ttalonMotor14.set(ControlMode.PercentOutput, -1.0);\n\t\t\ttalonMotor15.set(ControlMode.PercentOutput, -1.0);\n\t\t}\n\t\telse {\n//\t\t\tsparkMotor0.set(0);\n\t\t\tsparkMotor1.set(0);\n\t\t\ttestTalon.set(0);\n\t\t\t\n\t\t\ttalonMotor10.set(ControlMode.PercentOutput, 0);\n\t\t\ttalonMotor11.set(ControlMode.PercentOutput, 0);\n\t\t\ttalonMotor12.set(ControlMode.PercentOutput, 0);\n\t\t\ttalonMotor13.set(ControlMode.PercentOutput, 0);\n\t\t\ttalonMotor14.set(ControlMode.PercentOutput, 0);\n\t\t\ttalonMotor15.set(ControlMode.PercentOutput, 0);\n\t\t\t\n\t\t\ttestSel.set(Value.kForward);\n\t\t}\n\t\t\n\t\tif (testJoystick.getRawButton(7)) {\n\t\t\ttestSel.set(Value.kForward);\n\t\t\tSystem.out.println(compressor.getCompressorCurrent());\n\t\t}\n\t}", "public void moveBot(double drive, double rotate, double strafe, double scaleFactor)\n {\n double wheelSpeeds[] = new double[4];\n\n wheelSpeeds[0] = drive - rotate - strafe; // Right Read\n wheelSpeeds[1] = drive - rotate + strafe; // Right Front\n wheelSpeeds[2] = drive + rotate + strafe; // Left Rear\n wheelSpeeds[3] = drive + rotate - strafe; // Left Front\n // Find the magnitude of the first element in the array\n double maxMagnitude = Math.abs(wheelSpeeds[0]);\n // If any of the other wheel speeds are bigger, save that value in maxMagnitude\n for (int i = 1; i < wheelSpeeds.length; i++)\n {\n double magnitude = Math.abs(wheelSpeeds[i]);\n if (magnitude > maxMagnitude)\n {\n maxMagnitude = magnitude;\n }\n }\n // Normalize all of the magnitudes to below 1\n if (maxMagnitude > 1.0)\n {\n for (int i = 0; i < wheelSpeeds.length; i++)\n {\n wheelSpeeds[i] /= maxMagnitude;\n }\n }\n\n // Compare last wheel speeds to commanded wheel speeds and ramp as necessary\n for (int i = 0; i < lastwheelSpeeds.length; i++){\n // If the commanded speed value is more than SPEED_INCREMENT away from the last known wheel speed\n if (Math.abs(wheelSpeeds[i] - lastwheelSpeeds[i]) > SPEED_INCREMENT){\n // Set the current wheel speed to the last wheel speed plus speed increment in the signed directin of the difference\n wheelSpeeds[i] = lastwheelSpeeds[i] + Math.copySign(SPEED_INCREMENT,wheelSpeeds[i] - lastwheelSpeeds[i]);\n }\n }\n\n // Send the normalized values to the wheels, further scaled by the user\n rightRearDrive.setPower(wheelSpeeds[0] * scaleFactor);\n rightFrontDrive.setPower(wheelSpeeds[1] * scaleFactor);\n leftRearDrive.setPower(wheelSpeeds[2] * scaleFactor);\n leftFrontDrive.setPower(wheelSpeeds[3] * scaleFactor);\n\n // Save the last wheel speeds to assist in ramping\n for (int i = 0; i < lastwheelSpeeds.length; i++){\n lastwheelSpeeds[i] = wheelSpeeds[i];\n }\n }", "public void driveJoystick(double x, double y) {\n\t\ty = -y;\n\t\t\n\t\tdouble leftPower;\n\t\tdouble rightPower;\n\t\t\n\t\t// Calculate Power (Drive Train)\n\t\tleftPower = Range.clip(y + x, -1.0, 1.0) ;\n\t\trightPower = Range.clip(y - x, -1.0, 1.0) ;\n\t\t\n\t\tdrive(leftPower, rightPower);\n\t\t\n\t\t/* \n\t\t// Calculate Power (Drive Train)\n\t\tdouble drive = -gamepad1.left_stick_y;\n\t\tdouble turn = gamepad1.right_stick_x;\n\t\tleftPower\t = Range.clip(drive + turn, -1.0, 1.0) ;\n\t\trightPower = Range.clip(drive - turn, -1.0, 1.0) ;\n\t\t*/\n\t}", "@Override\r\n public void loop() {\r\n\r\n // throttle: left_stick_y ranges from -1 to 1, where -1 is full up, and\r\n // 1 is full down\r\n // direction: left_stick_x ranges from -1 to 1, where -1 is full left\r\n // and 1 is full right\r\n\r\n double y1 = -gamepad1.left_stick_y;\r\n double x1 = gamepad1.left_stick_x;\r\n double y2 = -gamepad1.right_stick_y;\r\n double x2 = gamepad1.right_stick_x; //This one is for turning\r\n\r\n double treadStickValueR = 0;\r\n double treadStickValueL = 0;\r\n\r\n boolean leftBumper = gamepad2.left_bumper;\r\n boolean rightBumper = gamepad2.right_bumper;\r\n\r\n boolean aButton = gamepad1.a;\r\n boolean bButton = gamepad1.b;\r\n\r\n /**\r\n if (gamepad2.right_bumper) rightBumper = true;\r\n else {\r\n rightBumper = false;\r\n }\r\n\r\n if (gamepad2.left_bumper) leftBumper = true;\r\n else {\r\n leftBumper = false;\r\n }\r\n */\r\n\r\n double armStickValue = -gamepad2.right_stick_y; //input for raising/lowering arm\r\n\r\n if (gamepad2.left_trigger != 0) {\r\n treadStickValueR = -gamepad2.left_trigger; //input for changing tread speed\r\n treadStickValueL = -gamepad2.left_trigger; //input for changing tread speed\r\n } else {\r\n treadStickValueR = gamepad2.right_trigger; //input for changing tread speed\r\n treadStickValueL = gamepad2.right_trigger; //input for changing tread speed\r\n }\r\n\r\n /**\r\n boolean dpadUP = gamepad1.dpad_up;\r\n boolean dpadDOWN = gamepad1.dpad_down;\r\n boolean dpadLEFT = gamepad1.dpad_left;\r\n boolean dpadRIGHT = gamepad1.dpad_right;\r\n */\r\n\r\n //On a scale of 1, -1, if it's less than 0.05, then it may be 0 in reality. 12.75 in 255 land\r\n if (Math.abs(x1) <= 0.1 * MAX)\r\n x1 = 0;\r\n if (Math.abs(y1) <= 0.1 * MAX)\r\n y1 = 0;\r\n if (Math.abs(x2) <= 0.1 * MAX)\r\n x2 = 0;\r\n if (Math.abs(y2) <= 0.1 * MAX)\r\n y2 = 0;\r\n\r\n if (Math.abs(armStickValue) <= 0.05 * MAX)\r\n armStickValue = 0;\r\n\r\n if (Math.abs(treadStickValueR) <= 0.05 * MAX)\r\n treadStickValueR = 0;\r\n if (Math.abs(treadStickValueL) <= 0.05 * MAX)\r\n treadStickValueL = 0;\r\n\r\n boolean LeftBumpVal = leftBumper;\r\n boolean RightBumpVal = rightBumper;\r\n //Decides direction by splitting circle into four quadrants, and assumes that the stick is pushed to the edge of the circle for precision between quadrants\r\n //See unit circle to explain why x must be less than or greater than Rt(2)/2\r\n\r\n if (y1 > 0) //Joystick forwards\r\n if (x1 < -(Math.sqrt(2) / 2)) //Moving straight left\r\n {\r\n FLval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FRval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BLval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BRval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n\r\n FLval = FLval*SPEED_MODIFIER;\r\n FRval = FRval*SPEED_MODIFIER;\r\n BLval = BLval*SPEED_MODIFIER;\r\n BRval = BRval*SPEED_MODIFIER;\r\n\r\n } else if (x1 > (Math.sqrt(2) / 2)) //Moving right\r\n {\r\n FLval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FRval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BLval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BRval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FLval = FLval*SPEED_MODIFIER;\r\n FRval = FRval*SPEED_MODIFIER;\r\n BLval = BLval*SPEED_MODIFIER;\r\n BRval = BRval*SPEED_MODIFIER;\r\n } else //Forwards\r\n {\r\n FLval = Math.round(Math.abs(y1 * 10)) / 10.0;\r\n FRval = Math.round(Math.abs(y1 * 10)) / 10.0;\r\n BLval = Math.round(Math.abs(y1 * 10)) / 10.0;\r\n BRval = Math.round(Math.abs(y1 * 10)) / 10.0;\r\n }\r\n else if (y1 < 0) //Stick backwards\r\n if (x1 < -(Math.sqrt(2) / 2)) //Straight left\r\n {\r\n FLval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FRval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BLval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BRval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FLval = FLval*SPEED_MODIFIER;\r\n FRval = FRval*SPEED_MODIFIER;\r\n BLval = BLval*SPEED_MODIFIER;\r\n BRval = BRval*SPEED_MODIFIER;\r\n } else if (x1 > (Math.sqrt(2) / 2)) //Right\r\n {\r\n FLval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FRval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BLval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BRval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FLval = FLval*SPEED_MODIFIER;\r\n FRval = FRval*SPEED_MODIFIER;\r\n BLval = BLval*SPEED_MODIFIER;\r\n BRval = BRval*SPEED_MODIFIER;\r\n } else //Backwards\r\n {\r\n FLval = -Math.round(Math.abs(y1 * 10)) / 10.0;\r\n FRval = -Math.round(Math.abs(y1 * 10)) / 10.0;\r\n BLval = -Math.round(Math.abs(y1 * 10)) / 10.0;\r\n BRval = -Math.round(Math.abs(y1 * 10)) / 10.0;\r\n }\r\n else //stick not moved vertically\r\n if (x1 > 0) { //Right\r\n\r\n FLval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FRval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BLval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BRval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FLval = FLval*SPEED_MODIFIER;\r\n FRval = FRval*SPEED_MODIFIER;\r\n BLval = BLval*SPEED_MODIFIER;\r\n BRval = BRval*SPEED_MODIFIER;\r\n } else if (x1 < 0) { //Left\r\n FLval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FRval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BLval = Math.round(Math.abs(x1 * 10)) / 10.0;\r\n BRval = -Math.round(Math.abs(x1 * 10)) / 10.0;\r\n FLval = FLval*SPEED_MODIFIER;\r\n FRval = FRval*SPEED_MODIFIER;\r\n BLval = BLval*SPEED_MODIFIER;\r\n BRval = BRval*SPEED_MODIFIER;\r\n } else { //Stick at origin\r\n FLval = 0;\r\n FRval = 0;\r\n BLval = 0;\r\n BRval = 0;\r\n }\r\n\r\n //Right now turning overrides other movement\r\n\r\n if (x2 != 0) //Turning\r\n {\r\n FRval = FORWARD_POWER * -(x2 / (Math.abs(x2)));\r\n FLval = FORWARD_POWER * (x2 / (Math.abs(x2)));\r\n BRval = FORWARD_POWER * -(x2 / (Math.abs(x2)));\r\n BLval = FORWARD_POWER * (x2 / (Math.abs(x2)));\r\n FLval = FLval*SPEED_MODIFIER;\r\n FRval = FRval*SPEED_MODIFIER;\r\n BLval = BLval*SPEED_MODIFIER;\r\n BRval = BRval*SPEED_MODIFIER;\r\n }\r\n\r\n //For changing tread speed\r\n TLval = treadStickValueL;\r\n TRval = -treadStickValueR;\r\n\r\n\r\n //For changing arm value\r\n armVal = armStickValue;\r\n\r\n Range.clip(FLval, -CLIP_NUM, CLIP_NUM); //This is to make sure that no STRANGE values somehow get in\r\n Range.clip(BLval, -CLIP_NUM, CLIP_NUM);\r\n Range.clip(BRval, -CLIP_NUM, CLIP_NUM);\r\n Range.clip(FRval, -CLIP_NUM, CLIP_NUM);\r\n\r\n /*\r\n boolean imaniDoesNotCareForHerOwnSafety = gamepad2.a;\r\n if ((lastWasForSlow && !imaniDoesNotCareForHerOwnSafety) || (lastWasBackSlow && !gamepad2.y))\r\n spikeTime = 0;\r\n */\r\n\r\n FrontRight.setPower(FRval);\r\n FrontLeft.setPower(FLval);\r\n BackRight.setPower(BRval);\r\n BackLeft.setPower(BLval);\r\n\r\n TreadLeft.setPower(TLval);\r\n TreadRight.setPower(TRval);\r\n\r\n ArmMotor.setPower(armVal);\r\n\r\n boolean lastResetState = false;\r\n boolean curResetState = false;\r\n/**\r\n // Get a reference to a Modern Robotics gyro object. We use several interfaces\r\n // on this object to illustrate which interfaces support which functionality.\r\n gyro = hardwareMap.get(IntegratingGyroscope.class, \"gyro\");\r\n modernRoboticsI2cGyro = hardwareMap.get(ModernRoboticsI2cGyro.class, \"gyro\");\r\n gyro = (IntegratingGyroscope) modernRoboticsI2cGyro;\r\n // If you're only interested in the IntegratingGyroscope interface, the following will suffice.\r\n\r\n // A similar approach will work for the Gyroscope interface, if that's all you need.\r\n\r\n // Start calibrating the gyro. This takes a few seconds and is worth performing\r\n // during the initialization phase at the start of each opMode.\r\n\r\n\r\n telemetry.log().add(\"Gyro Calibrating. Do Not Move!\");\r\n modernRoboticsI2cGyro.calibrate();\r\n\r\n // Wait until the gyro calibration is complete\r\n timer.reset();\r\n while (modernRoboticsI2cGyro.isCalibrating()) {\r\n telemetry.addData(\"calibrating\", \"%s\", Math.round(timer.seconds()) % 2 == 0 ? \"|..\" : \"..|\");\r\n telemetry.update();\r\n }\r\n\r\n telemetry.log().clear();\r\n telemetry.log().add(\"Gyro Calibrated. Press Start.\");\r\n telemetry.clear();\r\n telemetry.update();\r\n\r\n // Wait for the start button to be pressed\r\n telemetry.log().clear();\r\n telemetry.log().add(\"Press A & B to reset heading\");\r\n\r\n // If the A and B buttons are pressed just now, reset Z heading.\r\n curResetState = (gamepad1.a && gamepad1.b);\r\n if (curResetState && !lastResetState) {\r\n modernRoboticsI2cGyro.resetZAxisIntegrator();\r\n }\r\n lastResetState = curResetState;\r\n\r\n // The raw() methods report the angular rate of change about each of the\r\n // three axes directly as reported by the underlying sensor IC.\r\n int rawX = modernRoboticsI2cGyro.rawX();\r\n int rawY = modernRoboticsI2cGyro.rawY();\r\n int rawZ = modernRoboticsI2cGyro.rawZ();\r\n int heading = modernRoboticsI2cGyro.getHeading();\r\n int integratedZ = modernRoboticsI2cGyro.getIntegratedZValue();\r\n\r\n // Read dimensionalized data from the gyro. This gyro can report angular velocities\r\n // about all three axes. Additionally, it internally integrates the Z axis to\r\n // be able to report an absolute angular Z orientation.\r\n AngularVelocity rates = gyro.getAngularVelocity(AngleUnit.DEGREES);\r\n float zAngle = gyro.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES).firstAngle;\r\n\r\n // Read administrative information from the gyro\r\n int zAxisOffset = modernRoboticsI2cGyro.getZAxisOffset();\r\n int zAxisScalingCoefficient = modernRoboticsI2cGyro.getZAxisScalingCoefficient();\r\n telemetry.addLine()\r\n .addData(\"dx\", (rates.xRotationRate))\r\n .addData(\"dy\", (rates.yRotationRate))\r\n .addData(\"dz\", \"%s deg/s\", (rates.zRotationRate));\r\n telemetry.addData(\"angle\", \"%s deg\", (zAngle));\r\n telemetry.addData(\"heading\", \"%3d deg\", heading);\r\n telemetry.addData(\"integrated Z\", \"%3d\", integratedZ);\r\n telemetry.addLine()\r\n .addData(\"rawX\", (rawX))\r\n .addData(\"rawY\", (rawY))\r\n .addData(\"rawZ\", (rawZ));\r\n telemetry.addLine().addData(\"z offset\", zAxisOffset).addData(\"z coeff\", zAxisScalingCoefficient);\r\n telemetry.update();\r\n **/\r\n\r\n telemetry.addData(\"Front Left: \", FLval);\r\n telemetry.addData(\"Front Right: \", FRval);\r\n telemetry.addData(\"Back Left: \", BLval);\r\n telemetry.addData(\"Back Right: \", BRval);\r\n telemetry.addData(\"Tread Left: \", TLval);\r\n telemetry.addData(\"Tread Right: \", TRval);\r\n telemetry.addData(\"Arm: \", armVal);\r\n telemetry.addData(\"xLeft: \", x1);\r\n telemetry.addData(\"yLeft: \", y1);\r\n telemetry.addData(\"xRight: \", x2);\r\n }", "@Override\n public void loop() {\n switch (auto) {\n\n //Time Function Socks\n case 0:\n if (runtime.milliseconds() <= 6250) {\n robot.hook.setPower(1.0);\n } else if (runtime.milliseconds() > 6250) {\n robot.hook.setPower(0);\n auto++;\n } else {\n robot.hook.setPower(0);\n auto++;\n }\n\n break;\n\n case 1 :\n runtime.reset();\n auto++;\n break;\n\n\n case 2:\n if (runtime.milliseconds() <= 1000) {\n robot.drive(MovementEnum.RIGHTSTRAFE, 0.5);\n }\n else if(runtime.milliseconds() > 1000) {\n robot.drive(MovementEnum.STOP, 0.0);\n auto++;\n }\n else {robot.drive(MovementEnum.STOP, 0.0);\n auto++;\n }\n break;\n\n case 3:\n runtime.reset();\n auto++;\n break;\n\n case 4:\n // if (runtime.milliseconds() >= 12000) {\n //enable for color sensor here using DogeCV or OpenCV (Preferably DogeCV)\n /*\n if (runtime.milliseconds() > 7000) {\n robot.drive(MovementEnum.RIGHTTURN, 0.65);\n }\n auto++;\n */\n if (runtime.milliseconds() <= 3000) {\n robot.drive(MovementEnum.BACKWARD, 1);\n }\n else if(runtime.milliseconds() > 3000){ robot.drive(MovementEnum.STOP,0);}\n else {robot.drive(MovementEnum.STOP,0);}\n // auto++;\n\n\n break;\n\n case 34:\n if (runtime.milliseconds() <= 10000) {\n robot.drive(MovementEnum.BACKWARD, 1);\n }\n else if(runtime.milliseconds() > 10000)\n // auto++;\n break;\n\n case 45:\n if (runtime.milliseconds() > 11000) {\n robot.claw.setPosition(1);\n }\n auto++;\n break;\n\n case 5:\n if (runtime.milliseconds() > 13000) {\n robot.drive(MovementEnum.BACKWARD, 1);\n }\n break;\n\n default: {\n robot.drive(MovementEnum.STOP, 0);\n\n }\n break;\n //if gold color (RGB value) is detected return value. G\n // Go forward, go backwards, and turn left.\n // Go forward until distance to wall is 6 inches.\n // Turn 45 degrees, and go forward.\n // Drop the team marker, then back up into the crater.\n }\n\n }", "@Test public void lastWins() {\n\t\tfinal String[] args = new String[]{\"-speed\", \"4\", \"-speed\", \"8\"};\n\t\tfinal CliActuators actuators = parser.parse(args, OPTIONS);\n\t\tAssert.assertEquals(\"8\", actuators.getActuatorById(\"speed\").getValue());\n\t}", "public void setPuntosFwd(double value) {\r\n this.puntosFwd = value;\r\n }", "public void checkInputs() {\n\n gearShift = driveStick.getXButtonReleased();\n slow = driveStick.getAButtonReleased();\n\n manualClimb = driveStick.getBumper(Hand.kLeft) && driveStick.getBumper(Hand.kRight);\n\n //climbToggle = driveStick.getBumperReleased(Hand.kLeft);\n climbToggle = false;\n climbRelease = driveStick.getStartButton();\n\n resetBalls = gunnerStick.getStartButtonReleased();\n visionShoot = gunnerStick.getBButtonReleased();\n manualShoot = gunnerStick.getYButton();\n distShoot = gunnerStick.getAButton();\n intakeToggle = gunnerStick.getBumperReleased(Hand.kRight);\n hoodToggle = gunnerStick.getBumperReleased(Hand.kLeft);\n intakeReverse = gunnerStick.getXButtonReleased();\n magazineReverse = gunnerStick.getBackButton();\n\n\n //Switch statement to determine controls for the driver\n switch (driverScheme) {\n case \"Reverse Turning\":\n XSpeed = -driveStick.getY(Hand.kLeft);\n ZRotation = driveStick.getX(Hand.kRight);\n break;\n default:\n XSpeed = driveStick.getY(Hand.kLeft);\n ZRotation = -driveStick.getX(Hand.kRight);\n break;\n }\n\n //Switch statement to determine controls for the gunner\n switch (gunnerScheme) {\n case \"Fun Mode\":\n\n discoToggle = gunnerStick.getBackButtonReleased();\n break;\n\n default:\n\n // if ((gunnerStick.getTriggerAxis(Hand.kRight) >= 0.75) && (gunnerStick.getTriggerAxis(Hand.kLeft) >= 0.75) && !overriding) {\n // overrideSafeties = !overrideSafeties;\n // overriding = true;\n // } else if ((gunnerStick.getTriggerAxis(Hand.kRight) <= 0.75) && (gunnerStick.getTriggerAxis(Hand.kLeft) <= 0.75)) {\n // overriding = false;\n // }\n\n break;\n }\n }", "@Override\n public void robotInit() {\n m_oi = new OI();\n m_chooser.setDefaultOption(\"Default Auto\", new ExampleCommand());\n // chooser.addOption(\"My Auto\", new MyAutoCommand());\n SmartDashboard.putData(\"Auto mode\", m_chooser);\n\n Comp = new Compressor();\n\n //ClimbBack = new DoubleSolenoid(PCM_COMP_24V, 0, 1);\n //ClimbFront = new DoubleSolenoid(PCM_COMP_24V, 2, 3);\n LegFrontL = new VictorSPX(30);\n LegFrontR = new Spark(9);\n LegBackL = new VictorSPX(31);\n LegBackR = new VictorSPX(32);\n\n BackFootMover = new VictorSP(1);\n FrontFootMover = new Spark(2);\n //FeetMovers = new SpeedControllerGroup(BackFootMoverFootMover);\n\n MainRight = new CANSparkMax(9, MotorType.kBrushless);\n AltRight = new CANSparkMax(10, MotorType.kBrushless);\n MainLeft = new CANSparkMax(11, MotorType.kBrushless);\n AltLeft = new CANSparkMax(12, MotorType.kBrushless);\n\n MainRight.setIdleMode(IdleMode.kCoast);\n AltRight.setIdleMode(IdleMode.kCoast);\n MainLeft.setIdleMode(IdleMode.kCoast);\n AltLeft.setIdleMode(IdleMode.kCoast);\n\n AltLeft.follow(MainLeft);\n AltRight.follow(MainRight);\n\n Drive = new DifferentialDrive(MainLeft, MainRight);\n\n Lifter = new TalonSRX(6);\n Lifter.setNeutralMode(NeutralMode.Brake);\n Lifter.enableCurrentLimit(false);\n /*Lifter.configContinuousCurrentLimit(40);\n Lifter.configPeakCurrentLimit(50);\n Lifter.configPeakCurrentDuration(1500);*/\n //Lifter.configReverseSoftLimitEnable(true);\n //Lifter.configReverseSoftLimitThreshold(-27000);\n //Lifter.configForwardLimitSwitchSource(LimitSwitchSource.FeedbackConnector, LimitSwitchNormal.NormallyOpen);\n //Lifter.configClearPositionOnLimitF(true, 0);\n Lifter.selectProfileSlot(0, 0);\n LiftSetpoint = 0;\n\n LiftFollower = new TalonSRX(5);\n LiftFollower.follow(Lifter);\n LiftFollower.setNeutralMode(NeutralMode.Brake);\n\n ArmExtender = new Solenoid(0);\n ArmOpener = new Solenoid(1);\n ArmGrippers = new Spark(0);\n\n HatchSwitch0 = new DigitalInput(0);\n HatchSwitch1 = new DigitalInput(1);\n\n Accel = new BuiltInAccelerometer(Range.k2G);\n\n //Diagnostics = new DiagnosticsLogger();\n // Uncomment this line to enable diagnostics. Warning: this may\n // cause the robot to be slower than it is supposed to be because of lag.\n //Diagnostics.start();\n\n xbox = new XboxController(0);\n joystick = new Joystick(1);\n \n LiftRamp = new SRamp();\n SpeedRamp = new SRamp();\n\n NetworkTableInstance nt = NetworkTableInstance.getDefault();\n\n VisionTable = nt.getTable(\"ChickenVision\");\n TapeDetectedEntry = VisionTable.getEntry(\"tapeDetected\");\n TapePitchEntry = VisionTable.getEntry(\"tapePitch\");\n TapeYawEntry = VisionTable.getEntry(\"tapeYaw\");\n\n LedTable = nt.getTable(\"LedInfo\");\n LedScript = LedTable.getEntry(\"CurrentScript\");\n LedScriptArgument = LedTable.getEntry(\"ScriptArgument\");\n LedArmsClosed = LedTable.getEntry(\"ArmsClosed\");\n\n UsbCamera cam = CameraServer.getInstance().startAutomaticCapture();\n cam.setPixelFormat(PixelFormat.kMJPEG);\n cam.setResolution(320, 240);\n cam.setFPS(15);\n \n\n LedScript.setString(\"ColorWaves\");\n LedScriptArgument.setString(\"\");\n\n limits = new DigitalInput[8];\n\n for (int i = 0; i < limits.length; i++) {\n limits[i] = new DigitalInput(i + 2);\n }\n }", "private boolean loop() throws Exception{\n\t\treadSensors(100);\r\n\t\tint[] lightBumpReadings = getLightBumps();\r\n\t\tdriveDirect(300, 300);\r\n\t\t//driveDirect(500,350);\r\n\t\t\r\n\t\tif(lightBumpReadings[0]>0){\r\n\t\t\tdriveDirect(175,100);\r\n\t\t\tsleep(300);\r\n\t\t\t\r\n\t\t}\r\n\t\tif(lightBumpReadings[1]>0){\r\n\t\t\tdriveDirect(150,100);\r\n\t\t\tsleep(300);\r\n\t\t}\r\n\t\tif(lightBumpReadings[2]>0){\r\n\t\t\tdriveDirect(125,100);\r\n\t\t\tsleep(300);\r\n\t\t}\r\n\t\tif(lightBumpReadings[3]>0){\r\n\t\t\tdriveDirect(100,125);\r\n\t\t\tsleep(300);\r\n\t\t}\r\n\t\tif(lightBumpReadings[4]>0){\r\n\t\t\tdriveDirect(100,150);\r\n\t\t\tsleep(300);\r\n\t\t}\r\n\t\tif(lightBumpReadings[5]>0){\r\n\t\t\tdriveDirect(100,175);\r\n\t\t\tsleep(300);\r\n\t\t}\r\n\t\t\r\n\t\tif(lightBumpReadings[2]>0 && lightBumpReadings[3]>0){\r\n\t\t\tdriveDirect(0,500);\r\n\t\t\tsleep(750);\r\n\t\t\tif(lightBumpReadings[2]>0 && lightBumpReadings[3]>0){\r\n\t\t\t\tdriveDirect(0,500);\r\n\t\t\t\tsleep(1500);\r\n\t\t\t\tif(lightBumpReadings[2]>0 && lightBumpReadings[3]>0){\r\n\t\t\t\t\tdriveDirect(0,500);\r\n\t\t\t\t\tsleep(750);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tdriveDirect(300,300);\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tdriveDirect(300,300);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn true;\r\n\t}", "public void autoUpdate()\n {\n if(distanceSensor.checkDistance() < 300 && myRobot.getAutoDrive())\n {\n activateDumpSolenoid(forward);\n myRobot.setAutoDoneTrue();\n }\n\n //closes the ball tray after doing autonomous\n if(distanceSensor.checkDistance() > 900 && myRobot.getAutoDrive())\n {\n activateDumpSolenoid(reverse);\n }\n }", "public void tankDrive() {\n\t\tif (fastBool) {\n\t\t\tmotorRB.set(joystickRYAxis);\n\t\t\tmotorRF.set(joystickRYAxis);\n\t\t\tmotorLB.set(-joystickLYAxis);\n\t\t\tmotorLF.set(-joystickLYAxis);\n\n\t\t} else {\n\t\t\tmotorRB.set(joystickRYAxis/2);\n\t\t\tmotorRF.set(joystickRYAxis/2);\n\t\t\tmotorLB.set(-joystickLYAxis/2);\n\t\t\tmotorLF.set(-joystickLYAxis/2);\n\t\t\t//System.out.println(strongBad.motorMultiplier);\n\t\t\t//SmartDashboard.putNumber(\"MM2\", strongBad.motorMultiplier);\n\n\t\t}\n\t}", "public void intake(double up_speed, double down_speed) //上面&下面的intake\n {\n intake_up.set(ControlMode.PercentOutput, up_speed);\n intake_down.set(ControlMode.PercentOutput, down_speed);\n }", "protected void initialize() {\n \ttarget = (int) SmartDashboard.getNumber(\"target\", 120);\n \ttarget = (int) (target * Constants.TICKS_TO_INCHES);\n\t\tRobot.drive.stop();\n\t\tmaxCount = (int) SmartDashboard.getNumber(\"max count\", 0);\n\t\ttolerance = (int) SmartDashboard.getNumber(\"tolerance\", 0);\n\t\tRobot.drive.left.motor1.setSelectedSensorPosition(0, Constants.kPIDLoopIdx, Constants.kTimeoutMs);\n\t\tRobot.drive.right.motor1.setSelectedSensorPosition(0, Constants.kPIDLoopIdx, Constants.kTimeoutMs);\n }", "private void testRelease()\n {\n if(gamepad1.x) {\n // move to 0 degrees.\n servoLeft.setPosition(0);\n //servoRight.setPosition(0);\n }\n telemetry.addData(\"Servo Left Posit++backInc;ion\", servoLeft.getPosition());\n //telemetry.addData(\"Servo Right Position\", servoRight.getPosition());\n }", "public void gearBoxTest(){\n\t\tif (counter < 6) {\n\t\t\ttimerTest.start();\n\t\t\tif (480 >= timerTest.get()) {\n\t\t\t\tmotorRB.set(1);\n\t\t\t\tmotorRF.set(1);\n\t\t\t\tmotorLB.set(1);\n\t\t\t\tmotorLF.set(1);\n\t\t\t}\n\t\t\telse if (timerTest.get() > 480 && 600 >= timerTest.get()) {\n\t\t\t\tmotorRB.set(0);\n\t\t\t\tmotorRF.set(0);\n\t\t\t\tmotorLB.set(0);\n\t\t\t\tmotorLF.set(0);\n\t\t\t}\n\t\t\telse if (timerTest.get() > 600) {\n\t\t\t\ttimerTest.reset();\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t}", "protected void initialize() {\n \t starttime = Timer.getFPGATimestamp();\n \tthis.startAngle = RobotMap.navx.getAngle();\n \tangleorientation.setSetPoint(RobotMap.navx.getAngle());\n \t\n \tRobotMap.motorLeftTwo.enableControl();\n \tRobotMap.motorRightTwo.enableControl();\n \tRobotMap.motorLeftTwo.enableControl();\n \tRobotMap.motorRightTwo.enableControl();\n \n //settting talon control mode\n \tRobotMap.motorLeftTwo.changeControlMode(TalonControlMode.MotionMagic);\t\t\n\t\tRobotMap.motorLeftOne.changeControlMode(TalonControlMode.Follower);\t\n\t\tRobotMap.motorRightTwo.changeControlMode(TalonControlMode.MotionMagic);\t\n\t\tRobotMap.motorRightOne.changeControlMode(TalonControlMode.Follower);\n\t\t//setting peak and nominal output voltage for the motors\n\t\tRobotMap.motorLeftTwo.configPeakOutputVoltage(+12.0f, -12.0f);\n\t\tRobotMap.motorLeftTwo.configNominalOutputVoltage(0.00f, 0.0f);\n\t\tRobotMap.motorRightTwo.configPeakOutputVoltage(+12.0f, -12.0f);\n\t\tRobotMap.motorRightTwo.configNominalOutputVoltage(0.0f, 0.0f);\n\t\t//setting who is following whom\n\t\tRobotMap.motorLeftOne.set(4);\n\t\tRobotMap.motorRightOne.set(3);\n\t\t//setting pid value for both sides\n\t//\tRobotMap.motorLeftTwo.setCloseLoopRampRate(1);\n\t\tRobotMap.motorLeftTwo.setProfile(0);\n\t RobotMap.motorLeftTwo.setP(0.000014f);\n \tRobotMap.motorLeftTwo.setI(0.00000001);\n\t\tRobotMap.motorLeftTwo.setIZone(0);//325);\n\t\tRobotMap.motorLeftTwo.setD(1.0f);\n\t\tRobotMap.motorLeftTwo.setF(this.fGainLeft+0.014);//0.3625884);\n\t\tRobotMap.motorLeftTwo.setAllowableClosedLoopErr(0);//300);\n\t\t\n\t RobotMap.motorRightTwo.setCloseLoopRampRate(1);\n\t RobotMap.motorRightTwo.setProfile(0);\n\t\tRobotMap.motorRightTwo.setP(0.000014f);\n\t\tRobotMap.motorRightTwo.setI(0.00000001);\n\t\tRobotMap.motorRightTwo.setIZone(0);//325);\n\t\tRobotMap.motorRightTwo.setD(1.0f);\n\t\tRobotMap.motorRightTwo.setF(this.fGainRight);// 0.3373206);\n\t\tRobotMap.motorRightTwo.setAllowableClosedLoopErr(0);//300);\n\t\t\n\t\t//setting Acceleration and velocity for the left\n\t\tRobotMap.motorLeftTwo.setMotionMagicAcceleration(125);\n\t\tRobotMap.motorLeftTwo.setMotionMagicCruiseVelocity(250);\n\t\t//setting Acceleration and velocity for the right\n\t\tRobotMap.motorRightTwo.setMotionMagicAcceleration(125);\n\t\tRobotMap.motorRightTwo.setMotionMagicCruiseVelocity(250);\n\t\t//resets encoder position to 0\t\t\n\t\tRobotMap.motorLeftTwo.setEncPosition(0);\n\t\tRobotMap.motorRightTwo.setEncPosition(0);\n\t //Set Allowable error for the loop\n\t\tRobotMap.motorLeftTwo.setAllowableClosedLoopErr(300);\n\t\tRobotMap.motorRightTwo.setAllowableClosedLoopErr(300);\n\t\t\n\t\t//sets desired endpoint for the motors\n RobotMap.motorLeftTwo.set(motionMagicEndPoint);\n RobotMap.motorRightTwo.set(-motionMagicEndPoint );\n \t\n }", "private void updateMotors() {\n\t\t//Pass filtered values to ChopperStatus.\n\t\tmStatus.setMotorFields(mMotorSpeed);\n\t\tString logline = Long.toString(System.currentTimeMillis()) + \" \" + mMotorSpeed[0] + \" \" + mMotorSpeed[1] + \" \" + mMotorSpeed[2] + \" \" + mMotorSpeed[3] + \"\\n\";\n\t\ttry {\n\t\t\tif (logfile != null) {\n\t\t\t\tlogfile.write(logline);\n\t\t\t\tlogfile.flush();\n\t\t\t}\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\t//Log.e(TAG, \"Cannot write to logfile\");\n\t\t}\n\t\t//Pass motor values to motor controller!\n\t\tMessage msg = Message.obtain();\n\t\tmsg.what = SEND_MOTOR_SPEEDS;\n\t\tmsg.obj = mMotorSpeed;\n\t\tmBt.sendMessageToHandler(msg);\n\t\t//Log.i(TAG, \"Guidance sending message.\");\n\t\t\n\t}", "@Override\n public void loop() {\n\n //double armRot = robot.Pivot.getPosition();\n\n double deadzone = 0.2;\n\n double trnSpdMod = 0.5;\n\n float xValueRight = gamepad1.right_stick_x;\n float yValueLeft = -gamepad1.left_stick_y;\n\n xValueRight = Range.clip(xValueRight, -1, 1);\n yValueLeft = Range.clip(yValueLeft, -1, 1);\n\n // Pressing \"A\" opens and closes the claw\n if (gamepad1.a) {\n\n if (robot.Claw.getPosition() < 0.7)\n while(gamepad1.a){\n robot.Claw.setPosition(1);}\n else if (robot.Claw.getPosition() > 0.7)\n while(gamepad1.a){\n robot.Claw.setPosition(0.4);}\n else\n while(gamepad1.a)\n robot.Claw.setPosition(1);\n }\n\n // Pressing \"B\" changes the wrist position\n if (gamepad1.b) {\n\n if (robot.Wrist.getPosition() == 1)\n while(gamepad1.b)\n robot.Wrist.setPosition(0.5);\n else if (robot.Wrist.getPosition() == 0.5)\n while(gamepad1.b)\n robot.Wrist.setPosition(1);\n else\n while(gamepad1.b)\n robot.Wrist.setPosition(1);\n }\n\n // Turn left/right, overrides forward/back\n if (Math.abs(xValueRight) > deadzone) {\n\n robot.FL.setPower(xValueRight * trnSpdMod);\n robot.FR.setPower(-xValueRight * trnSpdMod);\n robot.BL.setPower(xValueRight * trnSpdMod);\n robot.BR.setPower(-xValueRight * trnSpdMod);\n\n\n } else {//Forward/Back On Solely Left Stick\n if (Math.abs(yValueLeft) > deadzone) {\n robot.FL.setPower(yValueLeft);\n robot.FR.setPower(yValueLeft);\n robot.BL.setPower(yValueLeft);\n robot.BR.setPower(yValueLeft);\n }\n robot.FL.setPower(0);\n robot.FR.setPower(0);\n robot.BL.setPower(0);\n robot.BR.setPower(0);\n }\n\n\n telemetry.addData(\"Drive Encoder Ticks\", robot.FL.getCurrentPosition());\n telemetry.addData(\"Winch Encoder Ticks\", robot.Winch.getCurrentPosition());\n telemetry.addData(\"ColorArm Position\", robot.ColorArm.getPosition());\n telemetry.addData(\"Wrist Position\", robot.Wrist.getPosition());\n telemetry.addData(\"Claw Position\", robot.Claw.getPosition());\n telemetry.addData(\"Grip Position\", robot.Grip.getPosition());\n telemetry.addData(\"Color Sensor Data Red\", robot.Color.red());\n telemetry.addData(\"Color Sensor Data Blue\", robot.Color.blue());\n\n /*\n\n // This is used for an Omniwheel base\n\n // Group a is Front Left and Rear Right, Group b is Front Right and Rear Left\n float a;\n float b;\n float turnPower;\n if(!gamepad1.x) {\n if (Math.abs(xValueRight) <= deadzone && Math.abs(yValueRight) <= deadzone) {\n // And is used here because both the y and x values of the right stick should be less than the deadzone\n\n a = Range.clip(yValueLeft + xValueLeft, -1, 1);\n b = Range.clip(yValueLeft - xValueLeft, -1, 1);\n\n\n robot.FL.setPower(a);\n robot.FR.setPower(b);\n robot.BL.setPower(b);\n robot.BR.setPower(a);\n\n telemetry.addData(\"a\", \"%.2f\", a);\n telemetry.addData(\"b\", \"%.2f\", b);\n\n } else if (Math.abs(xValueRight) > deadzone || Math.abs(yValueRight) > deadzone) {\n\n // Or is used here because only one of the y and x values of the right stick needs to be greater than the deadzone\n turnPower = Range.clip(xValueRight, -1, 1);\n\n robot.FL.setPower(-turnPower);\n robot.FR.setPower(turnPower);\n robot.BL.setPower(-turnPower);\n robot.BR.setPower(turnPower);\n\n } else {\n\n robot.FL.setPower(0);\n robot.FR.setPower(0);\n robot.BL.setPower(0);\n robot.BR.setPower(0);\n }\n\n } else {\n\n if (Math.abs(xValueRight) <= deadzone && Math.abs(yValueRight) <= deadzone) {\n\n // And is used here because both the y and x values of the right stick should be less than the deadzone\n a = Range.clip(yValueLeft + xValueLeft, -0.6f, 0.6f);\n b = Range.clip(yValueLeft - xValueLeft, -0.6f, 0.6f);\n\n\n robot.FL.setPower(a);\n robot.FR.setPower(b);\n robot.BL.setPower(b);\n robot.BR.setPower(a);\n\n telemetry.addData(\"a\", \"%.2f\", a);\n telemetry.addData(\"b\", \"%.2f\", b);\n\n } else if (Math.abs(xValueRight) > deadzone || Math.abs(yValueRight) > deadzone) {\n\n // Or is used here because only one of the y and x values of the right stick needs to be greater than the deadzone\n turnPower = Range.clip(xValueRight, -1, 1);\n\n robot.FL.setPower(-turnPower);\n robot.FR.setPower(turnPower);\n robot.BL.setPower(-turnPower);\n robot.BR.setPower(turnPower);\n\n } else {\n\n robot.FL.setPower(0);\n robot.FR.setPower(0);\n robot.BL.setPower(0);\n robot.BR.setPower(0);\n }\n }\n\n\n if (gamepad1.dpad_up) {\n\n robot.Swing.setPower(.6);\n\n } else if (gamepad1.dpad_down) {\n\n robot.Swing.setPower(-.6);\n\n } else {\n\n robot.Swing.setPower(0);\n }\n\n if(gamepad1.a){\n\n robot.Claw.setPosition(.4);\n\n } else if(gamepad1.b){\n\n robot.Claw.setPosition(0);\n }\n\n if(gamepad1.left_bumper) {\n\n robot.Pivot.setPosition(armRot+0.0005);\n\n } else if(gamepad1.right_bumper) {\n\n robot.Pivot.setPosition(armRot-0.0005);\n\n } else{\n\n robot.Pivot.setPosition(armRot);\n }\n\n telemetry.addData(\"position\", position);\n\n */\n\n /*\n * Code to run ONCE after the driver hits STOP\n */\n }", "public static void tick() {\n/* */ try {\n/* 540 */ if (!NEIConfig.isEnabled()) {\n/* */ return;\n/* */ }\n/* */ \n/* 544 */ for (Widget widget : controlWidgets)\n/* */ {\n/* 546 */ widget.update(gui);\n/* */ }\n/* */ }\n/* 549 */ catch (Exception exception) {\n/* */ \n/* 551 */ NEIUtils.reportException(exception);\n/* 552 */ NEIConfig.setEnabled(false);\n/* */ } \n/* */ }", "public void move() {\n\t\t\tRandom rand = new Random();//random number generator\n\t\t\tint value = rand.nextInt(500000);//there is a 1 in 500000 chance there will be a new powerup every frame.\n\t\t\tif (value==0) {//if the value is 0\n\t\t\t\tRandom ran = new Random();//make a random number generator and a power up vairable\n\t\t\t\tPowerUp currentPowerUp = null;\n\t\t\t\tint type = ran.nextInt(3);//switch the 1 for the amount of types made.\n\t\t\t\tif (type==0) {//add the powerup depending on the random number. There are 3 types\n\t\t\t\t\tcurrentPowerUp = new PowerUp(healthPowerUp, 0);//this adds a life\n\t\t\t\t}\n\t\t\t\telse if (type==1) {\n\t\t\t\t\tcurrentPowerUp = new PowerUp(longPowerUp, 1);//this makes the slider wider\n\t\t\t\t} else if (type==2) {\n\t\t\t\t\tcurrentPowerUp = new PowerUp(bonusPointsPowerUp, 2);//this just adds points\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t//set x and y\n\t\t\t\t//make a random x\n\t\t\t\tint newX = ran.nextInt(401) - 201 + GamePlay.getScreenWidth()/2; //-200 to 200 variance from center\n\t\t\t\tint newY = ran.nextInt(201) - 101 + GamePlay.getScreenHeight()/4;//-100 to 100 variance from the 25% of top distance line.\n\t\t\t\tif (currentPowerUp!=null) {\n\t\t\t\t\tcurrentPowerUp.setX(newX);\n\t\t\t\t\tcurrentPowerUp.setY(newY);\n\t\t\t\t\tpowerUps.add(currentPowerUp);//add the powerups to an array list\n\t\t\t\t} else {\n\t\t\t\t\tSystem.out.println(\"PowerUp error.\");//if the variable is null, something went wrong.\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//move all powerUps down by ball speed\n\t\t\tfor (PowerUp power: powerUps) {\n\t\t\t\tpower.setY(power.getY() + ballSpeed);\n\t\t\t}\n\t\t\t\n\t\t\t//check if the powerups are off the screen. remove if they are. \n\t\t\tfor (int r = powerUps.size()-1; r>=0; r--) {\n\t\t\t\tif (powerUps.get(r).getY() > GamePlay.getScreenHeight()-h) {\n\t\t\t\t\tpowerUps.remove(r);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t//death of a ball\n\t\t\tif (ball.getY()>GamePlay.getScreenHeight() && pause==false) {\n\t\t\t\tdeath();\n\t\t\t}\n\t\t\t\n\t\t\t//no bricks left\n\t\t\tif (blocks.size()==0) {\n\t\t\t\t//you leveled up!\n\t\t\t\tlevelUp();\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t//wall collision check for ball\n\t\t\t//right wall\n\t\t\tif (ball.rightCollide(GamePlay.getScreenWidth())) {//seperated for later use if wanted.\n\t\t\t\tballVX*=-1;\n\t\t\t} else if (ball.leftCollide(0)) {//left wall\n\t\t\t\tballVX*=-1;\n\t\t\t}\n\t\t\t\n\t\t\tif (ball.topCollide(0)) {//top wall\n\t\t\t\tballVY*=-1;\n\t\t\t} //dont check bottom wall because that is the death of a ball.\n\t\t\t\n\t\t\t//collision with the slider.\n\t\t\tif (ball.getRect().intersects(slider.getRect()) && ball.getY()+ball.getHeight() <= slider.getY()+ballSpeed) {//intersected bool needed\n\t\t\t\tballVY*=-1;\n\t\t\t\tballVX+=sliderVX;//add the slider velocity to the ball velocity, giving user some control over angle. \n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t//collision with the powerups\n\t\t\t\n\t\t\tfor (int a = powerUps.size()-1; a>=0; a--) {//iterate thrpough the powerups\n\t\t\t\tPowerUp power = powerUps.get(a);\n\t\t\t\tif (power.getRect().intersects(slider.getRect())) {//if the powerups rect intersects, the slider caught it. Remove from screen\n\t\t\t\t\t//THIS MEANS THEY CAUGHT THE POWERUP\n\t\t\t\t\tif (power.getType()==\"HEALTH\" && power.getIntersected()==false) {\n\t\t\t\t\t\tpower.setIntersected(true);\n\t\t\t\t\t\tif (lives<5)\n\t\t\t\t\t\t\tlives+=1;//add a life up to 5\n\t\t\t\t\t\tpowerUps.remove(a);\n\t\t\t\t\t} else if (power.getType()==\"LONG\" && power.getIntersected()==false) {\n\t\t\t\t\t\tpower.setIntersected(true);\n\t\t\t\t\t\textended = true;//extended flag to say the slider is extended. extend the slider's width by the adjust amount preset globally\n\t\t\t\t\t\tslider.resize(slider.getWidth()+adjust, slider.getHeight());\n\t\t\t\t\t\tslider.setX(slider.getX()-adjust/2);\n\t\t\t\t\t\textendTimer.restart();//restart the entend timer\n\t\t\t\t\t\tpowerUps.remove(a);\n\t\t\t\t\t} else if (power.getType()==\"BONUS\" && power.getIntersected()==false) {\n\t\t\t\t\t\tpower.setIntersected(true);\n\t\t\t\t\t\tscore+=100;//add a 100 points.\n\t\t\t\t\t\tpowerUps.remove(a);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//collision with blocks\n\t\t\t\n\t\t\tboolean changed = false;//this is a flag to see if any collisions occured this frame\n\t\t\tfor (Block block:blocks) {\n\t\t\t\tRectangle r = block.getRect();\t\t\n\t\t\t\tif (r.intersects(ball.getRect())) {//if the rects intersected, something hit something. However, we don't know from what direction\n\t\t\t\t\t//since the vy is always going to be by 1, we can check if it is equal. There is no multiples to deal with. \n\t\t\t\t\t\n\t\t\t\t\t//this checks if it was colliding from the bottom. Check the bottom edge of block and top of the ball\n\t\t\t\t\tif (ball.getY() + 2 >= block.getBottom() && ball.getY() -2 <= block.getBottom() && ball.getIntersected()==false) {\n\t\t\t\t\t\t//bottom collision\n\t\t\t\t\t\tballVY*=-1;//reflect back\n\t\t\t\t\t\tscore += block.downColor();//change the color, adjust score\n\t\t\t\t\t\tball.setIntersected(true);//set the intersected flag so it will not trigger again for the same stimuli\n\t\t\t\t\t\tball.setY(ball.getY() + ballVY);//set the y to remove the ball from collision\n\t\t\t\t\t\tchanged=true;//set the changed flag to true\n\t\t\t\t\t\thitSound.play();//play a sound\n\t\t\t\t\t\t\n\t\t\t\t\t} else if (ball.getY() + ball.getHeight() + 2 >=block.getTop() && ball.getY() + ball.getHeight() -2 <=block.getTop() && ball.getIntersected()==false) {\n\t\t\t\t\t\t//this checks if it was colliding on the top. Check bottom edge of ball and top of block.\n\t\t\t\t\t\tballVY*=-1;//reflect back\n\t\t\t\t\t\tscore += block.downColor();//change the color, adjust score\n\t\t\t\t\t\tball.setIntersected(true);//set the intersected flag so it will not trigger again for the same stimuli\n\t\t\t\t\t\tball.setY(ball.getY() + ballVY);//set the y to remove the ball from collision\n\t\t\t\t\t\tchanged=true;//set the changed flag to true\n\t\t\t\t\t\thitSound.play();//play a sound\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (changed==false && ball.getIntersected()==false) {\n\t\t\t\t\t\t//this must mean it is on the left or right\n\t\t\t\t\t\t//it doesn't matter which one, the change is the exact same!\n\t\t\t\t\t\tballVX*=-1;//flip the x direction\n\t\t\t\t\t\tscore+=block.downColor();//change color, adjust score\n\t\t\t\t\t\tball.setIntersected(true);//set the intersected flag\n\t\t\t\t\t\tball.setX(ball.getX() + ballVX);\n\t\t\t\t\t\tchanged=true;//set the changed flag\n\t\t\t\t\t\thitSound.play();//play the sound\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}//end the for.\n\t\t\tif (changed==false) {//if no changes, reset the flag.\n\t\t\t\tball.setIntersected(false);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t//move everything as per velocity\n\t\t\tif (slider.getX() > 10 && sliderVX<0) {\n\t\t\t\tslider.setX(slider.getX() + sliderVX*ballSpeed*2);//the slider can move twice as fast as the ball.\n\t\t\t} else if ((slider.getX()+slider.getWidth()) < GamePlay.getScreenWidth()-10 && sliderVX>0) {\n\t\t\t\tslider.setX(slider.getX() + sliderVX*ballSpeed*2);\n\t\t\t}\n\t\t\tif (ready) {\n\t\t\t\tball.setX(ball.getX() + ballVX);\n\t\t\t\tball.setY(ball.getY() + ballVY);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}", "void nearingTheWallBefore(){\n robot.absgyroRotation(0, \"absolute\");\n\n //alligning with the wall before going for the toy\n while(robot.leftDistanceSensor.getDistance(DistanceUnit.CM) > 15 && !isStopRequested()){\n if(robot.leftDistanceSensor.getDistance(DistanceUnit.CM) < 30)\n robot.mecanumMovement(0, .3, 0);\n else\n robot.mecanumMovement(0, .7, 0);\n\n telemetry.addLine(\"Distance from sensor: \" + robot.leftDistanceSensor.getDistance(DistanceUnit.CM));\n telemetry.update();\n }\n robot.mecanumMovement(0, 0, 0);\n\n robot.absgyroRotation(45, \"absolute\");\n }", "public void update1() {\n\n if(gamepad1.a)\n aCount1++;\n else\n aCount1 = 0;\n if(aCount1 == DEBOUNCING_NUMBER_OF_SAMPLES)\n aToggle1 = !aToggle1;\n\n if(gamepad1.b)\n bCount1++;\n else\n bCount1 = 0;\n if(bCount1 == DEBOUNCING_NUMBER_OF_SAMPLES)\n bToggle1 = !bToggle1;\n\n if(gamepad1.x)\n xCount1++;\n else\n xCount1 = 0;\n if(xCount1 == DEBOUNCING_NUMBER_OF_SAMPLES)\n xToggle1 = !xToggle1;\n\n if(gamepad1.y)\n yCount1++;\n else\n yCount1 = 0;\n if(yCount1 == DEBOUNCING_NUMBER_OF_SAMPLES)\n yToggle1 = !yToggle1;\n\n if(gamepad1.dpad_down)\n dpadDownCount1++;\n else\n dpadDownCount1 = 0;\n if(dpadDownCount1 == DEBOUNCING_NUMBER_OF_SAMPLES)\n dpadDownToggle1 = !dpadDownToggle1;\n\n if(gamepad1.dpad_up)\n dpadUpCount1++;\n else\n dpadUpCount1 = 0;\n if(dpadUpCount1 == DEBOUNCING_NUMBER_OF_SAMPLES)\n dpadUpToggle1 = !dpadUpToggle1;\n\n if(gamepad1.left_bumper)\n leftBumperCount1++;\n else\n leftBumperCount1 = 0;\n if(leftBumperCount1 == DEBOUNCING_NUMBER_OF_SAMPLES)\n leftBumperToggle1 = !leftBumperToggle1;\n\n if(gamepad1.right_bumper)\n rightBumperCount1++;\n else\n rightBumperCount1 = 0;\n if(rightBumperCount1 == DEBOUNCING_NUMBER_OF_SAMPLES)\n rightBumperToggle1 = !rightBumperToggle1;\n\n if(gamepad1.left_stick_button)\n leftStick1++;\n else\n leftStick1 = 0;\n if(leftStick1 == DEBOUNCING_NUMBER_OF_SAMPLES)\n leftStickToggle1 = !leftStickToggle1;\n\n if(gamepad1.right_stick_button)\n rightStick1++;\n else\n rightStick1 = 0;\n if(rightStick1 == DEBOUNCING_NUMBER_OF_SAMPLES)\n rightStickToggle1 = !rightStickToggle1;\n\n if(gamepad2.left_stick_button)\n leftStick2++;\n else\n leftStick2 = 0;\n if(leftStick2 == DEBOUNCING_NUMBER_OF_SAMPLES)\n leftStickToggle2 = !leftStickToggle2;\n\n if(gamepad2.right_stick_button)\n rightStick2++;\n else\n rightStick2 = 0;\n if(rightStick2 == DEBOUNCING_NUMBER_OF_SAMPLES)\n rightStickToggle2 = !rightStickToggle2;\n\n }", "@Override\npublic void teleopPeriodic() {\nm_robotDrive.arcadeDrive(m_stick.getRawAxis(5)* (-0.5), m_stick.getRawAxis(4)*0.5);\n}", "public void loop() {\n\n // robot.leftClamp.setPosition(((gamepad2.left_stick_y / 2) + .5));\n // robot.rightClamp.setPosition(((gamepad2.right_stick_y / 2) + .5));\n\n if(gamepad2.a){\n robot.rightClamp.setPosition(0);\n robot.leftClamp.setPosition(1);\n }\n else if(gamepad2.b){\n robot.rightClamp.setPosition(.275);\n robot.leftClamp.setPosition(.775);\n }\n\n\n }", "public void configVelocityControl() {\n leftDrive.configTeleopVelocity();\n rightDrive.configTeleopVelocity();\n }", "public void teleopPeriodic() {\n \t//driveTrain.setInputSpeed(xbox.getAxisLeftY(), xbox.getAxisRightY());\n \t\n \tdriveTrain.print();\n \t\n \t// funcao PID\n \tif (xbox.getButtonX()) {\n\t\t\tbotaoapertado = true;\n\t\t} else if (xbox.getButtonY()) {\n\t\t\tbotaoapertado = false;\n\t\t\tdriveTrain.start();\n\t\t\tdriveTrain.setSetPoint(0, 0);\n\t\t}\n \tif (botaoapertado) {\n \t\tdriveTrain.setSetPoint(100, 100);\n\t\t}\n \t\n }", "protected void execute() \n {\n if(Robot.isClimbEnabled)\n if(Math.abs(Robot.oi.driverJoystick.getLeftStickRaw_Y())>0.1) //we only want to drive fwd, never reverse\n Robot.monkeyBarIntakeWheels.driveIntakeAll((Math.abs(Robot.oi.driverJoystick.getLeftStickRaw_Y()+.2)) + 0.15);\n else\n Robot.monkeyBarIntakeWheels.driveIntakeAll(0.07); //always drive wheels in climb mode\n else\n Robot.monkeyBarIntakeWheels.driveIntakeAll(0.6*Robot.oi.getMonkeyBarIntakeJoystickValue());\n }", "public void adjustShooterAngleManual() {\n\n // If the driver pushes the Square Button on the PS4 Controller,\n // set the worm drive motors to go backwards (lower it).\n if (PS4.getRawButton(PS4_X_BUTTON) == true) {\n\n wormDriveMotors.set(-0.2);\n\n // If the driver pushes the Triangle Button on the PS4 Controller,\n // set the worm drive motors to go forwards (raise it up).\n } else if (PS4.getRawButton(PS4_SQUARE_BUTTON) == true) {\n\n wormDriveMotors.set(0.4);\n }\n\n // If the driver is an idiot and is pressing BOTH the Square Button AND the\n // Triangle Button at the same time, OR (||) if the driver is pushing neither\n // button, set the motor speed to 0.\n else if (((PS4.getRawButton(PS4_X_BUTTON) == true) && (PS4.getRawButton(PS4_SQUARE_BUTTON) == true))\n || ((PS4.getRawButton(PS4_X_BUTTON) == false) && (PS4.getRawButton(PS4_SQUARE_BUTTON) == false))) {\n\n wormDriveMotors.set(0);\n }\n\n }", "void enablePWM(double initialDutyCycle);", "private void controlLift()\n {\n if (gamepad1.dpad_up) {\n liftMotor.setPower(-0.5);\n } else if (gamepad1.dpad_down) {\n liftMotor.setPower(0.5);\n } else {++backInc;\n liftMotor.setPower(0);\n }\n }", "public void autoScoreBottomCenterPeg() {\n getRobotDrive().goForward(-.5); //Speed at which to back up\n Timer.delay(1); //Time to continue backing up\n getRobotDrive().stop(); //Stop backing up\n arm.armJag.set(.4); //Speed to lower arm *may need to be inverted*\n Timer.delay(.5); //Time to lower arm\n arm.grabTube(true); //Opens the claw to release Ub3r Tube\n getRobotDrive().goForward(-.5); //Speed at which to back up again\n arm.armJag.set(.3); //Lowers arm safely to ground.\n\n }", "void think() {\n //get the output of the neural network\n decision = brain.output(vision);\n\n if (decision[0] > 0.8) {//output 0 is boosting\n boosting = true;\n } else {\n boosting = false;\n }\n if (decision[1] > 0.8) {//output 1 is turn left\n spin = -0.08f;\n } else {//cant turn right and left at the same time\n if (decision[2] > 0.8) {//output 2 is turn right\n spin = 0.08f;\n } else {//if neither then dont turn\n spin = 0;\n }\n }\n //shooting\n if (decision[3] > 0.8) {//output 3 is shooting\n shoot();\n }\n }", "public Indexer() {\n motor = new CANSparkMax(RobotMap.INDEX_MOTOR, MotorType.kBrushless);\n motorPid = motor.getPIDController();\n motorEnc = motor.getEncoder();\n\n motorEnc.setVelocityConversionFactor(1);\n motorEnc.setPositionConversionFactor(1);\n\n motorEnc.setPosition(0);\n\n motorPid.setIZone(200);\n motorPid.setOutputRange(-1, 1);\n\n motorPid.setP(Constants.INDEXER_P);\n motorPid.setI(Constants.INDEXER_I);\n motorPid.setD(Constants.INDEXER_D);\n motorPid.setFF(Constants.INDEXER_FF);\n\n motorPid.setSmartMotionMaxAccel(10000, 0);\n motorPid.setSmartMotionAccelStrategy(AccelStrategy.kTrapezoidal, 0);\n motorPid.setSmartMotionMaxVelocity(MAX_VEL, 0);\n // motorPid.setSmartMotionMinOutputVelocity(100, 0);\n motorPid.setSmartMotionAllowedClosedLoopError(0.5, 0);\n\n motor.setIdleMode(IdleMode.kBrake);\n\n input1 = new DigitalInput(RobotMap.LIMIT_PORT_1);\n input2 = new DigitalInput(RobotMap.LIMIT_PORT_2);\n input3 = new DigitalInput(RobotMap.LIMIT_PORT_3);\n input5 = new DigitalInput(RobotMap.LIMIT_PORT_5);\n inputDecrement = new DigitalInput(RobotMap.LIMIT_PORT_DECREMENT);\n\n var tab = Shuffleboard.getTab(\"Indexer\");\n tab.addNumber(\"Motor Speed\", motorEnc::getVelocity);\n // tab.addNumber(\"Position\", motorEnc::getPosition);\n tab.addNumber(\"Num Balls\", () -> numBalls);\n tab.addBoolean(\"Beam Break 1\", input1::get);\n tab.addBoolean(\"Beam Break 2\", input2::get);\n tab.addBoolean(\"Beam Break 3\", input3::get);\n // tab.addBoolean(\"Beam Break 4\", input4::get);\n tab.addBoolean(\"Beam Break 5\", input5::get);\n\n var matchTab = Shuffleboard.getTab(\"Match\");\n matchTab.addNumber(\"Num Balls\", this::getNumBalls);\n matchTab.addBoolean(\"5 Balls\", () -> getNumBalls() >= 5);\n\n new Thread(() -> {\n boolean wasRead = false;\n while (true) {\n if (inputDecrement.get() && !wasRead) {\n wasRead = true;\n } else if (!inputDecrement.get() && wasRead) {\n decrementBall();\n wasRead = false;\n }\n try {\n Thread.sleep(5);\n } catch (InterruptedException e) {\n }\n }\n }).start();\n }", "public void joystickDeadZone() {\n\t\tif (joystickLXAxis <= 0.075 && joystickLXAxis >= -0.075) {\n\t\t\tjoystickLXAxis = 0;\n\t\t} if (joystickLYAxis <= 0.075 && joystickLYAxis >= -0.075) {\n\t\t\tjoystickLYAxis = 0;\n\t\t}\n\t\tif (joystickRXAxis <= 0.075 && joystickRXAxis >= -0.075) {\n\t\t\tjoystickRXAxis = 0;\n\t\t} if (joystickRYAxis <= 0.075 && joystickRYAxis >= -0.075) {\n\t\t\tjoystickRYAxis = 0;\n\t\t}\n\t}", "public void tensionRangeCheck(){\n if(motor.get() < 0){\n if(Bottom_Limit_Switch.get() | tenPot.pidGet()> tenPotMAX ){\n motor.set(0.0);\n }\n }else if(motor.get() > 0){\n if(Top_Limit_Switch.get() | tenPot.pidGet()< tenPotMIN){\n motor.set(0.0);\n }\n }\n }", "@Override\n public void loop() {\n\n // Right wheels will be controlled by the right stick\n // Left wheels will be controlled by the left stick\n float rightWheels = gamepad1.right_stick_y;\n float leftWheels = gamepad1.left_stick_y;\n\n // write the values to the motors\n setRightMotors(rightWheels);\n setLeftMotors(leftWheels);\n\n //When dino arms are open\n if (gamepad2.left_bumper){\n openDinoArms();\n }\n\n //When dino arms are closed\n if (gamepad2.right_bumper){\n closeDinoArms();\n }\n\n //When ball channel is open\n if (gamepad2.b) {\n openBallChannel();\n } else {\n //When ball channel is closed\n closeBallChannel();\n }\n\n //When the deflector is raised\n if (gamepad2.y) {\n openDeflector();\n }\n else {\n stopDeflector();\n }\n\n //When deflector is lowered\n if (gamepad2.a) {\n closeDeflector();\n }\n else {\n stopDeflector();\n }\n\n //When ball is shooting\n if (gamepad2.x) {\n shootBalls();\n }\n else{\n stopShootBalls();\n }\n\n //When collector is collecting balls\n if (gamepad1.right_trigger>0){\n collectorForward();\n }\n else {\n stopCollector();\n }\n\n //When collector is spitting balls out\n if (gamepad1.left_trigger>0){\n collectorBackward();\n }\n else{\n stopCollector();\n }\n }", "public void operatorControl() {\n \tmyRobot.setSafetyEnabled(true);\n while (isOperatorControl() && isEnabled()) {\n \tdouble x = stick2.getRawAxis(0);\n \tdouble y = stick2.getRawAxis(1);\n \tdouble rot = stick.getRawAxis(0);\n \tSmartDashboard.putNumber(\"x1\", x);\n SmartDashboard.putNumber(\"y1\", y);\n SmartDashboard.putNumber(\"rot1\", rot);\n \tif(Math.abs(x) < .2)\n \t\tx = 0;\n \tif(Math.abs(y) < .2)\n \t\ty = 0;\n \tif(Math.abs(rot) < .2)\n \t\trot = 0;\n \tmyRobot.mecanumDrive_Cartesian(x*-1, y*-1,rot*-1, gyro.getAngle());\n double current1 = pdp.getCurrent(0);\n double current2 = pdp.getCurrent(13);\n double current3 = pdp.getCurrent(15);\n double current4 = pdp.getCurrent(12);\n SmartDashboard.putNumber(\"Front Left current\", current1);\n SmartDashboard.putNumber(\"back Left current\", current2);\n SmartDashboard.putNumber(\"Front right current\", current3);\n SmartDashboard.putNumber(\"back right current\", current4);\n SmartDashboard.putNumber(\"x\", x);\n SmartDashboard.putNumber(\"y\", y);\n SmartDashboard.putNumber(\"rot\", rot);\n SmartDashboard.putNumber(\"Gyro\", gyro.getAngle());\n \tTimer.delay(0.005);\t\t// wait for a motor update time\n }\n }", "public void up() {\n\t\tmotor1.set( Constants.CLAW_MOTOR_SPEED );\n\t\t}", "@Override\n\tprotected void initialize() {\n\t\t//hookMotor1.configPeakCurrentDuration(9000, 10000);\n\t\t//hookMotor1.configPeakCurrentLimit(40, 10000);\n\t\t//hookMotor2.configPeakCurrentDuration(9000, 10000);\n\t\t//hookMotor2.configPeakCurrentLimit(40, 10000);\n\t\thookMotor1.enableCurrentLimit(false);\n\t\thookMotor2.enableCurrentLimit(false);\n\n\t\t//first move joint2 forward to release hook\n//\t\tRobot.joint2Cmd = new Joint2Cmd(RobotMap.jointEncoder2.getRaw(), -1647, 1000);\n//\t\tRobot.joint2Cmd.start();\n\t\t\n\t\thookMotor1.set(ControlMode.PercentOutput, -1.0);\n\t\thookMotor2.set(ControlMode.PercentOutput, -1.0);\n\t\tstepCnt = 0;\n\t\tSystem.out.println(\"start climbing\");\n\t}", "void disablePWM();", "@Override\n public void teleopPeriodic() {\n double x = xcontroller2.getX(Hand.kLeft);\n //double y = xcontroller1.getTriggerAxis(Hand.kRight) - xcontroller1.getTriggerAxis(Hand.kLeft);\n // For testing just use left joystick. Use trigger axis code for GTA Drive/\n double y = -xcontroller2.getY(Hand.kLeft);\n double z = xcontroller2.getX(Hand.kRight);\n double yaw = imu.getAngleZ();\n RobotDT.driveCartesian(x, y, 0, 0);\n \n\n // After you spin joystick R3 press A button to reset gyro angle\n if (xcontroller1.getAButtonPressed()) {\n imu.reset();\n }\n \n if (xcontroller2.getBButtonPressed()){\n mGPM.goSpongeHatch();\n }\n\n if (xcontroller2.getXButtonPressed()){\n mGPM.goPineHome();\n \n }\n\n\n /** \n * If Bumpers are pressed then Cargo Intake Motor = -1 for Intake \n *if Triggers are pressed set value to 1 for Outtake\n *If triggers are released set value to 0*/\n if(xcontroller2.getBumperPressed(Hand.kLeft) && xcontroller2.getBumperPressed(Hand.kRight)) {\n mGPM.setCargoMotor(-1);\n } else if((xcontroller2.getTriggerAxis(Hand.kLeft) >0.75) && (xcontroller2.getTriggerAxis(Hand.kRight) >0.75)) {\n mGPM.setCargoMotor(1);\n } else{\n mGPM.setCargoMotor(0);\n }\n }", "public void commonPeriodic()\n {\n double d1LeftJoystick = driver1.getAxis(driver1.LAxisUD);\n double d1RightJoystick = driver1.getAxis(driver1.RAxisUD);\n\n double d2LeftJoystick = driver2.getAxis(driver2.LAxisUD);\n double d2RightJoystick = driver2.getAxis(driver2.RAxisUD);\n\n // -------------------- DRIVER 1\n\n driveTrain.drive(d1LeftJoystick * speedModifier, d1RightJoystick * speedModifier);\n\n // driver1 controls ramp\n // press start and select together to deploy\n if(driver1.down(driver1.Start) && driver1.down(driver1.Select))\n {\n ramp.deploy();\n hatchArm.fingerGrab();\n }\n else\n {\n ramp.undeploy();\n }\n\n // driver 1 can double speed by holding L2\n //driveTrain.fastSpeed = driver1.down(driver1.L2);\n if(driver1.pressed(driver1.A))\n {\n driveTrain.slowSpeed = !driveTrain.slowSpeed;\n System.out.println(\"Fast speed toggled to: \" + driveTrain.slowSpeed);\n }\n\n //drive straight\n if(driver1.down(driver1.L1))\n {\n driveTrain.set_right_motors(speedModifier);\n }\n if(driver1.down(driver1.R1))\n {\n driveTrain.set_left_motors(speedModifier);\n }\n\n // flip drive orientation\n if(driver1.pressed(driver1.Select))\n {\n driveTrain.flip_orientation();\n \n if(driveTrain.isFacingForward())\n {\n camServForward.setSource(camFront);\n //camServReverse.setSource(camBack);\n // camBack.free();\n // camFront.close();\n // camFront = CameraServer.getInstance().startAutomaticCapture(0);\n // camBack = CameraServer.getInstance().startAutomaticCapture(1);\n }\n else\n {\n camServForward.setSource(camBack);\n //camServReverse.setSource(camFront);\n // camBack.close();\n // camFront.close();\n // camFront = CameraServer.getInstance().startAutomaticCapture(1);\n // camBack = CameraServer.getInstance().startAutomaticCapture(0);\n }\n }\n\n\n // -------------------- DRIVER 2\n\n\n // up is out\n // down is in\n // (when it's negated)\n cargoArm.spinBallMotor(-1 * d2LeftJoystick * 0.9);\n\n // control hatch placement pistons\n if(driver2.pressed(driver2.A))\n {\n hatchArm.pushPistons();\n }\n else if (driver2.released(driver2.A))\n {\n hatchArm.retractPistons();\n }\n\n // open/close hatch grabber arms\n if(driver2.pressed(driver2.B))\n {\n hatchArm.toggleGrabber();\n }\n\n if(driver2.pressed(driver2.Select))\n {\n //cargoArm.toggleArmLock();\n hatchArm.toggleFinger();\n }\n\n // extend/de-extend cargo hand\n if(driver2.pressed(driver2.Start))\n {\n cargoArm.toggleHand();\n }\n\n // button 7: L2\n // button 8: R2\n // L2 will reverse the finger\n // R2 will rotate it forward\n if(driver2.down(driver2.L1))\n {\n hatchArm.rotateFinger(1);\n }\n else\n {\n if(driver2.down(driver2.L2))\n {\n hatchArm.rotateFinger(-1);\n }\n else\n {\n hatchArm.rotateFinger(0);\n }\n }\n\n \n // button 5: L1\n // button 6: R1\n // L1 will move the hatch arm one way\n // R1 will move it the other way\n if(driver2.down(driver2.R1))\n {\n hatchArm.rotateArm(-1 * speedModifier);// * 0.75);\n }\n else\n {\n if(driver2.down(driver2.R2))\n {\n hatchArm.rotateArm(1 * speedModifier);// * 0.75);\n }\n else\n {\n hatchArm.rotateArm(0);\n }\n }\n\n \n // button 1: x\n // button 4: y\n // button 1 will move the ball arm one way\n // button 4 will move it the other way\n if(driver2.down(driver2.X))\n {\n //cargoArm.requestMove(-1 * speedModifier);\n cargoArm.rotateArm(-1);\n //cargoArm.solArmBrake.set(false);\n }\n else\n {\n if(driver2.down(driver2.Y))\n {\n //cargoArm.requestMove(2 * speedModifier);\n cargoArm.rotateArm(1);\n //cargoArm.solArmBrake.set(false);\n }\n else\n {\n //cargoArm.rotateArm(cargoArm.getArmCalculation());\n //cargoArm.solArmBrake.set(true);\n cargoArm.rotateArm(0);\n }\n }\n if(driver2.released(driver2.X) || driver2.released(driver2.Y))\n {\n //cargoArm.setArmTarget(cargoArm.currentPosition());\n //cargoArm.solArmBrake.set(true);\n cargoArm.rotateArm(0);\n }\n\n if(driver2.dpad(driver2.Up))\n {\n cargoArm.setArmUp();\n }\n if(driver2.dpad(driver2.Down))\n {\n cargoArm.setArmDown();\n }\n if(driver2.dpad(driver2.Left))\n {\n cargoArm.setArmMid();\n }\n if(driver2.dpad(driver2.Right))\n {\n cargoArm.setArmLow();\n }\n\n if(driver2.pressed(driver2.LThumb))\n {\n cargoArm.armLockEnabled = !cargoArm.armLockEnabled;\n \n }\n if(driver2.pressed(driver2.RThumb))\n {\n cargoArm.toggleBrake();\n }\n\n\n // allow move-to calculations to occur\n hatchArm.periodic();\n cargoArm.periodic();\n }", "@Override\n public void run() {\n while (!stop) {\n /**change the variable that controls the speed of the chassis using the bumpers*/\n if (gamepad1.right_bumper) {\n v = 1;\n } else if (gamepad1.left_bumper) {\n v = 2;\n }\n /**getting the gamepad joystick values*/\n forward = gamepad1.left_stick_y;\n right = -gamepad1.left_stick_x;\n clockwise = gamepad1.right_stick_x;\n\n /**calculating the power for motors */\n df = forward + clockwise - right;\n ss = -forward + clockwise + right;\n sf = -forward + clockwise - right;\n ds = forward + clockwise + right;\n\n /**normalising the power values*/\n max = abs(sf);\n if (abs(df) > max) {\n max = abs(df);\n }\n if (abs(ss) > max) {\n max = abs(ss);\n }\n if (abs(ds) > max) {\n max = abs(ds);\n }\n if (max > 1) {\n sf /= max;\n df /= max;\n ss /= max;\n ds /= max;\n }\n /** setting the speed of the chassis*/\n if (v == 1) {\n POWER(df / 5, sf / 5, ds / 5, ss / 5);\n } else if (v == 2) {\n POWER(df, sf, ds, ss);\n }\n }\n }", "private void driveForwardTimer()\r\n\t{\r\n\t\tif(timer.get() < Config.Auto.timeDriveForward){\r\n\t\t\tdrive.setSpeed(0, 0, Config.Auto.driveForwardSpeed, Config.Auto.driveForwardSpeed);\r\n\t\t\tSystem.out.println(timer.get());}\r\n\t\t\r\n\t\telse\r\n\t\t{\r\n\t\t\tdrive.setSpeed(0, 0, 0, 0);\r\n\t\t\tautoStep++;\r\n\t\t}\r\n\t}", "public void loop()\n {\n double rightPower, leftPower;\n double gearRatio = gamepad1.right_bumper ? 0.7 : 0.2;\n // If right_bumper is down, the gearRatio is 0.7. Otherwise, the gearRatio is 0.3\n \n rightPower = gearRatio * gamepad1.left_stick_y;\n leftPower = gearRatio * gamepad1.right_stick_y;\n \n leftpower = Range.clip(leftpower, -1, 1); //gamepad controllers have a value of 1 when you push it to its maximum foward\n rightpower = Range.clip(rightpower, -1, 1); //limiting the range of each power, min first then max\n \n motorR.setPower(rightPower);\n motroL.setPower(leftPower);\n \n telemetry.addData(\"Gear Ratio \", gearRatio);\n telemetry.addData(\"Right Power \", rightPower);\n telemetry.addData(\"Left Power \", leftPower);\n \n \n }", "public void teleopPeriodic() {\r\n //Driving\r\n if (driveChooser.getSelected().equals(\"tank\")){\r\n if (joystickChooser.getSelected().equals(\"two\")){\r\n drive.tankDrive(leftJoystick.getY(), rightJoystick.getY());\r\n } \r\n else {\r\n drive.tankDrive(manipulator.getY(), manipulator.getThrottle());\r\n }\r\n }\r\n if (driveChooser.getSelected().equals(\"arcade1\")){\r\n if (joystickChooser.getSelected().equals(\"two\")){\r\n drive.arcadeDrive(leftJoystick.getY(), leftJoystick.getX());\r\n } \r\n else {\r\n drive.arcadeDrive(manipulator.getY(), manipulator.getX());\r\n }\r\n }\r\n if (driveChooser.getSelected().equals(\"arcade2\")){\r\n if (joystickChooser.getSelected().equals(\"two\")){\r\n drive.arcadeDrive(leftJoystick.getY(), rightJoystick.getX());\r\n }\r\n else{\r\n drive.arcadeDrive(manipulator.getY(), manipulator.getTwist());\r\n }\r\n }\r\n \r\n //Shooting\r\n if (shootButton1.get()||shootButton2.get()){\r\n frontShooter.set(-1);\r\n backShooter.set(1);\r\n }\r\n else{\r\n frontShooter.set(0);\r\n backShooter.set(0); \r\n }\r\n if (transportButton1.get()||transportButton2.get()){\r\n transport.set(-1);\r\n }\r\n else{\r\n transport.set(0); \r\n }\r\n \r\n //Intake\r\n if (intakeButton1.get()||intakeButton2.get()){\r\n //intakeA.set(-1);BROKEN\r\n intakeB.set(-1);\r\n }\r\n else{\r\n intakeA.set(0);\r\n intakeB.set(0); \r\n }\r\n \r\n //Turret\r\n if (toggleTurretButton.get()){\r\n turret.set(leftJoystick.getX());\r\n }\r\n else{\r\n turret.set(manipulator.getX());\r\n }\r\n }", "@Override\r\n\tpublic void autonomous() {\n\r\n\t\tint autoMode = -1;\r\n\t\t\r\n\t\tif (!switch1.get() && !switch2.get() && !switch3.get()) {\r\n\t\t\t//if all the switches are off\r\n\t\t\tautoMode = 0;\r\n\t\t} else if (switch1.get() && !switch2.get() && !switch3.get()) {\r\n\t\t\tautoMode = 1;\r\n\t\t} else if (!switch1.get() && switch2.get() && !switch3.get()) {\r\n\t\t\tautoMode = 2;\r\n\t\t} else if (switch1.get() && switch2.get() && !switch3.get()) {\r\n\t\t\tautoMode = 3;\r\n\t\t}\r\n\r\n\t\tautotime.start();\r\n\r\n\t\t// double[] wheelSpeeds = new double[2];\r\n\t\t// double[] startCoords = {0, 0, Math.PI / 2};\r\n\t\t// double[] endCoords = {0, 1, Math.PI / 2};\r\n\t\t// AutoPath pathAuto = new AutoPath(startCoords, endCoords,\r\n\t\t// ahrs.getAngle());\r\n\t\t//\r\n\t\t// int i = 0;\r\n\t\t// boolean successfullyGrabbedRectangles = false;\r\n\t\t\r\n\t\tboolean shotGear = false;\r\n\t\t//boolean hasBackedUp = false;\r\n\t\twhile (isAutonomous() && isEnabled()) {\r\n\t\t\t// auto.drive(autoMode);\r\n\r\n\t\t\t// while(autotime.get() < 3) {\r\n\t\t\t// drive.drive(-0.9, -0.9);\r\n\t\t\t// }\r\n\r\n\t\t\t// grab the current switch status\r\n\r\n\t\t\tswitch (autoMode) {\r\n\t\t\tcase 0:\r\n\t\t\t\t//Mark: Drive forward\r\n\r\n\t\t\t\tif (autotime.get() < 3) {\r\n\t\t\t\t\tdrive.drive(-0.9, -0.9);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase 1:\r\n\t\t\t\t// Mark: Drive Forward, NO turning, and shoot gear onto peg\r\n\r\n\t\t\t\tif (autotime.get() < 3) {\r\n\t\t\t\t\tdrive.drive(-0.75, -0.75);\r\n\t\t\t\t} else if(!shotGear) {\r\n\t\t\t\t\t// shoot the gear onto the peg\r\n\t\t\t\t\tgearOutput.autoOutput();\r\n\t\t\t\t\tshotGear = true;\r\n\t\t\t\t}else if(autotime.get() < 3.67) {\r\n\t\t\t\t\tdrive.drive(0.50, 0.50);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tdrive.drive(0,0);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\t//Mark: start LEFT of center, drive forward, turn -60 degrees, drive forward, shoot gear on peg\r\n\t\t\t\tif (autotime.get() < 2) {\r\n\t\t\t\t\tdrive.drive(-0.75, -0.75);\r\n\t\t\t\t} else if (autotime.get() < 2.5) {\r\n\t\t\t\t\tdrive.drive(1, 0);\r\n\t\t\t\t}else if(autotime.get() < 3.5) { \r\n\t\t\t\t\tdrive.drive(-.75,-.75);\r\n\t\t\t\t} else if (!shotGear) {\r\n\t\t\t\t\tgearOutput.autoOutput();\r\n\t\t\t\t\tshotGear = true;\r\n\t\t\t\t}else if(autotime.get() < 4.5) {\r\n\t\t\t\t\tdrive.drive(0.75, 0.75);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tdrive.drive(0,0);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\t\t//Mark: start RIGHT of center, drive forward, turn 60 degrees, drive forward, shoot gear on peg\r\n\t\t\t\tif (autotime.get() < 2) {\r\n\t\t\t\t\tdrive.drive(-0.75, -0.75);\r\n\t\t\t\t} else if (autotime.get() < 2.25) {\r\n\t\t\t\t\tdrive.drive(0, 1);\r\n\t\t\t\t}else if(autotime.get() < 4) { \r\n\t\t\t\t\tdrive.drive(-.75,-.75);\r\n\t\t\t\t} else if (!shotGear) {\r\n\t\t\t\t\tgearOutput.autoOutput();\r\n\t\t\t\t\tshotGear = true;\r\n\t\t\t\t}else if(autotime.get() < 4.5) {\r\n\t\t\t\t\tdrive.drive(0.75, 0.75);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tdrive.drive(0,0);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// if(!successfullyGrabbedRectangles) {\r\n\t\t\t// Rectangle[] targets = grabRectangles();\r\n\t\t\t//\r\n\t\t\t//// System.out.println(\"-----\");\r\n\t\t\t//// for(Rectangle r : testing) {\r\n\t\t\t//// System.out.println(r.getArea());\r\n\t\t\t//// }\r\n\t\t\t//// System.out.println(\"-----\");\r\n\t\t\t//\r\n\t\t\t// if(targets[0].getArea() == 0) {\r\n\t\t\t// //since grabRectangles returns 1 rectangle with area of 0, so if\r\n\t\t\t// one of the area's\r\n\t\t\t// //equals 0, then it was a failed response\r\n\t\t\t// successfullyGrabbedRectangles = false;\r\n\t\t\t// }else{\r\n\t\t\t//\r\n\t\t\t// successfullyGrabbedRectangles = true;\r\n\t\t\t//\r\n\t\t\t// //call auto path to get the wheel speeds from the rectangle\r\n\t\t\t// pathAuto.makeNewPath(targets[0].getWidth(),\r\n\t\t\t// targets[1].getWidth(), targets[0].getXPos() - 240,\r\n\t\t\t// targets[1].getXPos() - 240, ahrs.getAngle());\r\n\t\t\t// //drive.drive(wheelSpeeds[0], wheelSpeeds[1]);\r\n\t\t\t//\r\n\t\t\t// }\r\n\t\t\t// }else{\r\n\t\t\t// //drive.drive(0,0);\r\n\t\t\t//\r\n\t\t\t// double[] wheelSpeedsFromPath = pathAuto.getWheelSpeeds(.4); //the\r\n\t\t\t// .4 doesn't mean anything at all; Beitel is just weird :^)\r\n\t\t\t// drive.drive(wheelSpeedsFromPath[0], wheelSpeedsFromPath[1]);\r\n\t\t\t// //System.out.println(\"Left:\" + wheelSpeedsFromPath[0]);\r\n\t\t\t// //System.out.println(\"Right: \" + wheelSpeedsFromPath[1]);\r\n\t\t\t// }\r\n\r\n\t\t}\r\n\t\t\r\n\t}", "public void autonomousPeriodic() {\n //Scheduler.getInstance().run();\n /** if(autoLoopCounter < 100) { //Checks to see if the counter has reached 100 yet\n myRobot.drive(-0.5, 0.0); //If the robot hasn't reached 100 packets yet, the robot is set to drive forward at half speed, the next line increments the counter by 1\n autoLoopCounter++;\n } else {\n myRobot.drive(0.0, 0.0); //If the robot has reached 100 packets, this line tells the robot to stop\n }*/\n }", "public void start(){\n tuningParams = new HashMap<>();\n running = true;\n int valsListIndex = 0;\n Gamepad gamepad1 = FTCUtilities.getOpMode().gamepad1;\n Switch upSwitch = new Switch();\n Switch downSwitch = new Switch();\n\n\n for(String name: params.keySet()){\n tuningParams.put(name,0.0);\n }\n\n while (running){\n for(String name : paramNames){\n String output = \"\";\n\n output += name;\n output += \": \";\n output += Double.toString(tuningParams.get(name));\n if(paramNames.get(valsListIndex).equals(name)){\n output += \"<---\"; // Indicator so that we know which value we're editing\n }\n\n FTCUtilities.addLine(output);\n }\n\n if(gamepad1.dpad_up) {\n if (upSwitch.flip()) {\n if (valsListIndex >= 1) {\n valsListIndex -= 1;\n } else {\n valsListIndex = paramNames.size() - 1; //wrap to top\n }\n }\n } else if(gamepad1.dpad_down){\n if (downSwitch.flip()) {\n if (valsListIndex < paramNames.size() - 1) {\n valsListIndex += 1;\n } else {\n valsListIndex = 0; // wrap around to 0\n }\n }\n } else {\n String currentValKey = paramNames.get(valsListIndex);\n double currentValDouble = tuningParams.get(currentValKey);\n currentValDouble += gamepad1.right_trigger * params.get(currentValKey);\n currentValDouble -= gamepad1.left_trigger * params.get(currentValKey);\n tuningParams.put(currentValKey, currentValDouble);\n }\n FTCUtilities.updateOpLogger();\n\n if (gamepad1.x) {\n stop();\n }\n }\n }", "public void run() {\n \t//System.out.println(\"In Run \" + currentPoint + \" \" + profile.length);\n \tif(currentPoint == profile.length) return;\n \tdouble[] profilePoint = profile[currentPoint];\n \tdouble leftPos = profilePoint[0];\n \tdouble leftVel = profilePoint[1];\n \tdouble rightPos = profilePoint[2];\n \tdouble rightVel = profilePoint[3];\n \tdouble heading = profilePoint[4];\n \tdouble leftError = leftPos-Robot.sensors.getLeftPosition();\n \tdouble rightError = rightPos-Robot.sensors.getRightPosition();\n \tdouble correction = kAngle * (heading - Robot.sensors.getHeading());\n \t\n \t\n \tcurrentPoint++;\n \t\n \tdouble leftPower = leftVel / vmax + (kP * (leftError)) - correction;\n \tdouble rightPower = rightVel / vmax + (kP * (rightError)) + correction;\n \t\n \tleftPower = leftPower > 1 ? 1 : leftPower;\n \trightPower = rightPower > 1 ? 1 : rightPower;\n \t\n \tleftPower = leftPower < -1 ? -1 : leftPower;\n \trightPower = rightPower < -1 ? -1 : rightPower;\n \t\n \tRobot.drive.setPower(leftPower, rightPower);\n \t\n \tlong currentTime = System.currentTimeMillis();\n \tlong elapsedTime = currentTime - lastTime;\n \tif(elapsedTime < minElapsedTime) minElapsedTime = elapsedTime;\n \tif(elapsedTime > maxElapsedTime) maxElapsedTime = elapsedTime;\n \tlastTime = currentTime;\n \tif(currentPoint == profile.length) {\n \t\tstopNotifier();\n \t}\n }", "public void execute () {\n // Gets values of Xbox joysticks from RobotContainer\n leftSpeed = robotcontainer.getXboxAxis(Constants.XBOX_LEFT_Y);\n rightSpeed = robotcontainer.getXboxAxis(Constants.XBOX_RIGHT_Y);\n\n if (Math.abs(leftSpeed) > Constants.DRV_DEADZONE || Math.abs(rightSpeed) > Constants.DRV_DEADZONE) {\n drive.drivePercentOutput(leftSpeed, rightSpeed);\n } \n\n }", "public void approachTargetWithVision() {\n final double STEER_P = 0.005; \n final double DRIVE_P = 0.05; \n final double DESIRED_TARGET_AREA = 4; // Area of the target when the robot reaches the wall\n final double MAX_DRIVE = 0.75; // Simple speed limit so we don't drive too fast\n final double STEER_I = 0.005;\n final double DRIVE_I = 0.0;\n final double STEER_D = 0.02;\n final double xError;\n final double aError;\n double DRIVE_INTEGRAL = 0;\n\n \n\n double tv = NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"tv\").getDouble(0);\n double tx = NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"tx\").getDouble(0);\n double ta = NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"ta\").getDouble(0);\n xError = tx;\n aError = (DESIRED_TARGET_AREA - ta);\n // SmartDashboard.putNumber(\"TA\", ta);\n // SmartDashboard.putNumber(\"TA Error\", aError);\n SmartDashboard.putNumber(\"TX Error\", xError);\n STEER_INTEGRAL = STEER_INTEGRAL + (xError*0.02);\n DRIVE_INTEGRAL = DRIVE_INTEGRAL + (aError * 0.02);\n STEER_DERIVATIVE = (xError - STEER_ERROR_PRIOR)/0.02;\n SmartDashboard.putNumber(\"Integral\", STEER_INTEGRAL);\n SmartDashboard.putNumber(\"Derivative\", STEER_DERIVATIVE);\n SmartDashboard.putNumber(\"TA\", ta);\n\n\n if (tv < 1.0) {\n m_LimelightHasValidTarget = false;\n drive_cmd = 0.0;\n steer_cmd = 0.0;\n } else {\n m_LimelightHasValidTarget = true;\n // Start with proportional steering\n steer_cmd = (xError * STEER_P) + (STEER_INTEGRAL * STEER_I) + (STEER_DERIVATIVE * STEER_D);\n\n // try to drive forward until the target area reaches our desired area\n drive_cmd = (aError * DRIVE_P) + (DRIVE_INTEGRAL * DRIVE_I);\n // don't let the robot drive too fast into the goal\n if (drive_cmd > MAX_DRIVE){\n drive_cmd = MAX_DRIVE;\n }\n }\n\n Robot.driveTrain.setLeftMotors(-drive_cmd - steer_cmd);\n Robot.driveTrain.setRightMotors(-drive_cmd + steer_cmd);\n\n STEER_ERROR_PRIOR = xError;\n\n }", "public void setBoulderLockOff(){\r\n\t\tservoTarget = Constants.BALL_HOLDER_RETRACTED;\r\n\t}", "@Override\r\n public int paddleSpeed() {\r\n return 5;\r\n }", "@Override\n\tpublic void robotInit() {\n\t\tdt = new DriveTrain();\n\t\t//Initialize drive Talons\n\t\tRobotMap.vspLeft = new WPI_TalonSRX(RobotMap.dtLeft);\n\t\tRobotMap.vspRight = new WPI_TalonSRX(RobotMap.dtRight);\n\t\t//Initialize drive slave Victors\n\t\t//RobotMap.slaveLeft = new WPI_VictorSPX(RobotMap.slaveDriveLeft);\n\t\t//RobotMap.slaveRight = new WPI_VictorSPX(RobotMap.slaveDriveRight);\n\t\t//Set drive slaves to follower mode\n\t\t//RobotMap.slaveLeft.follow(RobotMap.vspLeft);\n\t\t//RobotMap.slaveRight.follow(RobotMap.vspRight);\n\t\t//Initialize drive train\n\t\tRobotMap.rd = new DifferentialDrive(RobotMap.vspLeft, RobotMap.vspRight);\n\t\t//Initialize drive joystick\n\t\tRobotMap.stick = new Joystick(RobotMap.joystickPort);\n\t\t//Disabled drive safety\n\t\tRobotMap.vspLeft.setSafetyEnabled(false);\n\t\tRobotMap.vspRight.setSafetyEnabled(false);\n\t\tRobotMap.rd.setSafetyEnabled(false);\n\t\t//Initialize lift Talon\n\t\tRobotMap.liftTalon = new WPI_TalonSRX(5);\n\t\t//Initialize operator controller\n\t\tRobotMap.controller = new Joystick(RobotMap.controllerPort);\n\t\t//Initialize intake Victors\n\t\tRobotMap.intakeVictorLeft = new WPI_VictorSPX(RobotMap.intakeMaster);\n\t\tRobotMap.intakeVictorRight = new WPI_VictorSPX(RobotMap.intakeSlave);\n\t\t//Set right intake Victor to follow left intake Victor\n\t\tRobotMap.intakeVictorRight.follow(RobotMap.intakeVictorLeft);\n\t\t\n\t\tRobotMap.climberVictorLeft = new WPI_VictorSPX(RobotMap.climberLeftAddress);\n\t\tRobotMap.climberVictorRight = new WPI_VictorSPX(RobotMap.climberRightAddress);\n\t\t\n\t\tRobotMap.climberVictorRight.follow(RobotMap.climberVictorLeft);\n\t\t\n\t\tRobotMap.piston = new DoubleSolenoid(RobotMap.inChannel, RobotMap.outChannel);\n\t\t\n\t\tRobotMap.intakeLifter = new WPI_VictorSPX(2);\n\t\t\n\t\tRobotMap.liftTalon = new WPI_TalonSRX(RobotMap.liftTalonAddress);\n\t\t\n\t\tautoChooser = new SendableChooser();\n\t\tautoChooser.addDefault(\"Drive to baseline\" , new DriveToBaseline());\n\t\tautoChooser.addObject(\"Null auto\", new NullAuto());\n\t\tautoChooser.addObject(\"Switch from right\", new SwitchFromRight());\n\t\tautoChooser.addObject(\"Switch from left\", new SwitchFromLeft());\n\t\tautoChooser.addObject(\"PID from left\", new PIDfromLeft());\n\t\tautoChooser.addObject(\"PID from right\", new PIDfromRight());\n\t\tautoChooser.addObject(\"Scale from right\", new ScaleAutoRight());\n\t\tautoChooser.addObject(\"Scale from left\", new ScaleAutoLeft());\n\t\tautoChooser.addObject(\"PID tester\", new PIDTESTER());\n\t\tautoChooser.addObject(\"Joe use this one\", new leftOnly());\n\t\tSmartDashboard.putData(\"Autonomous mode chooser\", autoChooser);\n\t\t\n\t\t//RobotMap.liftVictor.follow(RobotMap.climberTalon);\n\t\t\n\t\tRobotMap.vspLeft.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, 0);\n\t\tRobotMap.vspRight.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, 0);\n\t\t\n\t\tRobotMap.intakeLifted = new DigitalInput(1);\n\t\tRobotMap.isAtTop = new DigitalInput(2);\n\t\tRobotMap.isAtBottom = new DigitalInput(0);\n\t\t\n\t\tRobotMap.vspLeft.configVelocityMeasurementPeriod(VelocityMeasPeriod.Period_100Ms, 1);\n\t\tRobotMap.vspRight.configVelocityMeasurementWindow(64, 1); \n\t\t\n\t\toi = new OI();\n\t}" ]
[ "0.58998287", "0.55651885", "0.54832953", "0.5410491", "0.5373911", "0.5329498", "0.5262923", "0.52456945", "0.5201236", "0.5184931", "0.5178085", "0.5165147", "0.5156968", "0.5095432", "0.50953484", "0.5092505", "0.50649095", "0.5038094", "0.5025455", "0.501059", "0.50000924", "0.50000155", "0.49838147", "0.49799362", "0.49684358", "0.49478707", "0.49417666", "0.4936416", "0.4926736", "0.49263713", "0.49160933", "0.4911264", "0.48854658", "0.4870678", "0.48617736", "0.4860925", "0.4856305", "0.48557168", "0.48362732", "0.4827729", "0.4818262", "0.48177263", "0.4798359", "0.4797731", "0.4796032", "0.47914803", "0.4785416", "0.47764137", "0.47583795", "0.47575963", "0.4757268", "0.47555318", "0.4753003", "0.47469875", "0.47257444", "0.47255266", "0.47174805", "0.47139055", "0.47092167", "0.4707987", "0.47078452", "0.4707298", "0.4701629", "0.46935427", "0.4680715", "0.46799913", "0.46759638", "0.46716768", "0.46693045", "0.4656202", "0.46527505", "0.46299252", "0.4628794", "0.46285415", "0.46270338", "0.46207973", "0.46091482", "0.46052018", "0.4604537", "0.45935193", "0.45931962", "0.45923162", "0.45919508", "0.45915192", "0.459015", "0.45869258", "0.4582629", "0.45813155", "0.45678878", "0.4557811", "0.4553496", "0.4547317", "0.45469612", "0.4542888", "0.45412016", "0.45393026", "0.4536216", "0.45353168", "0.4535006", "0.45309713" ]
0.59259015
0
private static String prevStg2StatusStr = "";
public static void runArm() { synchronized(ArmClawInfo.clawLock) { synchronized(armStage1.motorLock) { // synchronized(armStage2.motorLock) { PrtYn flag = PrtYn.N; if(Tm744Opts.isInSimulationMode()) { flag = PrtYn.Y; } String stg1StatusStr; // String stg2StatusStr; DsNamedControlsEntry ent = armStage1.jsNamedControl.getEnt(); double jsRdg = ent.getAnalog(); if(Math.abs(jsRdg)>0.1) { int junk = 5; //good breakpoint } stg1StatusStr = stageStatusStr(armStage1); // stg2StatusStr = stageStatusStr(armStage2); if( ! (stg1StatusStr.equals(prevStg1StatusStr) )) { //&& stg2StatusStr.equals(prevStg2StatusStr))) { P.println(flag, "(A)stg1: " + stg1StatusStr); // P.println(flag, "(A)stg2: " + stg2StatusStr); prevStg1StatusStr = stg1StatusStr; // prevStg2StatusStr = stg2StatusStr; } // TmSdMgr.putString(SdKeysE.KEY_ARM_STAGE1_OPERATING_MODE, armStage1.operatingMode.name()); switch(armStage1.operatingMode) { case JOYSTICK: runLiftStageFromJoystick(armStage1); if(true) { //nearTop and nearBottom methods check useEncoder flag if(armStage1.isMotorPercentOutMovingUpRapidly() && armStage1.isEncoderNearTop()) { ArmServices.idleAllLiftMotors(); } if(armStage1.isMotorPercentOutMovingDownRapidly() && armStage1.isEncoderNearBottom()) { ArmServices.idleAllLiftMotors(); } } break; case SERVO: if(armStage1.useEncoder || m_tds.isEnabledAutonomous()) { runStageInServoMode(armStage1, Cnst.ARM_STAGE1_ENCODER_ADJUSTMENT_COUNT); } else { armStage1.operatingMode = ArmOperate.OperatingModesE.JOYSTICK; } break; case IDLE: case STOPPED: default: //assume 'request' methods set the motors to the appropriate values break; } stg1StatusStr = stageStatusStr(armStage1); // stg2StatusStr = stageStatusStr(armStage2); if( ! (stg1StatusStr.equals(prevStg1StatusStr) )) { //&& stg2StatusStr.equals(prevStg2StatusStr))) { P.println(flag, "(B)stg1: " + stg1StatusStr); // P.println(flag, "(B)stg2: " + stg2StatusStr); prevStg1StatusStr = stg1StatusStr; // prevStg2StatusStr = stg2StatusStr; } if(m_tds.isEnabledAutonomous()) { switch(ArmClawInfo.clawCurrentState) { case BY_JOYSTICK: if(m_tds.isEnabledAutonomous()) { double percOut = 0.0; ArmClawInfo.clawMtrLeft.set(ControlMode.PercentOutput, percOut); ArmClawInfo.clawMtrRight.set(ControlMode.PercentOutput, -percOut); } else if(m_tds.isEnabledTeleop()) { double joystickRdg = DsNamedControlsE.ARM_CLAW_RUN_WITH_JOYSTICK_INPUT.getEnt().getAnalog(); if(joystickRdg == 0.0) {} //just a good debug breakpoint //squaring makes joysticks easier to use double percOut = - Math.copySign(joystickRdg*joystickRdg, joystickRdg); ArmClawInfo.clawMtrLeft.set(ControlMode.PercentOutput, percOut); ArmClawInfo.clawMtrRight.set(ControlMode.PercentOutput, -percOut); } break; case GRABBING: case RELEASING: case OFF: //assume 'request' methods set the motors to the appropriate values break; default: break; } } else { runArmClawLiftWheelsTeleop(); } postLimitSwitchRdgsToSd(); // } //sync for stg2 } //sync for stg1 } // sync claw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected String getStatus()\n { return call_state; \n }", "private String getServiceCurrentStatus(String csStatChng) {\r\n\t\t\t\t\r\n\t\tchar serviceStatus;\r\n\t\tString serviceStatusStr = \"\";\t\t\t\t\r\n\t\t\r\n\t\tif (csStatChng != null) {\r\n\t\t\tserviceStatus = csStatChng.charAt(csStatChng.length()-1);\r\n\t\t\tif (serviceStatus == ACTIVATE_STATE){\r\n\t\t\t\tserviceStatusStr = \"Ativado\";\r\n\t\t\t} else if (serviceStatus == SUSPENSE_STATE) {\r\n\t\t\t\tserviceStatusStr = \"Suspenso\";\r\n\t\t\t} else {\r\n\t\t\t\tserviceStatusStr = \"Desativado\";\r\n\t\t\t}\t\t\t\r\n\t\t}\t\r\n\t\t\r\n\t\treturn serviceStatusStr;\r\n\t}", "public String getStatusString() {\n String str = \"\";\n switch (actualStep) {\n case wait: { str = \"WAIT\"; break; }\n case press: { str = \"PRESS\"; break; }\n case hold: { str = \"HOLD\"; break; }\n case release: { str = \"RELEASE\"; break; }\n }\n return str;\n }", "String getSwstatus();", "java.lang.String getStatus();", "java.lang.String getStatus();", "java.lang.String getStatus();", "java.lang.String getStatus();", "private String changestatus(String string) {\n\t\tString changestatustemp;\r\n\t\tif (string.equals(\"0\")) {\r\n\t\t\tchangestatustemp = \"1\";\r\n\t\t} else {\r\n\t\t\tchangestatustemp = \"0\";\r\n\t\t}\r\n\t\treturn changestatustemp;\r\n\t}", "private String changestatus(String string) {\n\t\tString changestatustemp;\r\n\t\tif (string.equals(\"0\")) {\r\n\t\t\tchangestatustemp = \"1\";\r\n\t\t} else {\r\n\t\t\tchangestatustemp = \"0\";\r\n\t\t}\r\n\t\treturn changestatustemp;\r\n\t}", "public state getStatus(){\n return this.st;\n }", "@Override\n\t\t\t\tpublic StringBuilder getStatus() {\n\t\t\t\t\treturn new StringBuilder();\n\t\t\t\t}", "public abstract String currentStatus();", "protected String status() {\n if (!hasStarted() && !hasRun()) {\n return \" not run yet\";\n } else if (hasStarted() && !hasRun()) {\n return \" failed to run\";\n } else if (!hasStarted() && hasRun()) {\n return \" ILLEGAL STATE\";\n } else if (exceptionThrown == null) {\n return \" returned: \" + StringsPlume.toStringAndClass(retval);\n } else {\n return \" threw: \" + exceptionThrown;\n }\n }", "public String getStatus()\n \t{\n \t\treturn m_strStatus;\n \t}", "String getOldStatusId();", "String status();", "String status();", "String getStatus();", "String getStatus();", "String getStatus();", "String getStatus();", "String getStatus();", "public synchronized String getStatus(){\n\t\treturn status;\n\t}", "public String getCurrentStatusMessage()\n {\n return currentStatusMessage;\n }", "public String toString() {\r\n\treturn \"batch image builder for:\\n\\tnew state: \"/*nonNLS*/ + getNewState();\r\n}", "public void notifyStateChange(String str) {\n out.println(str); \n }", "@DISPID(38)\r\n\t// = 0x26. The runtime will prefer the VTID if present\r\n\t@VTID(37)\r\n\tjava.lang.String lastInstanceStatus();", "private void getStatus() {\n\t\t\n\t}", "String getStatusMessage( );", "public String calculateStatus(){\n\t\tHashMap<String,String> SubSystemsStatus = this.SubsystemStatus.getSubSystemsStatus();\n\t\tString SubSystemList[] = this.SubsystemStatus.getSubsystems();\n\t\tint SHUTDOWN = 0, OPERATIONAL = 0, STARTING1 = 0, STARTING2 = 0, STOPPING = 0;\n\t\tfor(String subsystem : SubSystemList){\n\t\t\tString status = SubSystemsStatus.get(subsystem);\n\t\t\t//System.out.println(\"subsystem \" + subsystem + \" status \" + status);\n\t\t\tif (status != null) {\n\t\t\t\tif (status.equalsIgnoreCase(\"UNAVAILABLE\")) {\n\t\t\t\treturn \"UNAVAILABLE\";\n\t\t\t\t}else if (status.equalsIgnoreCase(\"ERROR\")) {\n\t\t\t\t\treturn \"ERROR\";\n\t\t\t\t} else if (status.equalsIgnoreCase(\"SHUTDOWN\")) {\n\t\t\t\t\tSHUTDOWN++;\n\t\t\t\t} else if (status.equalsIgnoreCase(\"OPERATIONAL\")) {\n\t\t\t\t\tOPERATIONAL++;\n\t\t\t\t}\n\n\t\t\t\tif (status.equalsIgnoreCase(\"ONLINE\")\n\t\t\t\t\t\t|| status.equalsIgnoreCase(\"OPERATIONAL\")) {\n\t\t\t\t\tSTARTING1++;\n\t\t\t\t} else if (status.equalsIgnoreCase(\"INITIALIZING_PASS1\")\n\t\t\t\t\t\t|| status.equalsIgnoreCase(\"INITIALIZING_PASS2\")\n\t\t\t\t\t\t|| status.equalsIgnoreCase(\"SHUTDOWN\")\n\t\t\t\t\t\t|| status.equalsIgnoreCase(\"ONLINE\")\n\t\t\t\t\t\t|| status.equalsIgnoreCase(\"OPERATIONAL\")) {\n\t\t\t\t\tSTARTING2++;\n\t\t\t\t} else if (status.equalsIgnoreCase(\"SHUTTINGDOWN_PASS1\")\n\t\t\t\t\t\t|| status.equalsIgnoreCase(\"PRESHUTDOWN\")\n\t\t\t\t\t\t|| status.equalsIgnoreCase(\"SHUTTINGDOWN_PASS2\")\n\t\t\t\t\t\t|| status.equalsIgnoreCase(\"SHUTDOWN\")\n\t\t\t\t\t\t|| status.equalsIgnoreCase(\"OPERATIONAL\")) {\n\t\t\t\t\tSTOPPING++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(SHUTDOWN == SubSystemList.length){\n\t\t\treturn \"SHUTDOWN\";\n\t\t}else if(OPERATIONAL == SubSystemList.length){\n\t\t\treturn \"OPERATIONAL\";\n\t\t}else if(STARTING1 == SubSystemList.length || STARTING2 == SubSystemList.length){\n\t\t\treturn \"STARTING\";\n\t\t}else if(STOPPING == SubSystemList.length){\n\t\t\treturn \"STOPPING\";\n\t\t}else {\n\t\t\treturn \"TRANSITING\";\n\t\t}\n\t}", "public String getSTATUS() {\r\n return STATUS;\r\n }", "public String getSTATUS() {\r\n return STATUS;\r\n }", "public String getSTATUS() {\r\n return STATUS;\r\n }", "public String getSTATUS() {\r\n return STATUS;\r\n }", "public String getSTATUS() {\r\n return STATUS;\r\n }", "@DISPID(6)\r\n\t// = 0x6. The runtime will prefer the VTID if present\r\n\t@VTID(12)\r\n\tjava.lang.String lastInstanceStatus();", "java.lang.String getState();", "public void setgetStatus()\r\n\t{\r\n\t\tthis.status = 'S';\r\n\t}", "private String getTstatStatusMessage() {\n\n String thStatusMsg = null;\n WebElement modeDialog = getElement(getDriver(), By.cssSelector(MODEL_DIALOG), TINY_TIMEOUT);\n if (modeDialog.isDisplayed()) {\n WebElement modeMessage = getElementBySubElement(getDriver(), modeDialog,\n By.className(ERROR_MODEBOX), TINY_TIMEOUT);\n thStatusMsg = getElementBySubElement(getDriver(), modeMessage,\n By.className(MODEL_LABEL), TINY_TIMEOUT).getText();\n setLogString(\"Location status message:\" + thStatusMsg, true, CustomLogLevel.HIGH);\n }\n return thStatusMsg;\n }", "@Override\n\tpublic String getStateString() {\n\t\treturn null;\n\t}", "String getPrevMoves() {\n return this.prevMoves;\n }", "public java.lang.String getOrderStatus(){\n return localOrderStatus;\n }", "String getStatusMessage();", "public String printState(){\n if (this.state.equals(\"unstarted\")) return \"unstarted 0\";\n\n else if (this.state.equals(\"terminated\")) return \"terminated 0\";\n else if (this.state.equals(\"blocked\")) {\n return String.format(\"blocked %d\", ioBurstTime);\n }\n else if (this.state.equals(\"ready\")) {\n if (remainingCPUBurstTime !=null){\n return String.format(\"ready %d\", remainingCPUBurstTime);\n }\n return \"ready 0\";\n }\n\n else if (this.state.equals(\"running\")){\n return String.format(\"running %d\", cpuBurstTime);\n }\n\n else return \"Something went wrong.\";\n }", "public java.lang.String getOtherStatus() {\n\treturn otherStatus;\n}", "public String getStateString()\n {\n return stateString;\n }", "public String getSwstatus() {\n Object ref = swstatus_;\n if (!(ref instanceof String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n String s = bs.toStringUtf8();\n swstatus_ = s;\n return s;\n } else {\n return (String) ref;\n }\n }", "public String getXmlChangedState() {\n String msg = \"<change_object_state idobj=\\\"\" + codObjeto + \"\\\" \";\n msg += \" status=\\\"\" + status + \"\\\" tag=\\\"\" + tag + \"\\\" \";\n msg += \" flagInventario=\\\"\" + flagInventario + \"\\\" \";\n msg += \" codUser=\\\"\" + codUser + \"\\\"\";\n msg += \" posx=\\\"\" + posX + \"\\\" posY=\\\"\" + posY + \"\\\">\";\n msg += \"</change_object_state>\";\n return msg;\n \n }", "@Override\r\n public void status(String strVar)\r\n {\r\n System.out.println(strVar);\r\n }", "public final String getStatusAsString() {\n\t\tif ( m_status >= 0 && m_status < _fileStates.length)\n\t\t\treturn _fileStates[m_status];\n\t\treturn \"Unknown\";\n\t}", "protected String getGPIBStatus() {\n\n // check for errors\n if ( (m_ibsta.getValue() & ERR) != 0) {\n // return the GPIB Status because an error occurred\n int err = m_iberr.getValue();\n\n // make a nice String with the GPIB Status\n String str = String.format(Locale.US, \"GPIB Status: ibsta = 0x%x; iberr = %d (%s)\\n\",\n m_ibsta.getValue(), err,\n (err<ErrorMnemonic.length ? ErrorMnemonic[err] : \"Error number not recognized\"));\n\n // log event\n m_Logger.finer(str);\n //m_Comm_Logger.finer(str);\n\n return str;\n } else {\n // return an empty String\n return \"\";\n }\n }", "public String getNewStateName() {\n\t\tstateCounter.getAndIncrement();\n\t\tString state = makeStateName(stateCounter.get(), false);\n\t\treturn state;\n\t}", "public java.lang.String getCurr2() {\n\treturn curr2;\n}", "public String getSwstatus() {\n Object ref = swstatus_;\n if (ref instanceof String) {\n return (String) ref;\n } else {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n String s = bs.toStringUtf8();\n swstatus_ = s;\n return s;\n }\n }", "public String getOdlOpenflowStatus2() throws SnmpStatusException;", "com.polytech.spik.protocol.SpikMessages.StatusChanged getStatusChanged();", "public int getState() {\n\treturn com.hps.july.dictionary.APPStates.EDITSTRG;\n}", "public String getStCodeStS() {\n return stCodeStS;\n }", "public String getStatus(){\r\n\t\treturn status;\r\n\t}", "public abstract String getNodeStatusVariableName();", "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 String getState() { return state; }", "public String getEventWatchingGoingStatus() {\n\t\treturn eventWatchingGoingStatus;\n\t}", "public java.lang.String getOldValues_description(){\n return localOldValues_description;\n }", "public String getState()\n {\n \treturn state;\n }", "@Basic\n\tpublic String getPrevMove() {\n\t\treturn prev_move;\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn String.format(\"[%s,%s,%d,%s] \", sensorType.toString(),status.toString(),pin,lastValue.isPresent()?lastValue.get():\"NOT UPDATED YET\");\n\t}", "public String getNewState() {\n\t\treturn this.newState;\n\t}", "public String getStatus() { return status; }", "public String getNewState()\n\t{\n\t\treturn (UUID.randomUUID().toString());\n\t}", "public String getStateString()\r\n\t{\r\n\t\treturn stateString;\r\n\t}", "public final String cur_modstate_string () {\n\t\treturn get_modstate_as_string (modstate);\n\t}", "public java.lang.String getCurr1() {\n\treturn curr1;\n}", "String getProgressString();", "@DISPID(15)\n\t// = 0xf. The runtime will prefer the VTID if present\n\t@VTID(25)\n\tjava.lang.String status();", "public String getState(){\n return state;\n }", "protected void changeStatus(String state)\n { call_state=state;\n printLog(\"state: \"+call_state,Log.LEVEL_MEDIUM); \n }", "public void updateStatus(String s1)\n {\n s = s1;\n notifyObservers();\n }", "public java.lang.CharSequence getStatus() {\n return status;\n }", "public String getState() {\n\t\treturn this.state_rep;\n\t}", "protected boolean statusIs(String state)\n { return call_state.equals(state); \n }", "private static String getStatus(Task task) {\n Status myStatus = task.getStatus();\n if (myStatus == Status.UP_NEXT) {\n return \"UP_NEXT\";\n } else if (myStatus == Status.IN_PROGRESS) {\n return \"IN_PROGRESS\";\n } else {\n return myStatus.toString();\n }\n }", "String getCurrentState() {\n return context.getString(allStates[currentIdx]);\n }", "public String getWorking_status() {\n return working_status;\n }", "public String getStatus () {\r\n return status;\r\n }", "public java.lang.CharSequence getStatus() {\n return status;\n }", "private String getStatusMessage() {\n\t\treturn (m_isTestPassed == true) ? \" successfully...\" : \" with failures...\";\n\t}", "private void setLblStatus(String s){\n\t\tlblState.setText(s);\n\t}", "String getState();", "String getState();", "String getState();", "public String getStatus() {\n return isDone ? \"1\" : \"0\";\n }", "public String getCurrLexeme()\n {\n return myCurrLexeme;\n }", "public String getState()\n {\n return null;\n }", "public java.lang.String getStatus () {\r\n\t\treturn status;\r\n\t}", "public java.lang.String getState () {\n\t\treturn state;\n\t}", "public String getState() {\n StringBuilder builder = new StringBuilder();\n //builder.append(muteMusic.getBackground().getLevel());\n //builder.append(',');\n builder.append(muteClicked);\n builder.append(',');\n builder.append(gameOver);\n builder.append(',');\n builder.append(wordsDetectedByUser.size());\n builder.append(',');\n for(int i =0;i<wordsDetectedByUser.size();i++)\n { builder.append(wordsDetectedByUser.get(i));\n builder.append(',');}\n builder.append(notValidWord);\n builder.append(',');\n // m1Handler.removeCallbacks(m1Runnable);\n mHandler.removeCallbacks(mRunnable);\n builder.append(phaseTwo);\n builder.append(',');\n builder.append(currentScore); //storing current score\n builder.append(',');\n builder.append(t); //storing timer state\n builder.append(',');\n Object a[] = DoneTiles.toArray();\n builder.append(a.length);\n builder.append(',');\n for(int i=0;i<a.length;i++) {\n builder.append(a[i].toString());\n builder.append(',');\n }\n builder.append(mLastLarge);\n builder.append(',');\n builder.append(mLastSmall);\n builder.append(',');\n for (int large = 0; large < 9; large++) {\n for (int small = 0; small < 9; small++) {\n builder.append(mSmallTiles[large][small].getOwner().name());\n builder.append(',');\n builder.append((((Button)mSmallTiles[large][small].getView()).getText()).toString());\n builder.append(',');\n //Log.d(DoneTiles);\n }\n }\n return builder.toString();\n }", "public String getStatus(){\n\n //returns the value of the status field\n return this.status;\n }", "String provisioningState();", "void transStatus()\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif(passenger != null && status.equals(\"soon\"))\r\n\t\t\t{\r\n\t\t\t\tService s_temp = new Service(passenger);\r\n\t\t\t\tdes = passenger.loc;\r\n\t\t\t\tmakeService(loc.i*80+loc.j,des.i*80+des.j);\r\n\t\t\t\tstatus = \"stop\";\r\n\t\t\t\tThread.sleep(1000);\r\n\t\t\t\tstatus = \"serve\";\r\n\t\t\t\tdes = passenger.des;\r\n\t\t\t\ts_temp.path.add(loc);\r\n\t\t\t\tmakeService(loc.i*80+loc.j,des.i*80+des.j,s_temp.path);\r\n\t\t\t\tstatus = \"stop\";\r\n\t\t\t\tThread.sleep(1000);\r\n\t\t\t\tcredit += 3;\r\n\t\t\t\tser_times += 1;\r\n\t\t\t\tservices.add(s_temp);\r\n\t\t\t\t//refresh:\r\n\t\t\t\tstatus = \"wait\";\r\n\t\t\t\tpassenger = null;\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Sorry to catch Exception!\");\r\n\t\t}\r\n\t}" ]
[ "0.6215381", "0.62144446", "0.615823", "0.58919317", "0.5878591", "0.5878591", "0.5878591", "0.5878591", "0.58757824", "0.58757824", "0.5826649", "0.5826365", "0.57497853", "0.5745741", "0.5729365", "0.5713349", "0.5702283", "0.5702283", "0.5692676", "0.5692676", "0.5692676", "0.5692676", "0.5692676", "0.56802064", "0.56715316", "0.56528836", "0.56382453", "0.5634115", "0.5633695", "0.5591851", "0.5585816", "0.5578413", "0.5578413", "0.5578413", "0.5578413", "0.5578413", "0.5565784", "0.5538596", "0.55347645", "0.5527559", "0.5505512", "0.548737", "0.54840827", "0.5478176", "0.5472804", "0.54462194", "0.54403675", "0.5436635", "0.54314536", "0.5428468", "0.54236954", "0.5412456", "0.5407903", "0.5388", "0.53866243", "0.53796977", "0.53747964", "0.5364909", "0.53633815", "0.53616136", "0.5360503", "0.53540224", "0.5341886", "0.5337615", "0.5327628", "0.53209823", "0.53196216", "0.5317098", "0.5310873", "0.5308361", "0.530783", "0.53073657", "0.5301637", "0.5300287", "0.529657", "0.5292194", "0.52906483", "0.5289163", "0.52818143", "0.52785", "0.52771187", "0.527341", "0.5271979", "0.52624905", "0.52621216", "0.52610785", "0.52596265", "0.52585816", "0.5256067", "0.52519697", "0.52519697", "0.52519697", "0.5247079", "0.5243898", "0.52417445", "0.52303725", "0.52244425", "0.52225786", "0.52132994", "0.5210147", "0.5208315" ]
0.0
-1
TODO Autogenerated method stub
@Override public void sssDoLwTestInit() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
@Override public void sssDoLwTestPeriodic() { }
{ "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
Called just before this Command runs the first time
protected void initialize() { P.println(Tt.getClassName(this) + " initializing"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void preRun() {\n super.preRun();\n }", "protected void preRun() {\r\n\t\tthis.preparePairs();\r\n\t}", "@Override\n public void beforeFirstLogic() {\n }", "public void prePerform() {\n // nothing to do by default\n }", "protected void onFirstUse() {}", "@Override\n\t\t\tprotected void onPreExecute()\n\t\t\t{\n\n\t\t\t}", "@Override\n public void beforeStart() {\n \n }", "protected void initialize() {\n\t\tRobot.firstAutonomousCommandDone = true;\n\t}", "@Override\n\t\t\t\tprotected void onPreExecute()\n\t\t\t\t{\n\t\t\t\t\tsuper.onPreExecute();\n\t\t\t\t}", "public void preExecution() throws CommandListenerException;", "public void initDefaultCommand() {\n\t\t// Don't do anything\n }", "@Override\n\t\tprotected void onPreExecute() {\n\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "protected void onFirstTimeLaunched() {\n }", "@Override\n\t\t\tprotected void onPreExecute() {\n\t\t\t\tsuper.onPreExecute();\n\t\t\t}", "@Override\n\t\t\tprotected void onPreExecute() {\n\t\t\t\tsuper.onPreExecute();\n\t\t\t}", "@Override\r\n\t\t\t\tpublic void autInitProcess() {\n\t\t\t\t\t\r\n\t\t\t\t}", "@Override\r\n\t\t\t\tpublic void autInitProcess() {\n\t\t\t\t\t\r\n\t\t\t\t}", "@Override\n protected void onPreExecute() {\n\n }", "@Override\n protected void onPreExecute() {\n\n }", "@Override\n protected void onPreExecute() {\n\n }", "@Override\n protected void onPreExecute() {\n\n }", "protected void runBeforeStep() {}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\r\n\t\tprotected void onPreExecute() {\n\t\t}", "@Override\r\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\r\n\r\n\t\t}", "@Override\n protected void onStart() {\n checkUserStatus();\n\n super.onStart();\n }", "void PrepareRun() {\n }", "@Override\n\t\t\t\tpublic void onStart() {\n\t\t\t\t}", "@Override\n\t\tprotected void onPreExecute() \n\t\t{\n\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t}", "@Override\r\n\t\t\tprotected void onPreExecute() {\n\t\t\t\tsuper.onPreExecute();\r\n\t\t\t}", "public void autonomousInit() {\n if (autonomousCommand != null) autonomousCommand.start();\n }", "protected void onPreExecute() {\n\t\t}", "@Override\n protected void onStart() {\n checkUserStatus();\n super.onStart();\n }", "protected void initDefaultCommand() {\n \t\t\n \t}", "@Override\n protected void onPreExecute() {\n }", "@Override\n protected void onPreExecute() {\n }", "@Override\n protected void onPreExecute() {\n }", "@Override\n protected void onPreExecute() {\n }", "@Override\n protected void onPreExecute() {\n }", "@Override\n\t protected void onPreExecute() {\n\t }", "public void initDefaultCommand() {\n \n }", "@Override\n\t\t\t\t\tprotected void onPreExecute() {\n\t\t\t\t\t\tsuper.onPreExecute();\n\t\t\t\t\t}", "public void autonomousInit() {\n\t\tautonomousCommand.start();\r\n\t}", "@Override\n\t\t\t\t\tpublic void onStart() {\n\n\t\t\t\t\t}", "@Override\r\n\tprotected void doPre() {\n\t\t\r\n\t}", "@Override\n\t\t\tpublic void onPreExecute() {\n\t\t\t\t\n\t\t\t}", "@Override\r\n\tprotected void initDefaultCommand() {\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 initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n\n }", "protected abstract void preRun();", "private Command() {\n initFields();\n }", "public void initDefaultCommand() {\n \n }", "@RequiresApi(api = Build.VERSION_CODES.N)\n public void StartInitial() {\n model.StartInitial();\n\n // Add any code required\n\n }", "public void onStart() {\n /* do nothing - stub */\n }", "@Override\n protected void startUp() {\n }", "@Override\r\n\tprotected void onPreExecute() {\n\t}", "@Override\n public void initDefaultCommand() \n {\n }", "@Override\n protected void onPreExecute()\n {\n super.onPreExecute();\n }", "@Override\n protected void onPreExecute() {\n\n super.onPreExecute();\n\n }", "@Override\r\n protected void onPreExecute() {\n super.onPreExecute();\r\n }", "@Override\r\n\tpublic void preCheck(CheckCommand checkCommand) throws Exception {\n\r\n\t}", "public void preInstallHook() {\n }", "public void initDefaultCommand() {\n\t}", "public void startup() {\n neutral();\n }", "@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\t}", "@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\t}", "@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\t}", "@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\n\t}", "@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\n\t}", "@Override\n\t\t\t\tpublic void onStart() {\n\t\t\t\t\tsuper.onStart();\n\t\t\t\t}", "@Override\n\t\t\t\tpublic void onStart() {\n\t\t\t\t\tsuper.onStart();\n\t\t\t\t}", "public void onStart() {\n super.onStart();\n getStockVerification();\n }", "@Override\n public void onStart() {\n \n }", "@Override\n public void onStart() {\n \n }", "@Override\n protected void onPreExecute() {\n super.onPreExecute();\n\n }" ]
[ "0.71116775", "0.6540082", "0.643276", "0.64309984", "0.6406235", "0.63530433", "0.6307191", "0.62521607", "0.6246859", "0.6240541", "0.61669374", "0.6162758", "0.612669", "0.612669", "0.612669", "0.612669", "0.612669", "0.6106636", "0.60843927", "0.60843927", "0.6078098", "0.6078098", "0.6067516", "0.6067516", "0.6067516", "0.6067516", "0.606738", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.60612917", "0.6057326", "0.60445184", "0.60395783", "0.6038108", "0.60342497", "0.6029028", "0.6028095", "0.6011726", "0.60035837", "0.6001935", "0.5994244", "0.5990546", "0.5988089", "0.5988089", "0.5988089", "0.5988089", "0.5988089", "0.5976879", "0.59630865", "0.59607804", "0.5948146", "0.5944802", "0.59428716", "0.59088343", "0.5907871", "0.59078586", "0.59078586", "0.59078586", "0.59078586", "0.59078586", "0.59078586", "0.59078586", "0.59073347", "0.590471", "0.5903377", "0.5901662", "0.5891441", "0.58837813", "0.5882797", "0.5881506", "0.5876781", "0.5869825", "0.58597183", "0.58569473", "0.5848948", "0.58431983", "0.5841212", "0.58401227", "0.5836663", "0.5836663", "0.5836663", "0.5834893", "0.5834893", "0.5832427", "0.5832427", "0.5832232", "0.5827022", "0.5827022", "0.58263487" ]
0.0
-1
Called repeatedly when this Command is scheduled to run
protected void execute() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\t\tvoid runCommand() {\n\t\t\ttrigger.execute();\n\t\t}", "@Override\n public void run() {\n schedule();\n }", "@Override\n public void autonomousPeriodic() {\n \n Scheduler.getInstance().run();\n \n }", "public void run() {\n\t\texecuteCommand( client, false );\n\t}", "@Override\n public void periodic() {\n // This method will be called once per scheduler run\n }", "@Override\n\tpublic void execute() {\n\t\tsuper.execute();\n\n\t\t// TBD Needs rewrite for multi tenant\n\t\ttry {\t\n\t\t\tif (async == null || !async)\n\t\t\t\tupdated = Crosstalk.getInstance().refresh(customer);\n\t\t\telse {\n\t\t\t\tfinal Long id = random.nextLong();\n\t\t\t\tfinal ApiCommand theCommand = this;\n\t\t\t\tThread thread = new Thread(new Runnable() {\n\t\t\t\t @Override\n\t\t\t\t public void run(){\n\t\t\t\t \ttry {\n\t\t\t\t\t\t\tupdated = Crosstalk.getInstance().refresh(customer);\n\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\terror = true;\n\t\t\t\t\t\t\tmessage = e.toString();\n\t\t\t\t\t\t}\n\t\t\t\t }\n\t\t\t\t});\n\t\t\t\tthread.start();\n\t\t\t\tasyncid = \"\" + id;\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "protected void runEachMinute() {\n \n }", "@Override\n public void execute() {\n Time.sleep(3000);\n Starting.execute();\n }", "@Override\r\n public void robotPeriodic() {\r\n // Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled\r\n // commands, running already-scheduled commands, removing finished or interrupted commands,\r\n // and running subsystem periodic() methods. This must be called from the robot's periodic\r\n // block in order for anything in the Command-based framework to work.\r\n CommandScheduler.getInstance().run();\r\n }", "@Override\n public void robotPeriodic() {\n // Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled\n // commands, running already-scheduled commands, removing finished or interrupted commands,\n // and running subsystem periodic() methods. This must be called from the robot's periodic\n // block in order for anything in the Command-based framework to work.\n CommandScheduler.getInstance().run();\n }", "@Override\n public void autonomousPeriodic()\n {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\r\n Scheduler.getInstance().run();\r\n }", "private void scheduleJob() {\n\n }", "@Override\n\tpublic void execute() {\n\t\tcmdReceiver.send();\n\t}", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "protected void run() throws IOException {\n\t\tif (lastTime + interval > Time.now())\n\t\t\treturn;\n\t\texitCode = 0; // reset for next run\n\t\trunCommand();\n\t}", "protected void execute() {\n \tclimber.setCLimberSpeed(0);\n }", "@Override\n public void teleopPeriodic()\n {\n Scheduler.getInstance().run();\n }", "private void doCommand() {\n try {\n TimeUnit.SECONDS.sleep(2L);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }", "protected void waitUntilCommandFinished() {\n }", "public void autonomousPeriodic() \n {\n Scheduler.getInstance().run();\n }", "@Override\n public void teleopPeriodic() {\n Scheduler.getInstance().run();\n \n }", "private void schedule() {\n service.scheduleDelayed(task, schedulingInterval);\n isScheduled = true;\n }", "public void autonomousPeriodic() {\r\n\t\tScheduler.getInstance().run();\r\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tprotected void run() {\n\t\tUtils.executeAndWaitForCommand(this.getHMetisExec());\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\t\n\t}", "@Override\n public void autonomousPeriodic() {\n \n }", "public void intialRun() {\n }", "@Override\n public void periodic() {\n UpdateDashboard();\n }", "public void teleopPeriodic() {\r\n\t\tScheduler.getInstance().run();\r\n\t}", "@Override\n\tprotected void postRun() {\n\n\t}", "protected void execute() {\n \t\n \tcurrent_time = System.currentTimeMillis();\n \t\n \tlift.liftDown(LIFT_SPEED);\n }", "@Override\n\tpublic void teleopPeriodic() //runs the teleOp part of the code, repeats every 20 ms\n\t{\n\t\tScheduler.getInstance().run(); //has to be here, I think that this is looping the method\n\t\tSmartDashboard.putNumber(\"Encoder Left: \", RobotMap.encoderLeft.getRaw()); //putting the value of the left encoder to the SmartDashboard\n\t\tSmartDashboard.putNumber(\"Encoder Right: \", RobotMap.encoderRight.getRaw()); //putting the value of the right encoder to the smartDashboard\n\t\tSmartDashboard.putNumber(\"Ultrasonic sensor\", ultrasonic.getDistanceIn()); //putting the value of the ultrasonic sensor to the smartDashboard\n//\t\tSmartDashboard.putBoolean(\"allOK\", Robot.driveFar.ultrasonicOK);\n\t\tdriveExecutor.execute(); //running the execute method in driveExecutor\n\t\tgrab.execute(); //running the execute() method in GearGrab_Command (should run without this but this is ensuring us that it is on)\n\t}", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void run() {\n\t\t\t\tIMSScheduleManager.super.startCron();\r\n\t\t\t\t\r\n\t\t\t}", "@Override\n\t\t\tpublic void run() {\n\n\t\t\t}", "@Override\n public void autonomousPeriodic() {\n\n }", "@Override\n public void autonomousPeriodic() \n {\n Scheduler.getInstance().run();\n log();\n }", "@Override\n\tpublic void postRun() {\n\t}", "public void autonomousPeriodic() {\n // RobotMap.helmsman.trackPosition();\n Scheduler.getInstance().run();\n }", "private void beginSchedule(){\n\t\tDivaApp.getInstance().submitScheduledTask(new RandomUpdater(this), RandomUpdater.DELAY, RandomUpdater.PERIOD);\n\t}", "protected void runEachSecond() {\n \n }", "@Override\n protected void execute() {\n Robot.toteLifterSubsystem.setEjectorState(EjectorState.EXTENDING, ramper.process(1.0));\n }", "protected void execute() {\n\t\t_xboxControllerToRumble.setRumble(_rumbleType, _rumbleValue);\n\t\t_timesRumbled++;\n\t\tSystem.out.println(\"Rumbling \" + _timesRumbled);\n\t}", "private void runPeriodic() {\n boolean ok = ScheduledFutureTask.super.runAndReset();\n boolean down = isShutdown();\n // Reschedule if not cancelled and not shutdown or policy allows\n if (ok && !down) {\n updateNextExecutionTime();\n MeasurableScheduler.super.getQueue().add(this);\n }\n // This might have been the final executed delayed\n // task. Wake up threads to check.\n else if (down)\n interruptIdleWorkers();\n }", "public void execute() {\n\t\tlaunch();\n\t}", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void run() {\n\t\tif (this.isRunning == true) {\n\t\t\treturn;\n\t\t}\n\t\tthis.isRunning = true;\n\t\t// 写入一条日志\n\t\t\n\t\t// 详细运行参数\n\t\ttry {\n\t\t\tthis.taskRun();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tthis.isRunning = false;\n\t\tthis.addHistory(new Date());\n\t\tif(this.once) {\n\t\t\tthis.cancel();\n\t\t}\n\t}", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void autonomousPeriodic() {\n }", "@Override\n public void autonomousPeriodic() {\n }", "@Override\n public void autonomousPeriodic() {\n }", "@Override\n public void taskStarting() {\n\n }", "@Override\n public void teleopPeriodic() {\n Scheduler.getInstance().run();\n log();\n }", "@PostConstruct\n public void postConstruct() {\n execService = Executors.newScheduledThreadPool(1);\n scheduledFuture = execService.scheduleAtFixedRate(this, 0, PUSH_REPEAT_DELAY, TimeUnit.MILLISECONDS);\n }", "protected void run() {\r\n\t\t//\r\n\t}", "@Override\n\tpublic void run() {\n\t\tautomatischDurchAlleRouten();\n\n\t\t\n\t}", "public void autonomousPeriodic()\n\t{\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n public void execute() {\n if (System.currentTimeMillis() - currentMs >= timeMs) {\n // Delay has passed so initialize object11\n super.initialize();\n }\n }", "@Override\n\tprotected void execute() {\n\t\tRobot.collector.setMawOpen(Robot.oi.getCollectorOpen());\n\t\tRobot.collector.setIntakeSpeed(Robot.oi.getCollectorSpeed());\n\t\tRobot.collector.setWristStageOneRetracted(Robot.oi.getWristStageOneRetracted());\n\t\tRobot.collector.setWristStageTwoRetracted(Robot.oi.getWristStageTwoRetracted());\n\t}", "protected void execute() {\n \tRobot.chassisSubsystem.shootHighM.set(0.75);\n \tif(timeSinceInitialized() >= 1.25){\n \t\tRobot.chassisSubsystem.liftM.set(1.0);\n \t}\n }", "protected void execute() {\n command.start();\n }", "@Override\n public void autonomousPeriodic() {\n }", "@Override\n public void autonomousPeriodic() {\n\t// updateDiagnostics();9\n\tScheduler.getInstance().run();\n }", "@Override\n public void run()\n {\n //Log.d(TAG ,\"==========>Task Run In!\");\n updateDroneLocation();\n }", "public void teleopPeriodic()\n\t{\n\t\tScheduler.getInstance().run();\n\t}", "public void execute() {\n setExecuted(true);\n }", "@Override\n public void teleopPeriodic() {\n\tupdateDiagnostics();\n\tScheduler.getInstance().run();\n }", "public void execute() {\n\t\t\n\t\tdrivetrain.updateAnglePID();\n\t\t\n//\t\tif (drivetrain.currentControl()) {\n//\t\t\tdrivetrain.shiftGears();\n//\t\t}\n\t}", "protected void execute() {\n\t\tshooter.runShooter(power);\n\t}", "@Override\r\n public void run() {}", "@SuppressLint(\"InlinedApi\")\n @Override\n public void run() {\n }", "protected void execute() {\n \tshooterWheel.shooterWheelSpeedControllerAft.Pause();\n \tshooterWheel.shooterWheelSpeedControllerFwd.Pause();\n \t\n }", "@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 run() {\n ui.printStartingMessage();\n boolean isExit = false;\n\n while (!isExit) {\n isExit = parser.determineCommand();\n }\n\n storage.saveToFile(taskList);\n }" ]
[ "0.6689458", "0.6631115", "0.6566414", "0.65512514", "0.6530515", "0.6488629", "0.64019585", "0.6380878", "0.637645", "0.6363615", "0.63557744", "0.6330997", "0.6295938", "0.6275704", "0.6268897", "0.62656784", "0.62656784", "0.62656784", "0.62656784", "0.62656784", "0.62656784", "0.6255461", "0.624429", "0.6241397", "0.62090397", "0.6183934", "0.6178626", "0.61670285", "0.614122", "0.6137012", "0.6132416", "0.6132416", "0.6132416", "0.6132416", "0.61313075", "0.61313075", "0.61313075", "0.6120398", "0.61091226", "0.61073244", "0.610631", "0.610404", "0.6101818", "0.61014", "0.6099132", "0.6093559", "0.6092883", "0.6092883", "0.6092883", "0.6092883", "0.60926527", "0.60926485", "0.6077805", "0.6074907", "0.606528", "0.6062541", "0.60580474", "0.6056443", "0.60554063", "0.6054432", "0.60539037", "0.60538137", "0.60505164", "0.60505164", "0.604125", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6027496", "0.6027496", "0.6027496", "0.60272455", "0.6009362", "0.6006723", "0.59990466", "0.59985226", "0.59967", "0.5994757", "0.5985855", "0.59771705", "0.5973198", "0.5970597", "0.59701514", "0.5965313", "0.5964212", "0.596267", "0.59585357", "0.5954102", "0.595137", "0.5949223", "0.5946874", "0.5942587", "0.59406763", "0.59406763", "0.59366745" ]
0.0
-1
Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() { boolean ans = false; return ans; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public boolean execute() {\n return false;\n }", "@Override\n public boolean execute() {\n return false;\n }", "public boolean execute(){\n return false;\n }", "@Override\n\tpublic boolean Unexecute() \n\t{\n\t\treturn false;\n\t}", "protected boolean onExecute(String command)\n {\n return false;\n }", "@Override\n\tpublic boolean execute() {\n\t\treturn false;\n\t}", "@Override\n\t\tpublic boolean shouldContinueExecuting() {\n\t\t\treturn false;\n\t\t}", "public boolean shouldExecute() {\n\t\treturn true;\n\t}", "protected void execute() {\n \t// literally still do nothing\n }", "@Override\n public boolean canExecute() {\n return true;\n }", "protected void execute() {\n finished = true;\n }", "@Override\r\n\tpublic void unexecute() {\n\t\t\r\n\t}", "public Command() {\n this.executed = false;\n }", "@Override\n public void stopExecute() {\n\n }", "public boolean shouldExecute()\n {\n if (this.runDelay <= 0)\n {\n if (!this.theRaider.world.getGameRules().getBoolean(\"mobGriefing\"))\n {\n return false;\n }\n\n this.currentTask = -1;\n this.wantsToReapStuff = true;\n }\n\n return super.shouldExecute();\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n public void execute() {\n if(!manipulatorController.getRawButton(button)){\n shooter.shooterMotorsOff();\n hopper.hopperMotorOff();\n isDone = true;\n end(false);\n }\n\n }", "public void unExecute()\n\t{\n\t}", "@Override\r\n protected boolean isFinished() {\n return false;\r\n }", "@Override\r\n public void executeCommand() {\r\n shell.stopRunning();\r\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished()\n {\n return false;\n }", "@Override\r\n\tprotected boolean isFinished() {\r\n\t\treturn false;\r\n\t}", "@Override\r\n\tprotected boolean isFinished() {\r\n\t\treturn false;\r\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\t\t\n\t}", "@Override\n protected boolean isFinished() \n {\n return false;\n }", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn false;\r\n\t}", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn false;\r\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n boolean isFinished() {\n return false;\n }", "public boolean shouldContinueExecuting() {\n return (this.shouldExecute() || !this.entity.getNavigator().noPath()) && this.isBowInMainhand();\n }", "protected boolean isFinished() {\r\n return false;\r\n }", "protected boolean isFinished() {\r\n return false;\r\n }", "public boolean shouldExecute() {\n return this.goalOwner.getTeam() == null ? false : super.shouldExecute();\n }", "public void prepareExecuteNoSelect() {\n setCallFromStatement();\n // The statement is no longer require so can be released.\n clearStatement();\n\n super.prepareExecuteNoSelect();\n }", "protected void waitUntilCommandFinished() {\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "@Override\n\tprotected boolean isFinished()\n\t{\n\t\treturn false;\n\t}", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "protected void executionSuccess() {\n this.isUndoable = true;\n }", "protected boolean isFinished() {\n return false;\n \n }", "boolean redoLastCommand() throws Exception;", "@Override\n public boolean isFinished() {\n return false;\n }", "public boolean shouldContinueExecuting() {\n return this.currentTask >= 0 && super.shouldContinueExecuting();\n }", "@Override\r\n public void execute()\r\n {\r\n printInvalidCommandMessage();\r\n }" ]
[ "0.77345294", "0.77345294", "0.7678753", "0.76457655", "0.75966", "0.7554271", "0.6877811", "0.6748956", "0.6728847", "0.66855806", "0.65891784", "0.65624696", "0.64980483", "0.63857424", "0.63736373", "0.6356819", "0.6356819", "0.63498974", "0.63401324", "0.63290936", "0.63238996", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.63158405", "0.63097465", "0.63097465", "0.62977403", "0.62754494", "0.62744504", "0.62744504", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.6211897", "0.62113553", "0.62087166", "0.62087166", "0.62084436", "0.6203807", "0.619581", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.6184869", "0.61709535", "0.61614436", "0.61614436", "0.61614436", "0.61614436", "0.61614436", "0.6158993", "0.61529076", "0.61481965", "0.6146213", "0.6145282", "0.6143307" ]
0.0
-1
Called once after isFinished returns true
protected void end() { P.println(Tt.getClassName(this) + " ending"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected boolean isFinished() {\n return true;\n }", "@Override\n protected boolean isFinished() {\n return true;\n }", "@Override\n public boolean isFinished() {\n return true;\n }", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn true;\r\n\t}", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn true;\r\n\t}", "@Override\n protected boolean isFinished()\n {\n return false;\n }", "@Override\n protected boolean isFinished() \n {\n return false;\n }", "@Override\n public boolean isFinished() {\n return true;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n boolean isFinished() {\n return false;\n }", "@Override\r\n protected boolean isFinished() {\n return false;\r\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished(){\r\n return true;\r\n }", "protected boolean isFinished() {\n return true;\n }", "protected boolean isFinished() {\n return true;\n }", "protected boolean isFinished() {\n return true;\n }", "protected boolean isFinished() {\n return true;\n }", "protected boolean isFinished() {\n return true;\n }", "protected boolean isFinished() {\n return true;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\r\n\tprotected boolean isFinished() {\r\n\t\treturn false;\r\n\t}", "@Override\r\n\tprotected boolean isFinished() {\r\n\t\treturn false;\r\n\t}", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return isFinished;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn false;\r\n\t}", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn false;\r\n\t}", "@Override\n\tprotected boolean isFinished()\n\t{\n\t\treturn false;\n\t}", "@Override\r\n protected boolean isFinished() {\n if (super.isFinished()) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }", "@Override\n protected boolean isFinished() {\n return finished;\n }", "protected boolean isFinished()\n\t{\n\t\treturn true;\n\t}", "protected boolean isFinished() {\n\t\treturn true;\n\t}", "protected boolean isFinished() {\n\t\treturn true;\n\t}", "protected boolean isFinished() {\n\t\treturn true;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }" ]
[ "0.85854495", "0.85395205", "0.83341306", "0.83313096", "0.83313096", "0.83068", "0.8305024", "0.8298836", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.8277644", "0.82765675", "0.8268994", "0.8237624", "0.8237624", "0.82293963", "0.82061803", "0.82061803", "0.82061803", "0.82061803", "0.82061803", "0.82061803", "0.8163012", "0.81589365", "0.81589365", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.8152044", "0.81458783", "0.81380373", "0.81380373", "0.81380373", "0.81380373", "0.81380373", "0.8125088", "0.8125088", "0.81129867", "0.8111655", "0.808855", "0.8083022", "0.8040255", "0.8040255", "0.8040255", "0.8032732", "0.8032732", "0.8032732", "0.8032732", "0.8032732", "0.8032732", "0.8032732", "0.8032732", "0.8032732", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885", "0.8026885" ]
0.0
-1